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
|
#!/bin/bash
# vi:ts=2 sw=2 et:
set -eu
if ! [ -d .git ]; then
echo "Must be run from the project root" >&2
exit 1
fi
if [ `git symbolic-ref HEAD` != 'refs/heads/master' ]; then
echo "Must be run on the master branch" >&2
exit 1
fi
status=`git status --porcelain`
if [ -n "$status" ]; then
echo "Working directory is not clean" >&2
exit 1
fi
ac_init=`grep -E 'AC_INIT\(\[[_a-zA-Z-]*\],\[[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*~devel\]\)$' configure.ac`
if [ `echo $ac_init | wc -l` != 1 ]; then
echo "Unrecognized or multiple AC_INIT entries in configure.ac" >&2
exit 1
fi
PACKAGE=`echo $ac_init | sed -e 's/^.*AC_INIT(\[\(.*\)\],.*$/\1/'`
VERSION=`echo $ac_init | sed -e 's/^.*\[\(.*\)~devel\])$/\1/'`
TARBALL="$PACKAGE-$VERSION.tar.gz"
echo "Cleaning working tree"
git clean -fdxq
echo "Removing ~devel suffix from version in configure.ac"
sed -i '' -e "s/\(AC_INIT(.*\)~devel\(\])\)/\1\2/" configure.ac
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 //'`
version_current=`echo $version_info | awk -F: '{ print $1 }'`
version_revision=`echo $version_info | awk -F: '{ print $2 }'`
version_age=`echo $version_info | awk -F: '{ print $3 }'`
echo
echo "Current version-info: $version_info"
echo
while true; do
read -p "Has the library library source code has changed at all since the last update? [y/n]" yn
case $yn in
[Nn]*) break;;
[Yy]*)
version_revision=`expr $version_revision + 1`
while true; do
read -p "Have any interfaces been added, removed, or changed since the last update? [y/n]" yn
case $yn in
[Nn]*) break;;
[Yy]*)
version_current=`expr $version_current + 1`
version_revision=0
while true; do
read -p "Have any interfaces been added since the last public release? [y/n]" yn
case $yn in
[Nn]*) break;;
[Yy]*) version_age=`expr $version_age + 1`; break;;
*)
esac
done
while true; do
read -p "Have any interfaces been removed or changed since the last public release? [y/n]" yn
case $yn in
[Nn]*) break;;
[Yy]*) version_age=0; break;;
*)
esac
done
break;;
*)
esac
done
break;;
*)
esac
done
echo "Updating version-info in lib/src/Makefile.am"
sed -i '' -e "s/-version-info $version_info$/-version-info $version_current:$version_revision:$version_age/" lib/src/Makefile.am
echo
echo "Version changes:"
git diff
echo
while true; do
read -p "Commit? [y/n]" yn
case $yn in
[Nn]*) exit;;
[Yy]*) break;;
*)
esac
done
git commit -a -m "Bump version"
git tag -s -m "Release $VERSION" v$VERSION
echo
echo "Building distribution"
./autogen.sh
./configure
make dist
echo
echo "Signing distribution tarball"
gpg --armour --detach-sig "$TARBALL"
echo
echo "Building debian docker image"
debian_docker=`docker build . -q -f build-aux/build-debian.dockerfile`
echo "Built image $debian_docker"
git checkout debian
git clean -fd -e "$TARBALL*"
echo
echo "Switching to debian branch and importing distribution tarball"
docker run --rm -v `pwd`:/home/build/dist -w /home/build/dist -i $debian_docker /bin/sh -s <<EOF
mv "$TARBALL"* ..
gbp import-orig -u$VERSION --no-interactive --rollback ../"$TARBALL"
mv ../"$TARBALL"* .
EOF
echo
echo "Distribution created and debian branch updated"
git checkout master
VERSION_PATCH=`echo $VERSION | awk -F. '{ print $3 }'`
NEXT_VERSION=`echo $VERSION | awk -F. '{ print $1 "." $2 "." }'``expr $VERSION_PATCH + 1`
echo "Setting next ~devel version in configure.ac"
sed -i '' -e "s/\(AC_INIT(\[.*,\[\).*\(\])\)/\1$NEXT_VERSION~devel\2/" configure.ac
git add configure.ac
git commit -m "Bump version"
|