[oe-commits] [openembedded-core] 02/02: toaster.bbclass: only scan files-in-image.txt if it exists

git at git.openembedded.org git at git.openembedded.org
Tue Jul 19 08:03:53 UTC 2016


rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 8b369cdd73ab17cdf834a591b97b25840caeb740
Author: Elliot Smith <elliot.smith at intel.com>
AuthorDate: Tue Jul 12 15:54:28 2016 -0700

    toaster.bbclass: only scan files-in-image.txt if it exists
    
    We can reach the method in toaster.bbclass which tries to read from
    the files-in-image.txt file via a build which doesn't create that
    file (e.g. "bitbake core-image-minimal -c rootfs"). This causes
    the build to fail with an exception.
    
    Check that this file exists before trying to read from it.
    
    [YOCTO #9784]
    
    Signed-off-by: Elliot Smith <elliot.smith at intel.com>
    Signed-off-by: bavery <brian.avery at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/toaster.bbclass | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index 90ea563..972efb9 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -288,15 +288,22 @@ python toaster_buildhistory_dump() {
                             images[target][dependsname] = {'size': 0, 'depends' : []}
                         images[target][pname]['depends'].append((dependsname, deptype))
 
-            with open("%s/files-in-image.txt" % installed_img_path, "r") as fin:
-                for line in fin:
-                    lc = [ x for x in line.strip().split(" ") if len(x) > 0 ]
-                    if lc[0].startswith("l"):
-                        files[target]['syms'].append(lc)
-                    elif lc[0].startswith("d"):
-                        files[target]['dirs'].append(lc)
-                    else:
-                        files[target]['files'].append(lc)
+            # files-in-image.txt is only generated if an image file is created,
+            # so the file entries ('syms', 'dirs', 'files') for a target will be
+            # empty for rootfs builds and other "image" tasks which don't
+            # produce image files
+            # (e.g. "bitbake core-image-minimal -c populate_sdk")
+            files_in_image_path = "%s/files-in-image.txt" % installed_img_path
+            if os.path.exists(files_in_image_path):
+                with open(files_in_image_path, "r") as fin:
+                    for line in fin:
+                        lc = [ x for x in line.strip().split(" ") if len(x) > 0 ]
+                        if lc[0].startswith("l"):
+                            files[target]['syms'].append(lc)
+                        elif lc[0].startswith("d"):
+                            files[target]['dirs'].append(lc)
+                        else:
+                            files[target]['files'].append(lc)
 
             for pname in images[target]:
                 if not pname in allpkgs:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list