From: Peter Breitenlohner Date: Sun, 22 Mar 2009 09:11:14 +0000 (+0100) Subject: DISTFILES containing a directory and files in that directory. X-Git-Tag: v1.10b~5^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a12ed5e97dc193a38dd14e031658cbd329b50ca;p=thirdparty%2Fautomake.git DISTFILES containing a directory and files in that directory. For PR automake/533: When the source tree contains non-writable files or directories (as happens during distcheck), and directories or entries thereof are listed multiple times in variables to be distributed, then the corresponding directories below $(distdir) need to be made writable recursively. Since file modes should not change, they need to be copied recursively using `cp -f'. * lib/am/distdir.am: Handle this situation. * tests/distdir.test: Extend test to those cases. * NEWS: Update. Report by Peter Breitenlohner. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index b6858c067..2d85e13b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2009-03-22 Peter Breitenlohner + Ralf Wildenhues + + For PR automake/533: + DISTFILES containing a directory and files in that directory. + When the source tree contains non-writable files or directories + (as happens during distcheck), and directories or entries + thereof are listed multiple times in variables to be + distributed, then the corresponding directories below $(distdir) + need to be made writable recursively. Since file modes should + not change, they need to be copied recursively using `cp -f'. + * lib/am/distdir.am: Handle this situation. + * tests/distdir.test: Extend test to those cases. + * NEWS: Update. + Report by Peter Breitenlohner. + 2009-03-22 Jim Meyering Fix a documentation typo. diff --git a/Makefile.in b/Makefile.in index 4224570e9..7891cdac3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -482,10 +482,14 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ diff --git a/NEWS b/NEWS index a81b37b98..780b49a7d 100644 --- a/NEWS +++ b/NEWS @@ -183,6 +183,9 @@ Bugs fixed in 1.10a: - The default no-op recursive rules for these targets also work with BSD make now: html, install-html, install-dvi, install-pdf, install-pdf, install-info. + - `make distcheck' works also when both a directory and some file below it + have been added to a distribution variable, such as EXTRA_DIST or *_SOURCES. + * Bugs introduced by 1.10: - Fix output of dummy dependency files in presence of post-processed diff --git a/doc/Makefile.in b/doc/Makefile.in index befd9b1f6..fe0343a87 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -555,10 +555,14 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in index bae89fd63..d03f25dad 100644 --- a/lib/Automake/Makefile.in +++ b/lib/Automake/Makefile.in @@ -465,10 +465,14 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index b663fc446..85c49715e 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -312,10 +312,14 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ diff --git a/lib/Makefile.in b/lib/Makefile.in index 47d0c7216..3aaab7e90 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -440,10 +440,14 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in index ea62647ed..c61b2bc66 100644 --- a/lib/am/Makefile.in +++ b/lib/am/Makefile.in @@ -281,10 +281,14 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 2f2d1766a..5ee7b5c72 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -202,10 +202,16 @@ endif %?TOPDIR_P% ## directory exists only in $(srcdir), because some vendor Make (such ## as Tru64) will magically create an empty directory in `.' dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ +## If the destination directory already exists, it may contain read-only +## files, e.g., during `make distcheck'. + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ ## Test for file existence because sometimes a file gets included in ## DISTFILES twice. For example this happens when a single source diff --git a/m4/Makefile.in b/m4/Makefile.in index f9f1adb83..5b4eb2333 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -278,10 +278,14 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ diff --git a/tests/Makefile.in b/tests/Makefile.in index a49105591..32744bad9 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -990,10 +990,14 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ diff --git a/tests/distdir.test b/tests/distdir.test index 641a307b7..4c861bfef 100755 --- a/tests/distdir.test +++ b/tests/distdir.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 2002, 2003, 2006, 2007, 2009 Free Software +# Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,6 +19,8 @@ # sure *srcdir is properly handled. Note that using `./', as in # EXTRA_DIST = ./joe # does not work portably: it fails with HP-UX and Tru64 make. +# Also test DISTFILES containing a directory and a file in it, +# and repeated directories. . ./defs || Exit 1 @@ -26,20 +29,36 @@ set -e echo AC_OUTPUT >>configure.in cat > Makefile.am << 'END' -EXTRA_DIST = foo/bar joe $(top_srcdir)/woo/doo $(srcdir)/dada +include_HEADERS = some/file another/sub/subsub/file2 yet/another/file3 +EXTRA_DIST = foo/bar joe $(top_srcdir)/woo/doo $(srcdir)/dada \ + some another/sub yet \ + some another/sub yet + + +all-local: + $(MKDIR_P) another/sub/subsub + touch another/sub/subsub/file2 + +CLEANFILES = another/sub/subsub/file2 + check-local: test -f $(srcdir)/foo/bar test -f $(srcdir)/woo/doo test -f $(srcdir)/joe test -f $(srcdir)/dada + test -f $(srcdir)/some/file + test -f $(srcdir)/another/sub/subsub/file2 \ + || test -f /another/sub/subsub/file2 + test -f $(srcdir)/yet/another/file3 END $ACLOCAL $AUTOCONF $AUTOMAKE -mkdir foo woo -touch foo/bar joe woo/doo dada +mkdir foo woo some another another/sub another/sub/subsub yet yet/another +touch foo/bar joe woo/doo dada some/file another/sub/subsub/file2 +touch yet/another/file3 mkdir build cd build