]> code.ossystems Code Review - openembedded-core.git/commitdiff
package.bbclass: fix TypeError in runstrip
authorMartin Jansa <martin.jansa@gmail.com>
Tue, 31 Jul 2012 02:00:01 +0000 (04:00 +0200)
committerScott Garman <scott.a.garman@intel.com>
Mon, 24 Sep 2012 16:51:09 +0000 (09:51 -0700)
* some packages have .ko files which are not elf, without this change
  it fails with TypeError, with this change only runstip fails and
  reports where:
  ERROR: runstrip: ''arm-oe-linux-gnueabi-strip'  '/OE/shr-core/tmp-eglibc/work/armv4t-oe-linux-gnueabi/emacs-23.4-r0/package/usr/share/emacs/23.4/etc/tutorials/TUTORIAL.ko'' strip command failed

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/package.bbclass

index 44e551f6dd5a8400304f5eacae8a8c1846b6b72d..c03e5be028af993d1f0378157db8786071719c9f 100644 (file)
@@ -298,12 +298,16 @@ def runstrip(file, elftype, d):
         os.chmod(file, newmode)
 
     extraflags = ""
-    # .so and shared library
-    if ".so" in file and elftype & 8:
-        extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded"
-    # shared or executable:
-    elif elftype & 8 or elftype & 4:
-        extraflags = "--remove-section=.comment --remove-section=.note"
+    
+    # split_and_strip_files is calling this with elf_type None, causing:
+    # TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
+    if elftype:
+        # .so and shared library
+        if ".so" in file and elftype & 8:
+            extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded"
+        # shared or executable:
+        elif elftype & 8 or elftype & 4:
+            extraflags = "--remove-section=.comment --remove-section=.note"
 
     stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
     bb.debug(1, "runstrip: %s" % stripcmd)