summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-10-02 14:05:08 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-07 00:09:10 +0100
commit8cacd228e674f16804f3a09c776068073b31791a (patch)
treeaf2694884d6658f6c8d75f6ba21b267213c24edc /scripts/lib/recipetool
parente9616885fce0bef5009de851843efc83ab0a8ff3 (diff)
downloadpoky-8cacd228e674f16804f3a09c776068073b31791a.tar.gz
recipetool: create: fix change in path structure if --extract-to path exists
If the directory specified by --extract-to exists, because we were using shutil.move() to move the temporary extracted directory to the specified path, a subdirectory was being created under that directory instead of moving the contents, which was a different result than if the directory didn't previously exist. We could try to always move the contents but that's complicated when any symlinks are involved; the simplest thing is just to remove the directory (which should be empty anyway) before moving the temporary directory across in its place. (From OE-Core rev: 2880bd23b471c1966661b9f05726faf60f9c0e7e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool')
-rw-r--r--scripts/lib/recipetool/create.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 844073bf59..15aa9bdbb3 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -260,6 +260,12 @@ def create_recipe(args):
260 260
261 if args.extract_to: 261 if args.extract_to:
262 scriptutils.git_convert_standalone_clone(srctree) 262 scriptutils.git_convert_standalone_clone(srctree)
263 if os.path.isdir(args.extract_to):
264 # If the directory exists we'll move the temp dir into it instead of
265 # its contents - of course, we could try to always move its contents
266 # but that is a pain if there are symlinks; the simplest solution is
267 # to just remove it first
268 os.rmdir(args.extract_to)
263 shutil.move(srctree, args.extract_to) 269 shutil.move(srctree, args.extract_to)
264 logger.info('Source extracted to %s' % args.extract_to) 270 logger.info('Source extracted to %s' % args.extract_to)
265 271