diff options
author | Ross Burton <ross.burton@intel.com> | 2018-01-16 13:37:54 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-01-18 12:50:36 +0000 |
commit | e23298ca85c5058293d2089a3048bedf01e5e8d4 (patch) | |
tree | 7306b4cb478c741cb4c2d6cf205c9f4500a9b366 /meta | |
parent | eaf2636f6ce518f983e3007612c61c410fd74195 (diff) | |
download | poky-e23298ca85c5058293d2089a3048bedf01e5e8d4.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.
(From OE-Core rev: 8f7fdab41b8d6aced6753920bb5deed147c9baa8)
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.bbclass | 19 |
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 () { | |||
25 | } | 25 | } |
26 | 26 | ||
27 | python debian_package_name_hook () { | 27 | python debian_package_name_hook () { |
28 | import glob, copy, stat, errno, re, pathlib | 28 | import glob, copy, stat, errno, re, pathlib, subprocess |
29 | 29 | ||
30 | pkgdest = d.getVar("PKGDEST") | 30 | pkgdest = d.getVar("PKGDEST") |
31 | packages = d.getVar('PACKAGES') | 31 | packages = d.getVar('PACKAGES') |
@@ -76,15 +76,14 @@ python debian_package_name_hook () { | |||
76 | if path in libdirs: | 76 | if path in libdirs: |
77 | has_libs = 1 | 77 | has_libs = 1 |
78 | if so_re.match(os.path.basename(f)): | 78 | if so_re.match(os.path.basename(f)): |
79 | cmd = (d.getVar('TARGET_PREFIX') or "") + "objdump -p " + f + " 2>/dev/null" | 79 | try: |
80 | fd = os.popen(cmd) | 80 | cmd = [d.expand("${TARGET_PREFIX}objdump"), "-p", f] |
81 | lines = fd.readlines() | 81 | output = subprocess.check_output(cmd).decode("utf-8") |
82 | fd.close() | 82 | for m in re.finditer("\s+SONAME\s+([^\s]+)", output): |
83 | for l in lines: | 83 | if m.group(1) not in sonames: |
84 | m = re.match("\s+SONAME\s+([^\s]*)", l) | 84 | sonames.append(m.group(1)) |
85 | if m and not m.group(1) in sonames: | 85 | except subprocess.CalledProcessError: |
86 | sonames.append(m.group(1)) | 86 | pass |
87 | |||
88 | bb.debug(1, 'LIBNAMES: pkg %s libs %d bins %d sonames %s' % (orig_pkg, has_libs, has_bins, sonames)) | 87 | bb.debug(1, 'LIBNAMES: pkg %s libs %d bins %d sonames %s' % (orig_pkg, has_libs, has_bins, sonames)) |
89 | soname = None | 88 | soname = None |
90 | if len(sonames) == 1: | 89 | if len(sonames) == 1: |