summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2019-12-12 13:13:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-28 23:25:41 +0000
commit7785c41d0b95d084bec716166393d2a3323692dd (patch)
tree98e7598c8df724d4864b03c2762869652508d9e3
parent8b1eb782c32d8ce31e8f033ef3197e4be76bfc84 (diff)
downloadpoky-7785c41d0b95d084bec716166393d2a3323692dd.tar.gz
chrpath: do less work
Instead of trying to change the RPATH in every file under the binary directories, check that the file is an ELF first. This means that we don't attempt to change the RPATH on the entire Python standard library, for example. Also return early if the directory to iterate doesn't exist. (From OE-Core rev: 977f4baacf7c8d06d9cfe5c5e39bb8bc19f27028) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/chrpath.bbclass16
1 files changed, 11 insertions, 5 deletions
diff --git a/meta/classes/chrpath.bbclass b/meta/classes/chrpath.bbclass
index 2870c10d51..67b197ec22 100644
--- a/meta/classes/chrpath.bbclass
+++ b/meta/classes/chrpath.bbclass
@@ -2,7 +2,13 @@ CHRPATH_BIN ?= "chrpath"
2PREPROCESS_RELOCATE_DIRS ?= "" 2PREPROCESS_RELOCATE_DIRS ?= ""
3 3
4def process_file_linux(cmd, fpath, rootdir, baseprefix, tmpdir, d, break_hardlinks = False): 4def process_file_linux(cmd, fpath, rootdir, baseprefix, tmpdir, d, break_hardlinks = False):
5 import subprocess as sub 5 import subprocess as sub, oe.qa
6
7 with oe.qa.ELFFile(fpath) as elf:
8 try:
9 elf.open()
10 except oe.qa.NotELFFileError:
11 return
6 12
7 p = sub.Popen([cmd, '-l', fpath],stdout=sub.PIPE,stderr=sub.PIPE) 13 p = sub.Popen([cmd, '-l', fpath],stdout=sub.PIPE,stderr=sub.PIPE)
8 out, err = p.communicate() 14 out, err = p.communicate()
@@ -72,6 +78,10 @@ def process_file_darwin(cmd, fpath, rootdir, baseprefix, tmpdir, d, break_hardli
72 out, err = p.communicate() 78 out, err = p.communicate()
73 79
74def process_dir(rootdir, directory, d, break_hardlinks = False): 80def process_dir(rootdir, directory, d, break_hardlinks = False):
81 bb.debug(2, "Checking %s for binaries to process" % directory)
82 if not os.path.exists(directory):
83 return
84
75 import stat 85 import stat
76 86
77 rootdir = os.path.normpath(rootdir) 87 rootdir = os.path.normpath(rootdir)
@@ -80,10 +90,6 @@ def process_dir(rootdir, directory, d, break_hardlinks = False):
80 baseprefix = os.path.normpath(d.expand('${base_prefix}')) 90 baseprefix = os.path.normpath(d.expand('${base_prefix}'))
81 hostos = d.getVar("HOST_OS") 91 hostos = d.getVar("HOST_OS")
82 92
83 #bb.debug("Checking %s for binaries to process" % directory)
84 if not os.path.exists(directory):
85 return
86
87 if "linux" in hostos: 93 if "linux" in hostos:
88 process_file = process_file_linux 94 process_file = process_file_linux
89 elif "darwin" in hostos: 95 elif "darwin" in hostos: