From 43c3f39ef85f02be95db18b442bc7fc0c5964bd0 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 6 Jun 2006 20:42:08 +0000 Subject: [PATCH] Rewrite version bump script to not have external dependencies. Bump to bjam to 3.1.13. [SVN r34205] --- historic/jam/doc/bjam.qbk | 4 +- historic/jam/src/boost-jam.spec | 2 +- historic/jam/src/build.jam | 2 +- historic/jam/src/bump_version.py | 83 ++++++++++++++++++++----------- historic/jam/src/debian/copyright | 6 +-- historic/jam/src/patchlevel.h | 6 +-- 6 files changed, 64 insertions(+), 39 deletions(-) diff --git a/historic/jam/doc/bjam.qbk b/historic/jam/doc/bjam.qbk index 78cd1feee..f337c98b1 100644 --- a/historic/jam/doc/bjam.qbk +++ b/historic/jam/doc/bjam.qbk @@ -1,6 +1,6 @@ [article Boost.Jam [quickbook 1.3] - [version 3.1.12] + [version: 3.1.13] [authors [Rivera, Rene], [Abrahams, David], [Prus, Vladimir]] [copyright 2003 2004 2005 2006 Rene Rivera, David Abrahams, Vladimir Prus] [category tool-build] @@ -21,7 +21,7 @@ [/ Shortcuts ] -[def :version: 3.1.12] +[def :version: 3.1.13] [/ Images ] diff --git a/historic/jam/src/boost-jam.spec b/historic/jam/src/boost-jam.spec index 0a3a1baaf..c68756c7b 100644 --- a/historic/jam/src/boost-jam.spec +++ b/historic/jam/src/boost-jam.spec @@ -1,5 +1,5 @@ Name: boost-jam -Version: 3.1.12 +Version: 3.1.13 Summary: Build tool Release: 1 Source: %{name}-%{version}.tgz diff --git a/historic/jam/src/build.jam b/historic/jam/src/build.jam index eb066f1b4..32f028bae 100644 --- a/historic/jam/src/build.jam +++ b/historic/jam/src/build.jam @@ -12,7 +12,7 @@ if $(VMS) { . = "_" ; } else { . = "." ; } # Info about what we are building. -_VERSION_ = 3 1 12 ; +_VERSION_ = 3 1 13 ; NAME = boost-jam ; VERSION = $(_VERSION_:J=$(.)) ; RELEASE = 1 ; diff --git a/historic/jam/src/bump_version.py b/historic/jam/src/bump_version.py index 9757f7b6a..9423c4c77 100644 --- a/historic/jam/src/bump_version.py +++ b/historic/jam/src/bump_version.py @@ -7,49 +7,74 @@ # and updates all necessary files. For the time being, it's assumes presense # of 'perl' executable and Debian-specific 'dch' executable. # - -import sys -import string + import os +import os.path +import re +import string +import sys -def spec(version): - os.system("perl -pi -e 's|^Version:.*|Version: %s|' boost-jam.spec" % - string.join(version, ".")) +srcdir = os.path.abspath(os.path.dirname(__file__ )) +docdir = os.path.abspath(os.path.join(srcdir,"..","doc")) -def build_jam(version): - os.system("perl -pi -e 's|^VERSION = .* ;|VERSION = %s\$(.)%s\$(.)%s ;|' build.jam" - % (version[0], version[1], version[2])) +def edit(file,replacements): + print " '%s'..." %(file) + text = open(file,'r').read() + while len(replacements) > 0: + #~ print " '%s' ==> '%s'" % (replacements[0],replacements[1]) + text = re.compile(replacements[0],re.M).subn(replacements[1],text)[0] + replacements = replacements[2:] + #~ print text + open(file,'w').write(text) -def index_html(version): - os.system("perl -pi -e 's|This is version .* of BJam|This is version %s of BJam|' index.html" - % string.join(version, ".")) +def make_edits(version): + edit(os.path.join(srcdir,"boost-jam.spec"), [ + '^Version:.*$','Version: %s' % string.join(version, "."), + ]) -def jam_c(version): - re = "\\*major_version = .*, \\*minor_version = .*, \\*changenum = .*"; - new = ('*major_version = "%02d", *minor_version = "%02d", *changenum = "%02d";' % - (int(version[0]), int(version[1]), int(version[2]))) - os.system("perl -pi -e 's|%s|%s|' jam.c" % (re, new)) + edit(os.path.join(srcdir,"build.jam"), [ + '^_VERSION_ = .* ;$','_VERSION_ = %s %s %s ;' % (version[0], version[1], version[2]), + ]) -def patchlevel(version): - os.system("perl -pi -e 's|VERSION .*|VERSION \"%s\"|' patchlevel.h" % - string.join(version, ".")) + edit(os.path.join(docdir,"bjam.qbk"), [ + '\[version.*\]','[version: %s]' % string.join(version, '.'), + '\[def :version:.*\]','[def :version: %s]' % string.join(version, '.'), + ]) -def dch(version): - os.system("dch --ignore-dirname -v " + string.join(version, ".") + "-1") - -bumpers = [spec, build_jam, index_html, jam_c, patchlevel, dch] + edit(os.path.join(srcdir,"patchlevel.h"), [ + '^#define VERSION_MAJOR .*$', + '#define VERSION_MAJOR %s' % (version[0]), + '^#define VERSION_MINOR .*$', + '#define VERSION_MINOR %s' % (version[1]), + '^#define VERSION_PATCH .*$', + '#define VERSION_PATCH %s' % (version[2]), + '^#define VERSION_MAJOR_SYM .*$', + '#define VERSION_MAJOR_SYM "0%s"' % (version[0]), + '^#define VERSION_MINOR_SYM .*$', + '#define VERSION_MINOR_SYM "%s"' % (version[1]), + '^#define VERSION_PATCH_SYM .*$', + '#define VERSION_PATCH_SYM "%s"' % (version[2]), + '^#define VERSION .*$', + '#define VERSION "%s"' % string.join(version, '.'), + '^#define JAMVERSYM .*$', + '#define JAMVERSYM "JAMVERSION=%s.%s"' % (version[0],version[1]), + ]) def main(): if len(sys.argv) < 2: print "Expect new version as argument" sys.exit(1) - - new_version = string.split(sys.argv[1], ".") - print "Setting version to", new_version - for b in bumpers: - b(new_version) + + version = string.split(sys.argv[1], ".") + print "Setting version to", version + make_edits(version) if __name__ == '__main__': main() + +#~ Copyright 2006 Rene Rivera. +#~ Copyright 2005-2006 Vladimir Prus. +#~ Distributed under the Boost Software License, Version 1.0. +#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) diff --git a/historic/jam/src/debian/copyright b/historic/jam/src/debian/copyright index 4b4dcbfc8..f72e4e3a9 100644 --- a/historic/jam/src/debian/copyright +++ b/historic/jam/src/debian/copyright @@ -17,9 +17,9 @@ Copyright: Some portions are also: - Copyright 2001-2004 David Abrahams. - Copyright 2002-2005 Rene Rivera. - Copyright 2003-2005 Vladimir Prus. + Copyright 2001-2006 David Abrahams. + Copyright 2002-2006 Rene Rivera. + Copyright 2003-2006 Vladimir Prus. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) diff --git a/historic/jam/src/patchlevel.h b/historic/jam/src/patchlevel.h index a1a6df001..2dca9ccd2 100644 --- a/historic/jam/src/patchlevel.h +++ b/historic/jam/src/patchlevel.h @@ -9,9 +9,9 @@ #define VERSION_MAJOR 3 #define VERSION_MINOR 1 -#define VERSION_PATCH 12 +#define VERSION_PATCH 13 #define VERSION_MAJOR_SYM "03" #define VERSION_MINOR_SYM "1" -#define VERSION_PATCH_SYM "12" -#define VERSION "3.1.12" +#define VERSION_PATCH_SYM "13" +#define VERSION "3.1.13" #define JAMVERSYM "JAMVERSION=3.1"