build: rework prepare-minor-release bits to handle srcdir != builddir
authorColin Walters <walters@verbum.org>
Mon, 25 Jul 2011 21:20:36 +0000 (17:20 -0400)
committerColin Walters <walters@verbum.org>
Wed, 27 Jul 2011 13:12:16 +0000 (09:12 -0400)
Makefile.am
tools/verbump.py

index 29aee3292d8ea2369a394edaf20436dd0c44ad72..4029d658d37f658689ba64d53cd80575036c3d58 100644 (file)
@@ -55,22 +55,6 @@ EXTRA_DIST +=                        \
        misc/pre-commit         \
        misc/pyflakes.py
 
-prepare-release-tag: Makefile
-       @TAG=`echo $(VERSION)|sed s/\\\./_/g`;\
-         echo "git tag GOBJECT_INTROSPECTION_$$TAG"; \
-          git tag -m "Tag $$VERSION" -a \
-              GOBJECT_INTROSPECTION_$$TAG
-
-prepare-minor-release: Makefile $(distdir).tar.bz2 prepare-release-tag
-       python $(top_srcdir)/tools/verbump.py
-
-upload-release: $(distdir).tar.bz2
-       git log origin/master..master
-       @echo -n "Ok to push? [y/N] "; read ans; test x$$ans == xy || exit 1
-       git push --tags origin master:master
-       scp $(distdir).tar.bz2 master.gnome.org:
-       ssh master.gnome.org install-module $(distdir).tar.bz2
-
 check-local:
        gtester --verbose $(GTESTER_PROGS)
        @test ! -d $(top_srcdir)/.git || (test -f .git/hooks/pre-commit || (echo -e "ERROR: missing \
@@ -83,3 +67,38 @@ check-local:
 check-pyflakes:
        @echo "  CHECK Pyflakes"
        @find $(top_srcdir)/giscanner -name \*.py | sort | uniq | xargs $(PYTHON) $(top_srcdir)/misc/pyflakes.py
+
+
+# Colin's handy Makefile bits for:
+# 1) stuffing tarballs with pre-generated scripts from your workstation
+# 2) bumping configure.ac version post-release
+# 3) tagging correctly in git
+# 4) uploading to gnome.org
+# To use:
+#  $ make check
+#  $ make dist
+#  $ make prepare-minor-release
+
+# Customize to taste
+TAG_PREFIX=GOBJECT_INTROSPECTION_
+COMPRESSION=.bz2
+
+
+PACKAGE=@PACKAGE@
+VERSION=@VERSION@
+DISTNAME=$(PACKAGE)-$(VERSION).tar$(COMPRESSION)
+TAG_VERSION=$(shell echo $(VERSION) |sed s/\\\./_/g)
+
+prepare-release-tag: Makefile.release
+       git tag -m "Tag $(TAG_VERSION)" -a $(TAG_PREFIX)$(TAG_VERSION)
+
+prepare-minor-release: $(DISTNAME) prepare-release-tag
+       env top_srcdir=$(top_srcdir) python $(top_srcdir)/tools/verbump.py
+
+upload-release: $(DISTNAME)
+       git log origin/master..master
+       @echo -n "Ok to push? [y/N] "; read ans; test x$$ans == xy || exit 1
+       git push --tags origin master:master
+       scp $(DISTNAME) master.gnome.org:
+       ssh master.gnome.org install-module $(DISTNAME)
+
index 4e3837292b748b100d0b79379b57d85c03671558..0c7d593fb45041c65629d577aa478ca55da21212 100644 (file)
@@ -25,8 +25,9 @@ if not os.path.isfile('config.log'):
 package = _extract_config_log_variable('PACKAGE_TARNAME')
 version = _extract_config_log_variable('VERSION')
 
-f = open('configure.ac');
-newf = open('configure.ac.new', 'w')
+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:
@@ -38,9 +39,9 @@ for line in f:
   newf.write(micro_version_replace % (newv, ))
 newf.close()
 
-os.rename('configure.ac.new', 'configure.ac')
+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.ac']
+args=['git', 'commit', '-m', "configure: Post-release version bump", configure_path]
 print "Running: %r" % (args, )
 subprocess.check_call(args)