blob: 8947dbfdf8128984a657846c3a938147f997859f (
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
|
#!/bin/bash
IsArchRepo()
{
local repo=$1 ; [[ "$repo" =~ ^(community|core|extra|multilib|testing)$ ]]
}
ListParabolaDependents()
{
readonly BE_VERBOSE=$( [[ "$1" == '-v' ]] && echo 1 || echo 0 ) ; (( $BE_VERBOSE )) && shift ;
readonly DEP_PKG=$1
readonly CFG_FILE=/etc/pacman-all.conf
readonly CFG="--config=$CFG_FILE"
read -r -d '' USAGE <<-'USAGE_MSG'
USAGE:
parabola-dependents [ -v ] <PACKAGE_NAME>
list all parabola packages which are dependents of a specified package
by default, only first-order dependents are listed, with counts of higher-order dependents
verbose mode (-v) will itemize all higher-order dependents
USAGE_MSG
[[ -z "$DEP_PKG" ]] && echo -e "no dependency package specified\n\n$USAGE" && return 1
[[ ! -f "$CFG_FILE" ]] && echo "can not find pacman config: $CFG_FILE" && return 1
sudo pacman $CFG -Sy ; echo -e "\nsearching ...\n\n" ;
local dependency_chain pkg repos repo
while read dependency_chain
do pkg=$(sed 's|.*<- ||' <<<$dependency_chain)
repos=$(pacman $CFG -Si $pkg | grep Repository | cut -d ':' -f 2)
for repo in $repos
do IsArchRepo $repo && echo "$repo skip $pkg" && continue
echo "$repo/$pkg $( (( $BE_VERBOSE )) && echo "[ $dependency_chain ]" )"
done
done < <(/usr/bin/pactree $CFG --sync --reverse --unique --chain $DEP_PKG) | sort
}
ListParabolaDependents $@ || exit 1
|