automake-patches
[Top][All Lists]
Advanced

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

FYI: fix for PR/375 (texinfo indexes in included files)


From: Alexandre Duret-Lutz
Subject: FYI: fix for PR/375 (texinfo indexes in included files)
Date: Sat, 30 Nov 2002 20:43:16 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/20.7 (i386-debian-linux-gnu)

I'm checking this in (HEAD & branch-1-7).

At a first glance this may seem backward, like a feature
removal, but I realy think Automake was trying to be too clever
under a wrong assumption (a Texinfo document doesn't always have
one file).

Moreover, as far support for generated Texinfo files is
concerned the less information we grep in the Texi file the
better.

2002-11-30  Alexandre Duret-Lutz  <address@hidden>

        For PR automake/375 (Debian Bug #168671):
        * automake.in (scan_texinfo_file): Erase all known index files, no
        matter whether they are used at the top-level or not, because we
        can never know if they are used in included files.  The remaining
        macros we recognize at the top-level of a Texi document are
        @defindex, @defcodeindex, @synindex, and @syncodeindex.
        * tests/texinfo18.test: New file.
        * tests/Makefile.am (TESTS): Add texinfo18.test.
        Reported by Simon Richter.

Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.186.2.9
diff -u -r1.186.2.9 THANKS
--- THANKS      30 Nov 2002 15:35:41 -0000      1.186.2.9
+++ THANKS      30 Nov 2002 19:39:24 -0000
@@ -182,6 +182,7 @@
 Seth Alves             address@hidden
 Shuhei Amakawa         address@hidden
 Shigio Yamaguchi       address@hidden
+Simon Richter          address@hidden
 Steve M. Robbins       address@hidden
 Sven Verdoolaege       address@hidden
 Tamara L. Dahlgren     address@hidden
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1365.2.17
diff -u -r1.1365.2.17 automake.in
--- automake.in 30 Nov 2002 16:52:03 -0000      1.1365.2.17
+++ automake.in 30 Nov 2002 19:39:52 -0000
@@ -3604,30 +3604,24 @@
 {
     my ($filename) = @_;
 
-    # These are always created, no matter whether indexes are used or not.
-    # (Actually tmp is only created if an @macro is used and a certain e-TeX
+    # Some of the following extensions are always created, no matter
+    # whether indexes are used or not.  Other (like cps, fns, ... pgs)
+    # are only created when they are used.  We used to scan $FILENAME
+    # for their use, but that is not enough: they could be used in
+    # included files.  We can't scan included files because we don't
+    # know the include path.  Therefore we always erase these files,
+    # no matter whether they are used or not.
+    #
+    # (tmp is only created if an @macro is used and a certain e-TeX
     # feature is not available.)
-    my @clean_suffixes = qw(aux log toc tmp
-                           cp fn ky vr tp pg); # grep new.*index texinfo.tex
-
-    # There are predefined indexes which don't follow the regular rules.
-    my %predefined_index = qw(c cps
-                             f fns
-                             k kys
-                             v vrs
-                             t tps
-                             p pgs);
-
-    # There are commands which include a hidden index command.
-    my %hidden_index = (tp => 'tps');
-    $hidden_index{$_} = 'fns' foreach qw(fn un typefn typefun max spec
-                                        op typeop method typemethod);
-    $hidden_index{$_} = 'vrs' foreach qw(vr var typevr typevar opt cv
-                                        ivar typeivar);
-
-    # Indexes stored into another one.  In this case, the *.??s file
-    # is not created.
-    my @syncodeindexes = ();
+    my %clean_suffixes =
+      map { $_ => 1 } (qw(aux log toc tmp
+                         cp cps
+                         fn fns
+                         ky kys
+                         vr vrs
+                         tp tps
+                         pg pgs)); # grep 'new.*index' texinfo.tex
 
     my $texi = new Automake::XFile "< $filename";
     verb "reading $filename";
@@ -3656,30 +3650,20 @@
         $vfile = $1;
       }
 
-      # Try to find what are the indexes which are used.
+      # Try to find new or unused indexes.
 
       # Creating a new category of index.
       elsif (/address@hidden(code)?index (\w+)/)
       {
-        push @clean_suffixes, $2;
-      }
-
-      # Storing in a predefined index.
-      elsif (/^\@([cfkvtp])index /)
-      {
-        push @clean_suffixes, $predefined_index{$1};
-      }
-      elsif (/address@hidden(\w+) /)
-      {
-       push @clean_suffixes, $hidden_index{$1}
-         if defined $hidden_index{$1};
+       $clean_suffixes{$2} = 1;
+       $clean_suffixes{"$2s"} = 1;
       }
 
       # Merging an index into an another.
       elsif (/address@hidden(code)?index (\w+) (\w+)/)
       {
-       push @syncodeindexes, "$2s";
-       push @clean_suffixes, "$3s";
+       delete $clean_suffixes{"$2s"};
+       $clean_suffixes{"$3s"} = 1;
       }
 
     }
@@ -3692,9 +3676,8 @@
 
     my $infobase = basename ($filename);
     $infobase =~ s/\.te?xi(nfo)?$//;
-    my %clean_files = map { +"$infobase.$_" => 1 } @clean_suffixes;
-    grep { delete $clean_files{"$infobase.$_"} } @syncodeindexes;
-    return ($outfile, $vfile, (sort keys %clean_files));
+    return ($outfile, $vfile,
+           map { "$infobase.$_" } (sort keys %clean_suffixes));
 }
 
 # ($DIRSTAMP, @CLEAN_FILES)
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.443.2.9
diff -u -r1.443.2.9 Makefile.am
--- tests/Makefile.am   30 Nov 2002 16:52:03 -0000      1.443.2.9
+++ tests/Makefile.am   30 Nov 2002 19:39:52 -0000
@@ -412,6 +412,7 @@
 texinfo13.test \
 texinfo16.test \
 texinfo17.test \
+texinfo18.test \
 transform.test \
 unused.test \
 vars.test \
Index: tests/texinfo18.test
===================================================================
RCS file: tests/texinfo18.test
diff -N tests/texinfo18.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/texinfo18.test        30 Nov 2002 19:39:54 -0000
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 2002  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 autoconf; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure we clean index files, even if they are not used at the top-level.
+# Only *new* indexes need to be declared at the top-level.
+# PR/375.
+
+required='makeinfo tex'
+. ./defs || exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = main.texi
+main_TEXINFOS = sub.texi
+END
+
+cat > main.texi << 'END'
+\input texinfo
address@hidden main.info
address@hidden main
address@hidden au
address@hidden sa
address@hidden sb
address@hidden sa sb
address@hidden Top
+Hello walls.
address@hidden sub.texi
address@hidden
+END
+
+cat > sub.texi << 'END'
address@hidden foo
+foo
address@hidden bar
+bar
address@hidden baz
+baz
address@hidden sa
+sa
address@hidden sb
+sb
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure
+$MAKE distcheck
-- 
Alexandre Duret-Lutz





reply via email to

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