aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-11-08 15:17:06 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-11 12:19:13 +0000
commitad6b14f01aa326a1c6baa31bfac33be238bce805 (patch)
tree212c770ff5ab342e9a0bbbb33714a5375876f3ca
parent1e59ae8729513e19a801c723b67911491c2a66fe (diff)
downloadbitbake-ad6b14f01aa326a1c6baa31bfac33be238bce805.zip
bitbake-ad6b14f01aa326a1c6baa31bfac33be238bce805.tar.gz
bitbake-ad6b14f01aa326a1c6baa31bfac33be238bce805.tar.bz2
bitbake-layers: add-layer: enable adding multiple layers at once
Allow specifying multiple layers with bitbake-layers add-layer so that you can add more than one in a single command. This is not just useful, it's actually pretty important if you need to add a layer and its dependencies at the same time - since we now go through a parse process when the layer is added, without this you have to add them all in just the right order and wait for the parse each time which is somewhat painful. 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.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/bblayers/action.py b/lib/bblayers/action.py
index b1326e5..a421380 100644
--- a/lib/bblayers/action.py
+++ b/lib/bblayers/action.py
@@ -18,16 +18,18 @@ def plugin_init(plugins):
class ActionPlugin(LayerPlugin):
def do_add_layer(self, args):
- """Add a layer to bblayers.conf."""
- layerdir = os.path.abspath(args.layerdir)
- if not os.path.exists(layerdir):
- sys.stderr.write("Specified layer directory doesn't exist\n")
- return 1
+ """Add one or more layers to bblayers.conf."""
+ layerdirs = [os.path.abspath(ldir) for ldir in args.layerdir]
- layer_conf = os.path.join(layerdir, 'conf', 'layer.conf')
- if not os.path.exists(layer_conf):
- sys.stderr.write("Specified layer directory doesn't contain a conf/layer.conf file\n")
- return 1
+ for layerdir in layerdirs:
+ if not os.path.exists(layerdir):
+ sys.stderr.write("Specified layer directory %s doesn't exist\n" % layerdir)
+ return 1
+
+ layer_conf = os.path.join(layerdir, 'conf', 'layer.conf')
+ if not os.path.exists(layer_conf):
+ sys.stderr.write("Specified layer directory %s doesn't contain a conf/layer.conf file\n" % layerdir)
+ return 1
bblayers_conf = os.path.join('conf', 'bblayers.conf')
if not os.path.exists(bblayers_conf):
@@ -40,7 +42,7 @@ class ActionPlugin(LayerPlugin):
shutil.copy2(bblayers_conf, backup)
try:
- notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdir, None)
+ notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdirs, None)
if not (args.force or notadded):
try:
self.tinfoil.parseRecipes()
@@ -240,7 +242,7 @@ build results (as the layer priority order has effectively changed).
def register_commands(self, sp):
parser_add_layer = self.add_command(sp, 'add-layer', self.do_add_layer, parserecipes=False)
- parser_add_layer.add_argument('layerdir', help='Layer directory to add')
+ 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)')