summaryrefslogtreecommitdiffstats
path: root/prepare-release.sh
blob: db736b73db355e1cb1643321d20c4f49e5950528 (plain)
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
#!/bin/bash

# Script to run to prepare a new release.
# It will update the release number and tell you to update the
# CHANGES file and to double check everything looks before doing
# the release commit and tagging.

# Afterwards you probably want to run release-update.sh to upload
# the release and update the website at https://sourceware.org/bzip2/

# Any error is fatal
set -e

# We take one argument, the version (e.g. 1.0.7)
if [ $# -ne 1 ]; then
  echo "$0 <version> (e.g. 1.0.7)"
  exit 1
fi

LANG=C
VERSION="$1"
DATE=$(date +"%d %B %Y")

# Replace the version strings in the comments
VER_PREFIX="bzip2/libbzip2 version "
sed -i -e "s@${VER_PREFIX}[0-9].*@${VER_PREFIX}${VERSION} of ${DATE}@" \
  CHANGES LICENSE README* *.c *.h *.pl *.sh

# Add an entry to the README
DAY=$(date +"%d")
MONTH=$(date +"%B")
SHORTMONTH=$(date +"%b")
YEAR=$(date +"%Y")
printf "%2s %8s %s\n" "$DAY" "$MONTH" "$YEAR (bzip2, version $VERSION)" \
  >> README

# Update manual
sed -i -e "s@ENTITY bz-version \".*\"@ENTITY bz-version \"$VERSION\"@" \
       -e "s@ENTITY bz-date \".*\"@ENTITY bz-date \"$DAY $MONTH $YEAR\"@" \
  entities.xml

# bzip2.1 should really be generated from the manual.xml, but currently
# isn't, so explicitly change it here too.
sed -i -e "s@This manual page pertains to version .* of@This manual page pertains to version $VERSION of@" \
       -e "s@sorting file compressor, v.*@sorting file compressor, v$VERSION@" \
  bzip2.1* bzip2.txt

# Update sources. All sources, use bzlib_private.
# Except bzip2recover, which embeds a version string...
sed -i -e "s@^#define BZ_VERSION  \".*\"@#define BZ_VERSION  \"${VERSION}, ${DAY}-${SHORTMONTH}-${YEAR}\"@" \
  bzlib_private.h
sed -i -e "s@\"bzip2recover .*: extracts blocks from damaged@\"bzip2recover ${VERSION}: extracts blocks from damaged@" \
  bzip2recover.c

# And finally update the version/dist/so_name in the Makefiles.
sed -i -e "s@^DISTNAME=bzip2-.*@DISTNAME=bzip2-${VERSION}@" \
  Makefile
sed -i -e "s@libbz2\.so\.[0-9]\.[0-9]\.[0-9]*@libbz2\.so\.${VERSION}@" \
  Makefile-libbz2_so

echo "Now make sure the diff looks correct:"
echo "  git diff"
echo
echo "And make sure there is a $VERSION section in the CHANGES file."
echo
echo "Double check:"
echo "  make clean && make dist && make clean && make -f Makefile-libbz2_so"
echo
echo "Does everything look fine?"
echo
echo "git commit -a -m \"Prepare for $VERSION release.\""
echo "git push"
echo
echo "Wait for the buildbot to give the all green!"
echo "Then..."
echo
echo "git tag -s -m \"bzip2 $VERSION release\" bzip2-$VERSION"
echo "git push --tags"
echo
echo "./release-update.sh"