aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-11-08 15:17:07 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-11 12:19:13 +0000
commit2f2033836a5ce4064d9e4f263788a563001bc008 (patch)
tree90069c50d43b1c0efc9066e812c0fdb3089006fb
parentad6b14f01aa326a1c6baa31bfac33be238bce805 (diff)
downloadbitbake-2f2033836a5ce4064d9e4f263788a563001bc008.tar.gz
bitbake-layers: remove-layer: support removing multiple layers at a time
If you can add multiple layers at once, it stands to reason that you should also be able to remove more than one at a time. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bblayers/action.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/bblayers/action.py b/lib/bblayers/action.py
index a42138065..aa575d1c0 100644
--- a/lib/bblayers/action.py
+++ b/lib/bblayers/action.py
@@ -58,19 +58,22 @@ class ActionPlugin(LayerPlugin):
shutil.rmtree(tempdir)
def do_remove_layer(self, args):
- """Remove a layer from bblayers.conf."""
+ """Remove one or more layers from bblayers.conf."""
bblayers_conf = os.path.join('conf', 'bblayers.conf')
if not os.path.exists(bblayers_conf):
sys.stderr.write("Unable to find bblayers.conf\n")
return 1
- if args.layerdir.startswith('*'):
- layerdir = args.layerdir
- elif not '/' in args.layerdir:
- layerdir = '*/%s' % args.layerdir
- else:
- layerdir = os.path.abspath(args.layerdir)
- (_, notremoved) = bb.utils.edit_bblayers_conf(bblayers_conf, None, layerdir)
+ layerdirs = []
+ for item in args.layerdir:
+ if item.startswith('*'):
+ layerdir = item
+ elif not '/' in item:
+ layerdir = '*/%s' % item
+ else:
+ layerdir = os.path.abspath(item)
+ layerdirs.append(layerdir)
+ (_, notremoved) = bb.utils.edit_bblayers_conf(bblayers_conf, None, layerdirs)
if notremoved:
for item in notremoved:
sys.stderr.write("No layers matching %s found in BBLAYERS\n" % item)
@@ -245,7 +248,7 @@ build results (as the layer priority order has effectively changed).
parser_add_layer.add_argument('layerdir', nargs='+', help='Layer directory/directories to add')
parser_remove_layer = self.add_command(sp, 'remove-layer', self.do_remove_layer, parserecipes=False)
- parser_remove_layer.add_argument('layerdir', help='Layer directory to remove (wildcards allowed, enclose in quotes to avoid shell expansion)')
+ parser_remove_layer.add_argument('layerdir', nargs='+', help='Layer directory/directories to remove (wildcards allowed, enclose in quotes to avoid shell expansion)')
parser_remove_layer.set_defaults(func=self.do_remove_layer)
parser_flatten = self.add_command(sp, 'flatten', self.do_flatten)