summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass40
1 files changed, 4 insertions, 36 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 94e4639a11..f121acccab 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -936,38 +936,6 @@ python split_and_strip_files () {
936 sourcefile = d.expand("${WORKDIR}/debugsources.list") 936 sourcefile = d.expand("${WORKDIR}/debugsources.list")
937 bb.utils.remove(sourcefile) 937 bb.utils.remove(sourcefile)
938 938
939 # Return type (bits):
940 # 0 - not elf
941 # 1 - ELF
942 # 2 - stripped
943 # 4 - executable
944 # 8 - shared library
945 # 16 - kernel module
946 def isELF(path):
947 type = 0
948 result = subprocess.check_output(["file", "-b", path], stderr=subprocess.STDOUT).decode("utf-8")
949
950 # Not stripped
951 if "ELF" in result:
952 type |= 1
953 if "not stripped" not in result:
954 type |= 2
955 if "executable" in result:
956 type |= 4
957 if "shared" in result:
958 type |= 8
959 return type
960
961 def isStaticLib(path):
962 if path.endswith('.a') and not os.path.islink(path):
963 with open(path, 'rb') as fh:
964 # The magic must include the first slash to avoid
965 # matching golang static libraries
966 magic = b'!<arch>\x0a/'
967 start = fh.read(len(magic))
968 return start == magic
969 return False
970
971 # 939 #
972 # First lets figure out all of the files we may have to process ... do this only once! 940 # First lets figure out all of the files we may have to process ... do this only once!
973 # 941 #
@@ -987,7 +955,7 @@ python split_and_strip_files () {
987 if file.endswith(".ko") and file.find("/lib/modules/") != -1: 955 if file.endswith(".ko") and file.find("/lib/modules/") != -1:
988 kernmods.append(file) 956 kernmods.append(file)
989 continue 957 continue
990 if isStaticLib(file): 958 if oe.package.is_static_lib(file):
991 staticlibs.append(file) 959 staticlibs.append(file)
992 continue 960 continue
993 961
@@ -1017,14 +985,14 @@ python split_and_strip_files () {
1017 # If it's a symlink, and points to an ELF file, we capture the readlink target 985 # If it's a symlink, and points to an ELF file, we capture the readlink target
1018 if cpath.islink(file): 986 if cpath.islink(file):
1019 target = os.readlink(file) 987 target = os.readlink(file)
1020 if isELF(ltarget): 988 if oe.package.is_elf(ltarget):
1021 #bb.note("Sym: %s (%d)" % (ltarget, isELF(ltarget))) 989 #bb.note("Sym: %s (%d)" % (ltarget, oe.package.is_elf(ltarget)))
1022 symlinks[file] = target 990 symlinks[file] = target
1023 continue 991 continue
1024 992
1025 # It's a file (or hardlink), not a link 993 # It's a file (or hardlink), not a link
1026 # ...but is it ELF, and is it already stripped? 994 # ...but is it ELF, and is it already stripped?
1027 elf_file = isELF(file) 995 elf_file = oe.package.is_elf(file)
1028 if elf_file & 1: 996 if elf_file & 1:
1029 if elf_file & 2: 997 if elf_file & 2:
1030 if 'already-stripped' in (d.getVar('INSANE_SKIP_' + pn) or "").split(): 998 if 'already-stripped' in (d.getVar('INSANE_SKIP_' + pn) or "").split():