Patchwork package.bbclass: fix TypeError in runstrip

login
register
mail settings
Submitter Martin Jansa
Date July 31, 2012, 2 a.m.
Message ID <1343700001-15097-1-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/33365/
State Accepted
Commit a834ab8a6d53cae504fa112a89bab93d726539ec
Headers show

Comments

Martin Jansa - July 31, 2012, 2 a.m.
* 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>
---
 meta/classes/package.bbclass |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
Richard Purdie - July 31, 2012, 11:06 a.m.
On Tue, 2012-07-31 at 04:00 +0200, Martin Jansa wrote:
> * 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>
> ---
>  meta/classes/package.bbclass |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)

Merged to master, thanks.

Richard

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 6142911..3aaf999 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -291,12 +291,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)