summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian avery <brian.avery@intel.com>2016-10-28 17:55:34 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-03 13:32:23 +0000
commit82775c80d169266cc18ca2b2065a05c79dc6fbfc (patch)
tree8a7d96a323618704f25e8246b9efcde7e8739aae
parent00f79096f639ce3a9c0b7c72cfb36f14e264733d (diff)
downloadbitbake-contrib-82775c80d169266cc18ca2b2065a05c79dc6fbfc.tar.gz
toaster: buildinfohelper Handle regex paths
We were presuming that all the layer dependency information was of the form "^/path/to/layer" to we were just stripping the leading "^" off of the layer information when we were matching the layer priorities to the toaster database. This patch splits out the priorities layer match which gets a regex from the task/recipe match which is gets a path. Signed-off-by: brian avery <brian.avery@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/ui/buildinfohelper.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index 5b69660a3..3ddcb2ac6 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -982,6 +982,31 @@ class BuildInfoHelper(object):
pass
return task_information
+ def _get_layer_version_for_dependency(self, pathRE):
+ """ Returns the layer in the toaster db that has a full regex match to the pathRE.
+ pathRE - the layer path passed as a regex in the event. It is created in
+ cooker.py as a collection for the layer priorities.
+ """
+ self._ensure_build()
+
+ def _sort_longest_path(layer_version):
+ assert isinstance(layer_version, Layer_Version)
+ return len(layer_version.local_path)
+
+ # we don't care if we match the trailing slashes
+ p = re.compile(re.sub("/[^/]*?$","",pathRE))
+ # Heuristics: we always match recipe to the deepest layer path in the discovered layers
+ for lvo in sorted(self.orm_wrapper.layer_version_objects, reverse=True, key=_sort_longest_path):
+ if p.fullmatch(lvo.local_path):
+ return lvo
+ if lvo.layer.local_source_dir:
+ if p.fullmatch(lvo.layer.local_source_dir):
+ return lvo
+ #if we get here, we didn't read layers correctly; dump whatever information we have on the error log
+ logger.warning("Could not match layer dependency for path %s : %s", path, self.orm_wrapper.layer_version_objects)
+
+
+
def _get_layer_version_for_path(self, path):
self._ensure_build()
@@ -1372,7 +1397,7 @@ class BuildInfoHelper(object):
if 'layer-priorities' in event._depgraph.keys():
for lv in event._depgraph['layer-priorities']:
(_, path, _, priority) = lv
- layer_version_obj = self._get_layer_version_for_path(path[1:]) # paths start with a ^
+ layer_version_obj = self._get_layer_version_for_dependency(path)
assert layer_version_obj is not None
layer_version_obj.priority = priority
layer_version_obj.save()