summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-03-16 12:50:11 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-21 00:00:26 +0000
commit5252c459ac1cdc8a869ce02a0d7937c9efb0b833 (patch)
tree4d5fb78cd6430a91810f401196e561979209e69e /bitbake/lib/bb/ui
parent9752757da07f55b62574f9ea02b8744346513649 (diff)
downloadpoky-5252c459ac1cdc8a869ce02a0d7937c9efb0b833.tar.gz
bitbake: toastergui: recipe and layer identification
This patch fixes the recipe and layer identification by path when Toaster uses relative paths. (Bitbake rev: a92bb33a3ceacab2bfee9df1c39a202832866970) Signed-off-by: Alexandru DAMIAN <alexandru.damian@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.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 06a44905ea..64bd94e5e8 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -287,9 +287,13 @@ class ORMWrapper(object):
287 buildrequest = BuildRequest.objects.get(pk = br_id) 287 buildrequest = BuildRequest.objects.get(pk = br_id)
288 for brl in buildrequest.brlayer_set.all(): 288 for brl in buildrequest.brlayer_set.all():
289 localdirname = os.path.join(bc.getGitCloneDirectory(brl.giturl, brl.commit), brl.dirpath) 289 localdirname = os.path.join(bc.getGitCloneDirectory(brl.giturl, brl.commit), brl.dirpath)
290 logger.warn("Matched %s to BRlayer %s" % (pformat(layer_information["local_path"]), localdirname)) 290 # we get a relative path, unless running in HEAD mode where the path is absolute
291 if not localdirname.startswith("/"):
292 localdirname = os.path.join(bc.be.sourcedir, localdirname)
293 #logger.debug(1, "Localdirname %s lcal_path %s" % (localdirname, layer_information['local_path']))
291 if localdirname.startswith(layer_information['local_path']): 294 if localdirname.startswith(layer_information['local_path']):
292 # we matched the BRLayer, but we need the layer_version that generated this BR; reverse of the Project.schedule_build() 295 # we matched the BRLayer, but we need the layer_version that generated this BR; reverse of the Project.schedule_build()
296 #logger.debug(1, "Matched %s to BRlayer %s" % (pformat(layer_information["local_path"]), localdirname))
293 for pl in buildrequest.project.projectlayer_set.filter(layercommit__layer__name = brl.name): 297 for pl in buildrequest.project.projectlayer_set.filter(layercommit__layer__name = brl.name):
294 if pl.layercommit.layer.vcs_url == brl.giturl : 298 if pl.layercommit.layer.vcs_url == brl.giturl :
295 layer = pl.layercommit.layer 299 layer = pl.layercommit.layer
@@ -297,7 +301,7 @@ class ORMWrapper(object):
297 layer.save() 301 layer.save()
298 return layer 302 return layer
299 303
300 raise Exception("Unidentified layer %s" % pformat(layer_information)) 304 raise NotExisting("Unidentified layer %s" % pformat(layer_information))
301 305
302 306
303 def save_target_file_information(self, build_obj, target_obj, filedata): 307 def save_target_file_information(self, build_obj, target_obj, filedata):
@@ -703,6 +707,9 @@ class BuildInfoHelper(object):
703 # Heuristics: we match the path to where the layers have been checked out 707 # Heuristics: we match the path to where the layers have been checked out
704 for brl in sorted(BuildRequest.objects.get(pk = br_id).brlayer_set.all(), reverse = True, key = _slkey_managed): 708 for brl in sorted(BuildRequest.objects.get(pk = br_id).brlayer_set.all(), reverse = True, key = _slkey_managed):
705 localdirname = os.path.join(bc.getGitCloneDirectory(brl.giturl, brl.commit), brl.dirpath) 709 localdirname = os.path.join(bc.getGitCloneDirectory(brl.giturl, brl.commit), brl.dirpath)
710 # we get a relative path, unless running in HEAD mode where the path is absolute
711 if not localdirname.startswith("/"):
712 localdirname = os.path.join(bc.be.sourcedir, localdirname)
706 if path.startswith(localdirname): 713 if path.startswith(localdirname):
707 #logger.warn("-- managed: matched path %s with layer %s " % (path, localdirname)) 714 #logger.warn("-- managed: matched path %s with layer %s " % (path, localdirname))
708 # we matched the BRLayer, but we need the layer_version that generated this br 715 # we matched the BRLayer, but we need the layer_version that generated this br
@@ -775,7 +782,10 @@ class BuildInfoHelper(object):
775 layerinfos = BuildInfoHelper._get_data_from_event(event) 782 layerinfos = BuildInfoHelper._get_data_from_event(event)
776 self.internal_state['lvs'] = {} 783 self.internal_state['lvs'] = {}
777 for layer in layerinfos: 784 for layer in layerinfos:
778 self.internal_state['lvs'][self.orm_wrapper.get_update_layer_object(layerinfos[layer], self.brbe)] = layerinfos[layer]['version'] 785 try:
786 self.internal_state['lvs'][self.orm_wrapper.get_update_layer_object(layerinfos[layer], self.brbe)] = layerinfos[layer]['version']
787 except NotExisting as nee:
788 logger.warn("buildinfohelper: cannot identify layer exception:%s " % nee)
779 789
780 790
781 def store_started_build(self, event): 791 def store_started_build(self, event):
@@ -886,6 +896,9 @@ class BuildInfoHelper(object):
886 896
887 recipe_information = self._get_recipe_information_from_taskfile(taskfile) 897 recipe_information = self._get_recipe_information_from_taskfile(taskfile)
888 try: 898 try:
899 if recipe_information['file_path'].startswith(recipe_information['layer_version'].layer.local_path):
900 recipe_information['file_path'] = recipe_information['file_path'][len(recipe_information['layer_version'].layer.local_path):].lstrip("/")
901
889 recipe_object = Recipe.objects.get(layer_version = recipe_information['layer_version'], 902 recipe_object = Recipe.objects.get(layer_version = recipe_information['layer_version'],
890 file_path__endswith = recipe_information['file_path'], 903 file_path__endswith = recipe_information['file_path'],
891 name = recipename) 904 name = recipename)