-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuilt-against-pkgs
executable file
·85 lines (71 loc) · 2.09 KB
/
built-against-pkgs
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
80
81
82
83
84
#!/bin/bash
usage () {
echo "usage: $(basename "$0") [-h|-t] build... {-b|-s} package..."
echo
echo "List versions of specified package(s) used for each build."
echo "Builds and package names can contain wildcards. If a specified build"
echo "is not an exact match in koji, .osg* will be appended."
echo
echo "Options:"
echo " -h include JIRA header"
echo " -t plain text output instead of JIRA table format"
echo " -s package list refers to src pkg names (osg's packages only)"
echo " -b package list refers to bin pkg names (can include non-osg)"
echo
echo "Examples:"
echo " $(basename "$0") htcondor-ce-1.19-1 -s condor"
echo " $(basename "$0") htcondor-ce-1.19-1.osg{32,33}.el{5,6,7} -s condor"
echo " $(basename "$0") blahp-1.18.15.bosco-3.osg33.el{6,7} -b condor\\*"
echo " $(basename "$0") blahp-1.18.15.bosco-3.osg33.el6 -b condor-classads"
echo " $(basename "$0") bestman2-2.3.0-27 -b jglobus privilege-xacml"
exit
}
# want list-buildroot in path
absdir=$(dirname "$(readlink -f "$0")")
PATH=$absdir:$PATH
TBL=jirafy
while [[ $1 = -* ]]; do
case $1 in
-t ) TBL=simple ;;
-h ) HDR=Y ;;
* ) usage ;;
esac
shift
done
builds=()
while [[ $1 && $1 != -* ]]; do
builds+=("$1")
shift
done
case $1 in
-b ) B2S=cat ;;
-s ) B2S=nvras2pkgs ;;
* ) usage ;;
esac
shift
[[ $1 ]] || usage
ngrep () {
vr='(-[^-]+){2}$'
set -- "${@//\*/.*}"
set -- "${@//\?/.}"
set -- "${@/%/$vr}"
set -- "${@/#/-e}"
egrep "$@"
}
nvras2pkgs () {
xargs -r osg-koji rpminfo | awk '$1 == "SRPM:" {print $2}' | sort -u
}
jirafy () { awk '{print "| " B " | " $1 " |"}' B="$build"; }
simple () { awk '{print B, $1}' B="$build"; }
# resolve build globs to actual builds
builds_ex=
for build in "${builds[@]}"; do
build_ex=$(osg-koji search build "$build")
[[ $build_ex ]] || build_ex=$(osg-koji search build "$build.osg*")
builds_ex+=" $build_ex"
done
builds_ex=$(echo $builds_ex | xargs -n1 | sort)
[[ $HDR = Y ]] && echo "|| Build || Built Against ||"
for build in $builds_ex; do
list-buildroot "$build" | $B2S | ngrep "$@" | $TBL
done