summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2015-04-21 17:01:15 +0200
committerDieter Verfaillie <dieterv@optionexplicit.be>2015-06-29 16:54:29 +0200
commit87b047cabacfadc3fa04b541ab6d57ff50dbcba8 (patch)
treeab5ab71f79c771e520ae3e380d82b60adf0d529e /misc
parent7e0014607513fc335f96baf9408cdeb6d29c1375 (diff)
downloadgobject-introspection-87b047cabacfadc3fa04b541ab6d57ff50dbcba8.tar.gz
tools: move verbump.py from tools to misc...
... so it lives next to the rest of the maintainer utilities.
Diffstat (limited to 'misc')
-rw-r--r--misc/verbump.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/misc/verbump.py b/misc/verbump.py
new file mode 100644
index 00000000..0c7d593f
--- /dev/null
+++ b/misc/verbump.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# Automakes a release preparation for a post-release project
+# * Create a git tag
+# * Bump version in configure.ac and commit it
+
+import re
+import os
+import sys
+import subprocess
+
+micro_version_re = re.compile('m4_define.*gi_micro_version, ([0-9]+)')
+micro_version_replace = 'm4_define(gi_micro_version, %d)\n'
+
+def _extract_config_log_variable(name):
+ f = open('config.log')
+ keystart = name + '=\''
+ for line in f:
+ if line.startswith(keystart):
+ return line[len(keystart):-2]
+ f.close()
+ fatal("Failed to find '%s' in config.status" % (name, ))
+
+if not os.path.isfile('config.log'):
+ fatal("Couldn't find config.log; did you run configure?")
+package = _extract_config_log_variable('PACKAGE_TARNAME')
+version = _extract_config_log_variable('VERSION')
+
+configure_path=os.path.join(os.environ['top_srcdir'], 'configure.ac')
+f = open(configure_path)
+newf = open(configure_path + '.tmp', 'w')
+for line in f:
+ m = micro_version_re.match(line)
+ if not m:
+ newf.write(line)
+ continue
+ v = int(m.group(1))
+ newv = v+1
+ print "Will update micro version from %s to %s" % (v, newv)
+ newf.write(micro_version_replace % (newv, ))
+newf.close()
+
+os.rename(configure_path + '.tmp', configure_path)
+print "Successfully wrote new 'configure.ac' with post-release version bump"
+
+args=['git', 'commit', '-m', "configure: Post-release version bump", configure_path]
+print "Running: %r" % (args, )
+subprocess.check_call(args)