diff options
Diffstat (limited to 'gentoo-scripts/grabrdeps.sh')
-rw-r--r-- | gentoo-scripts/grabrdeps.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gentoo-scripts/grabrdeps.sh b/gentoo-scripts/grabrdeps.sh new file mode 100644 index 0000000..332b6c1 --- /dev/null +++ b/gentoo-scripts/grabrdeps.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +x="$1" + +cd ~ +if [ "${x/\// }" == "${x}" ]; then + wget -q -O ~/rindex.cache http://tinderbox.x86.dev.gentoo.org/misc/rindex/.rindex + x=$(grep /${x}$ ~/rindex.cache) + x=$(echo -n ${x} |tr '\n' ' ') + if [ "${x/ /}" != "${x}" ]; then + echo "ambiguous short name $1. Please specify one of the following fully-qualified ebuild names instead: $(echo $x | tr '\n' ' ')" + exit 1 + fi + [[ $x == "" ]] && exit 1 +fi + +foo=$(wget -q -O - http://tinderbox.x86.dev.gentoo.org/misc/rindex/$x) +if [[ $foo != "" ]]; then + for pkg in ${foo}; do + cpv=${pkg%:*} + use=${pkg/"${cpv}"} + result=${result:+${result}$'\n'}$(qatom -C ${cpv} | cut -f 1-2 -d " " --output-delimiter "/" | tr -d "\n")${use} + done + echo $x '<-' $(sort -u <<< "${result}" | tr "\n" " ") + exit $? +fi +exit 0 |