pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Allowed pkglint to check doc/CH...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3019240ee896
branches:  trunk
changeset: 550608:3019240ee896
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Nov 24 14:59:28 2008 +0000

description:
Allowed pkglint to check doc/CHANGES-* files individually.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  60 ++++++++++++++++++++++----------------
 1 files changed, 34 insertions(+), 26 deletions(-)

diffs (89 lines):

diff -r fdbc22d2f82f -r 3019240ee896 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Mon Nov 24 14:50:43 2008 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Mon Nov 24 14:59:28 2008 +0000
@@ -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 @@
        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 @@
        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 @@
        } 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.");
 



Home | Main Index | Thread Index | Old Index