summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/chrpath.bbclass20
-rw-r--r--meta/lib/oe/qa.py4
2 files changed, 12 insertions, 12 deletions
diff --git a/meta/classes/chrpath.bbclass b/meta/classes/chrpath.bbclass
index 67b197ec22..26b984c4db 100644
--- a/meta/classes/chrpath.bbclass
+++ b/meta/classes/chrpath.bbclass
@@ -2,7 +2,7 @@ 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, oe.qa 5 import subprocess, oe.qa
6 6
7 with oe.qa.ELFFile(fpath) as elf: 7 with oe.qa.ELFFile(fpath) as elf:
8 try: 8 try:
@@ -10,14 +10,11 @@ def process_file_linux(cmd, fpath, rootdir, baseprefix, tmpdir, d, break_hardlin
10 except oe.qa.NotELFFileError: 10 except oe.qa.NotELFFileError:
11 return 11 return
12 12
13 p = sub.Popen([cmd, '-l', fpath],stdout=sub.PIPE,stderr=sub.PIPE) 13 try:
14 out, err = p.communicate() 14 out = subprocess.check_output([cmd, "-l", fpath], universal_newlines=True)
15 # If returned successfully, process stdout for results 15 except subprocess.CalledProcessError:
16 if p.returncode != 0:
17 return 16 return
18 17
19 out = out.decode('utf-8')
20
21 # Handle RUNPATH as well as RPATH 18 # Handle RUNPATH as well as RPATH
22 out = out.replace("RUNPATH=","RPATH=") 19 out = out.replace("RUNPATH=","RPATH=")
23 # Throw away everything other than the rpath list 20 # Throw away everything other than the rpath list
@@ -50,10 +47,11 @@ def process_file_linux(cmd, fpath, rootdir, baseprefix, tmpdir, d, break_hardlin
50 47
51 args = ":".join(new_rpaths) 48 args = ":".join(new_rpaths)
52 #bb.note("Setting rpath for %s to %s" %(fpath, args)) 49 #bb.note("Setting rpath for %s to %s" %(fpath, args))
53 p = sub.Popen([cmd, '-r', args, fpath],stdout=sub.PIPE,stderr=sub.PIPE) 50 try:
54 out, err = p.communicate() 51 subprocess.check_output([cmd, "-r", args, fpath],
55 if p.returncode != 0: 52 stderr=subprocess.PIPE, universal_newlines=True)
56 bb.fatal("%s: chrpath command failed with exit code %d:\n%s%s" % (d.getVar('PN'), p.returncode, out, err)) 53 except subprocess.CalledProcessError as e:
54 bb.fatal("chrpath command failed with exit code %d:\n%s\n%s" % (e.returncode, e.stdout, e.stderr))
57 55
58def process_file_darwin(cmd, fpath, rootdir, baseprefix, tmpdir, d, break_hardlinks = False): 56def process_file_darwin(cmd, fpath, rootdir, baseprefix, tmpdir, d, break_hardlinks = False):
59 import subprocess as sub 57 import subprocess as sub
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index 21066c4dc3..ea831b930a 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -41,13 +41,15 @@ class ELFFile:
41 def __init__(self, name): 41 def __init__(self, name):
42 self.name = name 42 self.name = name
43 self.objdump_output = {} 43 self.objdump_output = {}
44 self.data = None
44 45
45 # Context Manager functions to close the mmap explicitly 46 # Context Manager functions to close the mmap explicitly
46 def __enter__(self): 47 def __enter__(self):
47 return self 48 return self
48 49
49 def __exit__(self, exc_type, exc_value, traceback): 50 def __exit__(self, exc_type, exc_value, traceback):
50 self.data.close() 51 if self.data:
52 self.data.close()
51 53
52 def open(self): 54 def open(self):
53 with open(self.name, "rb") as f: 55 with open(self.name, "rb") as f: