automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 5/8] dist: separate auxiliary file instantiation from DIST_COMMON


From: Stefano Lattarini
Subject: [PATCH 5/8] dist: separate auxiliary file instantiation from DIST_COMMON update
Date: Sun, 9 Oct 2011 10:53:01 +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                                          |   22 +++++++
 automake.in                                        |   12 ++--
 tests/Makefile.am                                  |    1 +
 tests/Makefile.in                                  |    1 +
 .../missing-auxfile-stops-makefiles-creation.test  |   65 ++++++++++++++++++++
 5 files changed, 95 insertions(+), 6 deletions(-)
 create mode 100755 tests/missing-auxfile-stops-makefiles-creation.test

diff --git a/ChangeLog b/ChangeLog
index aff4d06..3660fbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2011-10-08  Stefano Lattarini  <address@hidden>
 
+       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  <address@hidden>
+
        refactor: rename a subroutine to a more proper name
        * automake.in (maybe_push_require_file): Renamed ...
        (push_required_file): ... to this.
diff --git a/automake.in b/automake.in
index 951d5c7..9d51b8d 100644
--- a/automake.in
+++ b/automake.in
@@ -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");
-           }
        }
     }
 }
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dd07247..8980a6b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -681,6 +681,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/Makefile.in b/tests/Makefile.in
index ecd4bcc..32dac78 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -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
index 0000000..6492a14
--- /dev/null
+++ b/tests/missing-auxfile-stops-makefiles-creation.test
@@ -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
+
+:
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]