pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - Make sure that at the end of ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d222ec06bf8c
branches:  trunk
changeset: 509031:d222ec06bf8c
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Mar 02 13:23:28 2006 +0000

description:
- Make sure that at the end of a patch file, the state of the parser is
  PST_TEXT. Otherwise the last hunk may not be checked completely.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diffs (45 lines):

diff -r 80dbd4edf554 -r d222ec06bf8c pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Mar 02 13:08:37 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Mar 02 13:23:28 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.541 2006/03/02 13:08:37 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.542 2006/03/02 13:23:28 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -4539,6 +4539,34 @@
                }
        }
 
+       while ($state != PST_TEXT) {
+               $opt_debug and log_debug($fname, "EOF", "[${state} ${patched_files}/".($hunks||0)."/-".($dellines||0)."+".($addlines||0)."]");
+
+               my $found = false;
+               foreach my $t (@{$transitions}) {
+                       if ($state == $t->[0] && !defined($t->[1])) {
+                               my $newstate;
+
+                               $m = undef;
+                               $redostate = undef;
+                               $nextstate = $t->[2];
+                               $t->[3]->();
+                               $newstate = (defined($redostate)) ? $redostate : $nextstate;
+                               if ($newstate == $state) {
+                                       log_fatal($fname, "EOF", "Internal error in the patch transition table.");
+                               }
+                               $state = $newstate;
+                               $found = true;
+                               last;
+                       }
+               }
+
+               if (!$found) {
+                       log_error($fname, "EOF", "Parse error: state=${state}");
+                       $state = PST_TEXT;
+               }
+       }
+
        if ($patched_files > 1) {
                log_warning($fname, NO_LINE_NUMBER, "Contains patches for $patched_files files, should be only one.");
 



Home | Main Index | Thread Index | Old Index