summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig>2006-03-02 13:23:28 +0000
committerrillig <rillig>2006-03-02 13:23:28 +0000
commita1f6f9e389615bd967a13fbffc1b414707212e45 (patch)
treea6827f291ddc94ffcfacd2218960f8caa3833654 /pkgtools
parent44fb211e7f2f66b882de5d83f95d658a6a614a5c (diff)
downloadpkgsrc-a1f6f9e389615bd967a13fbffc1b414707212e45.tar.gz
- 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 (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl30
1 files changed, 29 insertions, 1 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index b155a4fd71f..d5a26d6d209 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -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 @@ sub checkfile_patch($) {
}
}
+ 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.");