forked from ceph/ceph-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo_release.sh
executable file
·96 lines (77 loc) · 2.29 KB
/
do_release.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh -x
set -e
xterm=${xterm:-0} # set to 1 to use xterm for remote sessions
gpgkey='17ED316D'
bindir=`dirname $0`
usage() {
echo "usage: $0 releasedir [dists]"
}
releasedir=$1
shift || true
dists="$*"
[ -z "$releasedir" ] && usage && exit 1
deb_hosts=`cat $bindir/deb_hosts`
rpm_hosts=`cat $bindir/rpm_hosts`
versionfile=`mktemp`
cleanup() {
[ -n "$pids" ] && kill $pids
rm $versionfile
[ -n "$vers" ] && rm -rf $releasedir/$vers
}
trap cleanup INT EXIT
rm $releasedir/* || true
$bindir/release_tarball.sh $releasedir $versionfile
vers=`cat $versionfile`
# debs
$bindir/build_dsc.sh $releasedir $vers 1 $dists
$bindir/sign_debs.sh $releasedir $vers $gpgkey dsc
for rem in $deb_hosts
do
ssh $rem sudo rm -r /tmp/release/\* \; sudo mkdir -p /tmp/release \; sudo rm -r /tmp/ceph-build.\* || true
scp -rp $releasedir/$vers $rem:/tmp/release/$vers
ssh $rem git clone git://github.com/ceph/ceph-build /tmp/ceph-build.$$
#scp -r ../ceph-build $rem:/tmp/ceph-build.$$
if [ $xterm -eq 1 ]; then
xterm -l -e ssh $rem sudo /tmp/ceph-build.$$/build_debs.sh /tmp/release /srv/debian-base $vers &
else
ssh $rem sudo /tmp/ceph-build.$$/build_debs.sh /tmp/release /srv/debian-base $vers > build.$rem 2>&1 &
fi
pids="$pids $!"
done
# rpms
for rem in $rpm_hosts
do
ssh $rem sudo rm -r /tmp/release/\* \; sudo mkdir -p /tmp/release \; sudo rm -r /tmp/ceph-build.\* || true
scp -rp $releasedir/$vers $rem:/tmp/release/$vers
ssh $rem git clone git://github.com/ceph/ceph-build /tmp/ceph-build.$$
if [ $xterm -eq 1 ]; then
xterm -l -e ssh $rem sudo /tmp/ceph-build.$$/build_rpms.sh /tmp/release $vers &
else
ssh $rem sudo /tmp/ceph-build.$$/build_rpms.sh /tmp/release $vers > build.$rem 2>&1 &
fi
pids="$pids $!"
done
# wait
for p in $pids
do
wait $p
done
# gather results
for rem in $deb_hosts
do
rsync -auv $rem:/tmp/release/$vers/\*.\{changes\,deb\,dsc\,diff.gz\,orig.tar.gz\} $releasedir/$vers/$rem
done
for rem in $rpm_hosts
do
rsync -auv --exclude "BUILD" $rem:/tmp/release/$vers/rpm/ $releasedir/$vers/rpm
done
# sign debian (rpms are signed later)
for rem in $deb_hosts
do
echo "signing debs in $rem"
$bindir/sign_debs.sh $releasedir $vers $gpgkey changes $rem
done
# probably a better way, but
rm $versionfile
trap true INT EXIT
exit 0