summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2014-12-19 10:20:31 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-21 17:29:00 +0000
commit0e94aed033917b91ea6ba0522b14a040c3bdc987 (patch)
tree5ada49916b728291bd2a9c1ae919ace6f85ab67b /bin
parentaa03a28b442549dd8ffe92ae4d6390f62202a76a (diff)
downloadbitbake-0e94aed033917b91ea6ba0522b14a040c3bdc987.zip
bitbake-layers: add commands for adding and removing layers
Add add-layer and remove-layer commands for easily adding and removing layers to/from bblayers.conf. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bitbake-layers54
1 files changed, 54 insertions, 0 deletions
diff --git a/bin/bitbake-layers b/bin/bitbake-layers
index 9964040b..edb4d2f0 100755
--- a/bin/bitbake-layers
+++ b/bin/bitbake-layers
@@ -103,6 +103,60 @@ class Commands(cmd.Cmd):
logger.plain("%s %s %d" % (layername.ljust(20), layerdir.ljust(40), layerpri))
+ def do_add_layer(self, dirname):
+ """Add a layer to bblayers.conf
+
+usage: add-layer <layerdir>
+"""
+ if not dirname:
+ sys.stderr.write("Please specify the layer directory to add\n")
+ return
+
+ layerdir = os.path.abspath(dirname)
+ if not os.path.exists(layerdir):
+ sys.stderr.write("Specified layer directory doesn't exist\n")
+ return
+
+ 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
+
+ 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
+
+ (notadded, _) = bb.utils.edit_bblayers_conf(bblayers_conf, layerdir, None)
+ if notadded:
+ for item in notadded:
+ sys.stderr.write("Specified layer %s not in BBLAYERS\n" % item)
+
+
+ def do_remove_layer(self, dirname):
+ """Remove a layer from bblayers.conf
+
+usage: remove-layer <layerdir>
+"""
+ if not dirname:
+ sys.stderr.write("Please specify the layer directory to remove\n")
+ return
+
+ 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
+
+ if dirname.startswith('*'):
+ layerdir = dirname
+ else:
+ layerdir = os.path.abspath(dirname)
+ (_, notremoved) = bb.utils.edit_bblayers_conf(bblayers_conf, None, layerdir)
+ if notremoved:
+ for item in notremoved:
+ sys.stderr.write("No layers matching %s found in BBLAYERS\n" % item)
+
+
def version_str(self, pe, pv, pr = None):
verstr = "%s" % pv
if pr: