diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-02-19 22:38:51 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-21 09:31:59 +0000 |
commit | bbe63eb97ae7f78959f117d6066ef821c4da1c77 (patch) | |
tree | 305d0846df8dd1ced2cfd0dbb96917adde1659cb /scripts/lib | |
parent | 184a256931e8cdc7bea97a905c4e67a435964de0 (diff) | |
download | openembedded-core-contrib-bbe63eb97ae7f78959f117d6066ef821c4da1c77.tar.gz |
devtool: reset: fix preserving patches/other files next to recipes
If files had been created next to the recipe (for example devtool add,
edit the source and commit and then devtool update-recipe), running
devtool reset failed to preserve those files and gave an error due
to trying to rmdir the directory containing them which wasn't empty.
Fix the preservation of files in the "attic" directory properly so
we catch anything under the directory for the recipe, and replicate
the same structure in the attic directory rather than slightly
flattening it as we were before.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/devtool/standard.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 590dfef27ef..bbbe426493e 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -190,7 +190,7 @@ def add(args, config, basepath, workspace): shutil.move(recipes[0], recipefile) else: raise DevtoolError('Command \'%s\' did not create any recipe file:\n%s' % (e.command, e.stdout)) - attic_recipe = os.path.join(config.workspace_path, 'attic', os.path.basename(recipefile)) + attic_recipe = os.path.join(config.workspace_path, 'attic', recipename, os.path.basename(recipefile)) if os.path.exists(attic_recipe): logger.warn('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) finally: @@ -645,7 +645,7 @@ def _check_preserve(config, recipename): import bb.utils origfile = os.path.join(config.workspace_path, '.devtool_md5') newfile = os.path.join(config.workspace_path, '.devtool_md5_new') - preservepath = os.path.join(config.workspace_path, 'attic') + preservepath = os.path.join(config.workspace_path, 'attic', recipename) with open(origfile, 'r') as f: with open(newfile, 'w') as tf: for line in f.readlines(): @@ -1256,7 +1256,7 @@ def reset(args, config, basepath, workspace): for pn in recipes: _check_preserve(config, pn) - preservepath = os.path.join(config.workspace_path, 'attic', pn) + preservepath = os.path.join(config.workspace_path, 'attic', pn, pn) def preservedir(origdir): if os.path.exists(origdir): for root, dirs, files in os.walk(origdir): @@ -1265,7 +1265,7 @@ def reset(args, config, basepath, workspace): _move_file(os.path.join(origdir, fn), os.path.join(preservepath, fn)) for dn in dirs: - os.rmdir(os.path.join(root, dn)) + preservedir(os.path.join(root, dn)) os.rmdir(origdir) preservedir(os.path.join(config.workspace_path, 'recipes', pn)) |