summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig>2005-09-01 22:45:16 +0000
committerrillig <rillig>2005-09-01 22:45:16 +0000
commit71212950877a1e49d8b18f8603358d6246c9fc7e (patch)
tree4e03651cc69d0c45fc58a8c886218bf96c6d3771
parentb75056f0a64505e0ee75110ec2a4c729549b9b69 (diff)
downloadpkgsrc-71212950877a1e49d8b18f8603358d6246c9fc7e.tar.gz
Fixed the false warnings for lines in patches that start with "---". The
old parser had been a little too simple.
-rw-r--r--pkgtools/pkglint/files/pkglint.pl13
1 files changed, 10 insertions, 3 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 98f10355dad..dee4ffa94bc 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -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 @@ sub checkfile_extra($$) {
# $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 @@ sub check_for_multiple_patches($) {
} elsif (index($text, "+++ ") == 0) {
$line_type = "+";
+ } elsif ($dellines > 0 && $text =~ qr"^(?:-|\s)") {
+ $dellines--;
+
} else {
$line_type = "";
}