about summary refs log tree commit diff
path: root/xoptdiff
blob: cfee63d4ab9d2b5d71ad7a358a843abc996e23a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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 [ $# -eq 0 ]; then
	xbps-query -p build-options -s '' | sed 's/^\([^ ]*\)-.*/\1/'
else
	printf '%s\n' "$@"
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  \
			      --repository=$(xbps-query -p repository $pkg) \
			      -p build-options $pkg | tr ' ' '\n' | sort) |
		tr '\n' ' ' | sed -n "s/^[^ ].*/$pkg$q\n/p"
done