[bitbake-devel] [PATCH] cooker.py: allow dangling bbappends if explicitly whitelisted

Patrick Ohly patrick.ohly at intel.com
Mon May 22 10:50:20 UTC 2017


Having a .bbappend without corresponding .bb file triggers an error or
at least warning, depending on the global BB_DANGLINGAPPENDS_WARNONLY.

Some layers (for example, meta-freescale) avoid that message by only
adding .bbappends to the BBFILES when the layers they apply to are
present. Others (like intel-iot-refkit) avoid such .bbappends by
falling back to global assignments with _pn-<recipe> as override. Both
is complicated.

Now the warning code checks BBAPPENDS_DANGLING_WHITELIST and ignores
all bbappends which match a file pattern in that list. This is an
easier way to have bbappends which may or may not apply to an
existing recipe.

Example usage:

  # We have recipes-* directories, add to BBFILES
  BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
	${LAYERDIR}/optional-bbappends/recipes-*/*/*.bbappend \
	${LAYERDIR}/recipes-*/*/*.bbappend"

  # Several of our *.bbappends might be for layers that are not
  # guaranteed to be present. Don't warn or even error out because
  # of those.
  BBAPPENDS_DANGLING_WHITELIST += "${LAYERDIR}/optional-bbappends/recipes-*/*/*.bbappend"

Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
---
 lib/bb/cooker.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index bc8574a..687fbfd 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -45,6 +45,7 @@ import pyinotify
 import json
 import pickle
 import codecs
+import fnmatch
 
 logger      = logging.getLogger("BitBake")
 collectlog  = logging.getLogger("BitBake.Collection")
@@ -1008,8 +1009,11 @@ class BBCooker:
             applied_appends.extend(self.collection.get_file_appends(fn))
 
         appends_without_recipes = []
+        appends_whitelist = (self.data.getVar("BBAPPENDS_DANGLING_WHITELIST") or "").split()
+        bb.note('Whitelist: %s' % appends_whitelist)
         for _, appendfn in self.collection.bbappends:
-            if not appendfn in applied_appends:
+            if not appendfn in applied_appends and \
+               not any(map(lambda whitelist_entry: fnmatch.fnmatch(appendfn, whitelist_entry), appends_whitelist)):
                 appends_without_recipes.append(appendfn)
 
         if appends_without_recipes:

base-commit: 362f6044fcaafe51ab4377af8f2606165b112717
-- 
git-series 0.9.1



More information about the bitbake-devel mailing list