Skip to contentSkip to conversation

cooker.py: Fix incorrect bb files matched warning

PATCH New Mark Hatle 1 participant 1 message Aug 29, 2018

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

PATCH 1/1 cooker.py: Fix incorrect bb files matched warning

In the case of a sublayer of an existing layer, where the sublayer and main layer share a path, the system may not match the paths properly resulting in:

No bb files matched BBFILE_PATTERN_sublayer '^/path/main/sublayer'

because it has already matched the main layer.

Fix this issue by sorting the collection items based on the pattern, using longest to shortest. Obviously regex wildcards could still be an issue but these are typically not used, so this simply fix should work in the existing cases.

---
 bin/bitbake-selftest   |  1 +
 lib/bb/cooker.py       |  5 ++-
 lib/bb/tests/cooker.py | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 lib/bb/tests/cooker.py
bin/bitbake-selftest +1 -0
index 7564de3..cfa7ac5 100755
@@ -27,6 +27,7 @@ except RuntimeError as exc:
     sys.exit(str(exc))
 
 tests = ["bb.tests.codeparser",
+         "bb.tests.cooker",
          "bb.tests.cow",
          "bb.tests.data",
          "bb.tests.event",
lib/bb/cooker.py +4 -1
index 946ba9c..d7e90f2 100644
@@ -1661,7 +1661,10 @@ class CookerExit(bb.event.Event):
 class CookerCollectFiles(object):
     def __init__(self, priorities):
         self.bbappends = []
-        self.bbfile_config_priorities = priorities
+        # Priorities is a list of tupples, with the second element as the pattern.
+        # We need to sort the list with the longest pattern first, and so on to
+        # the shortest.  This allows nested layers to be properly evaluated.
+        self.bbfile_config_priorities = sorted(priorities, key=lambda tup: tup[1], reverse=True)
 
     def calc_bbfile_priority( self, filename, matched = None ):
         for _, _, regex, pri in self.bbfile_config_priorities:
lib/bb/tests/cooker.py new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
1.8.3.1