about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README1
-rw-r--r--_xtools3
-rwxr-xr-xxrevshlib14
3 files changed, 17 insertions, 1 deletions
diff --git a/README b/README
index 9d36263..7fe9327 100644
--- a/README
+++ b/README
@@ -34,6 +34,7 @@ https://github.com/voidlinux/xbps
   xq [-R] PKGS... - query information about XBPS package
   xrecent [REPOURL|XBPS_ARCH] - list packages in repo ordered by build date
   xrevbump MESSAGE TEMPLATES... - increase template revision and commit
+  xrevshlib PACKAGE - list packages shlib-dependent on PACKAGE or its subpkgs
   xrs PATTERN - like xbps-query -Rs, but take cwd repo into account
   xsrc PKG - list source files for XBPS template
   xsubpkg [-m] PKG - lists all subpackages of a package
diff --git a/_xtools b/_xtools
index 4c04c58..934cae0 100644
--- a/_xtools
+++ b/_xtools
@@ -1,4 +1,4 @@
-#compdef xbulk xbump xcheckrestart xdiff xdbg xdowngrade xgensum xgrep xlg xlog xlocate xls xmindep xmypkgs xnew xoptdiff xpkg xq xrecent xrevbump xsrc
+#compdef xbulk xbump xcheckrestart xdiff xdbg xdowngrade xgensum xgrep xlg xlog xlocate xls xmindep xmypkgs xnew xoptdiff xpkg xq xrecent xrevbump xrevshlib xsrc
 
 _xbps  # force autoload
 
@@ -139,6 +139,7 @@ _xtools() {
 		xq) _xq "$@";;
 		xrecent) _xrecent "$@";;
 		xrevbump) _xrevbump "$@";;
+		xrevshlib) _xtools_one_template "$@";;
 		xsrc) _xtool_one_template "$@";;
 		xsubpkg) _xsubpkg "$@";;
 	esac
diff --git a/xrevshlib b/xrevshlib
new file mode 100755
index 0000000..c533868
--- /dev/null
+++ b/xrevshlib
@@ -0,0 +1,14 @@
+#!/bin/sh
+# xrevshlib PACKAGE - list packages shlib-dependent on PACKAGE or its subpkgs
+
+pkg="${1?no package name given}"
+
+xsubpkg "$pkg" |
+	xargs -d'\n' -n1 -r xbps-query -R -p shlib-provides -S |
+	sed 's/\.so.*//' |
+	xargs -d'\n' -n1 -r xbps-query -R -p shlib-requires -s |
+	sed 's/-[^- ]*: .*//' |
+	sort -u |
+	xargs -d'\n' -n1 -r xsubpkg -m |
+	sort -u |
+	grep -Fvx "$(xsubpkg -m $pkg)"