From 337bea6573db8ca23ba634406d1047264bc024ed Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 7 Jun 2017 11:03:18 +0200 Subject: bitbake: cookerdata: Add support for BBFILES_DYNAMIC BBFILES_DYNAMIC can be used to activate content only when some other layers are present. The other layers are identified by the collections that they define. The main use case is to avoid .bbappends without the corresponding .bb file in layers that want to modify other layers via .bbappends without introducing a hard dependency on those other layers. .bb files could also be handled via BBFILES_DYNAMIC. Entries in BBFILES_DYNAMIC must have the form :. Example usage: BBFILES_DYNAMIC += " \ clang-layer:${LAYERDIR}/bbappends/meta-clang/*/*/*.bbappend \ core:${LAYERDIR}/bbappends/openembedded-core/meta/*/*/*.bbappend \ " Parsing is aborted when invalid entries are found with an error message like this: ERROR: BBFILES_DYNAMIC entries must be of the form :, not: /work/my-layer/bbappends/meta-security-isafw/*/*/*.bbappend /work/my-layer/bbappends/openembedded-core/meta/*/*/*.bbappend Based on a patch by Richard Purdie. (Bitbake rev: 04f8bd50aa04b12cf91dd6a3154527ad2c24695c) Signed-off-by: Patrick Ohly Signed-off-by: Richard Purdie --- bitbake/lib/bb/cookerdata.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'bitbake/lib/bb/cookerdata.py') diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py index 722d860246..aa96f54e54 100644 --- a/bitbake/lib/bb/cookerdata.py +++ b/bitbake/lib/bb/cookerdata.py @@ -346,6 +346,20 @@ class CookerDataBuilder(object): data.delVar('LAYERDIR_RE') data.delVar('LAYERDIR') + bbfiles_dynamic = (data.getVar('BBFILES_DYNAMIC') or "").split() + collections = (data.getVar('BBFILE_COLLECTIONS') or "").split() + invalid = [] + for entry in bbfiles_dynamic: + parts = entry.split(":", 1) + if len(parts) != 2: + invalid.append(entry) + continue + l, f = parts + if l in collections: + data.appendVar("BBFILES", " " + f) + if invalid: + bb.fatal("BBFILES_DYNAMIC entries must be of the form :, not:\n %s" % "\n ".join(invalid)) + if not data.getVar("BBPATH"): msg = "The BBPATH variable is not set" if not layerconf: -- cgit v1.2.3-54-g00ecf