automake-patches
[Top][All Lists]
Advanced

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

pr186: DESTDIR check in distcheck


From: Alexandre Duret-Lutz
Subject: pr186: DESTDIR check in distcheck
Date: 20 Jan 2002 20:16:34 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi,

The following patch changes distcheck to use DESTDIR.

I initially intended to do as suggested in pr186: make two
installations, one with DESTDIR, one without, then compare.  But
it occured to me it was even simplier to set $prefix to a
read-only directory and have $DESTDIR writable.  This way, only
one installation is required because whatever `make install' try
to install in $prefix (instead of `$DESTDIR$prefix') will fail.

However I'm concerned by the lentgh of paths used during distcheck.

For instance, when running destdir.test $prefix is
$PWD/destdir-1.0 and $DESTDIR is $PWD/destdir-1.0/=inst.  The
file foo thus installed as
$PWD/destdir-1.0/=inst/$PWD/destdir-1.0/share/foo, which on my
host expands to
/home/adl/projs/cvs/automake/tests/testSubDir/destdir-1.0/=inst/home/adl/projs/cvs/automake/tests/testSubDir/destdir-1.0/share/foo.
A pretty longish pathname!

Setting --prefix to a shorter path, for instance /unexistant, is
another idea, but then people running `make distcheck' as root
on a buggy package might have bad surprises.

Any other idea?

Index: ChangeLog
===================================================================
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.1739
diff -u -r1.1739 ChangeLog
--- ChangeLog   2002/01/19 08:36:13     1.1739
+++ ChangeLog   2002/01/20 19:09:36
@@ -1,3 +1,11 @@
+2002-01-20  Alexandre Duret-Lutz  <address@hidden>
+
+       For PR automake/186:
+       * tests/destdir.test: New file.
+       * tests/Makefile.am (TESTS): Add it.
+       * lib/am/distdir.am (distcheck): Set DESTDIR when running
+       install, installcheck, and uninstall.
+
 2002-01-19  Alexandre Duret-Lutz  <address@hidden>
 
        Fix for PR automake/204:
Index: lib/am/distdir.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/distdir.am,v
retrieving revision 1.31
diff -u -r1.31 distdir.am
--- distdir.am  2002/01/13 20:33:39     1.31
+++ distdir.am  2002/01/20 19:09:38
@@ -259,7 +259,14 @@
        mkdir $(distdir)/=inst
 ## Undo the write access.
        chmod a-w $(distdir)
-       dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
+## Configure the package as if it was going to be installed in
+## $(distdir).  Note this is a read-only locatation.  During
+## `make install' we will set DESTDIR to $(distdir)/=inst which
+## is a writable directory.  This way we can detect all target
+## that fails to support DESTDIR: they will print `permission
+## denied' errors during `make install'.
+       dc_install_base=`$(am__cd) $(distdir) && pwd` \
+       dc_destdir="$$dc_install_base/=inst" \
 ?DISTCHECK-HOOK?         && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
          && cd $(distdir)/=build \
          && ../configure --srcdir=.. --prefix=$$dc_install_base \
@@ -270,13 +277,13 @@
          && $(MAKE) $(AM_MAKEFLAGS) \
          && $(MAKE) $(AM_MAKEFLAGS) dvi \
          && $(MAKE) $(AM_MAKEFLAGS) check \
-         && $(MAKE) $(AM_MAKEFLAGS) install \
-         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
-         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+         && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
 ## We use -le 1 because the `dir' file might still exist after uninstall.
-         && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+         && (test `find $$dc_destdir -type f -print | wc -l` -le 1 \
              || { echo "ERROR: files left after uninstall:" ; \
-                  find $$dc_install_base -type f -print ; \
+                  find $$dc_destdir -type f -print ; \
                   exit 1; } >&2 ) \
          && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
 ## Make sure to remove the dist file we created in the test build
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.375
diff -u -r1.375 Makefile.am
--- Makefile.am 2002/01/19 08:36:14     1.375
+++ Makefile.am 2002/01/20 19:09:39
@@ -119,6 +119,7 @@
 depend2.test \
 depend3.test \
 depend4.test \
+destdir.test \
 dirname.test \
 discover.test \
 distcommon.test \
Index: tests/destdir.test
===================================================================
RCS file: destdir.test
diff -N destdir.test
--- /dev/null   Tue May  5 13:32:27 1998
+++ destdir.test        Sun Jan 20 11:09:40 2002
@@ -0,0 +1,30 @@
+#! /bin/sh
+
+# Make sure that `make distcheck' can find some $(DESTDIR) omissions.
+
+. $srcdir/defs || exit 1
+
+cat >> configure.in <<'EOF'
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+dist_data_DATA = foo
+
+# This rule is bogus because it doesn't use $(DESTDIR) on the
+# second argument of cp.  distcheck is expected to catch this.
+install-data-hook:
+       cp $(DESTDIR)$(datadir)/foo $(datadir)/bar
+
+uninstall-local:
+       rm $(DESTDIR)$(datadir)/bar
+EOF
+
+: > foo
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+make distcheck && exit 1
+:
-- 
Alexandre Duret-Lutz



reply via email to

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