All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] toaster.bbclass: attach image file scan postfunc to do_image_complete
@ 2016-02-02 10:25 Elliot Smith
  2016-02-02 10:25 ` [PATCH 2/2] toaster.bbclass: reinstate scan for artifacts in the sdk directory Elliot Smith
  0 siblings, 1 reply; 2+ messages in thread
From: Elliot Smith @ 2016-02-02 10:25 UTC (permalink / raw)
  To: openembedded-core

The postfunc for finding image files after completion of a build
fails, as the image files we're interested in don't exist at the
point when the scan is currently done (following do_rootfs).

Attach the postfunc for scanning for image files to the new
do_image_complete task, which definitely runs after the image files
have been created.

[YOCTO #8956]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 meta/classes/toaster.bbclass | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index fba9067..e307014 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -159,7 +159,7 @@ python toaster_image_dumpdata() {
             except OSError as e:
                 bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d)
 
-    bb.event.fire(bb.event.MetadataEvent("ImageFileSize",image_info_data), d)
+    bb.event.fire(bb.event.MetadataEvent("ImageFileSize", image_info_data), d)
 }
 
 python toaster_artifact_dumpdata() {
@@ -175,14 +175,12 @@ python toaster_artifact_dumpdata() {
         for fn in filenames:
             try:
                 artifact_path = os.path.join(dirpath, fn)
-                filestat = os.stat(artifact_path)
                 if not os.path.islink(artifact_path):
-                    artifact_info_data[artifact_path] = filestat.st_size
+                    artifact_info_data[artifact_path] = os.stat(artifact_path).st_size
             except OSError as e:
-                import sys
                 bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d)
 
-    bb.event.fire(bb.event.MetadataEvent("ArtifactFileSize",artifact_info_data), d)
+    bb.event.fire(bb.event.MetadataEvent("ArtifactFileSize", artifact_info_data), d)
 }
 
 # collect list of buildstats files based on fired events; when the build completes, collect all stats and fire an event with collected data
@@ -357,9 +355,11 @@ toaster_buildhistory_dump[eventmask] = "bb.event.BuildCompleted"
 do_package[postfuncs] += "toaster_package_dumpdata "
 do_package[vardepsexclude] += "toaster_package_dumpdata "
 
-do_rootfs[postfuncs] += "toaster_image_dumpdata "
+do_image_complete[postfuncs] += "toaster_image_dumpdata "
+do_image_complete[vardepsexclude] += "toaster_image_dumpdata "
+
 do_rootfs[postfuncs] += "toaster_licensemanifest_dump "
-do_rootfs[vardepsexclude] += "toaster_image_dumpdata toaster_licensemanifest_dump "
+do_rootfs[vardepsexclude] += "toaster_licensemanifest_dump "
 
 do_populate_sdk[postfuncs] += "toaster_artifact_dumpdata "
 do_populate_sdk[vardepsexclude] += "toaster_artifact_dumpdata "
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] toaster.bbclass: reinstate scan for artifacts in the sdk directory
  2016-02-02 10:25 [PATCH 1/2] toaster.bbclass: attach image file scan postfunc to do_image_complete Elliot Smith
@ 2016-02-02 10:25 ` Elliot Smith
  0 siblings, 0 replies; 2+ messages in thread
From: Elliot Smith @ 2016-02-02 10:25 UTC (permalink / raw)
  To: openembedded-core

During refactoring of the SDK/artifact scan code in toaster.bbclass,
the code to find other non-image artifacts in the images/ directory
was incorrectly removed.

Reinstate that code and clean it up so it's clearer what's happening
and so that non-image artifacts are correctly reported.

[YOCTO #8956]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 meta/classes/toaster.bbclass | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index e307014..51a4c74 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -143,23 +143,33 @@ python toaster_image_dumpdata() {
     image_types.bbclass will spell out IMAGE_CMD_xxx variables that actually
     have hardcoded ways to create image file names in them.
     So we look for files starting with the set name.
+
+    We also look for other files in the images/ directory which don't
+    match IMAGE_NAME, such as the kernel bzImage, modules tarball etc.
     """
 
-    deploy_dir_image = d.getVar('DEPLOY_DIR_IMAGE', True);
+    dir_to_walk = d.getVar('DEPLOY_DIR_IMAGE', True);
     image_name = d.getVar('IMAGE_NAME', True);
     image_info_data = {}
+    artifact_info_data = {}
 
-    # collect all images
-    for dirpath, dirnames, filenames in os.walk(deploy_dir_image):
-        for fn in filenames:
+    # collect all images and artifacts in the images directory
+    for dirpath, dirnames, filenames in os.walk(dir_to_walk):
+        for filename in filenames:
+            full_path = os.path.join(dirpath, filename)
             try:
-                if fn.startswith(image_name):
-                    image_output = os.path.join(dirpath, fn)
-                    image_info_data[image_output] = os.stat(image_output).st_size
+                if filename.startswith(image_name):
+                    # image
+                    image_info_data[full_path] = os.stat(full_path).st_size
+                else:
+                    # other non-image artifact
+                    if not os.path.islink(full_path):
+                        artifact_info_data[full_path] = os.stat(full_path).st_size
             except OSError as e:
                 bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d)
 
     bb.event.fire(bb.event.MetadataEvent("ImageFileSize", image_info_data), d)
+    bb.event.fire(bb.event.MetadataEvent("ArtifactFileSize", artifact_info_data), d)
 }
 
 python toaster_artifact_dumpdata() {
@@ -167,16 +177,16 @@ python toaster_artifact_dumpdata() {
     Dump data about artifacts in the SDK_DEPLOY directory
     """
 
-    artifact_dir = d.getVar("SDK_DEPLOY", True)
+    dir_to_walk = d.getVar("SDK_DEPLOY", True)
     artifact_info_data = {}
 
-    # collect all artifacts
-    for dirpath, dirnames, filenames in os.walk(artifact_dir):
-        for fn in filenames:
+    # collect all artifacts in the sdk directory
+    for dirpath, dirnames, filenames in os.walk(dir_to_walk):
+        for filename in filenames:
+            full_path = os.path.join(dirpath, filename)
             try:
-                artifact_path = os.path.join(dirpath, fn)
-                if not os.path.islink(artifact_path):
-                    artifact_info_data[artifact_path] = os.stat(artifact_path).st_size
+                if not os.path.islink(full_path):
+                    artifact_info_data[full_path] = os.stat(full_path).st_size
             except OSError as e:
                 bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d)
 
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-02 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 10:25 [PATCH 1/2] toaster.bbclass: attach image file scan postfunc to do_image_complete Elliot Smith
2016-02-02 10:25 ` [PATCH 2/2] toaster.bbclass: reinstate scan for artifacts in the sdk directory Elliot Smith

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.