>From 0b8158dc67dfd23d00cbe67218ef78a0e889df86 Mon Sep 17 00:00:00 2001 Message-Id: From: Stefano Lattarini Date: Sat, 25 Feb 2012 14:38:22 +0100 Subject: [PATCH] docs: improve "make distcheck" documentation * doc/automake.texi (The dist Hook): Explicitly document the fact that the dist-hook should account for the case where the source tree is read-only, mostly for the benefit of distcheck. Since we are at it, do some minor unrelated rewordings, and remove obsolescent advice. Motivated by the discussion on automake bug#10878. * tests/disthook-perms.test: Renamed ... * tests/disthook.test: ... to this, and extended. * tests/list-of-tests.mk: Adjust. --- doc/automake.texi | 28 +++++++++----- tests/{disthook-perms.test => disthook.test} | 50 ++++++++++++++++++------- tests/list-of-tests.mk | 2 +- 3 files changed, 55 insertions(+), 25 deletions(-) rename tests/{disthook-perms.test => disthook.test} (55%) diff --git a/doc/automake.texi b/doc/automake.texi index c2c2a21..36e9882 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -8420,24 +8420,32 @@ nodist_foo_SOURCES = do-not-distribute.c Occasionally it is useful to be able to change the distribution before it is packaged up. If the @code{dist-hook} rule exists, it is run -after the distribution directory is filled, but before the actual tar -(or shar) file is created. One way to use this is for distributing -files in subdirectories for which a new @file{Makefile.am} is overkill: +after the distribution directory is filled, but before the actual +distribution archives are created. One way to use this is for +removing unnecessary files that get recursively included by specifying +a directory in @code{EXTRA_DIST}: @example +EXTRA_DIST = doc dist-hook: - mkdir $(distdir)/random - cp -p $(srcdir)/random/a1 $(srcdir)/random/a2 $(distdir)/random + rm -rf `find $(distdir)/doc -type d -name .svn` @end example -Another way to use this is for removing unnecessary files that get -recursively included by specifying a directory in EXTRA_DIST: address@hidden +Note that the @code{dist-hook} recipe shouldn't assume that the +regular files in the distribution directory are writable; this +might not be the case if one is packaging from a read-only source +tree, or when a @code{make distcheck} is being done. So, if the address@hidden wants to modify the content of an existing file +in the distribution directory, it should explicitly ensure to make +it readable first: @example -EXTRA_DIST = doc - +EXTRA_DIST = README dist-hook: - rm -rf `find $(distdir)/doc -type d -name .svn` + chmod u+w $(distdir)/README + echo >> README + echo "Distribution date: `date`" >> README @end example @vindex distdir diff --git a/tests/disthook-perms.test b/tests/disthook.test similarity index 55% rename from tests/disthook-perms.test rename to tests/disthook.test index a5f0acb..d5afe83 100755 --- a/tests/disthook-perms.test +++ b/tests/disthook.test @@ -14,19 +14,32 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check that the user can use the 'dist-hook' target to modify -# permissions of distributed files before putting them in the -# distribution tarball. See automake bug#10878. +# Check that 'dist-hook' works. See automake bug#10878. . ./defs || Exit 1 echo AC_OUTPUT >> configure.ac cat > Makefile.am <<'END' -EXTRA_DIST = write execute +EXTRA_DIST = write execute removed dir dist-hook: chmod u+w $(distdir)/write chmod u+x $(distdir)/execute + rm -f $(distdir)/removed $(distdir)/dir/bad + : > dir/good2 + echo all is ok > write +## Sanity check. + echo ok > $(srcdir)/../disthook-run +check-local: + test "`cat $(srcdir)/write`" = "all is ok" + test -f $(srcdir)/dir/good1 + test -f $(srcdir)/dir/good2 + test ! -f $(srcdir)/dir/bad + test ! -r $(srcdir)/dir/bad + $(srcdir)/execute + $(srcdir)/execute | grep 'I run successfully' +## Sanity check. + echo ok > $(srcdir)/../distcheck-run END $ACLOCAL @@ -34,8 +47,10 @@ $AUTOMAKE $AUTOCONF ./configure - -echo Will be clobbered > write +mkdir dir +: > dir/good1 +echo will be clobbered > write +: > bad cat > execute <<'END' #!/bin/sh echo I run successfully @@ -44,16 +59,23 @@ END chmod a-w write chmod a-x execute -$MAKE -$MAKE dist - -test -f $distdir.tar.gz -gzip -dc $distdir.tar.gz | tar xvf - - +$MAKE distdir +test -f disthook-run +test ! -f distcheck-run cd $distdir -echo clobber clobber > write -cat write | grep 'clobber clobber' +test "`cat write`" = "all is ok" +test -f dir/good1 +test -f dir/good2 +test ! -f dir/bad +test ! -r dir/bad ./execute ./execute | grep 'I run successfully' +cd .. + +rm -f disthook-run + +$MAKE distcheck +test -f disthook-run +test -f distcheck-ok : diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk index 5507ee5..89cff2f 100644 --- a/tests/list-of-tests.mk +++ b/tests/list-of-tests.mk @@ -355,7 +355,7 @@ distcom4.test \ distcom5.test \ distcom-subdir.test \ distdir.test \ -disthook-perms.test \ +disthook.test \ distlinks.test \ distlinksbrk.test \ distname.test \ -- 1.7.9