Skip to content

Commit

Permalink
Add --newrelease to makebumpver
Browse files Browse the repository at this point in the history
This also moves Release handling into configure.ac which used to pull it
from anaconda.spec.in, it was always a 1 so move that into a place where
it can easily make the substitution for the new release value.
  • Loading branch information
bcl committed Mar 6, 2015
1 parent e659c89 commit 61f0488
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion anaconda.spec.in
Expand Up @@ -3,7 +3,7 @@
Summary: Graphical system installer
Name: anaconda
Version: @PACKAGE_VERSION@
Release: 1%{?dist}
Release: @PACKAGE_RELEASE@%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://fedoraproject.org/wiki/Anaconda
Expand Down
4 changes: 1 addition & 3 deletions configure.ac
Expand Up @@ -115,9 +115,7 @@ SHUT_UP_GCC="-Wno-unused-result"
# Add remaining compiler flags we want to use
CFLAGS="$CFLAGS -Wall -Werror $SHUT_UP_GCC"

# Get the release number from the spec file
rel="`awk '/Release:/ { split($2, r, "%"); print r[[1]] }' $srcdir/anaconda.spec.in`"
AC_SUBST(PACKAGE_RELEASE, [$rel])
AC_SUBST(PACKAGE_RELEASE, [1])

# Perform arch related tests
AC_CANONICAL_BUILD
Expand Down
17 changes: 12 additions & 5 deletions scripts/makebumpver
Expand Up @@ -72,6 +72,7 @@ class MakeBumpVer:
self.name = kwargs.get('name')
self.version = kwargs.get('version')
self.release = kwargs.get('release')
self.new_release = kwargs.get('new_release') or self.release
self.bugreport = kwargs.get('bugreport')
self.ignore = kwargs.get('ignore')

Expand Down Expand Up @@ -412,6 +413,9 @@ class MakeBumpVer:
newVersion,
self.bugreport)

i = l.index("AC_SUBST(PACKAGE_RELEASE, [1])\n")
l[i] = "AC_SUBST(PACKAGE_RELEASE, [%s])\n" % self.new_release

f = open(self.configure, 'w')
f.writelines(l)
f.close()
Expand All @@ -432,7 +436,7 @@ class MakeBumpVer:
today = datetime.date.today()
stamp = today.strftime("%a %b %d %Y")
f.write("* %s %s <%s> - %s-%s\n" % (stamp, self.gituser, self.gitemail,
newVersion, self.release))
newVersion, self.new_release))

for msg, rhbz in rpmlog:
msg = re.sub('(?<!%)%%(?!%)|(?<!%%)%(?!%%)', '%%', msg)
Expand Down Expand Up @@ -529,7 +533,7 @@ class MakeBumpVer:
log.warning("jenkins test results do not pass; ignoring for now")

newVersion = self._incrementVersion()
fixedIn = "%s-%s-%s" % (self.name, newVersion, self.release)
fixedIn = "%s-%s-%s" % (self.name, newVersion, self.new_release)
rpmlog = self._rpmLog(fixedIn)

self._writeNewConfigure(newVersion)
Expand All @@ -541,6 +545,7 @@ def usage(cmd):
sys.stdout.write(" -n, --name Package name.\n")
sys.stdout.write(" -v, --version Current package version number.\n")
sys.stdout.write(" -r, --release Package release number.\n")
sys.stdout.write(" --newrelease Value for release in the .spec file.\n")
sys.stdout.write(" -b, --bugreport Bug reporting email address.\n")
sys.stdout.write(" -i, --ignore Comma separated list of git commits to ignore.\n")
sys.stdout.write(" -m, --map Comma separated list of FEDORA_BZ=RHEL_BZ mappings.\n")
Expand All @@ -561,14 +566,14 @@ def main(argv):
configure = os.path.realpath(cwd + '/configure.ac')
spec = os.path.realpath(cwd + '/anaconda.spec.in')
zanata_config = os.path.realpath(cwd + '/zanata.xml')
name, version, release, bugreport = None, None, None, None
name, version, release, new_release, bugreport = None, None, None, None, None
ignore, bugmap = None, None
show_help, unknown, skip_acks, skip_all, skip_zanata, skip_jenkins = False, False, False, False, False, False
opts = []

try:
opts, _args = getopt.getopt(sys.argv[1:], 'n:v:r:b:i:m:sSd?',
['name=', 'version=', 'release=',
['name=', 'version=', 'release=', "newrelease=",
'bugreport=', 'ignore=', 'map=',
'debug', 'help', 'skip-zanata', 'skip-jenkins'])
except getopt.GetoptError:
Expand All @@ -581,6 +586,8 @@ def main(argv):
version = a
elif o in ('-r', '--release'):
release = a
elif o in ('--newrelease'):
new_release = a
elif o in ('-b', '--bugreport'):
bugreport = a
elif o in ('-i', '--ignore'):
Expand Down Expand Up @@ -634,7 +641,7 @@ def main(argv):
bugreport=bugreport, ignore=ignore, bugmap=bugmap,
configure=configure, spec=spec, skip_acks=skip_acks,
skip_all=skip_all, zanata_config=zanata_config, skip_zanata=skip_zanata,
skip_jenkins=skip_jenkins)
skip_jenkins=skip_jenkins, new_release=new_release)
mbv.run()

if __name__ == "__main__":
Expand Down

0 comments on commit 61f0488

Please sign in to comment.