pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc Commit patch from PR 25222 by Roland Illig:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/eb1d8ce40945
branches:  trunk
changeset: 477035:eb1d8ce40945
user:      hubertf <hubertf%pkgsrc.org@localhost>
date:      Fri Jun 25 19:03:26 2004 +0000

description:
Commit patch from PR 25222 by Roland Illig:
 * use strict mode (already found one error... hi wiz!)
 * add -q (quiet) flag
 * Identifie if patch files don't patch any or more than one file

diffstat:

 doc/CHANGES                       |   3 +-
 pkgtools/pkglint/Makefile         |   4 +-
 pkgtools/pkglint/files/pkglint.pl |  83 +++++++++++++++++++++++++++++---------
 3 files changed, 67 insertions(+), 23 deletions(-)

diffs (221 lines):

diff -r bcd14d88ac7d -r eb1d8ce40945 doc/CHANGES
--- a/doc/CHANGES       Fri Jun 25 17:41:47 2004 +0000
+++ b/doc/CHANGES       Fri Jun 25 19:03:26 2004 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.6316 2004/06/25 17:22:41 wiz Exp $
+$NetBSD: CHANGES,v 1.6317 2004/06/25 19:03:26 hubertf Exp $
 
 Changes to the packages collection and infrastructure in 2004:
 
@@ -3067,3 +3067,4 @@
        Updated gnuplot to 4.0 [adrianp 2004-06-25]
        Updated gnuplot-nox11 to 4.0 [adrianp 2004-06-25]
        Added ctorrent-1.3.2 [wiz 2004-06-25]
+       Updated pkglint to 3.78 [hubertf 2004-06-25]
diff -r bcd14d88ac7d -r eb1d8ce40945 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Fri Jun 25 17:41:47 2004 +0000
+++ b/pkgtools/pkglint/Makefile Fri Jun 25 19:03:26 2004 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.190 2004/06/06 16:37:53 schmonz Exp $
+# $NetBSD: Makefile,v 1.191 2004/06/25 19:03:26 hubertf Exp $
 #
 
-DISTNAME=      pkglint-3.77
+DISTNAME=      pkglint-3.78
 CATEGORIES=    pkgtools devel
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r bcd14d88ac7d -r eb1d8ce40945 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Fri Jun 25 17:41:47 2004 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Fri Jun 25 19:03:26 2004 +0000
@@ -1,4 +1,4 @@
-#!@PERL@
+#!@PERL@ -w
 #
 # pkglint - lint for package directory
 #
@@ -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.106 2004/06/06 16:37:53 schmonz Exp $
+# $NetBSD: pkglint.pl,v 1.107 2004/06/25 19:03:26 hubertf Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by Hubert Feyrer <hubertf%netbsd.org@localhost>,
@@ -37,12 +37,14 @@
 $rcsidstr = 'NetBSD';
 $localbase = '@PREFIX@';
 
-getopts('hINB:vV');
+%opts = ();
+getopts('hINB:qvV', \%opts);
 
