From 7cc3de4ff380daee848e3ff5c17a1a72ed07cdb2 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 7 May 2020 09:48:10 +0000 Subject: uprev-srcrev: add Toradex specific script to uprev all recipes Create a Toradex specific script which loops through all recipes using AUTOREV and updates them to the current git hash. Related-to: AUT-355 Signed-off-by: Stefan Agner (cherry picked from commit 35fd1b9ead35b45a590b0a478f9ca11512d05921) --- scripts/uprev-srcrev | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 scripts/uprev-srcrev diff --git a/scripts/uprev-srcrev b/scripts/uprev-srcrev new file mode 100755 index 0000000..782af69 --- /dev/null +++ b/scripts/uprev-srcrev @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +# +# Tool to update Toradex recipes using AUTOREV +# +# Copyright (c) 2020, Toradex +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import os +import sys +import argparse +import logging +import subprocess +script_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = os.path.join(script_path, '../../openembedded-core/scripts/lib') +sys.path = sys.path + [lib_path] +import argparse_oe +import scriptutils + +logger = scriptutils.logger_create('uprev-srcrev') + +recipes = [ + "../layers/meta-toradex-bsp-common/recipes-kernel/backports/backports_5.4.bb", + "../layers/meta-toradex-bsp-common/recipes-kernel/linux/linux-toradex-mainline_5.4.bb", + "../layers/meta-toradex-bsp-common/recipes-kernel/linux/device-tree-overlays-mainline_git.bb", + "../layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_5.4-2.1.x.bb", + "../layers/meta-toradex-nxp/recipes-kernel/linux/device-tree-overlays_git.bb", + "../layers/meta-toradex-nxp/recipes-bsp/u-boot/u-boot-toradex_2020.04.bb", + "../layers/meta-toradex-nxp/recipes-bsp/u-boot/u-boot-toradex_2020.07.bb", + "../layers/meta-toradex-tegra/recipes-bsp/u-boot/u-boot-toradex-tk1_2019.07.bb", + ] + +def uprev_recipe(args, env, recipe): + + try: + result = subprocess.run( + 'recipetool updatesrcrev {}'.format(recipe), + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + env=env, universal_newlines=True, + shell=True) + if not args.quiet: + print(result.stdout) + except subprocess.CalledProcessError as e: + print('ERROR: recipetool failed:\n%s' % e.output.decode('utf-8')) + return e.returncode + + +def uprev(args): + env = os.environ.copy() + env['BB_SRCREV_POLICY'] = "cache" + for recipe in recipes: + logger.info('Processing recipe {}'.format(recipe)) + uprev_recipe(args, env, recipe) + +def main(): + parser = argparse_oe.ArgumentParser(description='SRCREV uprev tool.') + + parser.add_argument('-d', '--debug', help='enable debug output', action='store_true') + parser.add_argument('-q', '--quiet', help='print only errors', action='store_true') + + parser.set_defaults(func=uprev) + + args = parser.parse_args() + + if args.debug: + logger.setLevel(logging.DEBUG) + elif args.quiet: + logger.setLevel(logging.ERROR) + + ret = args.func(args) + + return ret + +if __name__ == "__main__": + sys.exit(main()) -- cgit v1.2.3