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>
This commit is contained in:
Richard Purdie 2024-05-13 16:02:41 +01:00
parent d24a7d0fb1
commit 569f8e09f0
3 changed files with 4 additions and 15 deletions

View File

@ -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:

View File

@ -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])

View File

@ -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