diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers index edb4d2f03a..98794981a0 100755 --- a/bitbake/bin/bitbake-layers +++ b/bitbake/bin/bitbake-layers @@ -130,7 +130,7 @@ usage: add-layer (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) + sys.stderr.write("Specified layer %s is already in BBLAYERS\n" % item) def do_remove_layer(self, dirname): diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index f26349f4a9..ef8cd4d624 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -1012,7 +1012,11 @@ def edit_bblayers_conf(bblayers_conf, add, remove): addlayers = layerlist_param(add) removelayers = layerlist_param(remove) + # Need to use a list here because we can't set non-local variables from a callback in python 2.x + bblayercalls = [] + def handle_bblayers(varname, origvalue): + bblayercalls.append(varname) updated = False bblayers = [remove_trailing_sep(x) for x in origvalue.split()] if removelayers: @@ -1040,5 +1044,9 @@ def edit_bblayers_conf(bblayers_conf, add, remove): return (origvalue, 2, False) edit_metadata_file(bblayers_conf, ['BBLAYERS'], handle_bblayers) + + if not bblayercalls: + raise Exception('Unable to find BBLAYERS in %s' % bblayers_conf) + return (notadded, notremoved)