[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: automake/533: DISTFILES containing a directory and files in that dir
From: |
Ralf Wildenhues |
Subject: |
Re: automake/533: DISTFILES containing a directory and files in that directory |
Date: |
Sun, 22 Mar 2009 10:17:06 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
* Ralf Wildenhues wrote on Fri, Mar 13, 2009 at 12:17:58AM CET:
> * Peter Breitenlohner wrote on Thu, Jan 29, 2009 at 05:24:55PM CET:
> > I tried to include a Third-Party package (automake manual 23.2) using
> > the suggestion in the last paragraph, i.e., doing everything with a
> > proxy Makefile.am such as:
> >
> > bin_PROGRAMS = prog
> > prog_SOURCES = sub/prog.c
> > EXTRA_DIST = sub
> >
> > with the result that 'make distcheck' failed.
I've thought more about this.
Here's why I have some qualms with this patch:
- First, the added 'find ... -exec' might still not be enough
(thinking of really weird systems behavior only, which I suppose the '||
chmod -R was used for in the code further down; in any case this isn't
all that big of a problem as it would not be a regression),
- The chmod 777 increases the window where we have world-writable files.
Well, we can fix that by allowing this for the user only:
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;
- The user can now induce behavior where work is done several times per
file, and not be punished about the inefficiency. Example:
EXTRA_DIST = subtree subtree subtree
will run the `find' several times on the subtree.
OTOH, I just thought a bit more about that last item, while looking at a
distcheck log of a large package, and found that we can actually also
save a wee bit when packaging sub packages, by not running the last find
more than once.
So, I'm pushing the patch as follows, to master:
Cheers, and thanks again,
Ralf
2009-03-22 Peter Breitenlohner <address@hidden>
Ralf Wildenhues <address@hidden>
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.
diff --git a/NEWS b/NEWS
index a81b37b..780b49a 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/lib/am/distdir.am b/lib/am/distdir.am
index 2f2d176..5ee7b5c 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/tests/distdir.test b/tests/distdir.test
index 641a307..4c861bf 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