automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] {maint} repo: don't commit generated files in the git reposi


From: Stefano Lattarini
Subject: Re: [PATCH] {maint} repo: don't commit generated files in the git repository anymore
Date: Fri, 9 Dec 2011 21:06:25 +0100
User-agent: KMail/1.13.7 (Linux/2.6.30-2-686; KDE/4.6.5; i686; ; )

Hi Jim.

On Friday 09 December 2011, Jim Meyering wrote:
>
> I would suggest to keep the generated files on a separate branch
> just for them (i.e., with no other content), and autogenerate, and
> auto-commit/push to that branch whenever a change in generated file is
> induced by a change on the primary branch.
>
> A lighter-weight and private tracking solution would be to do something
> like this, which I added to diffutils' cfg.mk (accidentally committed, it
> seems) almost two years ago.  This tracks changes to some autoconf-generated
> files and filters out predictable diffs:
> 
> _cf_state_dir ?= .config-state
> _date_time := $(shell date +%F.%T)
> config-compare:
>         diff -u                                 \
>           -I'define VERSION '                   \
>           -I'define PACKAGE_VERSION '           \
>           -I'define PACKAGE_STRING '            \
>           $(_cf_state_dir)/latest lib/config.h
>         diff -u                                 \
>           -I'$(PACKAGE_NAME)'                   \
>           -I'[SD]\["VERSION"\]'                 \
>           -I'[SD]\["PACKAGE_VERSION"\]'         \
>           -I'D\["PACKAGE_STRING"\]'             \
>           $(_cf_state_dir)/latest config.status
> 
> config-save:
>         $(MAKE) --quiet config-compare > /dev/null 2>&1 \
>           && { echo no change; exit 1; } || :
>         mkdir -p $(_cf_state_dir)/$(_date_time)
>         ln -nsf $(_date_time) $(_cf_state_dir)/latest
>         cp lib/config.h config.status $(_cf_state_dir)/latest
> 
I went for a middle-ground solution (sorta), by having the differences
generated on-the-fly.  This entails a decise slowdown, which is
however absolutely bearable even on my slow desktop.  See the attached
patch.

The code is a little more complicated than I'd like, but since this
is an optional, maintainer-only hack, with no impact on the build
system proper, that's not a big deal IMHO.

What I'm not satisfied with is the explanation of the change I've given
in the ChangeLog entry, which seems cumbersome and confusing.  But I
haven't been able to come up with anything better so far :-(

Comments and suggestions would be appreciated.

Thanks,
  Stefano
From dce238a8d8df8df97f9b7436aa64207583233369 Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Fri, 9 Dec 2011 18:46:54 +0100
Subject: [PATCH] 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, we won't be
able anymore to see with a simple "git diff" or "git log" if and
how a change in Automake reflects 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 had proved itself
quite useful in the past, often revealing inconsistencies and
blunders, and sometimes even bugs; so it would be a pity to loose
that altogether.

With this change, we add a new maintainer recipe that re-introduce
to a good degree such 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   |   18 +++++++++++++++
 Makefile.am |   69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5c07354..7bc6b00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2011-12-09  Stefano Lattarini  <address@hidden>
 
+       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, we won't be
+       able anymore to see with a simple "git diff" or "git log" if and
+       how a change in Automake reflects 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 had proved itself
+       quite useful in the past, often revealing inconsistencies and
+       blunders, and sometimes even bugs; so it would be a pity to loose
+       that altogether.
+       With this change, we add a new maintainer recipe that re-introduce
+       to a good degree such 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-09  Stefano Lattarini  <address@hidden>
+
        repo: don't commit generated files in the git repository anymore
        It has been quite some time since autoconf and libtool have stopped
        committing the generated autotools files in their git repositories,
diff --git a/Makefile.am b/Makefile.am
index 51eeb23..4e8d13e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -604,6 +604,75 @@ path-check: distdir
          rm -rf $(distdir); \
          exit $$estatus
 
+## Visually comparnig differences between the Makefile.in files in the
+## automake's own build system as generated in two different branches
+## might help to catch bugs and blunders.  This has already happened few
+## times in the past, when we used to keep the generated Makefile.in
+## committed into the automake's git repository.
+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; \
+        }; \
+        address@hidden \
+          && 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 out 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~/
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]