summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/buildinfohelper.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/buildinfohelper.py')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py47
1 files changed, 9 insertions, 38 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 5ea9284a39..1d41bba408 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -815,44 +815,15 @@ class BuildInfoHelper(object):
815 assert path.startswith("/") 815 assert path.startswith("/")
816 assert 'build' in self.internal_state 816 assert 'build' in self.internal_state
817 817
818 if self.brbe is None: 818 def _slkey_interactive(layer_version):
819 def _slkey_interactive(layer_version): 819 assert isinstance(layer_version, Layer_Version)
820 assert isinstance(layer_version, Layer_Version) 820 return len(layer_version.local_path)
821 return len(layer_version.local_path) 821
822 822 # Heuristics: we always match recipe to the deepest layer path in the discovered layers
823 # Heuristics: we always match recipe to the deepest layer path in the discovered layers 823 for lvo in sorted(self.orm_wrapper.layer_version_objects, reverse=True, key=_slkey_interactive):
824 for lvo in sorted(self.orm_wrapper.layer_version_objects, reverse=True, key=_slkey_interactive): 824 # we can match to the recipe file path
825 # we can match to the recipe file path 825 if path.startswith(lvo.local_path):
826 if path.startswith(lvo.local_path): 826 return lvo
827 return lvo
828
829 else:
830 br_id, be_id = self.brbe.split(":")
831 from bldcontrol.bbcontroller import getBuildEnvironmentController
832 bc = getBuildEnvironmentController(pk = be_id)
833
834 def _slkey_managed(layer_version):
835 return len(bc.getGitCloneDirectory(layer_version.giturl, layer_version.commit) + layer_version.dirpath)
836
837 # Heuristics: we match the path to where the layers have been checked out
838 for brl in sorted(BuildRequest.objects.get(pk = br_id).brlayer_set.all(), reverse = True, key = _slkey_managed):
839 localdirname = os.path.join(bc.getGitCloneDirectory(brl.giturl, brl.commit), brl.dirpath)
840 # we get a relative path, unless running in HEAD mode where the path is absolute
841 if not localdirname.startswith("/"):
842 localdirname = os.path.join(bc.be.sourcedir, localdirname)
843 if path.startswith(localdirname):
844 # If the build request came from toaster this field
845 # should contain the information from the layer_version
846 # That created this build request.
847 if brl.layer_version:
848 return brl.layer_version
849
850 #logger.warn("-- managed: matched path %s with layer %s " % (path, localdirname))
851 # we matched the BRLayer, but we need the layer_version that generated this br
852
853 for lvo in self.orm_wrapper.layer_version_objects:
854 if brl.name == lvo.layer.name:
855 return lvo
856 827
857 #if we get here, we didn't read layers correctly; dump whatever information we have on the error log 828 #if we get here, we didn't read layers correctly; dump whatever information we have on the error log
858 logger.warn("Could not match layer version for recipe path %s : %s", path, self.orm_wrapper.layer_version_objects) 829 logger.warn("Could not match layer version for recipe path %s : %s", path, self.orm_wrapper.layer_version_objects)