a helper script to build a release & packaging for debian + redhat
authorWolfram Schneider <wosch@indexdata.dk>
Mon, 31 Oct 2011 20:23:33 +0000 (20:23 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Mon, 31 Oct 2011 20:23:33 +0000 (20:23 +0000)
id-release [new file with mode: 0755]

diff --git a/id-release b/id-release
new file mode 100755 (executable)
index 0000000..874d503
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+usage () {
+    echo "usage $0 version"
+    exit 1
+}
+
+if [ -e "pom.xml" ]; then
+    java=true
+else
+    java=false
+fi
+
+if [ `find . -name '*.pm' | wc -l` -gt 0 ]; then
+    perl=true
+else
+    perl=false
+fi
+
+if [ `ls |egrep '\.spec$' | wc -l` -eq 0 ]; then
+    echo "No *.spec file found"
+    usage
+else
+    package=`ls |egrep '\.spec$' | head -1`
+fi
+
+case $1 in
+  [0-9]* ) version=$1 ;;
+       * ) usage ;;
+esac
+
+# configure new version
+perl -i.bak -npe "s,VERSION=.*,VERSION=$version," IDMETA
+
+if $java; then
+    echo "set maven version to $version"
+    mvn versions:set -DnewVersion=$version > mvn-versions.log
+fi
+
+if $perl; then
+  echo "check perl version numbers"
+  find . -name '*.pm' -print0 | xargs -0 egrep -H '\$VERSION.*=.*[0-9]'
+fi
+
+# update debian version file
+perl -i.bak -npe "\$. == 1 && s,\(.*?\),($version)," debian/changelog 
+
+######################################################################
+echo ""
+echo "# Please run now"
+echo "git commit -a"
+echo "git push"
+echo "git tag v$version"
+echo "git push origin tag v$version"
+
+if $java; then
+    echo "mvn versions:set -DnewVersion=$version-SNAPSHOT" 
+fi
+