pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files In logical lines from Makefiles...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/56220edc347f
branches:  trunk
changeset: 498755:56220edc347f
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Sep 02 11:43:52 2005 +0000

description:
In logical lines from Makefiles, white-space surrounding the
continuation is stripped from the string to make the output shorter.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (41 lines):

diff -r 71a6a6ad95e7 -r 56220edc347f pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Fri Sep 02 11:40:56 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Fri Sep 02 11:43:52 2005 +0000
@@ -11,7 +11,7 @@
 # Freely redistributable.  Absolutely no warranty.
 #
 # From Id: portlint.pl,v 1.64 1998/02/28 02:34:05 itojun Exp
-# $NetBSD: pkglint.pl,v 1.267 2005/09/02 10:42:18 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.268 2005/09/02 11:43:52 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -506,16 +506,21 @@
 
 sub get_logical_line($$) {
        my ($lines, $ref_lineno) = @_;
-       my ($value, $lineno);
+       my ($value, $lineno, $first);
 
        $value = "";
+       $first = true;
        for ($lineno = ${$ref_lineno}; $lineno <= $#{$lines}; $lineno++) {
-               my $text = $lines->[$lineno]->text;
-               if ($text =~ qr"^(.*)\\$") {
-                       $value .= $1;
-               } else {
-                       $value .= $text;
-                       last;
+               if ($lines->[$lineno]->text =~ qr"^(\s*)(.*?)\s*(\\?)$") {
+                       my ($indent, $text, $cont) = ($1, $2, $3);
+
+                       $value .= $first ? "$indent$text" : $text;
+                       if ($cont eq "\\") {
+                               $value .= " ";
+                       } else {
+                               last;
+                       }
+                       $first = false;
                }
        }
        ${$ref_lineno} = $lineno + 1;



Home | Main Index | Thread Index | Old Index