pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Fixed the false warnings for li...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/abaaf4ae3524
branches:  trunk
changeset: 498740:abaaf4ae3524
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Sep 01 22:45:16 2005 +0000

description:
Fixed the false warnings for lines in patches that start with "---". The
old parser had been a little too simple.

diffstat:

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

diffs (43 lines):

diff -r ad6106877f8b -r abaaf4ae3524 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Sep 01 22:23:41 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Sep 01 22:45:16 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.262 2005/09/01 22:09:39 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.263 2005/09/01 22:45:16 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -954,14 +954,18 @@
 # $lines => an array of lines as returned by load_file().
 sub check_for_multiple_patches($) {
        my ($lines) = @_;
-       my ($files_in_patch, $patch_state, $line_type);
+       my ($files_in_patch, $patch_state, $line_type, $dellines);
 
        $files_in_patch = 0;
        $patch_state = "";
+       $dellines = 0;
        foreach my $line (@{$lines}) {
                my $text = $line->text;
 
-               if (index($text, "--- ") == 0 && $text !~ qr"^--- \d+(?:,\d+|) ----$") {
+               if ($text =~ qr"^@@ -\d+,(\d+) \+\d+,\d+ @@") {
+                       $dellines = $1;
+
+               } elsif ($dellines == 0 && index($text, "--- ") == 0 && $text !~ qr"^--- \d+(?:,\d+|) ----$") {
                        $line_type = "-";
 
                } elsif (index($text, "*** ") == 0 && $text !~ qr"^\*\*\* \d+(?:,\d+|) \*\*\*\*$") {
@@ -971,6 +975,9 @@
                } elsif (index($text, "+++ ") == 0) {
                        $line_type = "+";
 
+               } elsif ($dellines > 0 && $text =~ qr"^(?:-|\s)") {
+                       $dellines--;
+
                } else {
                        $line_type = "";
                }



Home | Main Index | Thread Index | Old Index