diff options
author | jcorgan | 2006-08-03 04:51:51 +0000 |
---|---|---|
committer | jcorgan | 2006-08-03 04:51:51 +0000 |
commit | 5d69a524f81f234b3fbc41d49ba18d6f6886baba (patch) | |
tree | b71312bf7f1e8d10fef0f3ac6f28784065e73e72 /dtools/python/release_tools.py | |
download | gnuradio-5d69a524f81f234b3fbc41d49ba18d6f6886baba.tar.gz gnuradio-5d69a524f81f234b3fbc41d49ba18d6f6886baba.tar.bz2 gnuradio-5d69a524f81f234b3fbc41d49ba18d6f6886baba.zip |
Houston, we have a trunk.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3122 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'dtools/python/release_tools.py')
-rw-r--r-- | dtools/python/release_tools.py | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/dtools/python/release_tools.py b/dtools/python/release_tools.py new file mode 100644 index 000000000..788ede550 --- /dev/null +++ b/dtools/python/release_tools.py @@ -0,0 +1,87 @@ +# +# Copyright 2005 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +import re +import os + +def get_release(configure_ac_filename): + f = open(configure_ac_filename,'r') + contents = f.read() + pat = re.compile('^AM_INIT_AUTOMAKE\((.*),(\d+)\.(\d+)(.*)\)', re.M) + mo = pat.search(contents) + if mo: + return mo.groups() + +def set_release(configure_ac_filename, new_release): + f = open(configure_ac_filename,'r') + contents = f.read() + pat = re.compile('^AM_INIT_AUTOMAKE\(((.*),(\d+)\.(\d+)(.*))\)', re.M) + repl = ''.join(('AM_INIT_AUTOMAKE(', + new_release[0], + ',', + new_release[1], + '.', + new_release[2],new_release[3],')')) + new = pat.sub(repl, contents) + return new + +def incr_release(configure_ac_filename, final=False): + cur = get_release(configure_ac_filename) + if cur is None: + raise ValueError, "%s: couldn't find version" % (configure_ac_filename,) + new = set_release(configure_ac_filename, up_rev(cur, final)) + os.rename(configure_ac_filename, configure_ac_filename + '.bak') + f = open(configure_ac_filename,'w') + f.write(new) + f.close() + +def up_rev(current_rev, final=False): + """ + X.Y -> X.Ycvs + if final: + X.Ycvs -> X.(Y+1)rc1 + else: + X.Ycvs -> X.(Y+1) + if final: + X.YrcN -> X.Y + else + X.YrcN -> X.Yrc(N+1) + """ + pkg, major, minor, suffix = current_rev + + if len(suffix) == 0: + if final: + raise RuntimeError, ("Can't go from current to final. current = " + str(current_rev)) + return (pkg, major, minor, "cvs") + if suffix == "cvs": + if final: + return (pkg, major, str(int(minor)+1), "") + return (pkg, major, str(int(minor)+1), "rc1") + elif suffix.startswith('rc'): + if final: + return (pkg, major, minor, "") + return (pkg, major, minor, "rc" + (str(int(suffix[2:]) + 1))) + +def make_tag(current_rev): + pkg, major, minor, suffix = current_rev + if suffix == "cvs": + raise ValueError, "You tried to tag a X.Ycvs release..." + return 'REL_%s_%s%s' % (major, minor, suffix) |