summarylogtreecommitdiffstats
path: root/find-deps.py
diff options
context:
space:
mode:
authorSolomon Choina2020-05-16 21:29:39 -0400
committerSolomon Choina2020-05-16 21:29:39 -0400
commit18596f034c5a652ce7126b8928b0d72caea18793 (patch)
tree6a67e538d17eec61f3a2046e45a00cb5c1fa74e0 /find-deps.py
parentee52beedfccc270507e2d050a052f792df2307c2 (diff)
downloadaur-18596f034c5a652ce7126b8928b0d72caea18793.tar.gz
updpkgver, using shellharden, basing it off mpv-full-git
Diffstat (limited to 'find-deps.py')
-rwxr-xr-xfind-deps.py48
1 files changed, 0 insertions, 48 deletions
diff --git a/find-deps.py b/find-deps.py
deleted file mode 100755
index d6761f0a40f..00000000000
--- a/find-deps.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python3
-
-"""
-Usage: find-deps.py <binary> [<binary> ...]
-
-Finds (pacman/ALPM) dependencies for a binary or set of binaries based
-on dynamically linked libraries.
-
-"""
-
-import sys
-import os
-import subprocess
-import re
-
-def subprocess_get_lines(args, fail_okay=False):
- try:
- output = subprocess.check_output(args)
- except subprocess.CalledProcessError as e:
- if fail_okay:
- output = e.output
- else:
- raise
- 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)
-
-# Figure out which packages own them
-deps = set(subprocess_get_lines(
- ['pacman', '--query', '--owns', '--quiet'] + list(libs),
- fail_okay=True
-))
-
-# Remove redundant dependencies
-needed = set(deps)
-for pkg in deps:
- if pkg not in needed:
- continue # this subtree has already been pruned
- redundant = subprocess_get_lines(
- ['pactree', '--unique', pkg]
- )[1:] # first line is pkg itself
- needed.difference_update(redundant)
-
-print(' '.join(sorted(needed)))