summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/standard.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-03-04 12:56:13 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-20 11:27:44 +0000
commit9adae67e71f16b36a33479aa661ee0fd0180945c (patch)
treee90068fe36b8af559ed82c713cb568f233d79afd /scripts/lib/devtool/standard.py
parente3cfb80f1e5df809663ec2cd63171e6fe7f78c04 (diff)
downloadast2050-yocto-poky-9adae67e71f16b36a33479aa661ee0fd0180945c.zip
ast2050-yocto-poky-9adae67e71f16b36a33479aa661ee0fd0180945c.tar.gz
devtool: reset: add ability to reset entire workspace
Add a -a/--all option to allow you to quickly reset all recipes in your workspace. (From OE-Core rev: 0c83788b111a761f6f500b86780cc51aed255402) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r--scripts/lib/devtool/standard.py52
1 files changed, 33 insertions, 19 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 435878c..32fb3b6 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -556,28 +556,42 @@ def status(args, config, basepath, workspace):
def reset(args, config, basepath, workspace):
import bb.utils
- if not args.recipename in workspace:
- logger.error("no recipe named %s in your workspace" % args.recipename)
+ if args.recipename:
+ if args.all:
+ logger.error("Recipe cannot be specified if -a/--all is used")
+ return -1
+ elif not args.recipename in workspace:
+ logger.error("no recipe named %s in your workspace" % args.recipename)
+ return -1
+ elif not args.all:
+ logger.error("Recipe must be specified, or specify -a/--all to reset all recipes")
return -1
- if not args.no_clean:
- logger.info('Cleaning sysroot for recipe %s...' % args.recipename)
- exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % args.recipename)
+ if args.all:
+ recipes = workspace
+ else:
+ recipes = [args.recipename]
+
+ for pn in recipes:
+ if not args.no_clean:
+ logger.info('Cleaning sysroot for recipe %s...' % pn)
+ exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % pn)
- _check_preserve(config, args.recipename)
+ _check_preserve(config, pn)
- preservepath = os.path.join(config.workspace_path, 'attic', args.recipename)
- def preservedir(origdir):
- if os.path.exists(origdir):
- for fn in os.listdir(origdir):
- logger.warn('Preserving %s in %s' % (fn, preservepath))
- bb.utils.mkdirhier(preservepath)
- shutil.move(os.path.join(origdir, fn), os.path.join(preservepath, fn))
- os.rmdir(origdir)
+ preservepath = os.path.join(config.workspace_path, 'attic', pn)
+ def preservedir(origdir):
+ if os.path.exists(origdir):
+ for fn in os.listdir(origdir):
+ logger.warn('Preserving %s in %s' % (fn, preservepath))
+ bb.utils.mkdirhier(preservepath)
+ shutil.move(os.path.join(origdir, fn), os.path.join(preservepath, fn))
+ os.rmdir(origdir)
+
+ preservedir(os.path.join(config.workspace_path, 'recipes', pn))
+ # We don't automatically create this dir next to appends, but the user can
+ preservedir(os.path.join(config.workspace_path, 'appends', pn))
- preservedir(os.path.join(config.workspace_path, 'recipes', args.recipename))
- # We don't automatically create this dir next to appends, but the user can
- preservedir(os.path.join(config.workspace_path, 'appends', args.recipename))
return 0
@@ -644,7 +658,7 @@ def register_commands(subparsers, context):
parser_reset = subparsers.add_parser('reset', help='Remove a recipe from your workspace',
description='Removes the specified recipe from your workspace (resetting its state)',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
- parser_reset.add_argument('recipename', help='Recipe to reset')
+ parser_reset.add_argument('recipename', nargs='?', help='Recipe to reset')
+ parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all recipes (clear workspace)')
parser_reset.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output')
parser_reset.set_defaults(func=reset)
-
OpenPOWER on IntegriCloud