diff options
| author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-03-04 15:52:01 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-03-16 17:44:07 +0000 |
| commit | cca517056bd2a195f33a7f2945df38af1a17abdd (patch) | |
| tree | ef7f280631b923cedd9e8d9d5bc1fac5389caf5c /bitbake/lib/bb/ui | |
| parent | 42d1b65d1543cbb334e776bf0193ea9a8a14799e (diff) | |
| download | poky-cca517056bd2a195f33a7f2945df38af1a17abdd.tar.gz | |
bitbake: toasterui: identify proper layer in build mode
In build mode, instead of creating our own layer objects,
we identify the layer objects that the build system set up.
[YOCTO #7378]
(Bitbake rev: 22962b540ace6868cb357c0fd13f01ffd24449c4)
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.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 19ddd8e029..ae2ac9fee5 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
| @@ -270,15 +270,28 @@ class ORMWrapper(object): | |||
| 270 | else: | 270 | else: |
| 271 | # we are under managed mode; we must match the layer used in the Project Layer | 271 | # we are under managed mode; we must match the layer used in the Project Layer |
| 272 | from bldcontrol.models import BuildEnvironment, BuildRequest | 272 | from bldcontrol.models import BuildEnvironment, BuildRequest |
| 273 | br, be = brbe.split(":") | 273 | br_id, be_id = brbe.split(":") |
| 274 | 274 | ||
| 275 | buildrequest = BuildRequest.objects.get(pk = br) | 275 | # find layer by checkout path; |
| 276 | from bldcontrol import bbcontroller | ||
| 277 | bc = bbcontroller.getBuildEnvironmentController(pk = be_id) | ||
| 276 | 278 | ||
| 277 | # we might have a race condition here, as the project layers may change between the build trigger and the actual build execution | 279 | # we might have a race condition here, as the project layers may change between the build trigger and the actual build execution |
| 278 | # but we can only match on the layer name, so the worst thing can happen is a mis-identification of the layer, not a total failure | 280 | # but we can only match on the layer name, so the worst thing can happen is a mis-identification of the layer, not a total failure |
| 279 | layer_object = buildrequest.project.projectlayer_set.get(layercommit__layer__name=layer_information['name']).layercommit.layer | ||
| 280 | 281 | ||
| 281 | return layer_object | 282 | from pprint import pformat |
| 283 | # note that this is different | ||
| 284 | buildrequest = BuildRequest.objects.get(pk = br_id) | ||
| 285 | for brl in buildrequest.brlayer_set.all(): | ||
| 286 | localdirname = os.path.join(bc.getGitCloneDirectory(brl.giturl, brl.commit), brl.dirpath) | ||
| 287 | logger.warn("Matched %s to BRlayer %s" % (pformat(layer_information["local_path"]), localdirname)) | ||
| 288 | if localdirname.startswith(layer_information['local_path']): | ||
| 289 | # we matched the BRLayer, but we need the layer_version that generated this BR; reverse of the Project.schedule_build() | ||
| 290 | for pl in buildrequest.project.projectlayer_set.filter(layercommit__layer__name = brl.name): | ||
| 291 | if pl.layercommit.layer.vcs_url == brl.giturl : | ||
| 292 | return pl.layercommit.layer | ||
| 293 | |||
| 294 | raise Exception("Unidentified layer %s" % pformat(layer_information)) | ||
| 282 | 295 | ||
| 283 | 296 | ||
| 284 | def save_target_file_information(self, build_obj, target_obj, filedata): | 297 | def save_target_file_information(self, build_obj, target_obj, filedata): |
| @@ -683,7 +696,7 @@ class BuildInfoHelper(object): | |||
| 683 | 696 | ||
| 684 | # Heuristics: we match the path to where the layers have been checked out | 697 | # Heuristics: we match the path to where the layers have been checked out |
| 685 | for brl in sorted(BuildRequest.objects.get(pk = br_id).brlayer_set.all(), reverse = True, key = _slkey_managed): | 698 | for brl in sorted(BuildRequest.objects.get(pk = br_id).brlayer_set.all(), reverse = True, key = _slkey_managed): |
| 686 | localdirname = os.path.join(os.path.join(bc.be.sourcedir, bc.getGitCloneDirectory(brl.giturl, brl.commit)), brl.dirpath) | 699 | localdirname = os.path.join(bc.getGitCloneDirectory(brl.giturl, brl.commit), brl.dirpath) |
| 687 | if path.startswith(localdirname): | 700 | if path.startswith(localdirname): |
| 688 | #logger.warn("-- managed: matched path %s with layer %s " % (path, localdirname)) | 701 | #logger.warn("-- managed: matched path %s with layer %s " % (path, localdirname)) |
| 689 | # we matched the BRLayer, but we need the layer_version that generated this br | 702 | # we matched the BRLayer, but we need the layer_version that generated this br |
