From maechler at lynne.stat.math.ethz.ch  Wed Jan 28 09:24:32 2015
From: maechler at lynne.stat.math.ethz.ch (Martin Maechler)
Date: Wed, 28 Jan 2015 09:24:32 +0100
Subject: [Rd] [PATCH v2] Makefile: add support for git svn clones
In-Reply-To: <1422297668-6552-1-git-send-email-balbi@kernel.org>
References: <1422297668-6552-1-git-send-email-balbi@kernel.org>
Message-ID: <21704.40128.132212.472548@stat.math.ethz.ch>

>>>>> Felipe Balbi <balbi at kernel.org>
>>>>>     on Mon, 26 Jan 2015 12:41:08 -0600 writes:

    > git has an interface for cloning SVN repositories into git
    > which some users might decide to use. For those users'
    > surprise, the repository will always fail to build on
    > svnonly target and it will exit early.

    > The problem is simple enough to fix by just checking if a
    > .git directory exists in top_builddir and, if so, call git
    > svn info insstead of svn info.

    > Note, however, that this only supports Linux (and possibly
    > Mac) users, as I have no means of writing/testing an
    > equivalent patch for the Windows Makefiles.

and your patch still contains changes to Makefile.win .. so we
can hope to have gone "there" at least part of the way.

Thank you, Felipe!

[ The patch was not quite ok, probably because being simply
  copy-pasted into the e-mail, e.g., it had
 '@@ -104,7 +107,7 @@ svnonly:'
 in one line instead of two ]

As promised, I've applied the patch and tested that it does
*not* break usual building from svn.

All other tests: Please, git lovers among us who have
decided to track the R development via 'git svn' instead of via 'svn':
 
Follow Felipe's quest (below) and test this... and if it does
not work, try to fix it for your platform and send patches and/or
further contact Felipe so he can do so.

Martin Maechler, ETH Zurich

    > Signed-off-by: Felipe Balbi <balbi at kernel.org>
    > ---

    > Due to lack of a Windows system, this has only been tested
    > on my linux box, if someone could give this a whirl on
    > windows and Mac OS X, I'd be really glad.

    > cheers


>  Makefile.in              | 5 ++++-
>  src/include/Makefile.win | 7 +++++--
>  2 files changed, 9 insertions(+), 3 deletions(-)

> diff --git a/Makefile.in b/Makefile.in
> index 44b0a3b4b99f..10415abd442b 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -9,6 +9,9 @@ top_builddir = .
 
>  include $(top_builddir)/Makeconf
 
> +GIT := `if [ -d "$(top_builddir)/.git" ]; then \
> +	echo "git"; fi`
> +
>  distdir = $(PACKAGE)-$(VERSION)
>  INSTFILES = COPYING
>  NON_SVN_INSTFILES = SVN-REVISION
> @@ -104,7 +107,7 @@ svnonly:
>  	@if test ! -f "$(srcdir)/doc/FAQ" || test -f non-tarball ; then \
>  	  (cd doc/manual && $(MAKE) front-matter html-non-svn) ; \
>  	  touch non-tarball ; \
> -	  (cd $(srcdir); LC_ALL=C TZ=GMT svn info || $(ECHO) "Revision: -99") 2> /dev/null \
> +	  (cd $(srcdir); LC_ALL=C TZ=GMT $(GIT) svn info || $(ECHO) "Revision: -99") 2> /dev/null \
>  	    | sed -n -e '/^Revision/p' -e '/^Last Changed Date/'p \
>  	    | cut -d' ' -f1,2,3,4 > SVN-REVISION-tmp ; \
>  	  if test "`cat SVN-REVISION-tmp`" = "Revision: -99"; then \
> diff --git a/src/include/Makefile.win b/src/include/Makefile.win
> index 28361ef9cfa3..d81941f80f4f 100644
> --- a/src/include/Makefile.win
> +++ b/src/include/Makefile.win
> @@ -2,6 +2,9 @@
>  include ../gnuwin32/MkRules
>  R_HOME = ../..
 
> +GIT := `if [ -d "$(top_builddir)/.git" ]; then \
> +	echo "git"; fi`
> +
>  VER = $(shell sed -e 's/\([^ ]*\).*/\1/' ../../VERSION)
 
>  ## keep these in step with ./Makefile.in
> @@ -67,14 +70,14 @@ ifdef USE_SVNVERSION
>  	@LC_ALL=C svnversion ../.. | sed -n 's/^/Revision: /p' > svn-tmp || rm -f svn-tmp
>  	@grep -v exported svn-tmp > /dev/null || rm -f svn-tmp
>  else
> -	@(cd ../..; LC_ALL=C svn info || echo "Revision: unknown") 2> /dev/null \
> +	@(cd ../..; LC_ALL=C $(GIT) svn info || echo "Revision: unknown") 2> /dev/null \
>  	  | sed -n '/^Revision/p' > svn-tmp
>  	@if grep unknown svn-tmp > /dev/null ; then \
>  	  rm svn-tmp; \
>  	fi
>  endif
>  	@if test -f svn-tmp ; then \
> -	  (cd ../..; LC_ALL=C TZ=GMT svn info || echo "Last Changed Date: unknown") 2> /dev/null \
> +	  (cd ../..; LC_ALL=C TZ=GMT $(GIT) svn info || echo "Last Changed Date: unknown") 2> /dev/null \
>  	    | sed -n '/^Last Changed Date:/p' | sed 's/[0-9][0-9]:.*//' \
>  	    >> svn-tmp ; \
>  	else \
> -- 
> 2.3.0-rc1



[Rd] [PATCH v2] Makefile: add support for git svn clones
Martin Maechler