Patchwork [2/2] package.bbclass: add event with package file contents

login
register
mail settings
Submitter Alexandru DAMIAN
Date Sept. 26, 2013, 4:01 p.m.
Message ID <1380211301-23898-2-git-send-email-alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/59039/
State New
Headers show

Comments

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

In populate packages, the code breaks the artifacts
of the build process into separate directories for
each final package.

I'm adding code to use this opportunity and send out
a list of artifacts for each package together with the sizes.

This is needed in order to allow inspection of build artifacts
on remote clients.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 meta/classes/package.bbclass | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 67ee138..8f7ee3c 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1025,6 +1025,20 @@  python populate_packages () {
             if ret is False or ret == 0:
                 raise bb.build.FuncFailed("File population failed")
 
+    for pkg in package_list:
+        pkg_info_data = { 'PKG' : pkg }
+        root = os.path.join(pkgdest, pkg)
+
+        os.chdir(root)
+        pkg_info_data['FILES'] = []
+        import subprocess
+        for path in subprocess.Popen("find . -type f", shell=True, bufsize=16384, stdout=subprocess.PIPE).communicate()[0].rstrip().split("\n"):
+            if len(path) > 0:
+                size = os.stat(path).st_size
+                pkg_info_data['FILES'].append((path, size))
+
+        bb.event.fire(bb.event.MetadataEvent("PackageFileSize",pkg_info_data), d)
+
     os.chdir(workdir)
 
     unshipped = []