Patchwork [bitbake-devel,34/94] bitbake: webhob: determine if a build is an image

login
register
mail settings
Submitter Alexandru DAMIAN
Date Sept. 24, 2013, 4:52 p.m.
Message ID <604ac6de5329767bd00f4c674b1561956e781ea2.1380041477.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/58749/
State New
Headers show

Comments

Alexandru DAMIAN - Sept. 24, 2013, 4:52 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

Adding code to see if a build will generate a image
based on the inheritance of image.bbclass in the recipe
defining the build.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/lib/bb/ui/buildinfohelper.py              | 4 ++++
 bitbake/lib/webhob/bldviewer/templates/build.html | 2 ++
 bitbake/lib/webhob/orm/models.py                  | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

Patch

diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 92f1621..16e69c5 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -328,6 +328,7 @@  class BuildInfoHelper(object):
 
         build_information = self._get_build_information(machine_obj)
         build_information['target'] = ' '.join(event.getPkgs())
+
         build_obj = self.orm_wrapper.create_build_object(build_information)
         self.internal_state['build'] = build_obj
         self.internal_state['target'] = build_information['target']
@@ -422,6 +423,9 @@  class BuildInfoHelper(object):
             recipe_info['file_path'] = file_name
             recipe = self.orm_wrapper.get_update_recipe_object(recipe_info)
             recipe.is_image = True in map(lambda x: x.endswith('image.bbclass'), event._depgraph['pn'][pn]['inherits'])
+            if recipe.is_image and pn == self.internal_state['build'].target:
+                self.internal_state['build'].is_image = True
+                self.internal_state['build'].save()
             self.internal_state['recipes'][pn] = recipe
 
         # save all task information
diff --git a/bitbake/lib/webhob/bldviewer/templates/build.html b/bitbake/lib/webhob/bldviewer/templates/build.html
index 1b694d6..cd257e0 100644
--- a/bitbake/lib/webhob/bldviewer/templates/build.html
+++ b/bitbake/lib/webhob/bldviewer/templates/build.html
@@ -16,6 +16,7 @@ 
 			<th>Started On</th>
 			<th>Completed On</th>
 			<th>Target</th>
+	        <th>Image ?</th>
 			<th>Machine</th>
 			<th>Time</th>
 			<th>Errors</th>
@@ -33,6 +34,7 @@ 
 			<td>{{build.started_on}}</td>
 			<td>{{build.completed_on}}</td>
 			<td>{{build.target}}</td>
+	        <td>{{build.is_image}}</td>
 			<td>{{build.machine.name}}</td>
 			<td>{% time_difference build.started_on build.completed_on %}</td>
 			<td>{{build.errors_no}}</td>
diff --git a/bitbake/lib/webhob/orm/models.py b/bitbake/lib/webhob/orm/models.py
index 91b352e..0d6cf15 100644
--- a/bitbake/lib/webhob/orm/models.py
+++ b/bitbake/lib/webhob/orm/models.py
@@ -14,7 +14,7 @@  class Build(models.Model):
 
     uuid = models.CharField(max_length=100, unique=True)
     target = models.CharField(max_length=100)
-    is_image = models.BooleanField()
+    is_image = models.BooleanField(default = False)
     machine = models.ForeignKey('Machine', related_name='build_machine')
     distro = models.CharField(max_length=100)
     distro_version = models.CharField(max_length=100)