From a7b8d1c512cc8b2cb98864f2fc124cb3336d809d Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Wed, 7 Oct 2015 19:46:35 -0700 Subject: package.bbclass: strip archive files For saving space and removing build path in .a files. [YOCTO #8457] Signed-off-by: Robert Yang --- meta/classes/package.bbclass | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 09230b5bb9..583848f5a7 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass @@ -870,12 +870,25 @@ python split_and_strip_files () { return type + def isArchive(path): + ret, result = oe.utils.getstatusoutput("file \"%s\"" % path.replace("\"", "\\\"")) + if ret: + msg = "split_and_strip_files: 'file %s' failed" % path + package_qa_handle_error("split-strip", msg, d) + return False + + if "current ar archive" in result: + return True + else: + return False + # # First lets figure out all of the files we may have to process ... do this only once! # elffiles = {} symlinks = {} kernmods = [] + archives = [] inodes = {} libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir", True)) baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir", True)) @@ -886,6 +899,9 @@ python split_and_strip_files () { if file.endswith(".ko") and file.find("/lib/modules/") != -1: kernmods.append(file) continue + if file.endswith('.a') and isArchive(file): + archives.append(file) + continue # Skip debug files if debugappend and file.endswith(debugappend): @@ -1019,7 +1035,7 @@ python split_and_strip_files () { elf_file = int(elffiles[file]) #bb.note("Strip %s" % file) sfiles.append((file, elf_file, strip)) - for f in kernmods: + for f in kernmods + archives: sfiles.append((f, 16, strip)) oe.utils.multiprocess_exec(sfiles, oe.package.runstrip) -- cgit 1.2.3-korg