]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
devel: help in comparing Makefile.in from different commits
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 9 Dec 2011 17:46:54 +0000 (18:46 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 22 Dec 2011 11:55:50 +0000 (12:55 +0100)
Now that the generated Makefile.in, configure and aclocal.m4 files
are no longer committed in Automake's git repository, a simple
"git diff" or "git log" no longer shows if and how a change in
Automake results in changes to the Makefile.in files and/or
configure script of its own build system.  Still, the ability to
peek so easily at such differences has proved itself quite useful
in the past, often revealing inconsistencies and blunders, and
sometimes even bugs; so it would be a pity to lose that altogether.

With this change, we add a new maintainer recipe that re-introduces
much of that capability, by generating and comparing on the fly the
Makefile.in, configure and aclocal.m4 derived from two arbitrary
commits of the Automake repository.

* Makefile.am (autodiffs, compare-autodiffs): New phony targets.

ChangeLog
Makefile.am

index 4fbdef125529cd69edf0412dc33eeace3801482d..44c4444a2b667999dcaef5905822fdc12a15347d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2011-12-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       devel: help in comparing Makefile.in from different commits
+       Now that the generated Makefile.in, configure and aclocal.m4 files
+       are no longer committed in Automake's git repository, a simple
+       "git diff" or "git log" no longer shows if and how a change in
+       Automake results in changes to the Makefile.in files and/or
+       configure script of its own build system.  Still, the ability to
+       peek so easily at such differences has proved itself quite useful
+       in the past, often revealing inconsistencies and blunders, and
+       sometimes even bugs; so it would be a pity to lose that altogether.
+       With this change, we add a new maintainer recipe that re-introduces
+       much of that capability, by generating and comparing on the fly the
+       Makefile.in, configure and aclocal.m4 derived from two arbitrary
+       commits of the Automake repository.
+       * Makefile.am (autodiffs, compare-autodiffs): New phony targets.
+
 2011-12-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        repo: don't commit generated files in the git repository anymore
index d0dc846d4893eb7206a0dff5b889c0420e93dbd5..b29092510c079682585d9c77ad6627892a84b7ef 100644 (file)
@@ -606,6 +606,75 @@ path-check: distdir
          rm -rf $(distdir); \
          exit $$estatus
 
+## Visually comparing differences between the Makefile.in files in
+## automake's own build system as generated in two different branches
+## might help to catch bugs and blunders.  This has already happened a
+## few times in the past, when we used to version-control Makefile.in.
+autodiffs:
+       @set -u; \
+        NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
+        OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
+        am_gitdir='$(abs_top_srcdir)/.git'; \
+        get_autofiles_from_rev () \
+        { \
+            rev=$$1 dir=$$2 \
+              && echo "$@: will get files from revision $$rev" \
+              && git clone -q --depth 1 "$$am_gitdir" tmp \
+              && cd tmp \
+              && git checkout -q "$$rev" \
+              && echo "$@: bootstrapping $$rev" \
+              && $(SHELL) ./bootstrap \
+              && echo "$@: copying files from $$rev" \
+              && makefile_ins=`find . -name Makefile.in` \
+              && (tar cf - configure aclocal.m4 $$makefile_ins) | \
+                 (cd .. && cd "$$dir" && tar xf -) \
+              && cd .. \
+              && rm -rf tmp; \
+        }; \
+        outdir=$@.dir \
+## Before proceeding, ensure the specified revisions truly exist.
+          && git --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
+          && git --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
+          && rm -rf $$outdir \
+          && mkdir $$outdir \
+          && cd $$outdir \
+          && mkdir new old \
+          && get_autofiles_from_rev $$OLD_COMMIT old \
+          && get_autofiles_from_rev $$NEW_COMMIT new \
+          && exit 0
+## With lots of eye candy; we like our developers pampered and spoiled :-)
+compare-autodiffs: autodiffs
+       @set -u; \
+       : $${COLORDIFF=colordiff} $${DIFF=diff}; \
+       dir=autodiffs.dir; \
+       if test ! -d "$$dir"; then \
+         echo "$@: $$dir: Not a directory" >&2; \
+         exit 1; \
+       fi; \
+       mydiff=false mypager=false; \
+       if test -t 1; then \
+         if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
+           mydiff=$$COLORDIFF; \
+           mypager="less -R"; \
+         else \
+           mypager=less; \
+         fi; \
+       else \
+         mypager=cat; \
+       fi; \
+       if test "$$mydiff" = false; then \
+         if ($$DIFF -r -u . .); then \
+           mydiff=$$DIFF; \
+         else \
+           echo "$@: no good-enough diff program specified" >&2; \
+           exit 1; \
+         fi; \
+       fi; \
+       st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
+       rm -rf $$dir; \
+       exit $$st
+.PHONY: autodiffs compare-autodiffs
+
 ## Program to use to fetch files.
 WGET = wget
 WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/