summaryrefslogtreecommitdiff
path: root/meta/lib/oe/package.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-01 15:03:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-06 13:11:20 +0000
commit981fed49ee80560fb067b3f47aeada1fdee792ca (patch)
treebfb80b96a66cf55225d59c6f7f45c6afda45065e /meta/lib/oe/package.py
parent060f617cea4ea0a5af28d31ea19c0387e9773fce (diff)
downloadopenembedded-core-981fed49ee80560fb067b3f47aeada1fdee792ca.tar.gz
openembedded-core-981fed49ee80560fb067b3f47aeada1fdee792ca.tar.bz2
openembedded-core-981fed49ee80560fb067b3f47aeada1fdee792ca.zip
package: Process package stripping in parallel
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package.py')
-rw-r--r--meta/lib/oe/package.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 6b1c1f48ce..9a0ddb8536 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -1,3 +1,48 @@
+def runstrip(arg):
+ # Function to strip a single file, called from split_and_strip_files below
+ # A working 'file' (one which works on the target architecture)
+ #
+ # The elftype is a bit pattern (explained in split_and_strip_files) to tell
+ # us what type of file we're processing...
+ # 4 - executable
+ # 8 - shared library
+ # 16 - kernel module
+
+ import commands, stat, subprocess
+
+ (file, elftype, strip) = arg
+
+ newmode = None
+ if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
+ origmode = os.stat(file)[stat.ST_MODE]
+ newmode = origmode | stat.S_IWRITE | stat.S_IREAD
+ os.chmod(file, newmode)
+
+ extraflags = ""
+
+ # kernel module
+ if elftype & 16:
+ extraflags = "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
+ # .so and shared library
+ elif ".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)
+
+ ret = subprocess.call(stripcmd, shell=True)
+
+ if newmode:
+ os.chmod(file, origmode)
+
+ if ret:
+ bb.error("runstrip: '%s' strip command failed" % stripcmd)
+
+ return
+
def file_translate(file):
ft = file.replace("@", "@at@")