Quoting Ralf Wildenhues <[EMAIL PROTECTED]>:
Hello Benoit,
Thanks for your continuing work on this!
Thank *you* for your thorough and relevant reviews. It's thanks to
people like you that Free software is and remains high-quality
software. So thank you for investing your precious time in this
change (which is not critical, not release-blocker, not fixing any
bug...).
* Benoit Sigoure wrote on Tue, Jun 19, 2007 at 12:22:05AM CEST:
2007-06-17 Benoit Sigoure <[EMAIL PROTECTED]>
* automake.in, aclocal.in: New option `--clean'.
($clean, @files_installed): New.
* automake.in (&require_conf_file): Save the list of files to be
removed in @files_installed.
* aclocal.in (&install_file, &write_aclocal): Likewise.
* NEWS: Mention the new option.
* tests/Makefile.am, tests/Makefile.in: Add the new test.
Tiny nit: In the Automake package, it's been convention for a few years
not to mention changes of generated files, so let's not mention
Makefile.in here.
* tests/unbootstrap.test: New.
doc changes are missing:
* doc/automake.texi (Invoking Automake, aclocal options):
Document new options.
Also, can we rename unbootstrap.test to bootclean.test (I think that is
what you used in Autoconf as well)?
Nope, you already pointed out that the name should be uniform in
autoconf/automake/libtool and now it's named 'unbootstrap' everywhere
but we can change this to 'bootclean' if you prefere.
--- aclocal.in 14 Oct 2006 17:40:25 -0000 1.140
+++ aclocal.in 18 Jun 2007 22:20:06 -0000
@@ -1050,7 +1076,29 @@
last if write_aclocal ($output_file, keys %macro_traced);
last if $dry_run;
}
-check_acinclude;
+check_acinclude unless $clean;
+
+if ($clean)
+ {
+ if ($dry_run)
+ {
+ foreach my $cleanfile (@files_installed)
+ {
+ print "rm -f $cleanfile\n"
+ unless not -e $cleanfile;
+ }
+ print "rm -rf autom4te.cache\n";
+ }
+ else
+ {
+ foreach my $cleanfile (@files_installed)
+ {
+ unlink $cleanfile or fatal "Failed to remove `$cleanfile': $!"
+ unless not -e $cleanfile;
+ }
+ system ('rm -rf autom4te.cache');
Same problem as with autoconf: autom4te.cache should not be hard-coded.
Fixed by the last patch for autoconf which provides autom4te with a
--clean option.
+ }
+ }
--- automake.in 3 May 2007 17:57:41 -0000 1.1645
+++ automake.in 18 Jun 2007 22:20:08 -0000
[...]
@@ -7068,7 +7074,7 @@
# The default auxiliary directory is the first
# of ., .., or ../.. that contains install-sh.
# Assume . if install-sh doesn't exist yet.
- for my $dir (qw (. .. ../..))
+ for my $dir (qw(. .. ../..))
{
if (-f "$dir/install-sh")
{
Drop this unrelated change, please.
Uh, OK, sorry but it was making ViM go wild :)
I should try Emacs' perl-mode some day (I am ambidextrous, I can code
with both editors :D).
@@ -7296,6 +7302,7 @@
$macro = rvar ($macro) unless ref $macro;
if ($config_libobj_dir)
{
+ # FIXME: Do we need to put @files in @files_installed when --clean?
require_file_internal ($macro->rdef ($cond)->location, $mystrict,
$config_libobj_dir, @files);
}
Good question. How can we know after the fact that some AC_LIBSOURCEd
file was installed as-is by automake, and not later changed by the user,
or even hand-written by the user in the first place? She may get mighty
angry if we remove her precious work.
AFAICS the same issue exists with files installed by 'aclocal -I m4
--install'.
Sorry I have no idea, maybe I need to take more time to think about
this. Meanwhile we can leave the FIXME here and come back to it
later. We better do not enough cleaning rather than too much.
--- /dev/null 2007-06-19 00:18:28.000000000 +0200
+++ tests/unbootstrap.test 2007-06-18 15:35:28.000000000 +0200
[...]
+# Test that automake and aclocal --clean remove all the files installed
+# by --add-missing.
+
+. ./defs || exit 1
+
+set -e
+
+# Run the test in a subdir.
+mkdir frob
+cd frob
+
+# The "./." is here so we don't have to mess with subdirs.
I don't understand this comment. Can it be removed?
Neither do I, so I removed it :)
+cat > configure.ac << 'END'
+AC_INIT([unbootstrap], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+END
+: > Makefile.am
+
+touch list.after
+find . >list.before
Similar sorting issue as in the Autoconf patch.
ACK
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOMAKE --clean
+$ACLOCAL --clean
+
+find . >list.after
The rest of the test: ...
+res=false
+
+diff -u list.before list.after && res=:
+
+cd ..
+rm -rf frob
+$res
... should be replaced by just
diff list.before list.after
ACK
as -u is not portable, and there is no need to clean up after ourselves.
ACK
In fact, being able to play around with the test after it has run is
nice for turning up more issues. ;-)
For example, if I run
../../automake-1.10a --clean
instead of
../../automake-1.10a --foreign --clean
(which is what the last $AUTOMAKE expands to), then I get
| Makefile.am: required file `./NEWS' not found
| Makefile.am: required file `./README' not found
| Makefile.am: required file `./AUTHORS' not found
| Makefile.am: required file `./ChangeLog' not found
which seems a bit odd. If I run
../../automake-1.10a --foreign --clean
twice, then the second invocation outputs
| configure.ac:2: required file `./missing' not found
| configure.ac:2: `automake --add-missing' can install `missing'
| configure.ac:2: required file `./install-sh' not found
| configure.ac:2: `automake --add-missing' can install `install-sh'
which is a bit odd as well. Further,
../../automake-1.10a --clean --foreign --add-missing
outputs
| configure.ac:2: installing `./missing'
| configure.ac:2: installing `./install-sh'
but actually those files aren't present afterwards. It may be sensible
to forbid combining --add-missing with --clean.
All of these issues were obvious, I wonder why I missed them. Fixed, thanks.
Then, there are issues connected with 'aclocal --install'. But I see
that there is an unrelated internal error to be fixed before (in another
thread).
What internal error?
Anyway the 'aclocal --clean --dry-run' execution path is not tested in
the test yet. (You can also write more than one test if you prefer to.)
Alright so here is a revised patch. Changes since the previous one:
I Removed the hard-coded reference to `autom4te.cache'. Instead
trace_used_macros ends up invoking $trace --clean ($trace being
autom4te) when in clean mode and not-dry-run.
Now --clean and --add-missing are not accepted together. Also the
messages raised by not using `foreign' when cleaning are now ignored.
I didn't investigate further to see if it was relevant to ignore other
messages. Maybe it would be easier/safer to set_strictness
('foreign') if $clean; WDYT?
The test has been enhanced to test aclocal --clean --dry-run, deal
with the find-sorting-issue and diff -u being non-portable. The files
of the test are left over for easier debugging but the test starts by
making sure that the folder is fresh. It would be annoying if a
previous failed-run of the test could interfere with a new run.
I have one last concern though, but for a later patch if possible.
Now Autoconf (autoreconf) relies on the fact that Automake provide a
--clean option and also the other way around (since now aclocal uses
autom4te --clean). The new releases of Autoconf and Automake won't
make it at the same time in the repositories of the various
distributions. For instance when both autoconf 2.61 and automake 1.10
were released, the former was available several weeks before the later
(especially in MacPorts). Should we do something about this (such as
autoreconf testing that aclocal and automake have '--clean' in their
--help message)? Or should we just say that because the feature is
new, you need the good version of the various tools to use it and let
autoreconf --clean fail miserably?
Cheers,
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
2007-06-24 Benoit Sigoure <[EMAIL PROTECTED]>
* automake.in, aclocal.in: New option `--clean'.
($clean, @files_installed): New.
* automake.in (&require_conf_file): Save the list of files to be
removed in @files_installed.
(trace_used_macros): Invoke `autom4te --clean' in clean mode.
* aclocal.in (&install_file, &write_aclocal): Likewise.
* NEWS: Mention the new option.
* configure.ac: Define am_AUTOM4TE like am_AUTOCONF.
* tests/Makefile.am: Add the new test.
* tests/defs.in: Set $AUTOM4TE.
* tests/unbootstrap.test: New. Test the new --clean feature as well
as combination of --clean and --dry-run.
* doc/automake.texi: Mention the new options of automake and aclocal.
Index: Makefile.in
===================================================================
RCS file: /sources/automake/automake/Makefile.in,v
retrieving revision 1.539
diff -u -r1.539 Makefile.in
--- Makefile.in 28 Mar 2007 22:27:13 -0000 1.539
+++ Makefile.in 24 Jun 2007 22:15:52 -0000
@@ -124,6 +124,7 @@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOM4TE = @am_AUTOM4TE@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
Index: NEWS
===================================================================
RCS file: /sources/automake/automake/NEWS,v
retrieving revision 1.327
diff -u -r1.327 NEWS
--- NEWS 23 Jun 2007 08:30:46 -0000 1.327
+++ NEWS 24 Jun 2007 22:15:53 -0000
@@ -21,6 +21,9 @@
- install-sh supports -C, which does not update the installed file
(and its time stamps) if the contents did not change.
+ - automake and aclocal support a new `--clean' option that undoes the job
+ done by `--add-missing'.
+
Bugs fixed in 1.10a:
* Long standing bugs:
Index: aclocal.in
===================================================================
RCS file: /sources/automake/automake/aclocal.in,v
retrieving revision 1.141
diff -u -r1.141 aclocal.in
--- aclocal.in 23 Jun 2007 08:30:46 -0000 1.141
+++ aclocal.in 24 Jun 2007 22:15:53 -0000
@@ -8,7 +8,7 @@
# aclocal - create aclocal.m4 by scanning configure.ac
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006 Free Software Foundation, Inc.
+# 2005, 2006, 2007 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
@@ -77,6 +77,12 @@
# Option --force.
my $force_output = 0;
+# Option --clean.
+my $clean = 0;
+
+# Files to remove with --clean.
+my @files_installed;
+
# Modification time of the youngest dependency.
my $greatest_mtime = 0;
@@ -248,6 +254,11 @@
if $res;
unlink_tmp;
}
+ elsif ($clean)
+ {
+ # Remember that we must remove this file once we're finished.
+ push (@files_installed, $dest);
+ }
elsif (!$dry_run)
{
xsystem ('cp', $src, $dest);
@@ -686,6 +697,7 @@
}
$tracefh->close;
+ xsystem ("$traces --clean $configure_ac") if $clean and not $dry_run;
return %traced;
}
@@ -773,6 +785,14 @@
return 0;
}
+ # We are now about to output `$output_file'. If we're in clean mode, we
+ # shall just stop here.
+ if ($clean)
+ {
+ push (@files_installed, $output_file);
+ return 1;
+ }
+
# Nothing to output?!
# FIXME: Shouldn't we diagnose this?
return 1 if ! length ($output);
@@ -858,6 +878,7 @@
Options:
--acdir=DIR directory holding config files (for debugging)
+ --clean remove files installed by aclocal
--diff[=COMMAND] run COMMAND [diff -u] on M4 files that would be
changed (implies --install and --dry-run)
--dry-run pretend to, but do not actually update any file
@@ -916,6 +937,7 @@
'diff:s' => \$diff_command,
'dry-run' => \$dry_run,
'force' => \$force_output,
+ 'clean' => \$clean,
'I=s' => [EMAIL PROTECTED],
'install' => \$install,
'output=s' => \$output_file,
@@ -987,6 +1009,11 @@
$dry_run = 1;
}
+ if ($clean && $install)
+ {
+ fatal 'Cannot install and clean at the same time';
+ }
+
if ($install && [EMAIL PROTECTED])
{
fatal ("--install should copy macros in the directory indicated by the"
@@ -1051,7 +1078,27 @@
last if write_aclocal ($output_file, keys %macro_traced);
last if $dry_run;
}
-check_acinclude;
+check_acinclude unless $clean;
+
+if ($clean)
+ {
+ if ($dry_run)
+ {
+ foreach my $cleanfile (@files_installed)
+ {
+ print "rm -f $cleanfile\n"
+ unless not -e $cleanfile;
+ }
+ }
+ else
+ {
+ foreach my $cleanfile (@files_installed)
+ {
+ unlink $cleanfile or fatal "Failed to remove `$cleanfile': $!"
+ unless not -e $cleanfile;
+ }
+ }
+ }
exit $exit_code;
Index: automake.in
===================================================================
RCS file: /sources/automake/automake/automake.in,v
retrieving revision 1.1645
diff -u -r1.1645 automake.in
--- automake.in 3 May 2007 17:57:41 -0000 1.1645
+++ automake.in 24 Jun 2007 22:15:55 -0000
@@ -291,6 +291,12 @@
# TRUE if we should copy missing files; otherwise symlink if possible.
my $copy_missing = 0;
+# TRUE if we shoud remove files that would otherwise be installed (--clean).
+my $clean = 0;
+
+# List of files to be removed when we're finished (--clean).
+my @files_installed;
+
# TRUE if we should always update files that we know about.
my $force_missing = 0;
@@ -3894,7 +3900,7 @@
{
msg ('error', $ac_config_files_location{$file},
"required file `$i' not found")
- unless $i =~ /\$/ || exists $output_files{$i} || -f $i;
+ unless $i =~ /\$/ || exists $output_files{$i} || -f $i || $clean;
($i) = prepend_srcdir ($i);
push_dist_common ($i);
}
@@ -7296,6 +7302,7 @@
$macro = rvar ($macro) unless ref $macro;
if ($config_libobj_dir)
{
+ # FIXME: Do we need to put @files in @files_installed when --clean?
require_file_internal ($macro->rdef ($cond)->location, $mystrict,
$config_libobj_dir, @files);
}
@@ -7312,6 +7319,7 @@
{
my ($where, $mystrict, @files) = @_;
require_file_internal ($where, $mystrict, $config_aux_dir, @files);
+ push (@files_installed, map { $_ = $config_aux_dir . '/' . $_ } @files);
}
@@ -7532,10 +7540,17 @@
# defined or overridden variables.
$output_vars .= output_variables;
- check_typos;
-
my ($out_file) = $output_directory . '/' . $makefile_in;
+ if ($clean && -e $out_file)
+ {
+ unlink ($out_file)
+ or fatal "cannot remove $out_file: $!\n";
+ return;
+ }
+
+ check_typos;
+
if ($exit_code != 0)
{
verb "not writing $out_file because of earlier errors";
@@ -7604,6 +7619,7 @@
--help print this help, then exit
--version print version number, then exit
-v, --verbose verbosely list files processed
+ --clean remove files installed by automake
--no-force only update Makefile.in's that are out of date
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
@@ -7721,6 +7737,7 @@
'o|output-dir=s' => \$output_directory,
'a|add-missing' => \$add_missing,
'c|copy' => \$copy_missing,
+ 'clean' => \$clean,
'v|verbose' => sub { setup_channel 'verb', silent => 0; },
'W|warnings=s' => \&parse_warnings,
# These long options (--Werror and --Wno-error) for backward
@@ -7764,6 +7781,8 @@
# In the next release we'll remove this entirely.
$output_directory = '.';
}
+ msg 'fatal', "Cannot install missing files and clean at the same time\n"
+ if $add_missing and $clean;
return unless @ARGV;
@@ -7860,6 +7879,15 @@
}
}
+if ($clean)
+ {
+ foreach my $cleanfile (@files_installed)
+ {
+ unlink $cleanfile or fatal "Failed to remove `$cleanfile': $!"
+ unless not -e $cleanfile;
+ }
+ }
+
exit $exit_code;
Index: configure.ac
===================================================================
RCS file: /sources/automake/automake/configure.ac,v
retrieving revision 1.34
diff -u -r1.34 configure.ac
--- configure.ac 15 Oct 2006 19:21:49 -0000 1.34
+++ configure.ac 24 Jun 2007 22:15:57 -0000
@@ -31,6 +31,8 @@
# way we can run Autoconf tests from configure (or from the test
# suite) without being bothered by `missing'.
AC_SUBST([am_AUTOCONF], ["${AUTOCONF-autoconf}"])
+# Likewise for autom4te.
+AC_SUBST([am_AUTOM4TE], ["${AUTOM4TE-autom4te}"])
AM_INIT_AUTOMAKE([1.8a dist-bzip2 filename-length-max=99])
Index: doc/Makefile.in
===================================================================
RCS file: /sources/automake/automake/doc/Makefile.in,v
retrieving revision 1.66
diff -u -r1.66 Makefile.in
--- doc/Makefile.in 28 Mar 2007 22:27:14 -0000 1.66
+++ doc/Makefile.in 24 Jun 2007 22:15:57 -0000
@@ -122,6 +122,7 @@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOM4TE = @am_AUTOM4TE@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
Index: doc/automake.texi
===================================================================
RCS file: /sources/automake/automake/doc/automake.texi,v
retrieving revision 1.167
diff -u -r1.167 automake.texi
--- doc/automake.texi 3 May 2007 17:57:41 -0000 1.167
+++ doc/automake.texi 24 Jun 2007 22:16:02 -0000
@@ -2383,6 +2383,10 @@
When used with @option{--add-missing}, causes installed files to be
copied. The default is to make a symbolic link.
[EMAIL PROTECTED] --clean
[EMAIL PROTECTED] --clean
+Remove the files that would be installed by @option{--add-missing}.
+
@item --cygnus
@opindex --cygnus
Causes the generated @file{Makefile.in}s to follow Cygnus rules, instead
@@ -2949,6 +2953,10 @@
Look for the macro files in @var{dir} instead of the installation
directory. This is typically used for debugging.
[EMAIL PROTECTED] --clean
[EMAIL PROTECTED] --clean
+Remove the files that would otherwise be installed.
+
@item [EMAIL PROTECTED]
@opindex --diff
Run @var{command} on M4 file that would be installed or overwritten
Index: lib/Makefile.in
===================================================================
RCS file: /sources/automake/automake/lib/Makefile.in,v
retrieving revision 1.138
diff -u -r1.138 Makefile.in
--- lib/Makefile.in 28 Mar 2007 22:27:14 -0000 1.138
+++ lib/Makefile.in 24 Jun 2007 22:16:02 -0000
@@ -121,6 +121,7 @@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOM4TE = @am_AUTOM4TE@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
Index: lib/Automake/Makefile.in
===================================================================
RCS file: /sources/automake/automake/lib/Automake/Makefile.in,v
retrieving revision 1.149
diff -u -r1.149 Makefile.in
--- lib/Automake/Makefile.in 28 Mar 2007 22:27:14 -0000 1.149
+++ lib/Automake/Makefile.in 24 Jun 2007 22:16:02 -0000
@@ -118,6 +118,7 @@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOM4TE = @am_AUTOM4TE@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
Index: lib/Automake/tests/Makefile.in
===================================================================
RCS file: /sources/automake/automake/lib/Automake/tests/Makefile.in,v
retrieving revision 1.80
diff -u -r1.80 Makefile.in
--- lib/Automake/tests/Makefile.in 28 Mar 2007 22:27:14 -0000 1.80
+++ lib/Automake/tests/Makefile.in 24 Jun 2007 22:16:02 -0000
@@ -94,6 +94,7 @@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOM4TE = @am_AUTOM4TE@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
Index: lib/am/Makefile.in
===================================================================
RCS file: /sources/automake/automake/lib/am/Makefile.in,v
retrieving revision 1.124
diff -u -r1.124 Makefile.in
--- lib/am/Makefile.in 28 Mar 2007 22:27:14 -0000 1.124
+++ lib/am/Makefile.in 24 Jun 2007 22:16:02 -0000
@@ -105,6 +105,7 @@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOM4TE = @am_AUTOM4TE@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
Index: m4/Makefile.in
===================================================================
RCS file: /sources/automake/automake/m4/Makefile.in,v
retrieving revision 1.285
diff -u -r1.285 Makefile.in
--- m4/Makefile.in 28 Mar 2007 22:27:14 -0000 1.285
+++ m4/Makefile.in 24 Jun 2007 22:16:02 -0000
@@ -105,6 +105,7 @@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOM4TE = @am_AUTOM4TE@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
Index: tests/Makefile.am
===================================================================
RCS file: /sources/automake/automake/tests/Makefile.am,v
retrieving revision 1.621
diff -u -r1.621 Makefile.am
--- tests/Makefile.am 29 Mar 2007 23:26:48 -0000 1.621
+++ tests/Makefile.am 24 Jun 2007 22:16:02 -0000
@@ -583,6 +583,7 @@
txinfo30.test \
txinfo31.test \
transform.test \
+unbootstrap.test \
unused.test \
upc.test \
upc2.test \
Index: tests/Makefile.in
===================================================================
RCS file: /sources/automake/automake/tests/Makefile.in,v
retrieving revision 1.809
diff -u -r1.809 Makefile.in
--- tests/Makefile.in 29 Mar 2007 23:26:48 -0000 1.809
+++ tests/Makefile.in 24 Jun 2007 22:16:03 -0000
@@ -95,6 +95,7 @@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOM4TE = @am_AUTOM4TE@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
@@ -716,6 +717,7 @@
txinfo30.test \
txinfo31.test \
transform.test \
+unbootstrap.test \
unused.test \
upc.test \
upc2.test \
Index: tests/defs.in
===================================================================
RCS file: /sources/automake/automake/tests/defs.in,v
retrieving revision 1.42
diff -u -r1.42 defs.in
--- tests/defs.in 10 Jan 2007 17:57:24 -0000 1.42
+++ tests/defs.in 24 Jun 2007 22:16:03 -0000
@@ -73,6 +73,7 @@
test -z "$PERL" && PERL='@PERL@'
test -z "$MAKE" && MAKE=make
test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@"
+test -z "$AUTOM4TE" && AUTOM4TE="@am_AUTOM4TE@"
test -z "$AUTOHEADER" && AUTOHEADER="@AUTOHEADER@"
test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate
test -z "$MISSING" && MISSING=`pwd`/../lib/missing
Index: tests/unbootstrap.test
===================================================================
--- /dev/null 2007-06-25 00:15:07.000000000 +0200
+++ tests/unbootstrap.test 2007-06-23 16:36:16.000000000 +0200
@@ -0,0 +1,71 @@
+#! /bin/sh
+# Copyright (C) 2007 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that automake and aclocal --clean remove all the files installed
+# by --add-missing.
+
+. ./defs || exit 1
+
+# We can't always diff with `/dev/null' (DU 5.0 refuses).
+touch testdiff$$
+# Use `diff -u' when possible.
+if at_diff=`diff -u "testdiff$$" "testdiff$$" 2>&1` && test -z "$at_diff"
+then
+ at_diff='diff -u'
+else
+ at_diff=diff
+fi
+rm -f testdiff$$
+
+# We need a version of autom4te that has --clean.
+$AUTOM4TE --help | grep ' --clean' >/dev/null || exit 77
+
+# We need to run this test in a clean subdir.
+test -e chiche && rm -rf chiche
+set -e
+
+# Run the test in a subdir.
+mkdir chiche
+cd chiche
+
+cat >configure.ac << 'END'
+AC_INIT([unbootstrap], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+END
+: >Makefile.am
+
+# Create files so that they are listed in list.before
+touch list.after list.during
+find . | sort >list.before
+$ACLOCAL
+$AUTOMAKE --add-missing
+
+find . | sort >list.during
+$ACLOCAL --clean --dry-run
+find . | sort >list.after
+$at_diff list.during list.after
+
+$AUTOMAKE --clean
+$ACLOCAL --clean
+
+find . | sort >list.after
+
+$at_diff list.before list.after