Fix the changelog script to work in MonkeyWrench
authorAndrew Jorgensen <ajorgensen@novell.com>
Thu, 26 Aug 2010 18:38:00 +0000 (12:38 -0600)
committerAndrew Jorgensen <ajorgensen@novell.com>
Thu, 26 Aug 2010 19:29:23 +0000 (13:29 -0600)
* Makefile.am: Check for GIT_DIR if defined (rather than .git)
* commits-to-changelog.py: BUILD_REVISION rather than HEAD if defined

Makefile.am
scripts/commits-to-changelog.py

index 1a75a567d737fad67b9512e090c92d24ede2c3d2..0017405ca5a5c5937e8e74960040a95988e2b92d 100644 (file)
@@ -24,10 +24,11 @@ EXTRA_DIST= nls.m4 po.m4 progtest.m4 mono-uninstalled.pc.in build-mingw32.sh LIC
 DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
 
 # Distribute the 'mcs' tree too
+GIT_DIR ?= $(srcdir)/.git
 dist-hook:
        test -d $(distdir)/mcs || mkdir $(distdir)/mcs
        d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) distdir=$$d dist-recursive
-       test ! -d .git || ./scripts/commits-to-changelog.py --root=$(distdir) last-commit-with-compulsory-changelog-entry
+       test ! -d $(GIT_DIR) || ./scripts/commits-to-changelog.py --root=$(distdir) last-commit-with-compulsory-changelog-entry
 
 pkgconfigdir = $(libdir)/pkgconfig
 noinst_DATA = mono-uninstalled.pc
index 8d30a4abe2fd1f6ea70b37000485a9e266b5683d..c95f230e7d5d74fcd08fb77a52386ca5acce0d09 100755 (executable)
@@ -247,18 +247,24 @@ def main ():
         global path_to_root
         path_to_root = options.root + "/"
 
+    # MonkeyWrench uses a shared git repo but sets BUILD_REVISION,
+    # if present we use it instead of HEAD
+    HEAD = "HEAD"
+    if 'BUILD_REVISION' in os.environ:
+        HEAD = os.environ['BUILD_REVISION']
+
     #see if git supports %B in --format
-    output = git ("log", "-n1", "--format=%B", "HEAD")
+    output = git ("log", "-n1", "--format=%B", HEAD)
     if output.startswith ("%B"):
         print >> sys.stderr, "Error: git doesn't support %B in --format - install version 1.7.2 or newer"
         exit (1)
 
-    for filename in git ("ls-tree", "-r", "--name-only", "HEAD").splitlines ():
+    for filename in git ("ls-tree", "-r", "--name-only", HEAD).splitlines ():
         if re.search ("(^|/)Change[Ll]og$", filename):
             (path, name) = os.path.split (filename)
             all_changelogs [path] = name
 
-    commits = git ("rev-list", "--no-merges", "HEAD", "^%s" % start_commit).splitlines ()
+    commits = git ("rev-list", "--no-merges", HEAD, "^%s" % start_commit).splitlines ()
 
     touched_changelogs = {}
     for commit in commits: