-
Notifications
You must be signed in to change notification settings - Fork 5
/
list-package-updates
executable file
·77 lines (68 loc) · 1.94 KB
/
list-package-updates
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
#!/bin/bash
set -e
usage () {
script=$(basename "$0")
echo "usage: $script [--bare] [-u|--upcoming] 3.X.Y [3.X.Z]"
echo " or: $script [--bare] [-u|--upcoming] --since 3.X.Y"
echo
echo " eg: $script 3.2.7 3.2.8 # compare two releases"
echo " or: $script 3.2.8 # implicitly compare to 3.2.7"
echo " or: $script --since 3.3.20 # compare to current release"
echo
echo "Lists packages updated from osg releases 3.X.Y to 3.X.Z"
echo "If only one osg release is listed, compare to the previous release."
echo "If --since is given, compare to current release (for data releases)."
echo
echo "Use --upcoming to list packages from osg-upcoming-release-3.X.Y repos."
echo "Use --bare to list 1 package per line, without wrapping in <pre> tags."
exit
}
dvers=(el7 el8)
list_tag () {
osg-koji list-tagged --latest --quiet --rpms "$1" | grep -v '\.src$' \
| grep -v '^GenericError: ' || :
}
tag_diff () {
fgrep -vxf <(list_tag "$1") <(list_tag "$2") || :
}
indent () {
echo -n ' '
xargs
}
FILTER=indent
UPCOMING=
SINCE=
while [[ $1 = -* ]]; do
case $1 in
--since ) SINCE=Y; shift;;
--bare ) FILTER=cat; shift;;
-u|--upcoming ) UPCOMING=-upcoming; shift;;
-* ) echo "Unsupported option: $1" >&2; usage ;;
esac
done
case $# in
1 ) [[ $1 =~ ^[3-9]\.[0-9]\.[0-9]+$ ]] || usage
ser1=${1%.*}
ser2=$ser1
rel=${1##*.}
if [[ $SINCE ]]; then
v1=$1
v2=
else
v1=$ser1.$((rel-1))
v2=$1
fi ;;
2 ) [[ ! $SINCE ]] || usage
[[ $1 =~ ^[3-9]\.[0-9]\.[0-9]+$ ]] || usage
[[ $2 =~ ^[3-9]\.[0-9]\.[0-9]+$ ]] || usage
ser1=${1%.*}
ser2=${2%.*}
v1=$1
v2=$2 ;;
* ) usage ;;
esac
for dver in ${dvers[@]}; do
tag1=osg-$ser1${UPCOMING}-$dver-release-$v1
tag2=osg-$ser2${UPCOMING}-$dver-release${v2:+-$v2}
tag_diff $tag1 $tag2
done | perl -lpe 's/(-[^-]+){2}$//' | sort -u | $FILTER