forked from gluster/glusterfs-patch-acceptance-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·203 lines (172 loc) · 5.29 KB
/
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#!/bin/bash -eux
#
# Usage steps
#
# 1. Make sure $HOME is set and you have write permissions in $HOME/work/
#
# 2. Clone glusterfs.git (from http://git.gluster.com) as $HOME/work/glusterfs.git
#
# 3. Tag the commit id from which you are about to make a release with the release
# name prefixed by a "v". If you want to make 2.0.6rc5 release from the HEAD
# of release-2.0 branch, you need to:
#
# sh$ git checkout -b release-2.0 origin/release-2.0 # only for the first time on the tree
# sh$ git tag v2.0.6rc5 # this tags the HEAD of release-2.0 branch as "v2.0.6rc5"
#
# 4. Execute glusterfs-release with the release name, WITHOUT the "v" prefix. For e.g.
#
# sh$ glusterfs-release 2.0.6rc5
#
# 5. Keep inspecting the script output watching it make the tarball, compile test it,
# upload it to qa-releases directory and send out the announcement email
#
set -xe
function init_vars()
{
REVISION="glusterfs.git";
if [ "x$RELEASE_VERSION" = "x" ]; then
echo "FATAL: Unspecified \$RELEASE_VERSION"
exit 1
fi
VERSION="$RELEASE_VERSION";
if [ "x$GERRIT_REFSPEC" = "x" ]; then
echo "FATAL: Unspecified \$GERRIT_REFSPEC"
exit 1
fi
REFSPEC="$GERRIT_REFSPEC";
if [ "x$ANNOUNCE_EMAIL" = "x" ]; then
ANNOUNCE_EMAIL="[email protected], [email protected]";
fi
EMAIL="$ANNOUNCE_EMAIL";
#REPO=git://git.sv.gnu.org/glusterfs.git
REPO="$(pwd)";
BASEDIR="$HOME/work/releases";
INSTALLDIR="$BASEDIR/$VERSION/install";
TARBALL="glusterfs-$VERSION.tar.gz";
UFOTARBALL="gluster-swift-ufo-$VERSION.tar.gz";
SWIFT_VERSION="1.8.0"
RPMBUILD="$HOME/rpmbuild/RPMS"
PFX="pub/gluster/glusterfs";
BITS="/$PFX";
PATCHSET="";
}
function prepare_dirs()
{
rm -rf $BASEDIR;
mkdir -p $BASEDIR;
mkdir $BASEDIR/$VERSION;
mkdir $INSTALLDIR;
}
function get_src()
{
git clone $REPO $BASEDIR/$VERSION/$REVISION;
cd $BASEDIR/$VERSION/$REVISION;
git checkout $REFSPEC;
PATCHSET=$(git describe);
sed -i "s/^AC_INIT(.*)$/AC_INIT([glusterfs],[${VERSION}],[[email protected]])/" configure.ac
git log > ChangeLog;
}
function make_tarball()
{
cd $BASEDIR/$VERSION/$REVISION;
./autogen.sh;
#mkdir build;
#cd build;
./configure --enable-fusermount>/dev/null;
make dist >/dev/null;
cp *.tar.gz ..
}
function make_rpm()
{
if [ "x$BUILD_RPMS" != "xtrue" ]; then
echo "Skipping RPMBUILD. BUILD_RPMS='$BUILD_RPMS'";
return;
fi
rm -rvf $HOME/rpmbuild;
if [ -d extras/LinuxRPM ]; then
make -C extras/LinuxRPM glusterrpms;
if [ ! -d $RPMBUILD/x86_64 ]; then
mkdir -p $RPMBUILD/x86_64 $RPMBUILD/noarch $RPMBUILD/SRPMS
fi
cp extras/LinuxRPM/*.x86_64.rpm $RPMBUILD/x86_64/
cp extras/LinuxRPM/*.noarch.rpm $RPMBUILD/noarch/
cp extras/LinuxRPM/*.src.rpm $RPMBUILD/SRPMS/
else
rpmbuild -ta $BASEDIR/$VERSION/glusterfs-$VERSION.tar.gz;
fi
}
function cp_tarball()
{
mkdir $BITS/src -p;
cp $BASEDIR/$VERSION/gluster*-$VERSION.tar.gz $BITS/src/
sha256sum $BITS/src/gluster*-$VERSION.tar.gz > $BITS/src/gluster*-$VERSION.sha256sum
}
function stage_bits()
{
rm -rf $BITS/stage;
rm -rf $BITS/$VERSION;
mkdir $BITS/$VERSION;
mkdir $BITS/$VERSION/repodata;
ln -s $VERSION $BITS/stage;
cp -r $RPMBUILD/* $BITS/stage;
cat > $BITS/stage/repodata/comps.xml <<EOF
<comps>
<group>
<id>glusterfs-all</id>
<name>GlusterFS Packages</name>
<default>true</default>
<description>All packages of GlusterFS</description>
<uservisible>true</uservisible>
<packagelist>
<packagereq type="default">glusterfs</packagereq>
<packagereq type="default">glusterfs-devel</packagereq>
<packagereq type="default">glusterfs-fuse</packagereq>
<packagereq type="default">glusterfs-geo-replication</packagereq>
<packagereq type="optional">glusterfs-rdma</packagereq>
<packagereq type="optional">glusterfs-server</packagereq>
<packagereq type="optional">glusterfs-debuginfo</packagereq>
<packagereq type="optional">glusterfs-resource-agents</packagereq>
<packagereq type="optional">glusterfs-swift</packagereq>
<packagereq type="optional">glusterfs-swift-account</packagereq>
<packagereq type="optional">glusterfs-swift-container</packagereq>
<packagereq type="optional">glusterfs-swift-object</packagereq>
<packagereq type="optional">glusterfs-swift-proxy</packagereq>
<packagereq type="optional">glusterfs-ufo</packagereq>
</packagelist>
</group>
</comps>
EOF
createrepo -g $BITS/stage/repodata/comps.xml $BITS/stage;
mkdir $BITS/src -p;
cp $BASEDIR/$VERSION/gluster*-$VERSION.tar.gz $BITS/src/
}
function upload_rpms()
{
mkdir $BITS/src -p;
cp $BASEDIR/$VERSION/gluster*-$VERSION.tar.gz $BITS/src/
}
function announce_mail()
{
cat <<EOF | mail -s "glusterfs-$VERSION released" $EMAIL;
SRC: http://bits.gluster.org/$PFX/src/glusterfs-$VERSION.tar.gz
This release is made off $PATCHSET
-- Gluster Build System
EOF
}
function main()
{
init_vars;
prepare_dirs;
get_src;
make_tarball;
#make_rpm;
#stage_bits;
#verify_tarball;
#start_glusterfs;
#run_tests;
#cleanup_glusterfs;
#upload_tarball;
cp_tarball;
announce_mail;
}
main "$@"