summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/standard.py
diff options
context:
space:
mode:
authorChris Laplante <chris.laplante@agilent.com>2025-01-29 15:20:14 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-02-01 13:20:45 +0000
commitb7327c7c281a9d661bcb43ccb858b1aaaddaaa12 (patch)
tree9c3b8dcb7e03f077b2eca8b3b20e9f740cb23405 /scripts/lib/devtool/standard.py
parentd37380004c881d3e303246fe924969b46d0eaa6a (diff)
downloadpoky-b7327c7c281a9d661bcb43ccb858b1aaaddaaa12.tar.gz
devtool: standard: fix unbound variable usage
(From OE-Core rev: 90efa31f36eaea910b979c128da719e1ae61e00d) Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r--scripts/lib/devtool/standard.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index ca89c8e882..20c94616b2 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -209,7 +209,7 @@ def add(args, config, basepath, workspace):
209 for fn in os.listdir(tempdir): 209 for fn in os.listdir(tempdir):
210 shutil.move(os.path.join(tempdir, fn), recipedir) 210 shutil.move(os.path.join(tempdir, fn), recipedir)
211 else: 211 else:
212 raise DevtoolError('Command \'%s\' did not create any recipe file:\n%s' % (e.command, e.stdout)) 212 raise DevtoolError(f'Failed to create a recipe file for source {source}')
213 attic_recipe = os.path.join(config.workspace_path, 'attic', recipename, os.path.basename(recipefile)) 213 attic_recipe = os.path.join(config.workspace_path, 'attic', recipename, os.path.basename(recipefile))
214 if os.path.exists(attic_recipe): 214 if os.path.exists(attic_recipe):
215 logger.warning('A modified recipe from a previous invocation exists in %s - you may wish to move this over the top of the new recipe if you had changes in it that you want to continue with' % attic_recipe) 215 logger.warning('A modified recipe from a previous invocation exists in %s - you may wish to move this over the top of the new recipe if you had changes in it that you want to continue with' % attic_recipe)
@@ -542,6 +542,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works
542 tempbasedir = d.getVar('WORKDIR') 542 tempbasedir = d.getVar('WORKDIR')
543 bb.utils.mkdirhier(tempbasedir) 543 bb.utils.mkdirhier(tempbasedir)
544 tempdir = tempfile.mkdtemp(prefix='devtooltmp-', dir=tempbasedir) 544 tempdir = tempfile.mkdtemp(prefix='devtooltmp-', dir=tempbasedir)
545 appendbackup = None
545 try: 546 try:
546 tinfoil.logger.setLevel(logging.WARNING) 547 tinfoil.logger.setLevel(logging.WARNING)
547 548
@@ -552,7 +553,6 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works
552 appendbackup = os.path.join(tempdir, os.path.basename(appendfile) + '.bak') 553 appendbackup = os.path.join(tempdir, os.path.basename(appendfile) + '.bak')
553 shutil.copyfile(appendfile, appendbackup) 554 shutil.copyfile(appendfile, appendbackup)
554 else: 555 else:
555 appendbackup = None
556 bb.utils.mkdirhier(os.path.dirname(appendfile)) 556 bb.utils.mkdirhier(os.path.dirname(appendfile))
557 logger.debug('writing append file %s' % appendfile) 557 logger.debug('writing append file %s' % appendfile)
558 with open(appendfile, 'a') as f: 558 with open(appendfile, 'a') as f:
@@ -1018,6 +1018,7 @@ def rename(args, config, basepath, workspace):
1018 origfnver = '' 1018 origfnver = ''
1019 1019
1020 recipefilemd5 = None 1020 recipefilemd5 = None
1021 newrecipefilemd5 = None
1021 tinfoil = setup_tinfoil(basepath=basepath, tracking=True) 1022 tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
1022 try: 1023 try:
1023 rd = parse_recipe(config, tinfoil, args.recipename, True) 1024 rd = parse_recipe(config, tinfoil, args.recipename, True)
@@ -1095,6 +1096,7 @@ def rename(args, config, basepath, workspace):
1095 1096
1096 # Rename source tree if it's the default path 1097 # Rename source tree if it's the default path
1097 appendmd5 = None 1098 appendmd5 = None
1099 newappendmd5 = None
1098 if not args.no_srctree: 1100 if not args.no_srctree:
1099 srctree = workspace[args.recipename]['srctree'] 1101 srctree = workspace[args.recipename]['srctree']
1100 if os.path.abspath(srctree) == os.path.join(config.workspace_path, 'sources', args.recipename): 1102 if os.path.abspath(srctree) == os.path.join(config.workspace_path, 'sources', args.recipename):
@@ -1331,6 +1333,7 @@ def _export_patches(srctree, rd, start_revs, destdir, changed_revs=None):
1331 # values, but they ought to be anyway... 1333 # values, but they ought to be anyway...
1332 new_basename = seqpatch_re.match(new_patch).group(2) 1334 new_basename = seqpatch_re.match(new_patch).group(2)
1333 match_name = None 1335 match_name = None
1336 old_patch = None
1334 for old_patch in existing_patches: 1337 for old_patch in existing_patches:
1335 old_basename = seqpatch_re.match(old_patch).group(2) 1338 old_basename = seqpatch_re.match(old_patch).group(2)
1336 old_basename_splitext = os.path.splitext(old_basename) 1339 old_basename_splitext = os.path.splitext(old_basename)
@@ -1548,6 +1551,7 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi
1548 local_files_dir = tempfile.mkdtemp(dir=tempdir) 1551 local_files_dir = tempfile.mkdtemp(dir=tempdir)
1549 srctreebase = workspace[recipename]['srctreebase'] 1552 srctreebase = workspace[recipename]['srctreebase']
1550 upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) 1553 upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase)
1554 removedentries = {}
1551 if not no_remove: 1555 if not no_remove:
1552 # Find list of existing patches in recipe file 1556 # Find list of existing patches in recipe file
1553 patches_dir = tempfile.mkdtemp(dir=tempdir) 1557 patches_dir = tempfile.mkdtemp(dir=tempdir)
@@ -1724,6 +1728,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
1724 for basepath, param in upd_p.items(): 1728 for basepath, param in upd_p.items():
1725 path = param['path'] 1729 path = param['path']
1726 patchdir = param.get('patchdir', ".") 1730 patchdir = param.get('patchdir', ".")
1731 patchdir_param = {}
1727 if patchdir != "." : 1732 if patchdir != "." :
1728 patchdir_param = dict(patchdir_params) 1733 patchdir_param = dict(patchdir_params)
1729 if patchdir_param: 1734 if patchdir_param: