-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
commit-testing-to-current.sh
executable file
·74 lines (65 loc) · 2.03 KB
/
commit-testing-to-current.sh
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
#!/bin/sh
set -eu
if ! { [ $# -eq 3 ] && [ -n "$1" ]; }; then
echo "Usage: $0 <path-to-current-testing-repo-snapshot> \"<component list>\" <release-name>"
exit 1
fi
if [ -n "$3" ]; then
RELS_TO_UPDATE=`basename "$3"`
fi
MIN_AGE=7
#DRY=echo
repo_snapshot_dir="$1"
components="$2"
touch -t `date -d "$MIN_AGE days ago" +%Y%m%d%H%M` age-compare-file
# $1 - snapshot file
# $2 - source dir
# $3 - destination dir
process_snapshot_file() {
if ! [ -r $1 ]; then
if [ "$VERBOSE" -ge 1 ]; then
echo "Not existing snapshot, ignoring: `basename $1`"
fi
return
fi
if [ $1 -nt age-compare-file ]; then
echo "Packages wasn't in current-testing for at least $MIN_AGE days, ignoring: `basename $1`"
continue
fi
for f in `cat $1`; do
f=`basename $f`
if ! [ -r $2/$f ]; then
echo "Not existing package, ignoring: $2/$f"
continue
fi
if rpm --checksig $2/$f | grep -v pgp > /dev/null; then
echo "Not signed package: $2/$f"
continue
fi
$DRY ln -f $2/$f $3/
done
}
for rel in $RELS_TO_UPDATE; do
for pkg_set in dom0 vm; do
for dist in `ls $rel/current/$pkg_set`; do
if [ -n "$components" ]; then
for component in $components; do
process_snapshot_file $repo_snapshot_dir/current-testing-$pkg_set-$dist-$component \
$rel/current-testing/$pkg_set/$dist/rpm \
$rel/current/$pkg_set/$dist/rpm
done
else
for snapshot_file in $repo_snapshot_dir/current-testing-$pkg_set-$dist-*; do
process_snapshot_file $snapshot_file \
$rel/current-testing/$pkg_set/$dist/rpm \
$rel/current/$pkg_set/$dist/rpm
done
fi
done
done
done
rm -f age-compare-file
if [ "$AUTOMATIC_UPLOAD" = 1 ]; then
`dirname $0`/sync_qubes-os.org_repo.sh "$3"
fi
echo Done.