summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-11-24 11:20:05 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-30 15:48:10 +0000
commit6dba0281e1de039c64098fbb0b32e6fd78ab53eb (patch)
tree77a28d1bb29f2e19a2a84a319e6b313b9829d317
parent439f3da1a1737fe111f77b13c8c20718bfe91f49 (diff)
downloadpoky-6dba0281e1de039c64098fbb0b32e6fd78ab53eb.tar.gz
bitbake: toaster: buildinfohelper fix _get_layer_version_for_dependency
This function is simplified by not trying to handle replacing the regex and just compiling and using it for matching. - Fix typo in logger output with undefined variable - Fix pyflake errors (Bitbake rev: ea298ece8d678889cd5bcde46e00545e9a73edb9) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 43a1411fa0..63c779e81f 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -965,9 +965,10 @@ class BuildInfoHelper(object):
965 return task_information 965 return task_information
966 966
967 def _get_layer_version_for_dependency(self, pathRE): 967 def _get_layer_version_for_dependency(self, pathRE):
968 """ Returns the layer in the toaster db that has a full regex match to the pathRE. 968 """ Returns the layer in the toaster db that has a full regex
969 pathRE - the layer path passed as a regex in the event. It is created in 969 match to the pathRE. pathRE - the layer path passed as a regex in the
970 cooker.py as a collection for the layer priorities. 970 event. It is created in cooker.py as a collection for the layer
971 priorities.
971 """ 972 """
972 self._ensure_build() 973 self._ensure_build()
973 974
@@ -975,19 +976,26 @@ class BuildInfoHelper(object):
975 assert isinstance(layer_version, Layer_Version) 976 assert isinstance(layer_version, Layer_Version)
976 return len(layer_version.local_path) 977 return len(layer_version.local_path)
977 978
978 # we don't care if we match the trailing slashes 979 # Our paths don't append a trailing slash
979 p = re.compile(re.sub("/[^/]*?$","",pathRE)) 980 if pathRE.endswith("/"):
980 # Heuristics: we always match recipe to the deepest layer path in the discovered layers 981 pathRE = pathRE[:-1]
981 for lvo in sorted(self.orm_wrapper.layer_version_objects, reverse=True, key=_sort_longest_path): 982
982 if p.fullmatch(lvo.local_path): 983 p = re.compile(pathRE)
984 # Heuristics: we always match recipe to the deepest layer path in
985 # the discovered layers
986 for lvo in sorted(self.orm_wrapper.layer_version_objects,
987 reverse=True, key=_sort_longest_path):
988 if p.fullmatch(os.path.abspath(lvo.local_path)):
983 return lvo 989 return lvo
984 if lvo.layer.local_source_dir: 990 if lvo.layer.local_source_dir:
985 if p.fullmatch(lvo.layer.local_source_dir): 991 if p.fullmatch(os.path.abspath(lvo.layer.local_source_dir)):
986 return lvo 992 return lvo
987 #if we get here, we didn't read layers correctly; dump whatever information we have on the error log
988 logger.warning("Could not match layer dependency for path %s : %s", path, self.orm_wrapper.layer_version_objects)
989
990 993
994 # if we get here, we didn't read layers correctly;
995 # dump whatever information we have on the error log
996 logger.warning("Could not match layer dependency for path %s : %s",
997 pathRE,
998 self.orm_wrapper.layer_version_objects)
991 999
992 def _get_layer_version_for_path(self, path): 1000 def _get_layer_version_for_path(self, path):
993 self._ensure_build() 1001 self._ensure_build()