devtool: reset: print message about leaving source tree behind

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.

(From OE-Core rev: 1c616802ba2cfb37f8403f1dc6cf91ce3bd99ac2)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2015-12-22 17:03:14 +13:00 committed by Richard Purdie
parent 95a234e7b3
commit b272c5174f
1 changed files with 11 additions and 0 deletions

View 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