diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-13 16:02:41 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-22 22:26:30 +0100 |
commit | 569f8e09f0b077045d112dd569cbc4d47fdae08e (patch) | |
tree | 543339fe570d6ad4de7f22248aaeda99b274ad92 /scripts | |
parent | d24a7d0fb16457e10e7a216d4c9ae3fb265113d1 (diff) | |
download | poky-569f8e09f0b077045d112dd569cbc4d47fdae08e.tar.gz |
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 2 | ||||
-rw-r--r-- | scripts/lib/recipetool/create.py | 2 | ||||
-rw-r--r-- | scripts/lib/scriptutils.py | 15 |
3 files changed, 4 insertions, 15 deletions
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=''): | |||
32 | 32 | ||
33 | def _get_srctree(tmpdir): | 33 | def _get_srctree(tmpdir): |
34 | srctree = tmpdir | 34 | srctree = tmpdir |
35 | dirs = scriptutils.filter_src_subdirs(tmpdir) | 35 | dirs = os.listdir(tmpdir) |
36 | if len(dirs) == 1: | 36 | if len(dirs) == 1: |
37 | srctree = os.path.join(tmpdir, dirs[0]) | 37 | srctree = os.path.join(tmpdir, dirs[0]) |
38 | else: | 38 | 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): | |||
528 | if ftmpdir and args.keep_temp: | 528 | if ftmpdir and args.keep_temp: |
529 | logger.info('Fetch temp directory is %s' % ftmpdir) | 529 | logger.info('Fetch temp directory is %s' % ftmpdir) |
530 | 530 | ||
531 | dirlist = scriptutils.filter_src_subdirs(srctree) | 531 | dirlist = os.listdir(srctree) |
532 | logger.debug('Directory listing (excluding filtered out):\n %s' % '\n '.join(dirlist)) | 532 | logger.debug('Directory listing (excluding filtered out):\n %s' % '\n '.join(dirlist)) |
533 | if len(dirlist) == 1: | 533 | if len(dirlist) == 1: |
534 | singleitem = os.path.join(srctree, dirlist[0]) | 534 | 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 | |||
179 | f.write('SRCREV = "%s"\n' % srcrev) | 179 | f.write('SRCREV = "%s"\n' % srcrev) |
180 | f.write('PV = "0.0+"\n') | 180 | f.write('PV = "0.0+"\n') |
181 | f.write('WORKDIR = "%s"\n' % tmpworkdir) | 181 | f.write('WORKDIR = "%s"\n' % tmpworkdir) |
182 | f.write('UNPACKDIR = "%s"\n' % destdir) | ||
183 | |||
182 | # Set S out of the way so it doesn't get created under the workdir | 184 | # Set S out of the way so it doesn't get created under the workdir |
183 | f.write('S = "%s"\n' % os.path.join(tmpdir, 'emptysrc')) | 185 | f.write('S = "%s"\n' % os.path.join(tmpdir, 'emptysrc')) |
184 | if not mirrors: | 186 | if not mirrors: |
@@ -232,10 +234,6 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirr | |||
232 | if e.errno != errno.ENOTEMPTY: | 234 | if e.errno != errno.ENOTEMPTY: |
233 | raise | 235 | raise |
234 | 236 | ||
235 | bb.utils.mkdirhier(destdir) | ||
236 | for fn in os.listdir(tmpworkdir): | ||
237 | shutil.move(os.path.join(tmpworkdir, fn), destdir) | ||
238 | |||
239 | finally: | 237 | finally: |
240 | if not preserve_tmp: | 238 | if not preserve_tmp: |
241 | shutil.rmtree(tmpdir) | 239 | shutil.rmtree(tmpdir) |
@@ -271,12 +269,3 @@ def is_src_url(param): | |||
271 | return True | 269 | return True |
272 | return False | 270 | return False |
273 | 271 | ||
274 | def filter_src_subdirs(pth): | ||
275 | """ | ||
276 | Filter out subdirectories of initial unpacked source trees that we do not care about. | ||
277 | Used by devtool and recipetool. | ||
278 | """ | ||
279 | dirlist = os.listdir(pth) | ||
280 | filterout = ['git.indirectionsymlink', 'source-date-epoch', 'sstate-install-recipe_qa'] | ||
281 | dirlist = [x for x in dirlist if x not in filterout] | ||
282 | return dirlist | ||