Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] lib/package: cleanup objdump invocation when scanning for library dependencies
@ 2024-10-29 16:15 Ross Burton
  2024-10-30  9:38 ` [OE-core] " Mathieu Dubois-Briand
  0 siblings, 1 reply; 3+ messages in thread
From: Ross Burton @ 2024-10-29 16:15 UTC (permalink / raw)
  To: openembedded-core

Instead of using os.popen() directly, and passing a string then having
to quote the arguments, use subprocess.run() and pass a list of arguments.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oe/package.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 16359232ecd..f935b684de0 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -1625,11 +1625,11 @@ def process_shlibs(pkgfiles, d):
         sonames = set()
         renames = []
         ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
-        cmd = d.getVar('OBJDUMP') + " -p " + shlex.quote(file) + " 2>/dev/null"
-        fd = os.popen(cmd)
-        lines = fd.readlines()
-        fd.close()
         rpath = tuple()
+        cmd = [d.getVar("OBJDUMP"), "-p", file]
+        proc = subprocess.run(cmd, capture_output=True, text=True)
+        # Ignore errors silently as not all matching files will be parsed successfully
+        lines = proc.stdout.splitlines()
         for l in lines:
             m = re.match(r"\s+RPATH\s+([^\s]*)", l)
             if m:
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-31 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29 16:15 [PATCH] lib/package: cleanup objdump invocation when scanning for library dependencies Ross Burton
2024-10-30  9:38 ` [OE-core] " Mathieu Dubois-Briand
2024-10-31 12:47   ` Ross Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox