bitbake: toaster: get rid of complicated heuristics
Removed buildinfohelper code which was trying to guess layer version of the recipe using build request information. The code caused creation of duplicated recipes as it resulted in layer version from layer index instead of returning build layer version. As a result of this Toaster UI was not showing any information about recipes. Default approach used to find layer version seems to work much better as it finds proper layer version. Now toaster will use it as the only way to find layer version. (Bitbake rev: 101690bda7ad55dc0657483233c90c374713755b) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
556b8b6156
commit
8b7a548e30
|
@ -815,44 +815,15 @@ class BuildInfoHelper(object):
|
|||
assert path.startswith("/")
|
||||
assert 'build' in self.internal_state
|
||||
|
||||
if self.brbe is None:
|
||||
def _slkey_interactive(layer_version):
|
||||
assert isinstance(layer_version, Layer_Version)
|
||||
return len(layer_version.local_path)
|
||||
def _slkey_interactive(layer_version):
|
||||
assert isinstance(layer_version, Layer_Version)
|
||||
return len(layer_version.local_path)
|
||||
|
||||
# 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=_slkey_interactive):
|
||||
# we can match to the recipe file path
|
||||
if path.startswith(lvo.local_path):
|
||||
return lvo
|
||||
|
||||
else:
|
||||
br_id, be_id = self.brbe.split(":")
|
||||
from bldcontrol.bbcontroller import getBuildEnvironmentController
|
||||
bc = getBuildEnvironmentController(pk = be_id)
|
||||
|
||||
def _slkey_managed(layer_version):
|
||||
return len(bc.getGitCloneDirectory(layer_version.giturl, layer_version.commit) + layer_version.dirpath)
|
||||
|
||||
# Heuristics: we match the path to where the layers have been checked out
|
||||
for brl in sorted(BuildRequest.objects.get(pk = br_id).brlayer_set.all(), reverse = True, key = _slkey_managed):
|
||||
localdirname = os.path.join(bc.getGitCloneDirectory(brl.giturl, brl.commit), brl.dirpath)
|
||||
# we get a relative path, unless running in HEAD mode where the path is absolute
|
||||
if not localdirname.startswith("/"):
|
||||
localdirname = os.path.join(bc.be.sourcedir, localdirname)
|
||||
if path.startswith(localdirname):
|
||||
# If the build request came from toaster this field
|
||||
# should contain the information from the layer_version
|
||||
# That created this build request.
|
||||
if brl.layer_version:
|
||||
return brl.layer_version
|
||||
|
||||
#logger.warn("-- managed: matched path %s with layer %s " % (path, localdirname))
|
||||
# we matched the BRLayer, but we need the layer_version that generated this br
|
||||
|
||||
for lvo in self.orm_wrapper.layer_version_objects:
|
||||
if brl.name == lvo.layer.name:
|
||||
return lvo
|
||||
# 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=_slkey_interactive):
|
||||
# we can match to the recipe file path
|
||||
if path.startswith(lvo.local_path):
|
||||
return lvo
|
||||
|
||||
#if we get here, we didn't read layers correctly; dump whatever information we have on the error log
|
||||
logger.warn("Could not match layer version for recipe path %s : %s", path, self.orm_wrapper.layer_version_objects)
|
||||
|
|
Loading…
Reference in New Issue