diff options
author | rillig <rillig@pkgsrc.org> | 2008-11-24 14:59:28 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2008-11-24 14:59:28 +0000 |
commit | 784d621bc288e820e5b8740b32a24f0b4dc90fa2 (patch) | |
tree | a4da8412027d5a3dd71c51413199b7f512431526 /pkgtools | |
parent | 24d4cb8fe7246c030861a2fa4208b2d871b80c3d (diff) | |
download | pkgsrc-784d621bc288e820e5b8740b32a24f0b4dc90fa2.tar.gz |
Allowed pkglint to check doc/CHANGES-* files individually.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 3dd89950b7b..9341c5790ba 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.789 2008/11/19 07:46:35 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.790 2008/11/24 14:59:28 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -2221,6 +2221,35 @@ sub get_wip_TODO_updates() { return $get_wip_TODO_updates_result; } +sub load_doc_CHANGES($) { + my ($fname) = @_; + my $lines = load_file($fname) or die; + + my @changes = (); + foreach my $line (@$lines) { + my $text = $line->text; + next unless $text =~ m"^\t[A-Z]"; + + if ($text =~ m"^\t(Updated) (\S+) to (\S+) \[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { + push(@changes, PkgLint::Change->new($line, $1, $2, $3, $4, $5)); + } elsif ($text =~ m"^\t(Added) (\S+) version (\S+) \[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { + push(@changes, PkgLint::Change->new($line, $1, $2, $3, $4, $5)); + } elsif ($text =~ m"^\t(Removed) (\S+) (?:successor (\S+) )?\[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { + push(@changes, PkgLint::Change->new($line, $1, $2, undef, $3, $4)); + } elsif ($text =~ m"^\t(Downgraded) (\S+) to (\S+) \[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { + push(@changes, PkgLint::Change->new($line, $1, $2, $3, $4, $5)); + } elsif ($text =~ m"^\t(Renamed|Moved) (\S+) to (\S+) \[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { + push(@changes, PkgLint::Change->new($line, $1, $2, $3, $4, $5)); + } else { + $line->log_warning("Unknown doc/CHANGES line: " . $line->text); + $line->explain_warning( +"Maybe some developer didn't stick to the conventions that have been", +"established by mk/misc/developer.mk?"); + } + } + return \@changes; +} + my $get_doc_CHANGES_docs = undef; # [ $fname, undef or $lines ] sub get_doc_CHANGES($) { my ($pkgpath) = @_; @@ -2247,31 +2276,7 @@ sub get_doc_CHANGES($) { foreach my $doc (@$get_doc_CHANGES_docs) { if (!defined($doc->[1])) { $opt_debug_misc and log_debug(NO_FILE, NO_LINES, "loading $doc->[0]"); - my $lines = load_file("${cwd_pkgsrcdir}/doc/$doc->[0]") or die; - - my @changes = (); - foreach my $line (@$lines) { - my $text = $line->text; - next unless $text =~ m"^\t[A-Z]"; - - if ($text =~ m"^\t(Updated) (\S+) to (\S+) \[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { - push(@changes, PkgLint::Change->new($line, $1, $2, $3, $4, $5)); - } elsif ($text =~ m"^\t(Added) (\S+) version (\S+) \[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { - push(@changes, PkgLint::Change->new($line, $1, $2, $3, $4, $5)); - } elsif ($text =~ m"^\t(Removed) (\S+) (?:successor (\S+) )?\[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { - push(@changes, PkgLint::Change->new($line, $1, $2, undef, $3, $4)); - } elsif ($text =~ m"^\t(Downgraded) (\S+) to (\S+) \[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { - push(@changes, PkgLint::Change->new($line, $1, $2, $3, $4, $5)); - } elsif ($text =~ m"^\t(Renamed|Moved) (\S+) to (\S+) \[(\S+) (\d\d\d\d-\d\d-\d\d)\]$") { - push(@changes, PkgLint::Change->new($line, $1, $2, $3, $4, $5)); - } else { - $line->log_warning("Unknown doc/CHANGES line: " . $line->text); - $line->explain_warning( -"Maybe some developer didn't stick to the conventions that have been", -"established by mk/misc/developer.mk?"); - } - } - $doc->[1] = \@changes; + $doc->[1] = load_doc_CHANGES("${cwd_pkgsrcdir}/doc/$doc->[0]"); } foreach my $change (@{$doc->[1]}) { @@ -7734,6 +7739,9 @@ sub checkfile($) { } elsif ($basename eq "TODO" || $basename eq "README") { # Ok + } elsif ($basename =~ m"^CHANGES-.*") { + load_doc_CHANGES($fname); + } elsif (!-T $fname) { log_warning($fname, NO_LINE_NUMBER, "Unexpectedly found a binary file."); |