forked from gt1/libmaus2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bumpversion.sh
78 lines (60 loc) · 2.22 KB
/
bumpversion.sh
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
#! /bin/bash
VERSION=`grep AC_INIT < configure.ac | awk -F',' '{print $2}'`
FIRST=`echo $VERSION | awk -F'.' '{print $1}'`
SECOND=`echo $VERSION | awk -F'.' '{print $2}'`
THIRD=`echo $VERSION | awk -F'.' '{print $3}'`
NEXTTHIRD=`expr ${THIRD} + 1`
export [email protected]
export DEBFULLNAME="German Tischler"
function cleanup
{
if [ ! -z "${COMMITFILE}" ] ; then
if [ -f "${COMMITFILE}" ] ; then
rm -f "${COMMITFILE}"
fi
fi
}
COMMITFILE=commit_msg_$$.txt
trap cleanup EXIT SIGINT SIGTERM
# make sure we have the latest version
git checkout experimental
git pull -v
# create commit log message
joe "${COMMITFILE}"
if [ ! -s "${COMMITFILE}" ] ; then
echo "Empty commit log, aborting"
exit 1
fi
# update to next minor version
awk -v first=${FIRST} -v second=${SECOND} -v third=${THIRD} '/^AC_INIT/ {gsub(first"."second"."third,first"."second"."third+1);print} ; !/^AC_INIT/{print}' < configure.ac | \
awk -v first=${FIRST} -v second=${SECOND} -v third=${THIRD} '/^LIBRARY_VERSION=/ {gsub("="first"."third"."second,"="first":"third+1":"second);print} ; !/^LIBRARY_VERSION=/{print}' \
> configure.ac.tmp
mv configure.ac.tmp configure.ac
# update change log
CHANGELOG=ChangeLog dch --distribution unstable -v ${FIRST}.${SECOND}.${NEXTTHIRD}-1
# commit files
git add configure.ac ChangeLog
git commit -F "${COMMITFILE}"
git push -v
# switch to experimental debian branch
git checkout experimental-debian
git pull -v
git merge -m "Merge experimental branch" experimental
# create change log message
pushd debian
dch --distribution unstable -v ${FIRST}.${SECOND}.${NEXTTHIRD}-1 "New upstream version ${FIRST}.${SECOND}.${NEXTTHIRD}"
dch --release ""
popd
sed -i -e "s/[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/${FIRST}.${SECOND}.${NEXTTHIRD}/g" debian/libmaus2.install
sed -i -e "s/[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/${FIRST}.${SECOND}.${NEXTTHIRD}/g" debian/libmaus2.shlibs
git add debian/changelog
git add debian/libmaus2.install
git add debian/libmaus2.shlibs
git commit -F "${COMMITFILE}"
git push -v
# back to experimental branch
git checkout experimental
TAG=libmaus2_experimental_${FIRST}_${SECOND}_${NEXTTHIRD}
git tag -a ${TAG} -m "libmaus2 experimental version ${FIRST}_${SECOND}_${NEXTTHIRD}"
git push -v origin ${TAG}
exit 0