r22982 - gnucash/trunk - Add code to generate ChangeLog from git

Geert Janssens gjanssens at code.gnucash.org
Fri May 17 06:10:38 EDT 2013


Author: gjanssens
Date: 2013-05-17 06:10:37 -0400 (Fri, 17 May 2013)
New Revision: 22982
Trac: http://svn.gnucash.org/trac/changeset/22982

Modified:
   gnucash/trunk/Makefile.am
   gnucash/trunk/configure.ac
Log:
Add code to generate ChangeLog from git

This code will determine the repo type (git or svn) and use the
appropriate command to generate the ChangeLog file accordingly.

Modified: gnucash/trunk/Makefile.am
===================================================================
--- gnucash/trunk/Makefile.am	2013-05-15 14:24:52 UTC (rev 22981)
+++ gnucash/trunk/Makefile.am	2013-05-17 10:10:37 UTC (rev 22982)
@@ -183,8 +183,10 @@
 
 .potfiles:
 
+GIT_CMD = @GIT_CMD@
 SVN = svn
 XSLTPROC = xsltproc
+SCM_TYPE = @SCM_TYPE@
 
 if BUILDING_FROM_SCM
 # This rule will generate a ChangeLog of gnucash/trunk commits, plus
@@ -193,9 +195,20 @@
 # idea? Before a release, NEWS will get updated because of the version
 # change, so this should fit just fine.)
 ChangeLog: NEWS
-	$(SVN) log -v --xml -r HEAD:22687 http://svn.gnucash.org/repo/gnucash | \
-	  $(XSLTPROC) --stringparam strip-prefix "gnucash/trunk" \
-	  --stringparam include-rev "yes" $(srcdir)/macros/svn2cl.xsl - > $@
+	cd $(abs_srcdir) ; \
+	if test x$(SCM_TYPE) = xsvn ; then \
+	  $(SVN) log -v --xml -r HEAD:'{2013-01-01}' http://svn.gnucash.org/repo/gnucash | \
+	    $(XSLTPROC) --stringparam strip-prefix "gnucash/trunk" \
+	    --stringparam include-rev "yes" $(abs_srcdir)/macros/svn2cl.xsl - > $(abs_builddir)/$@ ; \
+	else \
+	  if test x$(SCM_TYPE) = xgit ; then \
+	    "$(GIT_CMD)" log --format="%ad %aN %n%n%x09* %s%d%n" --date=short --since=2013-01-01 > $(abs_builddir)/$@ ; \
+	  else \
+	    touch $(abs_builddir)/$@ ; \
+	    echo "Note: not in svn or git. ChangeLog not regenerated." ; \
+	  fi ; \
+	fi ; \
+	cd $(abs_builddir)
 endif
 
 ASTYLE = /usr/bin/astyle

Modified: gnucash/trunk/configure.ac
===================================================================
--- gnucash/trunk/configure.ac	2013-05-15 14:24:52 UTC (rev 22981)
+++ gnucash/trunk/configure.ac	2013-05-17 10:10:37 UTC (rev 22982)
@@ -175,15 +175,35 @@
 fi
 
 # test whether we are building directly from svn/svk/git/bzr
-${srcdir}/util/gnc-scm-info -r ${srcdir} >/dev/null 2>&1
+AC_MSG_CHECKING(if building from an scm managed directory)
+GIT_CMD=
+savedir="$PWD"
+cd "${srcdir}"
+./util/gnc-scm-info -r . >/dev/null 2>&1
 if test $? = 0 -o "x${BUILDING_FROM_SCM}" = "xyes" ; then
   BUILDING_FROM_SCM=yes
+  SCM_TYPE=$(./util/gnc-scm-info -t .)
+  AC_MSG_RESULT($SCM_TYPE)
 
+  if test "x${SCM_TYPE}" = "xgit"; then
+    AC_MSG_CHECKING(git command to use due to detected git repo)
+    # The windows build uses environment variable $GIT_CMD to invoke git (adding git
+    # to the PATH in Windows results in a build failure).
+    # So for platform independence, use GIT_CMD for all
+    if test -z "${GIT_CMD}" ; then
+      GIT_CMD=git
+    fi
+    AC_MSG_RESULT(${GIT_CMD})
+  fi
+
   # We need at least version 1.3.31 of SWIG because
   # that's when SWIG doesn't barf on the "inline" keyword in C headers anymore
   AC_PROG_SWIG(1.3.31)
 else
+  AC_MSG_RESULT(no)
   BUILDING_FROM_SCM=no
+  SCM_TYPE=
+
   # Make sure we've got swig-runtime.h and gnc-scm-info.h
   AC_CHECK_FILE(${srcdir}/src/swig-runtime.h, [],
     [AC_MSG_ERROR([
@@ -206,7 +226,10 @@
 
     ])])
 fi
+cd "${savedir}"
 AM_CONDITIONAL(BUILDING_FROM_SCM, test "x$BUILDING_FROM_SCM" = "xyes")
+AC_SUBST(SCM_TYPE)
+AC_SUBST(GIT_CMD)
 
 # Build dir adjustments
 AM_CONDITIONAL(GNUCASH_SEPARATE_BUILDDIR, test "x${srcdir}" != "x.")



More information about the gnucash-changes mailing list