blob: ff82e4cbf59c5727818bfb52ba734d224ddab434 [file] [log] [blame]
Harald Welteee497f22017-10-03 16:54:41 +08001#!/bin/sh
2VERSION=$1
3REL=$2
4
5if [ "z$REL" = "z" ]; then
6 echo "No REL value specified, defaulting to 'patch' release"
7 REL=patch
8fi
9
10BUMPVER=`command -v bumpversion`
11
12NEW_VER=`bumpversion --list --current-version $VERSION $REL --allow-dirty | awk -F '=' '{ print $2 }'`
13LIBVERS=`git grep -n LIBVERSION | grep '=' | grep am | grep -v LDFLAGS`
14MAKEMOD=`git diff -GLIBVERSION --stat | grep Makefile.am`
15ISODATE=`date -I`
16
17if [ "z$BUMPVER" = "z" ]; then
18 echo Unable to find 'bumpversion' command.
19 exit 1
20fi
21
22if [ "z$NEW_VER" = "z" ]; then
23 echo "Please fix versioning to match http://semver.org/ spec (current is $VERSION) before proceeding."
24 exit 1
25fi
26
27echo "Releasing $VERSION -> $NEW_VER..."
28
29if [ "z$LIBVERS" = "z" ]; then
30 gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch
31else
32 echo "You should NOT be doing this unless you've read and understood following article:"
33 echo "https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info"
34 grep -v '#' TODO-RELEASE | sed 's/\t\+/: /g' > TODO-RELEASE.entries
35 grep '#' TODO-RELEASE > TODO-RELEASE.clean
36 mv TODO-RELEASE.clean TODO-RELEASE
37 if [ "z$MAKEMOD" = "z" ]; then
38 git status -s -uno TODO-RELEASE
39 if [ $? -ne 0 ]; then
40 echo "Before releasing, please modify some of the libversions: $LIBVERS"
41 exit 1
42 fi
43 fi
44 xargs -a TODO-RELEASE.entries -r -d'\n' -I entry dch -m -v $NEW_VER "entry"
45fi
46dch -r -m --distribution "unstable" ""
47git add -u
48bumpversion --current-version $VERSION $REL --tag --commit --tag-name $NEW_VER --allow-dirty
49git tag -s $NEW_VER -f -m "Release v$NEW_VER on $ISODATE."
50echo "Release $NEW_VER prepared, tagged and signed."