2 # Copyright (c) 2011-2015 IndexData ApS. http://indexdata.com
3 # Author: Wolfram Schneider
5 # id-release - a helper script to build a release & packaging for debian + redhat
7 # see http://twiki.indexdata.dk/cgi-bin/twiki/view/ID/IDSoftwareRelease
8 # https://twiki.indexdata.com/twiki/bin/view/ID/AdamsReleaseProcedure
14 echo >&2 "usage $0 version"
20 if ! git branch | egrep -q '^\* master$'; then
21 ( echo ">>> Warning: you are not running on the master branch <<<"
22 git branch; echo ) 1>&2
26 ######################################################################
30 [0-9]* ) version=$1 ;;
39 # See also https://twiki.indexdata.com/twiki/bin/view/ID/AdamsReleaseProcedure
46 echo "# Did you updated the news log file?"
47 for file in Changes News NEWS
50 echo "# $(ls -l $file)"
55 if [ -e "pom.xml" ]; then
61 if [ `find . -name '*.pm' | wc -l` -gt 0 ]; then
67 if [ `ls | egrep '\.spec$' | wc -l` -eq 0 ]; then
68 usage "No *.spec file found"
70 spec=`ls |egrep '\.spec$' | head -1`
71 package=`perl -ne 's/\s*$//; print if s/^NAME=//' IDMETA`
72 if [ -z "$package" ]; then
73 package=`basename $spec .spec`
77 # configure new version
78 perl -i.bak -npe "s,VERSION=.*,VERSION=$version," IDMETA
81 echo "# set maven version to $version"
82 mvn versions:set -DnewVersion=$version > mvn-versions.log
86 echo "# check perl version numbers"
87 find . -name '*.pm' -print0 | xargs -0 egrep -H '\$VERSION.*=.*[0-9]' |
88 egrep -v '^\./deb-src/' | perl -npe 's,^,# ,'
91 # update debian version file
92 perl -i.bak -npe "\$. == 1 && s,\(.*?\),($version)," debian/changelog
94 # update redhat version file
95 perl -i.bak -npe "s,^Version: \d+.*,Version: $version," $spec
98 ######################################################################
99 echo "# Please commit the version updates now"
100 echo "git commit -a -m'new release v$version'"
102 echo "# Please tag now (we will push later to origin)"
103 echo "git tag v$version"
106 echo "mvn versions:set -DnewVersion=$version-SNAPSHOT"
109 ######################################################################
111 echo "# On mochi, please run the commands"
112 echo "\$HOME/proj/git-tools/id-deb-build/mkdist.sh"
113 echo "\$HOME/proj/git-tools/id-deb-build/id-pbuild.sh"
114 echo "\$HOME/proj/git-tools/id-deb-build/id-pbuild.sh --upload"
117 echo "# if successfully, don't forget to push to origin"
118 echo "git push origin master"
119 echo "git push origin tag v$version"