blob: 68bb6e17f3e963a83e34570b47a71be83aa708ca (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/bin/sh
# get reverse dependencies for a specific arch from
# the gentoo tinderbox and print the atoms
# (with USE-dep syntax) out, so your arch-testing tool
# can emerge them.
REPODIR="${HOME}/cvs/gentoo-x86"
BASE_URL="http://tinderbox.dev.gentoo.org/misc/dindex/"
if [[ $# -ne 2 ]]; then
echo "usage:"
echo " ${0} arch category/package"
echo
echo "Examples: ${0} arm media-gfx/graphviz"
exit 1
fi
arch="${1}"
pkg="${2}"
if [[ ! -d ${REPODIR} ]]; then
echo "your \${REPODIR}='${REPODIR}' does not exist."
exit 1
fi
if [[ ! -x $(which q) ]] ; then
echo "you need portage-utils"
echo "emerge app-portage/portage-utils"
exit 1
fi
if [[ $(egrep "\<${arch}\>" ${REPODIR}/profiles/arch.list | wc -l) == 0 ]]; then
echo "invalid arch ${arch}"
exit 1
fi
if [[ ! -d ${REPODIR}/${pkg} ]]; then
echo "invalid package ${pkg} - do not use a version-number"
fi
tmp="$(mktemp)"
wget -o /dev/null -O "${tmp}" "${BASE_URL}/${pkg}"
last_pn=""
# we sort it reverse, that we have the latest version in most cases the first and
# not print the "older ones". this has some room for improvement
for p in $(grep -v '^[B]' ${tmp} | sort -r); do
cpv="${p/:*/}"
use="${p/*:/}"
[[ ${use} == ${p} ]] && use=""
# negative use deps are !use and no -use
# multiple use-deps are separated by '+'
if [[ -n ${use} ]]; then
use="${use/!/-}"
use="${use/+/,}"
fi
# split up the category/package-version with q
declare -a qatom
qatom=($(qatom ${cpv}))
[[ ${qatom#} < 2 ]] && die "invalid atom ${cpv}"
category=${qatom[0]/=}
pn=${qatom[1]}
version=${qatom[2]}
revision=${qatom[3]}
[[ -n "${revision}" ]] && version="${version}-${revision}"
# make sure that the file exists, as the local or remote tree
# may be out of date
ebuild="${REPODIR}/${category}/${pn}/${pn}-${version}.ebuild"
if [[ -e ${ebuild} && $(egrep -H "KEYWORDS=.*( |\")\<${arch}\>" \
${ebuild} | wc -l) == 1 ]]; then
if [[ ${last_pn} != ${category}/${pn} ]]; then
[[ -z ${use} ]] && echo "=${cpv}" || echo "=${cpv}[${use}]"
fi
fi
last_pn="${category}/${pn}"
done
rm "${tmp}"
|