Hello Ralf and all,

[sorry for the delay, I forgot this in my "postponed" folder]

On Fri, Nov 10, 2006 at 01:35:54PM +0100, Ralf Wildenhues wrote:
> * Stepan Kasal wrote on Fri, Nov 10, 2006 at 12:40:18PM CET:
> > [...]  So it seems that distcheck would
> > catch more bugs if `_build' were not a subdirectory of the expanded
> > tarball tree.
> 
> It would possibly catch a different set of bugs.  There isn't a strict
> inclusion ordering on the set of all imaginable bugs; maybe if bugs are
> weighted by the likelihood by which they happen, I haven't looked into
> that enough.

When srcdir is ".." (or "../.." or some such), it represents a
relative path which is valid in many places.

So it is possible that the relative path would be applied to a wrong
place, probably because of the VPATH mechanism.
This can mask an error, as we observed in this thread.
OTOH, this could discover another type of error in the build scripts
of the package; I cannot imagine an actual example, but I admit it is
possible.
But I think that the former case is more common, and thus the
disadvantage overweight the advantage.

If the srcdir is "../_dist/$(distdir)" or some such, it is not
probable that it would apply relatively to a wrong directory.

Would you accept the patch attached below?

Stepan Kasal
2006-12-05  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/am/distdir.am (distcheck): Move the srcdir below
        `$(distdir)/_dist', so that `_build' and `_inst' are not
        below it.

        * tests/insthook.test: Do not depend on the actual
        implementation of `distcheck'.

Index: lib/am/distdir.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/distdir.am,v
retrieving revision 1.69
diff -u -r1.69 distdir.am
--- lib/am/distdir.am   15 Oct 2006 16:37:22 -0000      1.69
+++ lib/am/distdir.am   5 Dec 2006 18:31:05 -0000
@@ -315,26 +315,25 @@
 # tarfile.
 .PHONY: distcheck
 distcheck: dist
-       case '$(DIST_ARCHIVES)' in \
+       mkdir $(distdir)
+       mkdir $(distdir)/_dist
+       $(am__cd) $(distdir)/_dist && case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+         GZIP=$(GZIP_ENV) gunzip -c ../../$(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
-         bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+         bunzip2 -c ../../$(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.Z*) \
-         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+         uncompress -c ../../$(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+         GZIP=$(GZIP_ENV) gunzip -c ../../$(distdir).shar.gz | unshar ;;\
        *.zip*) \
-         unzip $(distdir).zip ;;\
+         unzip ../../$(distdir).zip ;;\
        esac
 ## Make the new source tree read-only.  Distributions ought to work in
-## this case.  However, make the top-level directory writable so we
-## can make our new subdirs.
-       chmod -R a-w $(distdir); chmod a+w $(distdir)
+## this case.
+       chmod -R a-w $(distdir)/_dist
        mkdir $(distdir)/_build
        mkdir $(distdir)/_inst
-## Undo the write access.
-       chmod a-w $(distdir)
 ## Compute the absolute path of `_inst'.  Strip any leading DOS drive
 ## to allow DESTDIR installations.  Otherwise "$(DESTDIR)$(prefix)" would
 ## expand to "c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst".
@@ -344,8 +343,8 @@
 ## create very long directory names.
          && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
 ?DISTCHECK-HOOK?         && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
-         && cd $(distdir)/_build \
-         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+         && $(am__cd) $(distdir)/_build \
+         && ../_dist/$(distdir)/configure --srcdir=../_dist/$(distdir) 
--prefix="$$dc_install_base" \
 ?GETTEXT?          --with-included-gettext \
 ## Additional flags for configure.  Keep this last in the configure
 ## invocation so the user can override previous options.
Index: tests/insthook.test
===================================================================
RCS file: /cvs/automake/automake/tests/insthook.test,v
retrieving revision 1.12
diff -u -r1.12 insthook.test
--- tests/insthook.test 14 May 2005 20:28:55 -0000      1.12
+++ tests/insthook.test 5 Dec 2006 18:31:06 -0000
@@ -40,7 +40,7 @@
 installcheck-local:
        test -f $(bindir)/foo
        test -f $(bindir)/foo-$(VERSION)
-       : > $(top_srcdir)/../ok
+       test -n "$$stampdir" && : > $$stampdir/ok
 END
 
 echo 1 > foo
@@ -50,7 +50,7 @@
 $AUTOMAKE
 
 ./configure
-$MAKE distcheck
+stampdir=`pwd` $MAKE -e distcheck
 # Sanity check to make sure installcheck-local was run.
 test -f ok
 

Reply via email to