-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlist-buildroot
More file actions
executable file
·47 lines (38 loc) · 964 Bytes
/
list-buildroot
File metadata and controls
executable file
·47 lines (38 loc) · 964 Bytes
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
#!/bin/bash
set -e
usage () {
echo "usage: $(basename "$0") NVR [arch] # build NVR + target arch"
echo " or: $(basename "$0") NVR.arch # target binary NVRA"
echo
echo "List the packages installed in a koji buildroot for a given build"
echo "or binary rpm."
exit
}
[[ $1 = [^-]*-[^-]*-[^-]* ]] || usage
NVR=$1
ARCH=$2
get_1st_nvra () {
osg-koji buildinfo "$NVR" |
sed -n 's/\.rpm$//; /^RPMs:$/,$p' |
awk -F/ '{print $NF}' |
egrep -m1 "\.($1)$"
}
if [[ $ARCH ]]; then
NVRA=$(get_1st_nvra "$ARCH")
else
case $NVR in
*.x86_64 | *.i[3-6]86 | *.noarch | .src ) NVRA=$NVR ;;
* ) NVRA=$(get_1st_nvra 'noarch|x86_64') ;;
esac
ARCH=${NVRA##*.}
fi
case $ARCH in
x86_64 | i[3-6]86 | noarch | src ) ;; # OK
* ) usage ;;
esac
BUILDROOT=$(
osg-koji rpminfo "$NVRA" |
awk '$1 == "Buildroot:" {print $2}
/No such rpm:/ {print >"/dev/stderr"; exit 1}'
)
osg-koji list-buildroot "$BUILDROOT"