From 6c4f30ab28d8200239350242b545c1021cb084d5 Mon Sep 17 00:00:00 2001 From: Raul Cuza Date: Tue, 5 Jul 2011 23:55:47 -0400 Subject: Finish converting find_and_replace calls to use dryrun argument. Set default value to false. Made the find_and_replace calls multilined. --- tools/export2.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'tools/export2.py') diff --git a/tools/export2.py b/tools/export2.py index 25ac8335e..0b8cc159d 100755 --- a/tools/export2.py +++ b/tools/export2.py @@ -33,7 +33,7 @@ ftpdir = '/mcs/ftp/pub/bcfg' def run(command): return Popen(command, shell=True, stdout=PIPE).communicate() -def find_and_replace(f, iftest, rline, startswith=False, dryrun=True): +def find_and_replace(f, iftest, rline, startswith=False, dryrun=False): if dryrun: inplace=0 print "*** dry-run: New '%s' will look like this:" % f @@ -144,24 +144,37 @@ def main(argv=None): # update solaris version find_and_replace('solaris/Makefile', 'VERS=', - 'VERS=%s-1\n' % version, startswith=True) + 'VERS=%s-1\n' % version, + startswith=True, + dryrun=options.dryrun) find_and_replace('solaris/pkginfo.bcfg2', 'VERSION=', - 'VERSION="%s"\n' % version, startswith=True) + 'VERSION="%s"\n' % version, + startswith=True, + dryrun=options.dryrun) find_and_replace('solaris/pkginfo.bcfg2-server', 'VERSION=', - 'VERSION="%s"\n' % version, startswith=True) + 'VERSION="%s"\n' % version, + startswith=True, + dryrun=options.dryrun) # set new version in setup.py - find_and_replace('setup.py', 'version=', ' version="%s",\n' % version) + find_and_replace('setup.py', 'version=', ' version="%s",\n' % version, + dryrun=options.dryrun) # replace version in misc/bcfg2.spec find_and_replace('misc/bcfg2.spec', 'Version:', - 'Version: %s\n' % version) + 'Version: %s\n' % version, + dryrun=options.dryrun) # update the version in reports find_and_replace('src/lib/Server/Reports/reports/templates/base.html', - 'Bcfg2 Version', ' Bcfg2 Version %s\n' % version) + 'Bcfg2 Version', ' Bcfg2 Version %s\n' % version, + dryrun=options.dryrun) # update the version in the docs find_and_replace('doc/conf.py', 'version =', - 'version = \'%s\'\n' % majorver[0:3], startswith=True) + 'version = \'%s\'\n' % majorver[0:3], + startswith=True, + dryrun=options.dryrun) find_and_replace('doc/conf.py', 'release =', - 'release = \'%s\'\n' % (majorver), startswith=True) + 'release = \'%s\'\n' % (majorver), + startswith=True, + dryrun=options.dryrun) # tag the release #FIXME: do this using python-dulwich -- cgit v1.2.3-1-g7c22