[OE-core] [PATCH 2/2 RFC] package.bbclass: Trigger a bb.error if split/strip fails

Mark Hatle mark.hatle at windriver.com
Mon Mar 25 17:19:53 UTC 2013


[ YOCTO #4089 ]

If debugedit, objcopy calls fail, capture the error and return a
failure to the user.

Signed-off-by: Mark Hatle <mark.hatle at windriver.com>
---
 meta/classes/package.bbclass | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 0702c92..3752bdc 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -254,14 +254,26 @@ def splitdebuginfo(file, debugfile, debugsrcdir, d):
 
     # We need to extract the debug src information here...
     if debugsrcdir:
-        subprocess.call("'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (debugedit, workparentdir, debugsrcdir, sourcefile, file), shell=True)
+        cmd = "'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (debugedit, workparentdir, debugsrcdir, sourcefile, file)
+        ret = subprocess.call(cmd, shell=True)
+        if ret != 0:
+            bb.error("debugedit failed: %s - %d" % (cmd, ret))
+            return ret
 
     bb.utils.mkdirhier(os.path.dirname(debugfile))
 
-    subprocess.call("'%s' --only-keep-debug '%s' '%s'" % (objcopy, file, debugfile), shell=True)
+    cmd = "'%s' --only-keep-debug '%s' '%s'" % (objcopy, file, debugfile)
+    ret = subprocess.call(cmd, shell=True)
+    if ret != 0:
+        bb.error("debugedit failed: %s - %d" % (cmd, ret))
+        return ret
 
     # Set the debuglink to have the view of the file path on the target
-    subprocess.call("'%s' --add-gnu-debuglink='%s' '%s'" % (objcopy, debugfile, file), shell=True)
+    cmd = "'%s' --add-gnu-debuglink='%s' '%s'" % (objcopy, debugfile, file)
+    ret = subprocess.call(cmd, shell=True)
+    if ret != 0:
+        bb.error("debugedit failed: %s - %d" % (cmd, ret))
+        return ret
 
     if newmode:
         os.chmod(file, origmode)
@@ -806,7 +818,9 @@ python split_and_strip_files () {
             bb.utils.mkdirhier(os.path.dirname(fpath))
             #bb.note("Split %s -> %s" % (file, fpath))
             # Only store off the hard link reference if we successfully split!
-            splitdebuginfo(file, fpath, debugsrcdir, d)
+            ret = splitdebuginfo(file, fpath, debugsrcdir, d)
+            if ret != 0:
+                return ret
 
         # Hardlink our debug symbols to the other hardlink copies
         for file in hardlinks:
@@ -878,6 +892,8 @@ python split_and_strip_files () {
     #
     # End of strip
     #
+
+    return 0
 }
 
 python populate_packages () {
-- 
1.8.1.2.545.g2f19ada





More information about the Openembedded-core mailing list