about summary refs log tree commit diff
path: root/xdbg
blob: cb8528776bea6124902ec3822238b274a9600198 (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
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# xdbg PKGS... - list debugging packages for PKGS and recursive dependencies

BRANCH=$(git symbolic-ref -q --short HEAD 2>/dev/null)
if [ -n "$XBPS_HOSTDIR" ]; then
	XBPS_BINPKGS="$XBPS_HOSTDIR/binpkgs"
else
	XBPS_DISTDIR="$(xdistdir 2>/dev/null)" || XBPS_DISTDIR=.
	XBPS_BINPKGS="$XBPS_DISTDIR/hostdir/binpkgs"
fi
ADDREPO="
	--repository=$XBPS_BINPKGS/$BRANCH
	--repository=$XBPS_BINPKGS/$BRANCH/nonfree
	--repository=$XBPS_BINPKGS/$BRANCH/multilib
	--repository=$XBPS_BINPKGS/$BRANCH/multilib/nonfree
	--repository=$XBPS_BINPKGS/$BRANCH/debug
	--repository=$XBPS_BINPKGS
	--repository=$XBPS_BINPKGS/nonfree
	--repository=$XBPS_BINPKGS/multilib
	--repository=$XBPS_BINPKGS/multilib/nonfree
	--repository=$XBPS_BINPKGS/debug
"

alldbg() {
	xbps-query --regex $ADDREPO -Rs '-dbg-[^-]*$' |
		sed 's/^... //; s/-[^- ]* .*//' |
		sort -u
}

depdbg() {
	for pkg; do
		printf "%s-0\n" "$pkg"
		xbps-query --fulldeptree $ADDREPO -x "$pkg"
	done | sed 's/-[^-]*$/-dbg/' | sort -u
}

comm -12 <(depdbg "$@") <(alldbg)