summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Hieber <rhi@pengutronix.de>2022-07-24 01:51:19 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-28 11:07:33 +0100
commitc6d0348206b5e6ea7718282a9c802b3340e2ec13 (patch)
tree0d6088ff934b11046f9a086b63ebbb36c6e98e7a
parent2e25ddcaeab8585a57c57db429a6c769846d23df (diff)
downloadpoky-c6d0348206b5e6ea7718282a9c802b3340e2ec13.tar.gz
devtool: error out when workspace is using old override syntax
When the workspace bbappends are still using the old override syntax with EXTERNALSRC_pn-*, externalsrc_re will not match, and pn will never be assigned, leading to a nondescript UnboundLocalError being raised on the user's terminal. Try to detect that situation and give the user a hint how to solve it. (From OE-Core rev: d42ea8e849cf2df3708406418b961168268b316a) Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/devtool10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/devtool b/scripts/devtool
index af4811b922..20d785c7f7 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -104,6 +104,7 @@ def read_workspace():
104 for fn in glob.glob(os.path.join(config.workspace_path, 'appends', '*.bbappend')): 104 for fn in glob.glob(os.path.join(config.workspace_path, 'appends', '*.bbappend')):
105 with open(fn, 'r') as f: 105 with open(fn, 'r') as f:
106 pnvalues = {} 106 pnvalues = {}
107 pn = None
107 for line in f: 108 for line in f:
108 res = externalsrc_re.match(line.rstrip()) 109 res = externalsrc_re.match(line.rstrip())
109 if res: 110 if res:
@@ -123,6 +124,9 @@ def read_workspace():
123 elif line.startswith('# srctreebase: '): 124 elif line.startswith('# srctreebase: '):
124 pnvalues['srctreebase'] = line.split(':', 1)[1].strip() 125 pnvalues['srctreebase'] = line.split(':', 1)[1].strip()
125 if pnvalues: 126 if pnvalues:
127 if not pn:
128 raise DevtoolError("Found *.bbappend in %s, but could not determine EXTERNALSRC:pn-*. "
129 "Maybe still using old syntax?" % config.workspace_path)
126 if not pnvalues.get('srctreebase', None): 130 if not pnvalues.get('srctreebase', None):
127 pnvalues['srctreebase'] = pnvalues['srctree'] 131 pnvalues['srctreebase'] = pnvalues['srctree']
128 logger.debug('Found recipe %s' % pnvalues) 132 logger.debug('Found recipe %s' % pnvalues)
@@ -314,10 +318,10 @@ def main():
314 318
315 args = parser.parse_args(unparsed_args, namespace=global_args) 319 args = parser.parse_args(unparsed_args, namespace=global_args)
316 320
317 if not getattr(args, 'no_workspace', False):
318 read_workspace()
319
320 try: 321 try:
322 if not getattr(args, 'no_workspace', False):
323 read_workspace()
324
321 ret = args.func(args, config, basepath, workspace) 325 ret = args.func(args, config, basepath, workspace)
322 except DevtoolError as err: 326 except DevtoolError as err:
323 if str(err): 327 if str(err):