-if ($opt_h) {
+if ($opts{"h"}) {
                ($prog) = ($0 =~ /([^\/]+)$/);
                print STDERR <<EOF;
-usage: $prog [-vIN] [-B#] [package_directory]
+usage: $prog [-qvIN] [-B#] [package_directory]
+       -q      quiet
        -v      verbose mode
        -V      version (@DISTVER@)
        -I      show Makefile (with all included files)
@@ -51,14 +53,15 @@
 EOF
                exit 0;
 };
-$verbose = 1   if $opt_v;
-$newpkg = 1    if $opt_N;
-$showmakefile = 1      if $opt_I;
-$contblank = $opt_B    if $opt_B;
+$quiet = 1     if $opts{"q"};
+$verbose = 1   if $opts{"v"};
+$newpkg = 1    if $opts{"N"};
+$showmakefile = 1      if $opts{"I"};
+$contblank = $opts{"B"}        if $opts{"B"};
 
 $portdir = shift || ".";
 
-if ($opt_V) {
+if ($opts{"V"}) {
        print "@DISTVER@\n";
        exit;
 }
@@ -133,7 +136,7 @@
 }
 
 # we need to handle the Makefile first to get some variables
-print "OK: checking Makefile.\n";
+print "OK: checking Makefile.\n" unless $quiet;
 if (! -f "$portdir/Makefile") {
        &perror("FATAL: no Makefile in \"$portdir\".");
 } else {
@@ -194,7 +197,7 @@
        }
 }
 foreach $i (@checker) {
-       print "OK: checking $i.\n";
+       print "OK: checking $i.\n" unless $quiet;
        if (! -f "$portdir/$i") {
                &perror("FATAL: no $i in \"$portdir\".");
        } else {
@@ -586,9 +589,9 @@
 }
 
 sub checkpatch {
-       local($file) = @_;
-       local($rcsidseen) = 0;
-       local($whole);
+       my ($file) = @_;
+       my ($rcsidseen, $whole, @lines);
+       $rcsidseen = 0;
 
        if ($file =~ /.*~$/) {
                &perror("WARN: is $file a backup file? If so, please remove it \n"
@@ -602,6 +605,7 @@
        while (<IN>) {
                $rcsidseen++ if /\$$rcsidstr[:\$]/;
                $whole .= $_;
+               push(@lines, $_);
        }
        if ($committer && $whole =~ /.\$(Author|Date|Header|Id|Locker|Log|Name|RCSfile|Revision|Source|State|NetBSD)(:.*\$|\$)/) { # XXX
                # RCS ID in very first line is ok, to identify version
@@ -615,6 +619,45 @@
                        "in patch $file.")
        }
        close(IN);
+
+       $files_in_patch = 0;
+       $patch_state = "";
+       foreach my $patch_line (@lines) {
+           chomp($patch_line);
+           if (index($patch_line, "--- ") == 0 && $patch_line !~ qr"^--- \d+,\d+ ----$") {
+               $line_type = "-";
+           } elsif (index($patch_line, "*** ") == 0 && $patch_line !~ qr"^\*\*\* \d+,\d+ \*\*\*\*$") {
+               $line_type = "*";
+           } elsif (index($patch_line, "+++ ") == 0) {
+               $line_type = "+";
+           } else {
+               $line_type = "";
+           }
+           if ($patch_state eq "*") {
+               if ($line_type eq "-") {
+                   $files_in_patch++;
+                   $patch_state = "";
+               } else {
+                   &perror("WARN: $i:$.: unknown patch format (might be an internal error)");
+               }
+           } elsif ($patch_state eq "-") {
+               if ($line_type eq "+") {
+                   $files_in_patch++;
+                   $patch_state = "";
+               } else {
+                   &perror("WARN: $i:$.: unknown patch format (might be an internal error)");
+               }
+           } elsif ($patch_state eq "") {
+               $patch_state = $line_type;
+           }
+           #printf("%s:%d: state=(%s), line=(%s)\n", $i, $., $patch_state, $line_type);
+       }
+       if ($files_in_patch > 1) {
+           &perror("WARN: patch `$i' contains patches for more than one file, namely $files_in_patch");
+       } elsif ($files_in_patch == 0) {
+           &perror("WARN: patch `$i' contains no patch");
+       }
+       return 1;
 }
 
 sub readmakefile {
@@ -653,7 +696,7 @@
                                                $level--;
                                        }
                                        if ($level eq 0) {
-                                               break;
+                                               last;
                                        }
                                }
                                if ($level > 0) {
@@ -663,7 +706,7 @@
                        }
                        else {
                                print("OK: defining $1\n") if $verbose;
-                               $definesfound{$1} = true;
+                               $definesfound{$1} = 1;
                        }
                }
                # try to get any included file
@@ -682,7 +725,7 @@
                        } else {
                                $dirname = dirname($file);
                                 if (-e "$dirname/$includefile") {
-                                    print("OK: including $dirname/$includefile\n");
+                                    print("OK: including $dirname/$includefile\n") unless $quiet;
                                     $contents .= readmakefile("$dirname/$includefile");
                                 }
                                 else {
@@ -1347,6 +1390,8 @@
                        print "OK: checking packages listed in $j.\n"
                                if ($verbose);
                        foreach $k (split(/\s+/, $i)) {
+                               $l = (split(':', $k))[0];
+
                                # check BUILD_USES_MSGFMT
                                if ($l =~ /^(msgfmt|gettext)$/) {
                                        &perror("WARN: dependency to $1 ".
@@ -1354,7 +1399,6 @@
                                                " BUILD_USES_MSGFMT.");
                                }
                                # check USE_PERL5
-                               $l = (split(':', $k))[0];
                                if ($l =~ /^perl(\.\d+)?$/) {
                                        &perror("WARN: dependency to perl ".
                                                "listed in $j. Consider using".
@@ -1659,7 +1703,6 @@
        local($sub) = "";
        local($contents);
        local(@dirlist);
-       local(%alldirs);
        local($i);
 
        $contents = readmakefile("$portdir/$file") or



Home | Main Index | Thread Index | Old Index