From 569f8e09f0b077045d112dd569cbc4d47fdae08e Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 13 May 2024 16:02:41 +0100 Subject: recipetool/devtool: Update to work correctly with UNPACKDIR Tweak recipetool and devtool to correctly use UNPACKDIR. This allows some simplification of the code. This patch makes things basically work but there are likely deeper improvements that can be made now that WORKDIR != UNPACKDIR. (From OE-Core rev: d2eeaa88b27a2875c419591d1d91bcc85d7b129c) Signed-off-by: Richard Purdie --- scripts/lib/devtool/upgrade.py | 2 +- scripts/lib/recipetool/create.py | 2 +- scripts/lib/scriptutils.py | 15 ++------------- 3 files changed, 4 insertions(+), 15 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index fa5b8ef3c7..a8130ed23f 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py @@ -32,7 +32,7 @@ def _run(cmd, cwd=''): def _get_srctree(tmpdir): srctree = tmpdir - dirs = scriptutils.filter_src_subdirs(tmpdir) + dirs = os.listdir(tmpdir) if len(dirs) == 1: srctree = os.path.join(tmpdir, dirs[0]) else: diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 8e9ff38db6..066366e34f 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py @@ -528,7 +528,7 @@ def create_recipe(args): if ftmpdir and args.keep_temp: logger.info('Fetch temp directory is %s' % ftmpdir) - dirlist = scriptutils.filter_src_subdirs(srctree) + dirlist = os.listdir(srctree) logger.debug('Directory listing (excluding filtered out):\n %s' % '\n '.join(dirlist)) if len(dirlist) == 1: singleitem = os.path.join(srctree, dirlist[0]) diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py index f23e53cba9..81f0b01fa5 100644 --- a/scripts/lib/scriptutils.py +++ b/scripts/lib/scriptutils.py @@ -179,6 +179,8 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirr f.write('SRCREV = "%s"\n' % srcrev) f.write('PV = "0.0+"\n') f.write('WORKDIR = "%s"\n' % tmpworkdir) + f.write('UNPACKDIR = "%s"\n' % destdir) + # Set S out of the way so it doesn't get created under the workdir f.write('S = "%s"\n' % os.path.join(tmpdir, 'emptysrc')) if not mirrors: @@ -232,10 +234,6 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirr if e.errno != errno.ENOTEMPTY: raise - bb.utils.mkdirhier(destdir) - for fn in os.listdir(tmpworkdir): - shutil.move(os.path.join(tmpworkdir, fn), destdir) - finally: if not preserve_tmp: shutil.rmtree(tmpdir) @@ -271,12 +269,3 @@ def is_src_url(param): return True return False -def filter_src_subdirs(pth): - """ - Filter out subdirectories of initial unpacked source trees that we do not care about. - Used by devtool and recipetool. - """ - dirlist = os.listdir(pth) - filterout = ['git.indirectionsymlink', 'source-date-epoch', 'sstate-install-recipe_qa'] - dirlist = [x for x in dirlist if x not in filterout] - return dirlist -- cgit v1.2.3-54-g00ecf