about summary refs log tree commit diff
path: root/xq
blob: 29a1b48a8d299c08fb9532137511d5c01f8cc66d (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
25
26
27
#!/bin/sh
# xq PKGS... - query information about XBPS package

rmcol() {
	sed 's/\x1b\[[0-9;]*[mG]//g'
}

totop() {
	sed -n 's/^'"$1"'/&/p;tk;H;:k;${x;s/\n//;p};d'
}

BRANCH=$(git symbolic-ref -q --short HEAD 2>/dev/null)
ADDREPO="--repository=hostdir/binpkgs/$BRANCH
	--repository=../hostdir/binpkgs/$BRANCH
	--repository=../../hostdir/binpkgs/$BRANCH"

for pkg; do
	xbps-query $ADDREPO -S "$pkg" | rmcol |
		totop short_desc |
		totop pkgver
	xbps-query $ADDREPO -x "$pkg" | sed 's/^/	/;1s/^/depends:\n/'
	REVDEP=$(xbps-query -X "$pkg" | sed 's/^/	/' )
	if [ "$REVDEP" ]; then
		printf "%s\n" "required-by:" "$REVDEP"
	fi
done