diff options
author | brian avery <brian.avery@intel.com> | 2016-10-28 17:52:51 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-11-04 12:50:55 +0000 |
commit | 637c93edfa0bf91467dedad8f014ca89e0e1fa0e (patch) | |
tree | 25d1d6b81a74c4e408a650aac629b893116036e8 /bitbake/lib/bb/ui | |
parent | 754fa212bcdfc5c88641420f6a75276705678f32 (diff) | |
download | poky-637c93edfa0bf91467dedad8f014ca89e0e1fa0e.tar.gz |
bitbake: 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.
(Bitbake rev: e23b574fe52f416184ee43838b8ab28b5b8eb71d)
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>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 5b69660a39..3ddcb2ac6d 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -982,6 +982,31 @@ class BuildInfoHelper(object): | |||
982 | pass | 982 | pass |
983 | return task_information | 983 | return task_information |
984 | 984 | ||
985 | def _get_layer_version_for_dependency(self, pathRE): | ||
986 | """ Returns the layer in the toaster db that has a full regex match to the pathRE. | ||
987 | pathRE - the layer path passed as a regex in the event. It is created in | ||
988 | cooker.py as a collection for the layer priorities. | ||
989 | """ | ||
990 | self._ensure_build() | ||
991 | |||
992 | def _sort_longest_path(layer_version): | ||
993 | assert isinstance(layer_version, Layer_Version) | ||
994 | return len(layer_version.local_path) | ||
995 | |||
996 | # we don't care if we match the trailing slashes | ||
997 | p = re.compile(re.sub("/[^/]*?$","",pathRE)) | ||
998 | # Heuristics: we always match recipe to the deepest layer path in the discovered layers | ||
999 | for lvo in sorted(self.orm_wrapper.layer_version_objects, reverse=True, key=_sort_longest_path): | ||
1000 | if p.fullmatch(lvo.local_path): | ||
1001 | return lvo | ||
1002 | if lvo.layer.local_source_dir: | ||
1003 | if p.fullmatch(lvo.layer.local_source_dir): | ||
1004 | return lvo | ||
1005 | #if we get here, we didn't read layers correctly; dump whatever information we have on the error log | ||
1006 | logger.warning("Could not match layer dependency for path %s : %s", path, self.orm_wrapper.layer_version_objects) | ||
1007 | |||
1008 | |||
1009 | |||
985 | def _get_layer_version_for_path(self, path): | 1010 | def _get_layer_version_for_path(self, path): |
986 | self._ensure_build() | 1011 | self._ensure_build() |
987 | 1012 | ||
@@ -1372,7 +1397,7 @@ class BuildInfoHelper(object): | |||
1372 | if 'layer-priorities' in event._depgraph.keys(): | 1397 | if 'layer-priorities' in event._depgraph.keys(): |
1373 | for lv in event._depgraph['layer-priorities']: | 1398 | for lv in event._depgraph['layer-priorities']: |
1374 | (_, path, _, priority) = lv | 1399 | (_, path, _, priority) = lv |
1375 | layer_version_obj = self._get_layer_version_for_path(path[1:]) # paths start with a ^ | 1400 | layer_version_obj = self._get_layer_version_for_dependency(path) |
1376 | assert layer_version_obj is not None | 1401 | assert layer_version_obj is not None |
1377 | layer_version_obj.priority = priority | 1402 | layer_version_obj.priority = priority |
1378 | layer_version_obj.save() | 1403 | layer_version_obj.save() |