Skip to content

Instantly share code, notes, and snippets.

Created March 18, 2018 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f78ca1b5ce78ca2a9d973fa22fc4c1c3 to your computer and use it in GitHub Desktop.
Save anonymous/f78ca1b5ce78ca2a9d973fa22fc4c1c3 to your computer and use it in GitHub Desktop.
diff --git a/find-deps.py b/find-deps.py
index d6761f0..111ed48 100755
--- a/find-deps.py
+++ b/find-deps.py
@@ -24,10 +24,9 @@ def subprocess_get_lines(args, fail_okay=False):
return output.decode().splitlines()
# Get the filenames of the libs we need
-del os.environ['LD_LIBRARY_PATH'], os.environ['LD_PRELOAD'] # otherwise fakeroot will interfere
-ldd_output = subprocess_get_lines(['ldd'] + sys.argv[1:])
-regex = re.compile(r' => (.*) \(0x[0-9a-f]+\)$')
-libs = set(match.group(1) for match in map(regex.search, ldd_output) if match)
+readelf_output = subprocess_get_lines(['readelf', '-d'] + sys.argv[1:])
+regex = re.compile(r'Shared library: \[(.*)\]$')
+libs = set("/usr/lib/" + match.group(1) for match in map(regex.search, readelf_output) if match)
# Figure out which packages own them
deps = set(subprocess_get_lines(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment