about summary refs log tree commit diff
path: root/xoptdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2014-09-15 00:29:34 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2014-09-15 00:29:34 +0200
commite43c8cd8fd278e67cd9f316a8ddf80aad236bdf1 (patch)
tree852f9414282e6e7b809c2216f05feae630e7fa1a /xoptdiff
parentc457ffe6df1f8defaef4a8514d7fdab3f7ebfe92 (diff)
downloadxtools-e43c8cd8fd278e67cd9f316a8ddf80aad236bdf1.tar.gz
xtools-e43c8cd8fd278e67cd9f316a8ddf80aad236bdf1.tar.xz
xtools-e43c8cd8fd278e67cd9f316a8ddf80aad236bdf1.zip
add xoptdiff
Diffstat (limited to 'xoptdiff')
-rwxr-xr-xxoptdiff22
1 files changed, 22 insertions, 0 deletions
diff --git a/xoptdiff b/xoptdiff
new file mode 100755
index 0000000..205f433
--- /dev/null
+++ b/xoptdiff
@@ -0,0 +1,22 @@
+#!/bin/bash
+# xoptdiff [-q] [PKGS...] - show template options which differ from binary package
+
+# Defaults to list of installed packages with options.
+
+q="\t&"
+if [ "$1" = -q ]; then
+	shift
+	q=
+fi
+
+if [ $# = 0 ]; then
+	xbps-query -p build-options -s '' | sed 's/^\([^ ]*\)-.*/\1/'
+else
+	echo "$@"
+fi | while read pkg; do
+	comm -23 <(./xbps-src show-options $pkg 2>/dev/null |
+			sed -n '/\(ON\)/s/ *\([^ ]*\):.*/\1/p;
+			        /\(OFF\)/s/ *\([^ ]*\):.*/~\1/p;' | sort) \
+		 <(xbps-query -R -p build-options $pkg | tr ' ' '\n' | sort) |
+		tr '\n' ' ' | sed -n "s/^[^ ].*/$pkg$q\n/p"
+done