aboutsummaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-01-16 13:37:54 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-17 16:36:22 +0000
commit8f7fdab41b8d6aced6753920bb5deed147c9baa8 (patch)
treea3f904b0c9e718641b4f52f81931e32b492626c6 /meta
parent7b1896f6f5367010b54c6a8b300db84037734533 (diff)
downloadopenembedded-core-contrib-8f7fdab41b8d6aced6753920bb5deed147c9baa8.tar.gz
classes/debian: clean up process spawning
This code is old and was of it's time, rewrite it to use modernish (we support Python 3.4, so can't use subprocess.run()) subprocess and re idioms instead. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/debian.bbclass19
1 files changed, 9 insertions, 10 deletions
diff --git a/meta/classes/debian.bbclass b/meta/classes/debian.bbclass
index edc6da1ba3..989ea8f8d2 100644
--- a/meta/classes/debian.bbclass
+++ b/meta/classes/debian.bbclass
@@ -25,7 +25,7 @@ python () {
}
python debian_package_name_hook () {
- import glob, copy, stat, errno, re, pathlib
+ import glob, copy, stat, errno, re, pathlib, subprocess
pkgdest = d.getVar("PKGDEST")
packages = d.getVar('PACKAGES')
@@ -76,15 +76,14 @@ python debian_package_name_hook () {
if path in libdirs:
has_libs = 1
if so_re.match(os.path.basename(f)):
- cmd = (d.getVar('TARGET_PREFIX') or "") + "objdump -p " + f + " 2>/dev/null"
- fd = os.popen(cmd)
- lines = fd.readlines()
- fd.close()
- for l in lines:
- m = re.match("\s+SONAME\s+([^\s]*)", l)
- if m and not m.group(1) in sonames:
- sonames.append(m.group(1))
-
+ try:
+ cmd = [d.expand("${TARGET_PREFIX}objdump"), "-p", f]
+ output = subprocess.check_output(cmd).decode("utf-8")
+ for m in re.finditer("\s+SONAME\s+([^\s]+)", output):
+ if m.group(1) not in sonames:
+ sonames.append(m.group(1))
+ except subprocess.CalledProcessError:
+ pass
bb.debug(1, 'LIBNAMES: pkg %s libs %d bins %d sonames %s' % (orig_pkg, has_libs, has_bins, sonames))
soname = None
if len(sonames) == 1: