2 # Copyright (c) 2011 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
13 echo >&2 "usage $0 version"
18 ######################################################################
20 [0-9]* ) version=$1 ;;
24 echo "Did you updated the news log file?"
25 for file in Changes News NEWS
33 if [ -e "pom.xml" ]; then
39 if [ `find . -name '*.pm' | wc -l` -gt 0 ]; then
45 if [ `ls |egrep '\.spec$' | wc -l` -eq 0 ]; then
46 usage "No *.spec file found"
48 spec=`ls |egrep '\.spec$' | head -1`
49 package=`perl -ne 's/\s*$//; print if s/^NAME=//' IDMETA`
52 # configure new version
53 perl -i.bak -npe "s,VERSION=.*,VERSION=$version," IDMETA
56 echo "set maven version to $version"
57 mvn versions:set -DnewVersion=$version > mvn-versions.log
61 echo "check perl version numbers"
62 find . -name '*.pm' -print0 | xargs -0 egrep -H '\$VERSION.*=.*[0-9]' | egrep -v '^\./deb-src/'
65 # update debian version file
66 perl -i.bak -npe "\$. == 1 && s,\(.*?\),($version)," debian/changelog
68 # update redhat version file
69 perl -i.bak -npe "s,^Version: .*,Version: $version," $spec
73 ######################################################################
75 echo "# Please run now"
78 echo "git tag v$version"
79 echo "git push origin tag v$version"
82 echo "mvn versions:set -DnewVersion=$version-SNAPSHOT"
85 ######################################################################
87 echo "# On RedHat or centos, please run the commands"
90 echo "\$HOME/proj/git-tools/id-deb-build/mkdist.sh"
91 echo "sudo cp $package-$version.tar.gz /usr/src/redhat/SOURCES/"
92 echo "sudo rpmbuild -ba $spec"
93 echo "# if successfully, upload"
94 echo "\$HOME/proj/git-tools/id-rpm-build/upload-rpms.sh $spec"
96 echo "# on kebab run: sudo su; cd \$HOME/proj/git-tools/update-archive; update-yum-archive.sh"
99 ######################################################################
101 echo "# On debian or ubuntu, please run the commands"
102 echo "sudo rm -rf deb-src"
104 echo "\$HOME/proj/git-tools/id-deb-build/mkdist.sh"
105 echo "\$HOME/proj/git-tools/id-deb-build/id-mk-deb-src.sh"
106 echo "sudo \$HOME/proj/git-tools/id-deb-build/id-pbuild.sh"
107 echo "# if successfully, upload"
108 echo "\$HOME/proj/git-tools/id-deb-build/id-pbuild.sh --upload"
110 echo "# on kebab run: sudo su; cd $HOME/proj/git-tools/update-archive; ./update-archive.sh"