[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-ng] [PATCH 2/4] [ng] dist: strip duplicates from dist files at
From: |
Stefano Lattarini |
Subject: |
[Automake-ng] [PATCH 2/4] [ng] dist: strip duplicates from dist files at make (not automake) runtime |
Date: |
Sun, 6 May 2012 18:35:28 +0200 |
We can do this thanks to the new make macros '$(am__uniq)' introduced in
the recent commit 'v1.12-145-g112d08a'.
* automake.in (handle_dist): Don't "uniq"ify the contents of DIST_COMMON
here, but instead ...
* lib/am/distdir.am: ... "uniq"ify the contents of DISTFILES here.
* t/dist-repeated.sh: Remove sanity check checking for a once expected
invariant that is not there anymore now.
* t/distcom4.sh, t/distcom5.sh: Adjust.
Signed-off-by: Stefano Lattarini <address@hidden>
---
automake.in | 11 ++---------
lib/am/distdir.am | 3 ++-
t/dist-repeated.sh | 8 --------
t/distcom4.sh | 27 +++++++--------------------
t/distcom5.sh | 41 ++++++++++++++---------------------------
5 files changed, 25 insertions(+), 65 deletions(-)
diff --git a/automake.in b/automake.in
index 7af3fec..fa30d6d 100644
--- a/automake.in
+++ b/automake.in
@@ -3774,15 +3774,8 @@ sub handle_dist ()
}
}
- # Files to distributed. Don't use ->value_as_list_recursive
- # as it recursively expands '$(dist_pkgdata_DATA)' etc.
- my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
- @dist_common = uniq @dist_common;
- variable_delete 'DIST_COMMON';
- define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
-
- # Now that we've processed DIST_COMMON, disallow further attempts
- # to set it.
+ # We don't expected further attempts to modify DIST_COMMON after
+ # this point, so disallow it, for extra safety.
$handle_dist_run = 1;
# Scan EXTRA_DIST to see if we need to distribute anything from a
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index 90ba095..7fe451a 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -14,7 +14,8 @@
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+DISTFILES = $(call am__uniq, \
+ $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST))
## Try to avoid repeated slashed in the $(DISTFILES) entries, to make the
## filtering in the 'am__dist_files_1' definition below more reliable.
diff --git a/t/dist-repeated.sh b/t/dist-repeated.sh
index 6651e72..14ea6ac 100755
--- a/t/dist-repeated.sh
+++ b/t/dist-repeated.sh
@@ -29,13 +29,6 @@ bar_SOURCES = foo.c
python_PYTHON = bar.py
EXTRA_DIST = foo.c bar.py
-.PHONY: sanity-check
-sanity-check:
- for f in $(DISTFILES); do echo " $$f "; done > dist.txt
- cat dist.txt
- test `grep ' foo\.c ' dist.txt | wc -l` -eq 3
- test `grep ' bar\.py ' dist.txt | wc -l` -eq 2
-
# So that we don't have to require a C compiler.
AUTOMAKE_OPTIONS = no-dependencies
CC = false
@@ -94,7 +87,6 @@ $AUTOCONF
$AUTOMAKE
./configure
-$MAKE sanity-check || fatal_ "expected invariants not verified"
$MAKE distdir
test -f cp-wrapper-has-seen-foo-c && test -f cp-wrapper-has-seen-bar-py \
|| fatal_ "our cp wrapper hasn't run correctly"
diff --git a/t/distcom4.sh b/t/distcom4.sh
index 6f9d871..18f8b33 100755
--- a/t/distcom4.sh
+++ b/t/distcom4.sh
@@ -43,8 +43,12 @@ mkdir tests
: > README
: > tests/wrapper.in
cat > Makefile.am << 'END'
-.PHONY: test
-test: distdir
+.PHONY: test1 test 2
+test1:
+ for x in $(DISTFILES); do echo $$x; done | grep 'tests/' > lst
+ cat lst # For debugging.
+ test `wc -l <lst` -eq 1
+test2: distdir
test -f $(distdir)/tests/wrapper.in
END
@@ -52,23 +56,6 @@ $ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
./configure
-$MAKE test
-
-sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' Makefile.in > dc.txt
-
-cat dc.txt # For debugging.
-
-test 1 = `grep tests dc.txt | wc -l`
-grep configure dc.txt
+$MAKE test1 test2
:
diff --git a/t/distcom5.sh b/t/distcom5.sh
index adfbe52..b8290dd 100755
--- a/t/distcom5.sh
+++ b/t/distcom5.sh
@@ -21,21 +21,6 @@
. ./defs || Exit 1
-extract_distcommon ()
-{
- sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' ${1+"$@"}
-}
-
cat >> configure.ac << 'END'
AC_CONFIG_FILES([tests/autoconf:tests/wrapper.in],
[chmod +x tests/autoconf])
@@ -57,28 +42,30 @@ END
mkdir tests
: > tests/wrapper.in
-: > tests/Makefile.am
+
cat > Makefile.am << 'END'
SUBDIRS = tests
.PHONY: test
test: distdir
test -f $(distdir)/tests/wrapper.in
+check-local: test
+ for x in $(DISTFILES); do echo $$x; done \
+ | grep tests && exit 1; :
+END
+
+cat > tests/Makefile.am <<'END'
+check-local:
+ for x in $(DISTFILES); do echo $$x; done | grep wrapper.in > lst
+ cat lst # For debugging.
+ test `wc -l <lst` -eq 1
END
$ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
./configure
-$MAKE test
-
-extract_distcommon Makefile.in > top.txt
-extract_distcommon tests/Makefile.in > inner.txt
-
-# Might be useful for debugging.
-cat top.txt
-cat inner.txt
-
-test 0 = `grep tests top.txt | wc -l`
-test 1 = `grep wrapper inner.txt | wc -l`
+$MAKE check
+# Sanity check.
+test -f tests/lst
:
--
1.7.9.5