From deb751de7f61efb594317c2e518bec11bd159baa Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 16 May 2010 15:28:08 +0200 Subject: [PATCH] [molecule] add version tagging script, fix version handling --- TODO | 4 +--- molecule/settings.py | 3 ++- molecule/version.py | 20 ++++++++++++++++++++ scripts/tag-version.sh | 30 ++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 molecule/version.py create mode 100755 scripts/tag-version.sh diff --git a/TODO b/TODO index 0abc926..b1c3b1d 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,2 @@ - add i18n support -- add real plugin factory -- move version string to file -- add build system \ No newline at end of file +- add real plugin factory \ No newline at end of file diff --git a/molecule/settings.py b/molecule/settings.py index 45aaad1..a3c1d3f 100644 --- a/molecule/settings.py +++ b/molecule/settings.py @@ -21,6 +21,7 @@ from molecule.exception import SpecFileError from molecule.specs.plugins import SPEC_PLUGS from molecule.specs.plugins.builtin import LivecdSpec from molecule.specs.skel import GenericSpec +from molecule.version import VERSION import molecule.utils class Constants(dict): @@ -51,7 +52,7 @@ class Configuration(dict): if mysettings is None: mysettings = {} settings = { - 'version': "0.5.4", + 'version': VERSION, 'chroot_compressor': "mksquashfs", 'iso_builder': "mkisofs", 'mirror_syncer': "rsync", diff --git a/molecule/version.py b/molecule/version.py new file mode 100644 index 0000000..651f5d8 --- /dev/null +++ b/molecule/version.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Molecule Disc Image builder for Sabayon Linux +# Copyright (C) 2009 Fabio Erculiani +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# DO NOT CHANGE THIS FILE AND THIS VARIABLE MANUALLY +VERSION = "0.5.5" \ No newline at end of file diff --git a/scripts/tag-version.sh b/scripts/tag-version.sh new file mode 100755 index 0000000..a864838 --- /dev/null +++ b/scripts/tag-version.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# Check current dir +[[ ! -d ".git" ]] && echo "this script must be executed from git repo root" && exit 1 + +# Check target tag +[[ -z "$1" ]] && echo "usage: $0 " && exit 1 + +# Validate new version +new_tag="$1" +for cur_tag in `git tag`; do + [[ "$cur_tag" == "$new_tag" ]] && echo "$new_tag already tagged" && exit 1 +done + +# Update ChangeLog +echo "Updating ChangeLog for $new_tag" +git log > docs/ChangeLog +git add docs/ChangeLog +sed -i "s/^VERSION = \".*\"/VERSION = \"$new_tag\"/" molecule/version.py +git add molecule/version.py +git commit -m "Tagging Molecule version $new_tag" docs/ChangeLog \ + molecule/version.py + +# tag version +echo "Tagging version: $new_tag" +git tag $new_tag HEAD + +# Push changes upstream +git push +git push --tags