diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 5 | ||||
-rw-r--r-- | scripts/lib/recipetool/create.py | 4 | ||||
-rw-r--r-- | scripts/lib/scriptutils.py | 10 |
3 files changed, 14 insertions, 5 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index 18c5b66a29..cb6dce378a 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 = os.listdir(tmpdir) | 35 | dirs = scriptutils.filter_src_subdirs(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 | return srctree | 38 | return srctree |
@@ -281,7 +281,8 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee | |||
281 | logger.info('Preserving temporary directory %s' % tmpsrctree) | 281 | logger.info('Preserving temporary directory %s' % tmpsrctree) |
282 | else: | 282 | else: |
283 | shutil.rmtree(tmpsrctree) | 283 | shutil.rmtree(tmpsrctree) |
284 | shutil.rmtree(tmpdir) | 284 | if tmpdir != tmpsrctree: |
285 | shutil.rmtree(tmpdir) | ||
285 | 286 | ||
286 | return (rev, md5, sha256, srcbranch, srcsubdir_rel) | 287 | return (rev, md5, sha256, srcbranch, srcsubdir_rel) |
287 | 288 | ||
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index b5c9f78843..4c4bbadb4c 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -495,9 +495,7 @@ def create_recipe(args): | |||
495 | if ftmpdir and args.keep_temp: | 495 | if ftmpdir and args.keep_temp: |
496 | logger.info('Fetch temp directory is %s' % ftmpdir) | 496 | logger.info('Fetch temp directory is %s' % ftmpdir) |
497 | 497 | ||
498 | dirlist = os.listdir(srctree) | 498 | dirlist = scriptutils.filter_src_subdirs(srctree) |
499 | filterout = ['git.indirectionsymlink', 'source-date-epoch'] | ||
500 | dirlist = [x for x in dirlist if x not in filterout] | ||
501 | logger.debug('Directory listing (excluding filtered out):\n %s' % '\n '.join(dirlist)) | 499 | logger.debug('Directory listing (excluding filtered out):\n %s' % '\n '.join(dirlist)) |
502 | if len(dirlist) == 1: | 500 | if len(dirlist) == 1: |
503 | singleitem = os.path.join(srctree, dirlist[0]) | 501 | singleitem = os.path.join(srctree, dirlist[0]) |
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py index c573dc7f67..45bdaf5f4e 100644 --- a/scripts/lib/scriptutils.py +++ b/scripts/lib/scriptutils.py | |||
@@ -268,3 +268,13 @@ def is_src_url(param): | |||
268 | elif param.startswith('git@') or ('@' in param and param.endswith('.git')): | 268 | elif param.startswith('git@') or ('@' in param and param.endswith('.git')): |
269 | return True | 269 | return True |
270 | return False | 270 | return False |
271 | |||
272 | def filter_src_subdirs(pth): | ||
273 | """ | ||
274 | Filter out subdirectories of initial unpacked source trees that we do not care about. | ||
275 | Used by devtool and recipetool. | ||
276 | """ | ||
277 | dirlist = os.listdir(pth) | ||
278 | filterout = ['git.indirectionsymlink', 'source-date-epoch'] | ||
279 | dirlist = [x for x in dirlist if x not in filterout] | ||
280 | return dirlist | ||