From 625ba3bbe8fbf7471bd179f5c3e01ef7e444651c Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Wed, 6 Nov 2013 14:13:56 -0600 Subject: export: Fix pre/rc behavior for spec files Signed-off-by: Sol Jerome --- tools/export.py | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'tools') diff --git a/tools/export.py b/tools/export.py index 8e90b8766..6cd36a9b6 100755 --- a/tools/export.py +++ b/tools/export.py @@ -248,32 +248,49 @@ 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', - startswith=True, + 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', - startswith=True, + 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', -- cgit v1.2.3-1-g7c22