bitbake: bitbake-layers: fix error handling in add-layer / remove-layer
* Fix add-layer error message when a layer is already in BBLAYERS * Ensure we show an error message if we can't find BBLAYERS at all (Bitbake rev: 1c743fd2103730e27699dd55efc6914d3b0c3702) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
6dde745bf9
commit
b264f5629b
|
@ -130,7 +130,7 @@ usage: add-layer <layerdir>
|
|||
(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):
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue