summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-10-01 19:22:37 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-10-01 19:22:37 +0200
commit6816b316a8424f868342218eab4d61497988bea6 (patch)
tree00139d7c0b65a4e5797eafb3108014163ab07aa3
parent8dc8556c9a4d1680aae579698ac3f39d39f235e5 (diff)
parenta2498fe8d148c507e5e09b7de8a5aee9f2418e5c (diff)
downloadautomake-6816b316a8424f868342218eab4d61497988bea6.tar.gz
Merge branch 'fix-pr9579' into maint
* fix-pr9579: distuninstallcheck: fail also when only one file is left installed
-rw-r--r--ChangeLog14
-rw-r--r--Makefile.in14
-rw-r--r--NEWS3
-rw-r--r--lib/am/distdir.am22
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/Makefile.in2
-rwxr-xr-xtests/distcheck-override-infodir.test63
-rwxr-xr-xtests/distcheck-pr9579.test98
8 files changed, 211 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index c3b041d26..7468680d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-09-26 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ distuninstallcheck: fail also when only one file is left installed
+ This change fixes automake bug#9579.
+ * lib/am/distdir.am (distuninstallcheck): Be stricter in ignoring
+ a potential `dir' file created by install-info and left installed.
+ Also, be more careful about "this can't happen" kind of errors.
+ (am__distuninstallcheck_listfiles): New internal helper macro.
+ * tests/distcheck-pr9579.test: New test.
+ * tests/distcheck-override-infodir.test: Likewise.
+ * tests/Makefile.am (TESTS): Add them.
+ * NEWS, THANKS: Update.
+ Report by Nick Bowler.
+
2011-09-28 Stefano Lattarini <stefano.lattarini@gmail.com>
maintcheck: fix usage of `cd' instead of `$(am__cd)'
diff --git a/Makefile.in b/Makefile.in
index 5fcf53db7..60fae317a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -151,6 +151,8 @@ am__relativize = \
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|${prefix}/|' | grep -v '${infodir}/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -757,8 +759,16 @@ distcheck: dist
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
- @$(am__cd) '$(distuninstallcheck_dir)' \
- && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with and empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
diff --git a/NEWS b/NEWS
index 54838d0d5..4fe41967f 100644
--- a/NEWS
+++ b/NEWS
@@ -61,6 +61,9 @@ Bugs fixed in 1.11.0a:
* Long standing bugs:
+ - "make distcheck" now correctly complains also when "make uninstall"
+ leaves one and only one file installed in $(prefix).
+
- A "make uninstall" issued before a "make install", or after a mere
"make install-data" or a mere "make install-exec" does not spuriously
fail anymore.
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index c2dd7c55a..ceb7e4189 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -1,6 +1,6 @@
## automake - create Makefile.in from Makefile.am
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-## 2010 Free Software Foundation, Inc.
+## 2010, 2011 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
@@ -516,11 +516,23 @@ distcheck: dist
## from distcheck, so that they can be overridden by the user.
.PHONY: distuninstallcheck
distuninstallcheck_listfiles = find . -type f -print
+## The `dir' file (created by install-info) might still exist after
+## uninstall, so we must be prepared to account for it. The following
+## check is not 100% strict, but is definitely good enough, and even
+## accounts for overridden ${infodir}.
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|${prefix}/|' | grep -v '${infodir}/dir$$'
distuninstallcheck:
-## We use -le 1 because the `dir' file (created by install-info)
-## might still exist after uninstall.
- @$(am__cd) '$(distuninstallcheck_dir)' \
- && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 221f08a5c..983cc9c37 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -335,6 +335,8 @@ distcheck-hook.test \
distcheck-hook2.test \
distcheck-missing-m4.test \
distcheck-outdated-m4.test \
+distcheck-pr9579.test \
+distcheck-override-infodir.test \
dmalloc.test \
doc-parsing-buglets-colneq-subst.test \
doc-parsing-buglets-tabs.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index a1a517ace..fa274deb8 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -619,6 +619,8 @@ distcheck-hook.test \
distcheck-hook2.test \
distcheck-missing-m4.test \
distcheck-outdated-m4.test \
+distcheck-pr9579.test \
+distcheck-override-infodir.test \
dmalloc.test \
doc-parsing-buglets-colneq-subst.test \
doc-parsing-buglets-tabs.test \
diff --git a/tests/distcheck-override-infodir.test b/tests/distcheck-override-infodir.test
new file mode 100755
index 000000000..8c54cfb2c
--- /dev/null
+++ b/tests/distcheck-override-infodir.test
@@ -0,0 +1,63 @@
+#! /bin/sh
+# Copyright (C) 2011 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that we can override ${infodir} while having distcheck still
+# working. Relate to automake bug#9579.
+
+required='makeinfo tex texi2dvi'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+infodir = ${prefix}/blah/blah/foobar
+info_TEXINFOS = main.texi
+## Sanity check.
+installcheck-local:
+ if test x$${infodir+set} != xset; then \
+ ls -l "$(DESTDIR)/$(prefix)/blah/blah/foobar/" || exit 1; \
+ test -f "$(DESTDIR)/$(prefix)/blah/blah/foobar/dir" || exit 1; \
+ else \
+ ls -l "$(DESTDIR)/$$infodir/" || exit 1; \
+ test -f "$(DESTDIR)/$$infodir/dir" || exit 1; \
+ fi
+END
+
+cat > main.texi << 'END'
+\input texinfo
+@setfilename main.info
+@settitle main
+@node Top
+Hello walls.
+@bye
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+./configure
+$MAKE
+
+$MAKE distcheck
+infodir="`pwd`"/_info $MAKE -e distcheck
+test -f _info/dir || Exit 99 # Sanity check.
+
+:
diff --git a/tests/distcheck-pr9579.test b/tests/distcheck-pr9579.test
new file mode 100755
index 000000000..667401daa
--- /dev/null
+++ b/tests/distcheck-pr9579.test
@@ -0,0 +1,98 @@
+#! /bin/sh
+# Copyright (C) 2011 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check against automake bug#9579: distcheck does not always detect
+# incomplete uninstall as advertised.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+# NOTE: the use of `dir' as the name of the data file installed by hand
+# is deliberate, and enhances coverage -- see definition and comments of
+# lib/am/distdir.am:$(am__distuninstallcheck_listfiles).
+
+cat > Makefile.am << 'END'
+dist_data_DATA = foo
+EXTRA_DIST = dir
+install-data-local:
+ $(MKDIR_P) '$(DESTDIR)$(datadir)'
+ cp '$(srcdir)/dir' '$(DESTDIR)$(datadir)/dir'
+END
+
+: > foo
+: > dir
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure --prefix="`pwd`/inst"
+
+# Sanity checks.
+$MAKE install
+find inst -type f
+test -f inst/share/foo
+test -f inst/share/dir
+# We expect the uninstall target of our Makefile to be definitely broken.
+$MAKE uninstall
+test -f inst/share/dir
+rm -rf inst
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+
+$FGREP 'ERROR: files left after uninstall:' output
+grep '/share/dir *$' output
+
+# A few trickier corner cases.
+
+cat > Makefile.am << 'END'
+EXTRA_DIST = dir
+install-data-local:
+install-data-local:
+ $(MKDIR_P) '$(DESTDIR)$(prefix)/mu/share/info'
+ cp '$(srcdir)/dir' '$(DESTDIR)$(prefix)/mu/share/info'
+ $(MKDIR_P) '$(DESTDIR)$(infodir)/more'
+ cp '$(srcdir)/dir' '$(DESTDIR)$(infodir)/more'
+END
+
+$AUTOMAKE
+./config.status Makefile
+
+# Sanity checks, again.
+$MAKE install
+find inst -type f
+test -f inst/mu/share/info/dir
+test -f inst/share/info/more/dir
+# We expect the uninstall target of our Makefile to be definitely broken.
+$MAKE uninstall
+test -f inst/mu/share/info/dir
+test -f inst/share/info/more/dir
+rm -rf inst
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+
+$FGREP 'ERROR: files left after uninstall:' output
+grep '/mu/share/info/dir *$' output
+grep '/share/info/more/dir *$' output
+
+: