summaryrefslogtreecommitdiffstats
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-21 13:06:45 +0000
commit8afaa56313c5fe55b6fa70eabca123bda4c30f41 (patch)
tree2b0c33fd35b5e74a8a4f379a036d03c90ca4abd0
parent2a9a6465ba04b6f0dd76a952e1b977e47668703a (diff)
downloadpoky-8afaa56313c5fe55b6fa70eabca123bda4c30f41.tar.gz
bitbake: 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. (Bitbake rev: 2f2033836a5ce4064d9e4f263788a563001bc008) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bblayers/action.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/bitbake/lib/bblayers/action.py b/bitbake/lib/bblayers/action.py
index a421380657..aa575d1c09 100644
--- a/bitbake/lib/bblayers/action.py
+++ b/bitbake/lib/bblayers/action.py
@@ -58,19 +58,22 @@ class ActionPlugin(LayerPlugin):
58 shutil.rmtree(tempdir) 58 shutil.rmtree(tempdir)
59 59
60 def do_remove_layer(self, args): 60 def do_remove_layer(self, args):
61 """Remove a layer from bblayers.conf.""" 61 """Remove one or more layers from bblayers.conf."""
62 bblayers_conf = os.path.join('conf', 'bblayers.conf') 62 bblayers_conf = os.path.join('conf', 'bblayers.conf')
63 if not os.path.exists(bblayers_conf): 63 if not os.path.exists(bblayers_conf):
64 sys.stderr.write("Unable to find bblayers.conf\n") 64 sys.stderr.write("Unable to find bblayers.conf\n")
65 return 1 65 return 1
66 66
67 if args.layerdir.startswith('*'): 67 layerdirs = []
68 layerdir = args.layerdir 68 for item in args.layerdir:
69 elif not '/' in args.layerdir: 69 if item.startswith('*'):
70 layerdir = '*/%s' % args.layerdir 70 layerdir = item
71 else: 71 elif not '/' in item:
72 layerdir = os.path.abspath(args.layerdir) 72 layerdir = '*/%s' % item
73 (_, notremoved) = bb.utils.edit_bblayers_conf(bblayers_conf, None, layerdir) 73 else:
74 layerdir = os.path.abspath(item)
75 layerdirs.append(layerdir)
76 (_, notremoved) = bb.utils.edit_bblayers_conf(bblayers_conf, None, layerdirs)
74 if notremoved: 77 if notremoved:
75 for item in notremoved: 78 for item in notremoved:
76 sys.stderr.write("No layers matching %s found in BBLAYERS\n" % item) 79 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).
245 parser_add_layer.add_argument('layerdir', nargs='+', help='Layer directory/directories to add') 248 parser_add_layer.add_argument('layerdir', nargs='+', help='Layer directory/directories to add')
246 249
247 parser_remove_layer = self.add_command(sp, 'remove-layer', self.do_remove_layer, parserecipes=False) 250 parser_remove_layer = self.add_command(sp, 'remove-layer', self.do_remove_layer, parserecipes=False)
248 parser_remove_layer.add_argument('layerdir', help='Layer directory to remove (wildcards allowed, enclose in quotes to avoid shell expansion)') 251 parser_remove_layer.add_argument('layerdir', nargs='+', help='Layer directory/directories to remove (wildcards allowed, enclose in quotes to avoid shell expansion)')
249 parser_remove_layer.set_defaults(func=self.do_remove_layer) 252 parser_remove_layer.set_defaults(func=self.do_remove_layer)
250 253
251 parser_flatten = self.add_command(sp, 'flatten', self.do_flatten) 254 parser_flatten = self.add_command(sp, 'flatten', self.do_flatten)