2 # Copyright 2005 Free Software Foundation, Inc.
4 # This file is part of GNU Radio
6 # GNU Radio is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
11 # GNU Radio is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Radio; see the file COPYING. If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street,
19 # Boston, MA 02110-1301, USA.
25 def get_release(configure_ac_filename):
26 f = open(configure_ac_filename,'r')
28 pat = re.compile('^AM_INIT_AUTOMAKE\((.*),(\d+)\.(\d+)(.*)\)', re.M)
29 mo = pat.search(contents)
33 def set_release(configure_ac_filename, new_release):
34 f = open(configure_ac_filename,'r')
36 pat = re.compile('^AM_INIT_AUTOMAKE\(((.*),(\d+)\.(\d+)(.*))\)', re.M)
37 repl = ''.join(('AM_INIT_AUTOMAKE(',
42 new_release[2],new_release[3],')'))
43 new = pat.sub(repl, contents)
46 def incr_release(configure_ac_filename, final=False):
47 cur = get_release(configure_ac_filename)
49 raise ValueError, "%s: couldn't find version" % (configure_ac_filename,)
50 new = set_release(configure_ac_filename, up_rev(cur, final))
51 os.rename(configure_ac_filename, configure_ac_filename + '.bak')
52 f = open(configure_ac_filename,'w')
56 def up_rev(current_rev, final=False):
68 pkg, major, minor, suffix = current_rev
72 raise RuntimeError, ("Can't go from current to final. current = " + str(current_rev))
73 return (pkg, major, minor, "cvs")
76 return (pkg, major, str(int(minor)+1), "")
77 return (pkg, major, str(int(minor)+1), "rc1")
78 elif suffix.startswith('rc'):
80 return (pkg, major, minor, "")
81 return (pkg, major, minor, "rc" + (str(int(suffix[2:]) + 1)))
83 def make_tag(current_rev):
84 pkg, major, minor, suffix = current_rev
86 raise ValueError, "You tried to tag a X.Ycvs release..."
87 return 'REL_%s_%s%s' % (major, minor, suffix)