summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-07-26 16:24:21 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-25 22:27:46 +0000
commitd3ad2438222050faf33e83598c1f6ecd25ff65b6 (patch)
tree023b899c26e0e43388e01a86da7b8709841a0085 /bitbake
parent9f8d417c320b23834ae809c40b83dbd587df4df2 (diff)
downloadpoky-d3ad2438222050faf33e83598c1f6ecd25ff65b6.tar.gz
bitbake: utils: add optional callback to edit_bblayers_conf()
Add a callback that lets you modify or remove items in addition to the current scheme where you can only add or remove. This enables you to for example replace a layer with a temporary copy (which is what we will use this for first in OE's oe-selftest). (Bitbake rev: 4f6ba26e8335f975038d90b9e1c1767160bd5272) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/utils.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 2ff7e82222..b20cdabcf0 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -1290,7 +1290,7 @@ def edit_metadata_file(meta_file, variables, varfunc):
1290 return updated 1290 return updated
1291 1291
1292 1292
1293def edit_bblayers_conf(bblayers_conf, add, remove): 1293def edit_bblayers_conf(bblayers_conf, add, remove, edit_cb=None):
1294 """Edit bblayers.conf, adding and/or removing layers 1294 """Edit bblayers.conf, adding and/or removing layers
1295 Parameters: 1295 Parameters:
1296 bblayers_conf: path to bblayers.conf file to edit 1296 bblayers_conf: path to bblayers.conf file to edit
@@ -1298,6 +1298,8 @@ def edit_bblayers_conf(bblayers_conf, add, remove):
1298 list to add nothing 1298 list to add nothing
1299 remove: layer path (or list of layer paths) to remove; None or 1299 remove: layer path (or list of layer paths) to remove; None or
1300 empty list to remove nothing 1300 empty list to remove nothing
1301 edit_cb: optional callback function that will be called after
1302 processing adds/removes once per existing entry.
1301 Returns a tuple: 1303 Returns a tuple:
1302 notadded: list of layers specified to be added but weren't 1304 notadded: list of layers specified to be added but weren't
1303 (because they were already in the list) 1305 (because they were already in the list)
@@ -1361,6 +1363,17 @@ def edit_bblayers_conf(bblayers_conf, add, remove):
1361 bblayers.append(addlayer) 1363 bblayers.append(addlayer)
1362 del addlayers[:] 1364 del addlayers[:]
1363 1365
1366 if edit_cb:
1367 newlist = []
1368 for layer in bblayers:
1369 res = edit_cb(layer, canonicalise_path(layer))
1370 if res != layer:
1371 newlist.append(res)
1372 updated = True
1373 else:
1374 newlist.append(layer)
1375 bblayers = newlist
1376
1364 if updated: 1377 if updated:
1365 if op == '+=' and not bblayers: 1378 if op == '+=' and not bblayers:
1366 bblayers = None 1379 bblayers = None