1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#!/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_tdxref = [
"../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb",
"../layers/meta-toradex-bsp-common/recipes-kernel/linux/linux-toradex-mainline_git.bb",
"../layers/meta-toradex-bsp-common/recipes-kernel/linux/linux-toradex-mainline-rt_git.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.15-2.1.x.bb",
"../layers/meta-toradex-nxp/recipes-kernel/linux/device-tree-overlays_git.bb",
"../layers/meta-toradex-nxp/recipes-bsp/imx-sc-firmware/imx-sc-firmware-toradex_1.14.0.bb",
"../layers/meta-toradex-nxp/recipes-bsp/u-boot/u-boot-toradex_2022.04.bb",
"../layers/meta-toradex-ti/recipes-bsp/u-boot/u-boot-toradex-ti-staging_2021.01.bb",
"../layers/meta-toradex-ti/recipes-kernel/linux/device-tree-overlays-ti_git.bb",
"../layers/meta-toradex-ti/recipes-kernel/linux/linux-toradex-ti_5.10.bb",
]
recipes_tezi = [
"../layers/meta-toradex-tezi/recipes-tezi/qt-tezi/qt-tezi_git.bb",
"../layers/meta-toradex-tezi/recipes-tezi/qt-tezi/qt-tezictl_git.bb",
]
recipes_torizon = [
"../layers/meta-toradex-torizon/recipes-kernel/linux/linux-toradex-kmeta.inc",
]
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)
return result.returncode
except subprocess.CalledProcessError as e:
logger.error('ERROR: recipetool failed:\n%s' % e.output.decode('utf-8'))
return e.returncode
def uprev(args):
env = os.environ.copy()
# make sure that we query the remote repo as we execute the script, not
# the clone we have in the local download.
env['BB_SRCREV_POLICY'] = "clear"
# decide if we build torizon or tdxref. Use the existence of meta-toradex-torizon
recipes = recipes_tdxref
if os.path.exists(os.path.join(script_path, '../../meta-toradex-torizon')):
recipes = recipes + recipes_torizon
elif os.path.exists(os.path.join(script_path, '../../meta-toradex-tezi')):
recipes = recipes + recipes_tezi
for recipe in recipes:
logger.info('Processing recipe {}'.format(recipe))
res = uprev_recipe(args, env, recipe)
if (res != os.EX_OK):
return res
return os.EX_OK
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())
|