#!/bin/sh # Copyright (c) 2011-2015 IndexData ApS. http://indexdata.com # Author: Wolfram Schneider # # id-release - a helper script to build a release & packaging for debian + redhat # # see http://twiki.indexdata.dk/cgi-bin/twiki/view/ID/IDSoftwareRelease # https://twiki.indexdata.com/twiki/bin/view/ID/AdamsReleaseProcedure # die early set -e usage () { echo >&2 "usage $0 version" echo >&2 "$@" exit 1 } ###################################################################### case $1 in [0-9]* ) version=$1 ;; * ) usage ;; esac echo "See also https://twiki.indexdata.com/twiki/bin/view/ID/AdamsReleaseProcedure" echo "" echo "Did you updated the news log file?" for file in Changes News NEWS do if [ -e $file ]; then ls -l $file fi done echo "" 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 usage "No *.spec file found" else spec=`ls |egrep '\.spec$' | head -1` package=`perl -ne 's/\s*$//; print if s/^NAME=//' IDMETA` if [ -z "$package" ]; then package=`basename $spec .spec` fi fi # 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]' | egrep -v '^\./deb-src/' fi # update debian version file perl -i.bak -npe "\$. == 1 && s,\(.*?\),($version)," debian/changelog # update redhat version file perl -i.bak -npe "s,^Version: \d+.*,Version: $version," $spec ###################################################################### echo "# Please commit the version updates now" echo "git commit -a -m'new release v$version'" echo "" echo "# Please tag now (we will push later to origin)" echo "git tag v$version" if $java; then echo "mvn versions:set -DnewVersion=$version-SNAPSHOT" fi ###################################################################### echo "" echo "# On mochi, please run the commands" echo "\$HOME/proj/git-tools/id-deb-build/mkdist.sh" echo "\$HOME/proj/git-tools/id-deb-build/id-pbuild.sh" echo "\$HOME/proj/git-tools/id-deb-build/id-pbuild.sh --upload" echo "" echo "# if successfully, don't forget to push to origin" echo "git push origin master" echo "git push origin tag v$version"