[Toaster] [PATCH] toaster: add license manifest path to database

Cristiana Voicu cristiana.voicu at intel.com
Fri Mar 7 06:23:23 PST 2014


In order to obtain DEPLOY_DIR and IMAGE_NAME, a function was added
to toaster.bbclass to intercept the end of rootfs.
The information is added to a metadata event. Based on image_name,
the target is obtained, and then the path is added in the database.

[YOCTO #5649]
Signed-off-by: Cristiana Voicu <cristiana.voicu at intel.com>
---
 bitbake/lib/bb/ui/buildinfohelper.py |   14 ++++++++++++++
 bitbake/lib/bb/ui/toasterui.py       |    2 ++
 meta/classes/toaster.bbclass         |   12 ++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 5060a21..cf31872 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -92,6 +92,10 @@ class ORMWrapper(object):
         build.outcome = outcome
         build.save()
 
+    def update_target_object(self, target, license_manifest_path):
+
+        target.license_manifest_path = license_manifest_path
+        target.save()
 
     def get_update_task_object(self, task_information, must_exist = False):
         assert 'build' in task_information
@@ -623,6 +627,16 @@ class BuildInfoHelper(object):
         if 'build' in self.internal_state:
             self.orm_wrapper.update_build_object(self.internal_state['build'], errors, warnings, taskfailures)
 
+
+    def store_license_manifest_path(self, event):
+        deploy_dir = event.data['deploy_dir_image']
+        image_name =  event.data['image_name']
+        path = deploy_dir + "/licenses/" + image_name + "/"
+        for target in self.internal_state['targets']:
+            if target.target in image_name:
+                self.orm_wrapper.update_target_object(target, path)
+
+
     def store_started_task(self, event):
         assert isinstance(event, (bb.runqueue.sceneQueueTaskStarted, bb.runqueue.runQueueTaskStarted, bb.runqueue.runQueueTaskSkipped))
         assert 'taskfile' in vars(event)
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index e469d93..99a8c71 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -241,6 +241,8 @@ def main(server, eventHandler, params ):
                     buildinfohelper.store_tasks_stats(event)
                 if event.type == "ImagePkgList":
                     buildinfohelper.store_target_package_data(event)
+                if event.type == "LicenseManifestPath":
+                    buildinfohelper.store_license_manifest_path(event)
                 continue
 
             # ignore
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index ddfceb5..563b1f7 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -296,6 +296,17 @@ python toaster_buildhistory_dump() {
 
 }
 
+# dump information related to license manifest path
+
+python toaster_licensemanifest_dump() {
+    deploy_dir_image = d.getVar('DEPLOY_DIR_IMAGE', True);
+    image_name = d.getVar('IMAGE_NAME', True);
+
+    data = { 'deploy_dir_image' : deploy_dir_image, 'image_name' : image_name }
+
+    bb.event.fire(bb.event.MetadataEvent("LicenseManifestPath", data), d)
+}
+
 # set event handlers
 addhandler toaster_layerinfo_dumpdata
 toaster_layerinfo_dumpdata[eventmask] = "bb.event.TreeDataPreparationCompleted"
@@ -308,3 +319,4 @@ toaster_buildhistory_dump[eventmask] = "bb.event.BuildCompleted"
 do_package[postfuncs] += "toaster_package_dumpdata "
 
 do_rootfs[postfuncs] += "toaster_image_dumpdata "
+do_rootfs[postfuncs] += "toaster_licensemanifest_dump "
-- 
1.7.9.5



More information about the toaster mailing list