Skip to content

Commit 785a622

Browse files
committed
Add release script
1 parent ac33100 commit 785a622

File tree

2 files changed

+167
-0
lines changed

2 files changed

+167
-0
lines changed

build-aux/build-debian.dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM debian:unstable
2+
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
RUN apt-get update
6+
RUN apt-get -y upgrade
7+
RUN apt-get install -y build-essential autotools-dev automake libtool pkg-config
8+
RUN apt-get install -y check valgrind
9+
RUN apt-get install -y peg
10+
RUN apt-get install -y libssl-dev
11+
RUN apt-get install -y libedit-dev
12+
RUN apt-get install -y git-buildpackage vim doxygen
13+
RUN apt-get install -y vim
14+
RUN apt-get install -y doxygen
15+
16+
RUN useradd -m build
17+
USER build
18+
RUN git config --global user.name "Chris Leishman"
19+
RUN git config --global user.email "[email protected]"
20+
ENV DEBFULLNAME "Chris Leishman"
21+
ENV DEBEMAIL "[email protected]"
22+
WORKDIR /home/build

build-aux/release.sh

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
if ! [ -d .git ]; then
6+
echo "Must be run from the project root" >&2
7+
exit 1
8+
fi
9+
10+
if [ `git symbolic-ref HEAD` != 'refs/heads/master' ]; then
11+
echo "Must be run on the master branch" >&2
12+
exit 1
13+
fi
14+
15+
status=`git status --porcelain`
16+
if [ -n "$status" ]; then
17+
echo "Working directory is not clean" >&2
18+
exit 1
19+
fi
20+
21+
ac_init=`grep -E 'AC_INIT\(\[[_a-zA-Z-]*\],\[[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*~devel\]\)$' configure.ac`
22+
if [ `echo $ac_init | wc -l` != 1 ]; then
23+
echo "Unrecognized or multiple AC_INIT entries in configure.ac" >&2
24+
exit 1
25+
fi
26+
27+
PACKAGE=`echo $ac_init | sed -e 's/^.*AC_INIT(\[\(.*\)\],.*$/\1/'`
28+
VERSION=`echo $ac_init | sed -e 's/^.*\[\(.*\)~devel\])$/\1/'`
29+
TARBALL="$PACKAGE-$VERSION.tar.gz"
30+
31+
echo "Cleaning working tree"
32+
git clean -fdxq
33+
34+
echo "Removing ~devel suffix from version in configure.ac"
35+
sed -i '' -e "s/\(AC_INIT(.*\)~devel\(\])\)/\1\2/" configure.ac
36+
37+
version_info=`grep -e '-version-info [0-9][0-9]*:[0-9][0-9]*:[0-9][0-9]*$' lib/src/Makefile.am | sed -e 's/^.*-version-info //'`
38+
version_current=`echo $version_info | awk -F: '{ print $1 }'`
39+
version_revision=`echo $version_info | awk -F: '{ print $2 }'`
40+
version_age=`echo $version_info | awk -F: '{ print $3 }'`
41+
echo
42+
echo "Current version-info: $version_info"
43+
echo
44+
while true; do
45+
read -p "Has the library library source code has changed at all since the last update? [y/n]" yn
46+
case $yn in
47+
[Yy]*)
48+
version_revision=`expr $version_revision + 1`
49+
break;;
50+
[Nn]*)
51+
break;;
52+
*)
53+
esac
54+
done
55+
while true; do
56+
read -p "Have any interfaces been added, removed, or changed since the last update? [y/n]" yn
57+
case $yn in
58+
[Yy]*)
59+
version_current=`expr $version_current + 1`
60+
version_revision=0
61+
while true; do
62+
read -p "Have any interfaces been added since the last public release? [y/n]" yn
63+
case $yn in
64+
[Yy]*)
65+
version_age=`expr $version_age + 1`
66+
break;;
67+
[Nn]*)
68+
break;;
69+
*)
70+
esac
71+
done
72+
while true; do
73+
read -p "Have any interfaces been removed or changed since the last public release? [y/n]" yn
74+
case $yn in
75+
[Yy]*)
76+
version_age=0
77+
break;;
78+
[Nn]*)
79+
break;;
80+
*)
81+
esac
82+
done
83+
break;;
84+
[Nn]*)
85+
break;;
86+
*)
87+
esac
88+
done
89+
90+
echo "Updating version-info in lib/src/Makefile.am"
91+
sed -i '' -e "s/-version-info $version_info$/-version-info $version_current:$version_revision:$version_age/" lib/src/Makefile.am
92+
93+
echo
94+
echo "Version changes:"
95+
git diff
96+
echo
97+
while true; do
98+
read -p "Commit? [y/n]" yn
99+
case $yn in
100+
[Yy]*)
101+
break;;
102+
[Nn]*)
103+
exit;;
104+
*)
105+
esac
106+
done
107+
git commit -a -m "Bump version"
108+
109+
echo
110+
echo "Building distribution"
111+
./autogen.sh
112+
./configure
113+
make dist
114+
115+
echo
116+
echo "Signing distribution tarball"
117+
gpg --armour --detach-sig "$TARBALL"
118+
119+
echo
120+
echo "Building debian docker image"
121+
debian_docker=`docker build . -q -f build-aux/build-debian.dockerfile`
122+
echo "Built image $debian_docker"
123+
124+
git checkout debian
125+
git clean -fd -e "$TARBALL*"
126+
127+
echo
128+
echo "Switching to debian branch and importing distribution tarball"
129+
docker run --rm -v `pwd`:/home/build/dist -w /home/build/dist -i $debian_docker /bin/sh -s <<EOF
130+
mv "$TARBALL"* ..
131+
gbp import-orig -u$VERSION --no-interactive --rollback ../"$TARBALL"
132+
mv ../"$TARBALL"* .
133+
EOF
134+
135+
echo
136+
echo "Distribution created and debian branch updated"
137+
138+
git checkout master
139+
VERSION_PATCH=`echo $VERSION | awk -F. '{ print $3 }'`
140+
NEXT_VERSION=`echo $VERSION | awk -F. '{ print $1 "." $2 "." }'``expr $VERSION_PATCH + 1`
141+
142+
echo "Setting next ~devel version in configure.ac"
143+
sed -i '' -e "s/\(AC_INIT(\[.*,\[\).*\(\])\)/\1$NEXT_VERSION~devel\2/" configure.ac
144+
git add configure.ac
145+
git commit -m "Bump version"

0 commit comments

Comments
 (0)