change-test-based-on-item: check for characters.
[sbcl.git] / freeze.sh
blob632f2a7d0ad8d4a6d0546427af5747af6447f71f
1 #! /bin/bash
3 # Sourceforge username
4 SFUSER=${SFUSER:-$USER}
6 set -ex
8 usage() {
9 if ! [ -z "$1" ]
10 then
11 echo $1
13 cat <<EOF
15 usage: $0 VERSION
17 This script performs a number of sanity checks on the current repository, and creates
18 a lightweight tag for the revision in \$PWD/release.sbcl (or does it?).
20 ENVIRONMENT:
22 SFUSER: Sourceforge username. Defaults to \$USER
23 SBCL_RELEASE_DIR: Absolute path to directory containing all the build
24 artifacts. If not defined, a new build directory is created in \$PWD.
25 CCL: Path to Clozure Common Lisp, suitable as an argument to make.sh
26 CLISP: Path to CLISP, suitable as an argument to make.sh
27 EOF
28 exit 1
31 if [ -z "$1" ]
32 then
33 usage "No version number."
34 else
35 VERSION="$1-rc"; shift
36 echo $VERSION | perl -pe 'die "Invalid version number: $_\n" if !/^\d+\.\d+\.\d+-rc$/'
39 if ! [ -z "$@" ]
40 then
41 usage "Extra command-line arguments: $@"
44 if [ -z "$CLISP" ]
45 then
46 usage "CLISP environment variable not set"
49 SBCL_RELEASE_DIR=${SBCL_RELEASE_DIR:-$(mktemp -d $PWD/sbcl-release-dir-$(date +%Y%m%d)-XXXXXXXXX)}
50 SBCL_DIR=$SBCL_RELEASE_DIR/sbcl-$VERSION
51 GIT_DIR=$PWD/release.sbcl
52 LOGFILE=$SBCL_RELEASE_DIR/log.txt
54 if [ ! -d $SBCL_DIR ]; then
55 sbcl_directory="$(cd "$(dirname $0)"; pwd)"
56 cd $GIT_DIR
58 echo "Checking that the tree is clean."
59 if ! [ $(git status --porcelain | wc -l) = 0 ]
60 then
61 echo "There are uncommitted / unpushed changes in this checkout!"
62 git status
63 exit 1
66 ## Find the current version using git describe
67 git_describe_version="$(git describe | grep -E '^sbcl-[0-9]\.[0-9]+\.[0-9]+' | sed -E 's/^sbcl-([0-9]\.[0-9]+\.[0-9]+)-.*$/\1/')"
68 ## Check NEWS
70 echo "Checking NEWS"
71 if ! grep "^changes relative to sbcl-$git_describe_version:" NEWS > /dev/null
72 then
73 echo "NEWS not in correct format!"
74 exit 1
77 ## Make draft release notes
79 if [ ! -f $SBCL_RELEASE_DIR/sbcl-$VERSION-release-notes.txt ]; then
80 awk "BEGIN { state = 0 }
81 /^changes relative to sbcl-/ { state = 1 }
82 /^changes in sbcl-/ { state = 0 }
83 { if(state == 1) print \$0 }" < $GIT_DIR/NEWS > $SBCL_RELEASE_DIR/sbcl-$VERSION-release-notes.txt
86 ## Tag
88 # I'd like to use the same tag each time, but I can't convince
89 # myself that that will do the right thing when pushed, and I don't
90 # want to break all our mirrors for this.
92 # echo "Tagging as release_candidate"
93 # git tag release_candidate
95 git clone $GIT_DIR $SBCL_DIR
98 # check self-build (without float oracle)
100 ## Build x86-64 binary for bootstrap.
102 if [ ! -d $SBCL_RELEASE_DIR/bin ]; then
103 echo "Building bootstrap x86-64 binary"
104 cd $SBCL_DIR
105 nice -20 ./make.sh >$LOGFILE 2>&1
107 cd tests
108 nice -20 sh ./run-tests.sh >>$LOGFILE 2>&1
109 mkdir -p $SBCL_RELEASE_DIR/bin
110 cp $SBCL_DIR/src/runtime/sbcl $SBCL_RELEASE_DIR/bin/sbcl
111 cp $SBCL_DIR/output/sbcl.core $SBCL_RELEASE_DIR/bin/sbcl.core
114 ## Build x86-64 release candidate binary.
116 if [ ! -d $SBCL_RELEASE_DIR/sbcl-$VERSION-x86-64-linux ]; then
117 echo "Building release candidate x86-64 binary"
118 cd $SBCL_DIR
119 sh clean.sh
120 nice -20 ./make.sh "$SBCL_RELEASE_DIR/bin/sbcl --core $SBCL_RELEASE_DIR/bin/sbcl.core --no-userinit" >> $LOGFILE 2>&1
121 cd doc && sh ./make-doc.sh
122 cd $SBCL_RELEASE_DIR
124 ln -s $SBCL_DIR $SBCL_RELEASE_DIR/sbcl-$VERSION-x86-64-linux
125 sh $SBCL_DIR/binary-distribution.sh sbcl-$VERSION-x86-64-linux
126 bzip2 sbcl-$VERSION-x86-64-linux-binary.tar
127 sh $SBCL_DIR/html-distribution.sh sbcl-$VERSION
128 bzip2 sbcl-$VERSION-documentation-html.tar
130 mv $SBCL_DIR/obj/from-xc obj_from-xc_sbcl
133 # check build from ccl
135 if [ -n "$CCL" ]; then
136 if [ ! -d $SBCL_RELEASE_DIR/obj_from-xc_ccl ]; then
137 cd $SBCL_DIR
138 sh clean.sh
139 nice -20 ./make.sh "$CCL" >> $LOGFILE 2>&1
140 cd $SBCL_RELEASE_DIR
142 mv $SBCL_DIR/obj/from-xc obj_from-xc_ccl
146 if [ ! -d $SBCL_RELEASE_DIR/obj_from-xc_clisp ]; then
147 cd $SBCL_DIR
148 sh clean.sh
149 nice -20 ./make.sh "$CLISP" >> $LOGFILE 2>&1
150 cd $SBCL_RELEASE_DIR
152 mv $SBCL_DIR/obj/from-xc obj_from-xc_clisp
155 # TODO: check binary-equality between ccl, clisp, sbcl objs
157 # TODO: check build from abcl, ecl
159 # upload rc build
161 if [ ! -f $SBCL_RELEASE_DIR/uploaded ]; then
163 read -n 1 -p "Ok to upload? " A; echo
164 if [ $A \!= "y" ]; then
165 exit 1
168 cd $SBCL_RELEASE_DIR
169 cat > $SBCL_RELEASE_DIR/sftp-batch <<EOF
170 cd /home/frs/project/s/sb/sbcl/sbcl-rc
171 put sbcl-$VERSION-x86-64-linux-binary.tar.bz2
172 put sbcl-$VERSION-documentation-html.tar.bz2
173 put sbcl-$VERSION-release-notes.txt
175 sftp -b $SBCL_RELEASE_DIR/sftp-batch $SFUSER,sbcl@frs.sourceforge.net
176 touch uploaded
179 # TODO: check self-crossbuild on x86, arm, ppc
182 # TODO: find Fix Committed lp bugs for NEWS frobbery