From 29b18bc93bbb86ecac6261a14187491610504a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=A1gr?= Date: Fri, 1 May 2015 15:13:42 +0200 Subject: [PATCH] Tagged releases This patch modifies release.sh and version.py for tagged releases Change-Id: I8af98e91ac7fbf3cf7a937bff8a707d4be36cba6 --- bin/release.sh | 25 +++++++++++-------------- packstack/version.py | 9 ++++----- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/bin/release.sh b/bin/release.sh index d512c59a2..8810f3f76 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -4,19 +4,16 @@ SCRIPT_PATH="${BASH_SOURCE[0]}" SCRIPT_DIR=`dirname $SCRIPT_PATH` cd $SCRIPT_DIR/.. -git reset --hard - if [ -n "$1" ] ; then - git tag -a -m $1 $1 + # tagged release + BRANCH=`git rev-parse --abbrev-ref HEAD` + git fetch gerrit + git tag -m $1 -s $1 gerrit/$BRANCH + git push gerrit tag $1 +else + # development release + VERSION=`python setup.py --version` + sed -i -e "s/RESERVE_STR = None/RESERVE_STR = '$VERSION'/g" packstack/version.py + python setup.py sdist + git checkout packstack/version.py fi - -VERSION=`python setup.py --version` - -sed -i -e "s/RESERVE_STR = None/RESERVE_STR = '$VERSION'/g" packstack/version.py -python setup.py sdist - -if [ -n "$1" ] ; then - echo "Packstack was released with tag '$1'. Please don't forget to push tag upstream (git push --tags)." -fi - -git checkout packstack/version.py diff --git a/packstack/version.py b/packstack/version.py index 10fe9c6c4..5a1f1bbba 100644 --- a/packstack/version.py +++ b/packstack/version.py @@ -48,6 +48,7 @@ def vr_from_git(): tag, snap_tag, git_hash = description.split('-') else: # no tag has been found + tag = '.'.join(VERSION) rc, git_hash = execute( 'git log -n1 --pretty=format:%h', workdir=proj_dir, @@ -61,11 +62,9 @@ def vr_from_git(): use_shell=True, log=False ) - return '{0}.dev{1}.{2}'.format( - '.'.join(VERSION), - snap_tag.strip(), - git_hash.strip(), - ) + + tag, snap_tag, git_hash = tag.strip(), snap_tag.strip(), git_hash.strip() + return '{tag}.dev{snap_tag}.{git_hash}'.format(**locals()) def vr_from_setuptools():