diff options
Diffstat (limited to 'bitbake')
| -rw-r--r-- | bitbake/lib/bb/utils.py | 15 |
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 | ||
| 1293 | def edit_bblayers_conf(bblayers_conf, add, remove): | 1293 | def 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 |
