diff options
Diffstat (limited to 'tools/export.py')
-rwxr-xr-x | tools/export.py | 132 |
1 files changed, 57 insertions, 75 deletions
diff --git a/tools/export.py b/tools/export.py index 5cd0d5c41..dc2878e3e 100755 --- a/tools/export.py +++ b/tools/export.py @@ -136,8 +136,7 @@ E.G. 1.2.0pre1 is a valid version. tarname = '/tmp/%s-%s.tar.gz' % (pkgname, version) - newchangelog = \ -"""bcfg2 (%s-0.0) unstable; urgency=low + newchangelog = """bcfg2 (%s-0.0) unstable; urgency=low * New upstream release @@ -164,56 +163,6 @@ E.G. 1.2.0pre1 is a valid version. print(help_message) quit() - if version_info['build'] == '': - rpmchangelog = ["* %s %s <%s> %s-1\n" % - (datetime.datetime.now().strftime("%a %b %d %Y"), - name, email, version_release), - "- New upstream release\n", "\n"] - else: - rpmchangelog = ["* %s %s <%s> %s-0.%s.%s\n" % - (datetime.datetime.now().strftime("%a %b %d %Y"), - name, email, version_release, - version_info['build'][-1], version_info['build']), - "- New upstream release\n", "\n"] - - # write out the new RPM changelog - specs = ["misc/bcfg2.spec", "misc/bcfg2-selinux.spec", "redhat/bcfg2.spec.in"] - if options.dryrun: - print("*** Add the following to the top of the %%changelog section in %s:\n%s\n" - % (rpmchangelog, " and ".join(specs))) - else: - for fname in specs: - try: - lines = open(fname).readlines() - for lineno in range(len(lines)): - if lines[lineno].startswith("%changelog"): - break - else: - print("No %changelog section found in %s" % fname) - continue - for line in reversed(rpmchangelog): - lines.insert(lineno + 1, line) - open(fname, 'w').write("".join(lines)) - except: - err = sys.exc_info()[1] - print("Could not write %s: %s" % (fname, err)) - print(help_message) - quit() - - # Update redhat directory versions - if options.dryrun: - print("*** Replace redhat/VERSIONS content with '%s'." - % version_release) - print("*** Replace redhat/RELEASE content with '%s'." - % version_info['build']) - else: - with open('redhat/VERSION', 'w') as f: - f.write("%s\n" % version_release) - f.close() - with open('redhat/RELEASE', 'w') as f: - f.write("0.0%s\n" % version_info['build']) - f.close() - # update solaris version find_and_replace('solaris/Makefile', 'VERS=', 'VERS=%s-1\n' % version, @@ -228,14 +177,28 @@ E.G. 1.2.0pre1 is a valid version. startswith=True, dryrun=options.dryrun) # update solaris IPS version - find_and_replace('solaris-ips/MANIFEST.bcfg2.header', 'set name=pkg.fmri value="pkg://bcfg2/bcfg2@', - 'set name=pkg.fmri value="pkg://bcfg2/bcfg2@%s"' % version, - startswith=True, - dryrun=options.dryrun) - find_and_replace('solaris-ips/MANIFEST.bcfg2-server.header', 'set name=pkg.fmri value="pkg://bcfg2/bcfg2-server@', - 'set name=pkg.fmri value="pkg://bcfg2/bcfg2-server@%s"' % version, - startswith=True, - dryrun=options.dryrun) + find_and_replace('solaris-ips/Makefile', 'VERS=', + 'VERS=%s-1\n' % version, + startswith=True, + dryrun=options.dryrun) + find_and_replace('solaris-ips/MANIFEST.bcfg2.header', + 'set name=pkg.fmri value="pkg://bcfg2/bcfg2@', + 'set name=pkg.fmri value="pkg://bcfg2/bcfg2@%s"\n' % version, + startswith=True, + dryrun=options.dryrun) + find_and_replace('solaris-ips/MANIFEST.bcfg2-server.header', + 'set name=pkg.fmri value="pkg://bcfg2/bcfg2-server@', + 'set name=pkg.fmri value="pkg://bcfg2/bcfg2-server@%s"\n' % version, + startswith=True, + dryrun=options.dryrun) + find_and_replace('solaris-ips/pkginfo.bcfg2', 'VERSION=', + 'VERSION="%s"\n' % version, + startswith=True, + dryrun=options.dryrun) + find_and_replace('solaris-ips/pkginfo.bcfg2-server', 'VERSION=', + 'VERSION="%s"\n' % version, + startswith=True, + dryrun=options.dryrun) # set new version in Bcfg2/version.py find_and_replace('src/lib/Bcfg2/version.py', '__version__ =', @@ -248,40 +211,59 @@ E.G. 1.2.0pre1 is a valid version. find_and_replace('misc/bcfg2-selinux.spec', 'Version:', 'Version: %s\n' % version_release, dryrun=options.dryrun) - if version_info['build'] == '': - find_and_replace('misc/bcfg2.spec', 'Release: ', - 'Release: 1\n', + if version_info['build'].startswith('rc'): + find_and_replace('misc/bcfg2.spec', 'global _rc ', + '%%global _rc %s\n' % version_info['build'], dryrun=options.dryrun) - find_and_replace('misc/bcfg2-selinux.spec', 'Release: ', - 'Release: 1\n', + find_and_replace('misc/bcfg2-selinux.spec', 'global _rc ', + '%%global _rc %s\n' % version_info['build'], + dryrun=options.dryrun) + elif version_info['build'].startswith('pre'): + find_and_replace('misc/bcfg2.spec', 'global _pre ', + '%%global _pre %s\n' % version_info['build'], + dryrun=options.dryrun) + find_and_replace('misc/bcfg2-selinux.spec', 'global _pre ', + '%%global _pre %s\n' % version_info['build'], dryrun=options.dryrun) else: + # comment out pre/rc + find_and_replace('misc/bcfg2.spec', 'global _pre ', + '#%%global _pre 2\n', + dryrun=options.dryrun) + find_and_replace('misc/bcfg2-selinux.spec', 'global _pre ', + '#%%global _pre 2\n', + dryrun=options.dryrun) + find_and_replace('misc/bcfg2.spec', 'global _rc ', + '#%%global _rc 1\n', + dryrun=options.dryrun) + find_and_replace('misc/bcfg2-selinux.spec', 'global _rc ', + '#%%global _rc 1\n', + dryrun=options.dryrun) + find_and_replace('misc/bcfg2.spec', 'Release: ', - 'Release: 0.%s.%s\n' % - (version_info['build'][-1], version_info['build']), + 'Release: 1%{?_pre_rc}%{?dist}\n', + startswith=True, dryrun=options.dryrun) find_and_replace('misc/bcfg2-selinux.spec', 'Release: ', - 'Release: 0.%s.%s\n' % - (version_info['build'][-1], version_info['build']), + 'Release: 1%{?_pre_rc}%{?dist}\n', + startswith=True, dryrun=options.dryrun) find_and_replace('misc/bcfg2.spec', '%setup', - '%%setup -q -n %%{name}-%%{version}%s\n' % - version_info['build'], + '%setup -q -n %{name}-%{version}%{?_pre_rc}\n', startswith=True, dryrun=options.dryrun) find_and_replace('misc/bcfg2-selinux.spec', '%setup', - '%%setup -q -n %%{name}-%%{version}%s\n' % - version_info['build'], + '%setup -q -n %{name}-%{version}%{?_pre_rc}\n', startswith=True, dryrun=options.dryrun) find_and_replace('misc/bcfg2.spec', 'BuildRoot', 'BuildRoot: %%{_tmppath}/%%{name}-%%{version}%s-%%{release}-root-%%(%%{__id_u} -n)\n' % - version_info['build'], + version_info['build'], startswith=True, dryrun=options.dryrun) find_and_replace('misc/bcfg2-selinux.spec', 'BuildRoot', 'BuildRoot: %%{_tmppath}/%%{name}-%%{version}%s-%%{release}-root-%%(%%{__id_u} -n)\n' % - version_info['build'], + version_info['build'], startswith=True, dryrun=options.dryrun) # fix pre problem noted in |