-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·323 lines (252 loc) · 8.06 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
#!/bin/bash
# Sourceforge username
SFUSER=${SFUSER:-$USER}
set -ex
## Parse command line arguments
usage () {
if ! [ -z "$1" ]
then
echo $1
fi
cat <<EOF
usage: $0 [-s] VERSION-NUMBER [REV]
This script frobs NEWS, makes a "release" commit + tag of the
repository in \$PWD/release.sbcl .
It then clones the repository to a new clean directory and does the
following:
- Builds source tarball
- Builds a SBCL for self-build
- Builds x86-64 binaries
- Uploads binaries
- Pushes the repository
- Builds and uploads the documentation
If -s is given, then use the gpg-sign mechanism of "git tag". You
will need to have your gpg secret key handy.
if REV is given, it is the git revision to build into a release.
Default is origin/master.
ENVIRONMENT:
SFUSER: Sourceforge username. Defaults to \$USER
SBCL_RELEASE_DIR: Absolute path to directory containing all the build
artifacts. If not defined, a new build directory is created in \$PWD.
EOF
exit 1
}
if [ "-s" = "$1" ] || [ "--sign" = "$1" ]
then
sign="-s"; shift
else
sign=""
fi
## Verify version number
if [ -z "$1" ]
then
usage "No version number."
else
VERSION=$1; shift
echo $VERSION | perl -pe 'die "Invalid version number: $_\n" if !/^\d+\.\d+\.\d+$/'
fi
if [ -z "$1" ]
then
rev=origin/master
else
rev=$1; shift
type=$(git cat-file -t "$rev" 2> /dev/null || echo "unknown")
if ([ "tag" != "$type" ] && [ "commit" != "$type" ])
then
usage "$rev is $type, not a tag or a commit."
fi
fi
if ! [ -z "$@" ]
then
usage "Extra command-line arguments: $@"
fi
SBCL_RELEASE_DIR=${SBCL_RELEASE_DIR:-$(mktemp -d $PWD/sbcl-release-dir-$(date +%Y%m%d)-XXXXXXXXX)}
SBCL_DIR=$SBCL_RELEASE_DIR/sbcl-$VERSION
GIT_DIR=$PWD/release.sbcl
LOGFILE=$SBCL_RELEASE_DIR/log.txt
## Frob the git repository, and clone the repo to a clean build directory.
if [ ! -d $SBCL_DIR ]; then
cd $GIT_DIR
sbcl_directory="$(cd "$(dirname $0)"; pwd)"
branch_name="release-$(date '+%s')"
original_branch="$(git describe --all --contains HEAD)"
echo "Checking that the tree is clean."
if ! [ $(git status --porcelain | wc -l) = 0 ]
then
echo "There are uncommitted / unpushed changes in this checkout!"
git status
exit 1
fi
## Perform the necessary changes to the NEWS file:
echo "Munging NEWS"
sed -i.orig "/^changes relative to sbcl-.*:/ s/changes/changes in sbcl-$VERSION/ " NEWS
rm -f NEWS.orig
if ! grep "^changes in sbcl-$VERSION relative to" NEWS > /dev/null
then
echo "NEWS munging failed!"
exit 1
fi
## Commit
cd "$sbcl_directory"
echo "Committing release version."
git add NEWS
git commit -m "$VERSION: will be tagged as \"sbcl-$VERSION\""
## Make release notes
if [ ! -f $SBCL_RELEASE_DIR/sbcl-$VERSION-release-notes.txt ]; then
awk "BEGIN { state = 0 }
/^changes in sbcl-/ { state = 0 }
/^changes in sbcl-$VERSION/ { state = 1 }
{ if(state == 1) print \$0 }" < $GIT_DIR/NEWS > $SBCL_RELEASE_DIR/sbcl-$VERSION-release-notes.txt
fi
## Tag
tag="sbcl-$VERSION"
echo "Tagging as $tag"
git tag $sign -F $SBCL_RELEASE_DIR/sbcl-$VERSION-release-notes.txt "$tag"
git clone $GIT_DIR $SBCL_DIR
fi
## Make the source tarball.
if [ ! \( -f $SBCL_RELEASE_DIR/sbcl-$VERSION-source.tar -o -f $SBCL_RELEASE_DIR/sbcl-$VERSION-source.tar.bz2 \) ]; then
cd $SBCL_DIR
$SBCL_DIR/generate-version.sh
mkdir -p CVS
sh ./distclean.sh
rm -rf .git
cd $SBCL_RELEASE_DIR
sh sbcl-$VERSION/source-distribution.sh sbcl-$VERSION
mv $SBCL_DIR $SBCL_DIR.git
tar xvf sbcl-$VERSION-source.tar
fi
## Build x86-64 binary for bootstrap.
if [ ! -d $SBCL_RELEASE_DIR/bin ]; then
cd $SBCL_DIR
nice -20 ./make.sh >$LOGFILE 2>&1
cd tests
nice -20 sh ./run-tests.sh >>$LOGFILE 2>&1
mkdir -p $SBCL_RELEASE_DIR/bin
cp $SBCL_DIR/src/runtime/sbcl $SBCL_RELEASE_DIR/bin/sbcl
cp $SBCL_DIR/output/sbcl.core $SBCL_RELEASE_DIR/bin/sbcl.core
fi
## Build x86-64 release binary.
if [ ! -d $SBCL_RELEASE_DIR/sbcl-$VERSION-x86-64-linux ]; then
cd $SBCL_DIR
sh clean.sh
nice -20 ./make.sh "$SBCL_RELEASE_DIR/bin/sbcl --core $SBCL_RELEASE_DIR/bin/sbcl.core --no-userinit" >> $LOGFILE 2>&1
cd doc && sh ./make-doc.sh
cd $SBCL_RELEASE_DIR
ln -s $SBCL_DIR $SBCL_RELEASE_DIR/sbcl-$VERSION-x86-64-linux
sh $SBCL_DIR/binary-distribution.sh sbcl-$VERSION-x86-64-linux
sh $SBCL_DIR/html-distribution.sh sbcl-$VERSION
fi
## Build x86 release binary.
#if [ ! -d $SBCL_RELEASE_DIR/sbcl-$VERSION-x86-linux ]; then
# cd $SBCL_DIR
# sh clean.sh
# export SBCL_ARCH=x86
# export PATH=/scratch/src/release/x86-gcc-wrapper:$PATH
# nice -20 ./make.sh "$SBCL_RELEASE_DIR/bin/sbcl --core $SBCL_RELEASE_DIR/bin/s#bcl.core --no-userinit" >> $LOGFILE 2>&1
# cd tests
# nice -20 sh ./run-tests.sh >>$LOGFILE 2>&
# cd $SBCL_RELEASE_DIR
# ln -s $SBCL_DIR $SBCL_RELEASE_DIR/sbcl-$VERSION-x86-linux
# sh $SBCL_DIR/binary-distribution.sh sbcl-$VERSION-x86-linux
#fi
## Checksum
if [ ! -f $SBCL_RELEASE_DIR/sbcl-$VERSION-$SFUSER ]; then
cd $SBCL_RELEASE_DIR
echo "The SHA256 checksums of the following distribution files are:" > sbcl-$VERSION-$SFUSER
echo >> sbcl-$VERSION-$SFUSER
sha256sum sbcl-$VERSION*.tar >> sbcl-$VERSION-$SFUSER
bzip2 sbcl-$VERSION*.tar
fi
## Bug closing email
if [ ! -f $SBCL_RELEASE_DIR/sbcl-$VERSION-bugmail.txt ]; then
cd $SBCL_RELEASE_DIR
echo Bugs fixed by sbcl-$VERSION release > sbcl-$VERSION-bugmail.txt
for bugnum in $(egrep -o "#[1-9][0-9][0-9][0-9][0-9][0-9]+" sbcl-$VERSION-release-notes.txt | sed s/#// | sort -n); do
printf "\n bug %s\n status fixreleased" $bugnum >> sbcl-$VERSION-bugmail.txt
done
echo >> sbcl-$VERSION-bugmail.txt
fi
## Sign
if [ ! -f $SBCL_RELEASE_DIR/sbcl-$VERSION-$SFUSER.asc ]; then
cd $SBCL_RELEASE_DIR
gpg -sta $SBCL_RELEASE_DIR/sbcl-$VERSION-$SFUSER
fi
## Upload to sf.net
if [ ! -f $SBCL_RELEASE_DIR/uploaded ]; then
read -n 1 -p "Ok to upload? " A; echo
if [ $A \!= "y" ]; then
exit 1
fi
cd $SBCL_RELEASE_DIR
cat > $SBCL_RELEASE_DIR/sftp-batch <<EOF
cd /home/frs/project/s/sb/sbcl/sbcl
mkdir $VERSION
chmod 775 $VERSION
cd $VERSION
put sbcl-$VERSION-$SFUSER.asc
put sbcl-$VERSION-x86-64-linux-binary.tar.bz2
put sbcl-$VERSION-source.tar.bz2
put sbcl-$VERSION-documentation-html.tar.bz2
put sbcl-$VERSION-release-notes.txt
put sbcl-$VERSION-release-notes.txt README
EOF
sftp -b $SBCL_RELEASE_DIR/sftp-batch $SFUSER,sbcl@frs.sourceforge.net
touch uploaded
fi
## Push
if [ ! -f $SBCL_RELEASE_DIR/sbcl-git-pushed ]; then
cd $GIT_DIR
git diff origin || true
read -n 1 -p "Ok? " A; echo
if [ $A = "y" ]; then
git push
git push --tags
touch $SBCL_RELEASE_DIR/sbcl-git-pushed
else
exit 1
fi
fi
## Build + push documentation
if [ ! -f $SBCL_RELEASE_DIR/sbcl-page-uploaded ]; then
cp -af $GIT_DIR/../sbcl-page $SBCL_RELEASE_DIR
cd $SBCL_RELEASE_DIR/sbcl-page/sbcl
git fetch
cd $SBCL_RELEASE_DIR/sbcl-page
git pull
git submodule update
cp $SBCL_DIR/NEWS .
perl -i -pe "s/(:x86-64 :linux :available) \".*\"/\$1 \"$VERSION\"/" \
platform-support-platforms.lisp
export LC_CTYPE=en_GB.utf8
## FIXME: this depends on the sbcl-$VERSION tag being visible on sf
## git, not just the local machine (because of the submodule), which
## means that the release.sbcl should have as its origin sf not
## another local copy.
nice -20 make manual generate-pages SBCL_TAG=sbcl-$VERSION >>$LOGFILE 2>&1
COMMIT=false
git diff || COMMIT=true
links -dump platform-table.html
read -n 1 -p "Ok? " A; echo
if [ $A = "y" ]; then
if [ $COMMIT ]; then
git commit -a -m "Update for $VERSION"
git push
fi
make upload-pages upload-manual SBCL_TAG=sbcl-$VERSION
touch $SBCL_RELEASE_DIR/sbcl-page-uploaded
else
exit 1
fi
fi
set +x
echo TODO:
echo
echo perform administrative tasks:
echo
echo \* visit https://sourceforge.net/projects/sbcl/files/
echo \* select sbcl -> $VERSION -> "view details" for the source
echo \ \ tarball, "Select all" and Save
echo \* mail sbcl-announce
echo \* check and send sbcl-$VERSION-bugmail.txt to edit@bugs.launchpad.net
echo \ \ '(sign: C-c RET s p)'