[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: wrap very long lines
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: wrap very long lines |
Date: |
Sat, 12 Feb 2005 12:41:44 +0100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) |
I'm installing this on HEAD and branch-1-9, as discussed in
http://lists.gnu.org/archive/html/automake/2005-02/msg00010.html
2005-02-12 Alexandre Duret-Lutz <address@hidden>
* automake.in (read_am_file): Define variable containing long
lines as VAR_PRETTY to work around tools with limited input width.
* tests/longlin2.test: New file.
* tests/Makefile.am (TESTS): Add it.
Report from Albert Chin.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1569.2.11
diff -u -r1.1569.2.11 automake.in
--- automake.in 1 Jan 2005 14:00:41 -0000 1.1569.2.11
+++ automake.in 12 Feb 2005 11:37:48 -0000
@@ -5754,6 +5754,7 @@
my $comment = '';
my $blank = 0;
my $saw_bk = 0;
+ my $var_look = VAR_ASIS;
use constant IN_VAR_DEF => 0;
use constant IN_RULE_DEF => 1;
@@ -5922,21 +5923,35 @@
$last_var_value = $3;
$last_where = $where->clone;
if ($3 ne '' && substr ($3, -1) eq "\\")
- {
+ {
# We preserve the `\' because otherwise the long lines
# that are generated will be truncated by broken
# `sed's.
$last_var_value = $3 . "\n";
- }
+ }
+ # Normally we try to output variable definitions in the
+ # same format they were input. However, POSIX compliant
+ # systems are not required to support lines longer than
+ # 2048 bytes (most notably, some sed implementation are
+ # limited to 4000 bytes, and sed is used by config.status
+ # to rewrite Makefile.in into Makefile). Moreover nobody
+ # would really write such long lines by hand since it is
+ # hardly maintainable. So if a line is longer that 1000
+ # bytes (an arbitrary limit), assume it has been
+ # automatically generated by some tools, and flatten the
+ # variable definition. Otherwise, keep the variable as it
+ # as been input.
+ $var_look = VAR_PRETTY if length ($last_var_value) >= 1000;
if (!/\\$/)
{
Automake::Variable::define ($last_var_name, VAR_MAKEFILE,
$last_var_type, $cond,
$last_var_value, $comment,
- $last_where, VAR_ASIS)
+ $last_where, $var_look)
if $cond != FALSE;
$comment = $spacing = '';
+ $var_look = VAR_ASIS;
}
}
elsif (/$INCLUDE_PATTERN/o)
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.565.2.12
diff -u -r1.565.2.12 Makefile.am
--- tests/Makefile.am 16 Jan 2005 00:37:05 -0000 1.565.2.12
+++ tests/Makefile.am 12 Feb 2005 11:37:48 -0000
@@ -318,6 +318,7 @@
listval.test \
location.test \
longline.test \
+longlin2.test \
ltcond.test \
ltcond2.test \
ltconv.test \
Index: tests/longlin2.test
===================================================================
RCS file: tests/longlin2.test
diff -N tests/longlin2.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/longlin2.test 12 Feb 2005 11:37:49 -0000
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 2005 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Long lines should be wrapped.
+# Report from Albert Chin.
+
+. ./defs || exit 1
+
+set -e
+
+n=1
+files=
+match=
+while test $n -le 100
+do
+ files="$files filename$n"
+ match="..........$match"
+ n=`expr $n + 1`
+done
+files2=`echo "$files" | sed s/filename/filenameb/g`
+
+cat >Makefile.am <<EOF
+FOO = $files $files2 \
+ grepme
+EOF
+
+# The `FOO = ...' line is 2293-byte long. More than what a POSIX
+# conforment system is expected to support.
+
+# (It's OK if grep truncates the long line.)
+grep $match Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+
+grep $match Makefile.in && exit 1
+grep 'filenameb100 grepme' Makefile.in
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: wrap very long lines,
Alexandre Duret-Lutz <=