]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
dist: separate auxiliary file instantiation from DIST_COMMON update
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 7 Oct 2011 18:53:08 +0000 (20:53 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 8 Oct 2011 19:19:34 +0000 (21:19 +0200)
This change simplifies the automake internals dealing with the
checking, copying and distributing of required auxiliary files.
With this change, a required auxiliary file is *unconditionally*
added to the contents of the DIST_COMMON variable in the generated
Makefile.in, before checking whether it exists, or trying to copy
it (if `--add-missing' is in use).  This shouldn't be a problem,
since if the checking or copying of the file fails, automake will
bail out, the Makefile.in won't be created, and thus its content
will not matter.  OK, this is not completely true when threaded
automake is in use, but then, such a situation was also possible
before this patch, so no regression here, which is enough for us.

This change is the first of a series of steps aimed at fixing
the regression introduced in threaded automake usage by commit
`v1.11-1219-g326ecba'.

* automake.in (require_file_internal): Add the required file to
DIST_COMMON unconditionally.
* tests/missing-auxfile-stops-makefiles-creation.test: New test.
* tests/Makefile.am (TESTS): Add it.

ChangeLog
automake.in
tests/Makefile.am
tests/Makefile.in
tests/missing-auxfile-stops-makefiles-creation.test [new file with mode: 0755]

index aff4d068d94cdeb9e64a3abfa530ff5803be645c..3660fbb5b05450aaff579b77467a2e454a0e8e00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       dist: separate auxiliary file instantiation from DIST_COMMON update
+       This change simplifies the automake internals dealing with the
+       checking, copying and distributing of required auxiliary files.
+       With this change, a required auxiliary file is *unconditionally*
+       added to the contents of the DIST_COMMON variable in the generated
+       Makefile.in, before checking whether it exists, or trying to copy
+       it (if `--add-missing' is in use).  This shouldn't be a problem,
+       since if the checking or copying of the file fails, automake will
+       bail out, the Makefile.in won't be created, and thus its content
+       will not matter.  OK, this is not completely true when threaded
+       automake is in use, but then, such a situation was also possible
+       before this patch, so no regression here, which is enough for us.
+       This change is the first of a series of steps aimed at fixing
+       the regression introduced in threaded automake usage by commit
+       `v1.11-1219-g326ecba'.
+       * automake.in (require_file_internal): Add the required file to
+       DIST_COMMON unconditionally.
+       * tests/missing-auxfile-stops-makefiles-creation.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
 2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        refactor: rename a subroutine to a more proper name
index 951d5c7c037c1e3c41630f11ce55e2b356413f53..9d51b8d45004188a75caaf6941ff49a2fb9825e3 100644 (file)
@@ -7676,10 +7676,15 @@ sub require_file_internal ($$$@)
 
   foreach my $file (@files)
     {
+      next
+        unless $strictness >= $mystrict;
+
       my $fullfile = "$dir/$file";
       my $found_it = 0;
       my $dangling_sym = 0;
 
+      push_required_file ($dir, $file, $fullfile);
+
       if (-l $fullfile && ! -f $fullfile)
        {
          $dangling_sym = 1;
@@ -7687,7 +7692,6 @@ sub require_file_internal ($$$@)
       elsif (dir_has_case_matching_file ($dir, $file))
        {
          $found_it = 1;
-         push_required_file ($dir, $file, $fullfile);
        }
 
       # `--force-missing' only has an effect if `--add-missing' is
@@ -7708,9 +7712,7 @@ sub require_file_internal ($$$@)
              next if defined $required_file_not_found{$fullfile};
              $required_file_not_found{$fullfile} = 1;
            }
-
-         if ($strictness >= $mystrict)
-           {
+          # FIXME: re-indent this correctly
              if ($dangling_sym && $add_missing)
                {
                  unlink ($fullfile);
@@ -7763,7 +7765,6 @@ sub require_file_internal ($$$@)
                        }
                      set_dir_cache_file ($dir, $file);
                    }
-                 push_required_file ($dir, $file, $fullfile);
                }
              else
                {
@@ -7783,7 +7784,6 @@ sub require_file_internal ($$$@)
                if !$suppress && rule $file;
 
              msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2");
-           }
        }
     }
 }
index dd07247ff29fc3979440ac70a64a2ee3e692dd2f..8980a6bc74690cd599a1aa5b92e302c8d5682953 100644 (file)
@@ -681,6 +681,7 @@ missing3.test \
 missing4.test \
 missing5.test \
 missing6.test \
+missing-auxfile-stops-makefiles-creation.test \
 mkinstall.test \
 mkinst2.test \
 mkinst3.test \
index ecd4bcc7e4a375f5ac4528fdaf0d51253a71781a..32dac78a4ccc748995b0a032b7272dee4def93f7 100644 (file)
@@ -945,6 +945,7 @@ missing3.test \
 missing4.test \
 missing5.test \
 missing6.test \
+missing-auxfile-stops-makefiles-creation.test \
 mkinstall.test \
 mkinst2.test \
 mkinst3.test \
diff --git a/tests/missing-auxfile-stops-makefiles-creation.test b/tests/missing-auxfile-stops-makefiles-creation.test
new file mode 100755 (executable)
index 0000000..6492a14
--- /dev/null
@@ -0,0 +1,65 @@
+#! /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/>.
+
+# Automake should stop the creation of Makefile.in files at the first
+# encountered error due to a required auxiliary file not found.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<END
+AM_PATH_PYTHON
+END
+
+echo SUBDIRS = > Makefile.am
+
+for i in 1 2 3 4 5; do
+  echo "AC_CONFIG_FILES([sub$i/Makefile])" >> configure.in
+  echo "SUBDIRS += sub$i" >> Makefile.am
+  mkdir sub$i
+  echo python_PYTHON = foo.py > sub$i/Makefile.am
+done
+
+: > sub1/Makefile.am
+
+$ACLOCAL
+
+unset AUTOMAKE_JOBS || :
+
+AUTOMAKE_fails
+ls -l Makefile.in */Makefile.in || : # For debugging.
+# Top-level Makefile.in might be created or not, we don't want to set
+# too strict semantics here, so don't check for it.  But the later
+# files shouldn't exist.
+test -f sub1/Makefile.in
+test ! -f sub2/Makefile.in
+test ! -f sub3/Makefile.in
+test ! -f sub4/Makefile.in
+test ! -f sub5/Makefile.in
+
+rm -f Makefile.in */Makefile.in
+
+: > sub2/Makefile.am
+: > sub3/Makefile.am
+
+AUTOMAKE_fails
+ls -l Makefile.in */Makefile.in || : # For debugging.
+test -f sub1/Makefile.in
+test -f sub2/Makefile.in
+test -f sub3/Makefile.in
+test ! -f sub4/Makefile.in
+test ! -f sub5/Makefile.in
+
+: