#!/bin/sh
# print revdeps of packages specified on command-line

fetch() {
	if [ -d /tmp/${1}index ]; then
		cat /tmp/${1}index/${pkg}
	else
		wget -q -O - https://qa-reports.gentoo.org/output/genrdeps/${1}index/${pkg}
	fi
}

for pkg; do
	echo "== rdep of ${pkg} ==" >&2
	fetch r
	echo "== ddep of ${pkg} ==" >&2
	fetch d
	echo "== bdep of ${pkg} ==" >&2
	fetch b
	echo "== pdep of ${pkg} ==" >&2
	fetch p
done
