]> code.ossystems Code Review - openembedded-core.git/commitdiff
devtool: reset: print message about leaving source tree behind
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 22 Dec 2015 04:03:14 +0000 (17:03 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 22 Dec 2015 16:44:04 +0000 (16:44 +0000)
We deliberately leave the source tree alone when resetting in case it
contains any work in progress belonging to the user; tell them that
we're doing this so they aren't surprised about it still existing later
on.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/devtool/standard.py

index ed9e793d4a711b97089d2b86127ee8100fd1058c..a9c4cf8d8d0dc1b0a4525626abf3047f345fd4bf 100644 (file)
@@ -1229,6 +1229,17 @@ def reset(args, config, basepath, workspace):
         # We don't automatically create this dir next to appends, but the user can
         preservedir(os.path.join(config.workspace_path, 'appends', pn))
 
+        srctree = workspace[pn]['srctree']
+        if os.path.isdir(srctree):
+            if os.listdir(srctree):
+                # We don't want to risk wiping out any work in progress
+                logger.info('Leaving source tree %s as-is; if you no '
+                            'longer need it then please delete it manually'
+                            % srctree)
+            else:
+                # This is unlikely, but if it's empty we can just remove it
+                os.rmdir(srctree)
+
     return 0