pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc Updated pkglint to 4.42.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7a08514aa975
branches:  trunk
changeset: 503116:7a08514aa975
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Nov 14 11:45:52 2005 +0000

description:
Updated pkglint to 4.42.

Changes since 4.41:
- In .mk files, line continuations are properly handled.
- An open bracket is allowed in variable and tool names.
- Added checks for ALTERNATIVES and INSTALL/DEINSTALL files.
- By default, don't check files in ${FILESDIR}.
- Warn about unknown file and directory names.

diffstat:

 doc/CHANGES                       |    3 +-
 pkgtools/pkglint/Makefile         |    4 +-
 pkgtools/pkglint/files/pkglint.0  |    4 +
 pkgtools/pkglint/files/pkglint.1  |    6 +-
 pkgtools/pkglint/files/pkglint.pl |  152 ++++++++++++++++++++++++++-----------
 5 files changed, 119 insertions(+), 50 deletions(-)

diffs (271 lines):

diff -r e1678c37f144 -r 7a08514aa975 doc/CHANGES
--- a/doc/CHANGES       Mon Nov 14 10:43:14 2005 +0000
+++ b/doc/CHANGES       Mon Nov 14 11:45:52 2005 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.11932 2005/11/14 10:12:17 augustss Exp $
+$NetBSD: CHANGES,v 1.11933 2005/11/14 11:46:22 rillig Exp $
 
 Changes to the packages collection and infrastructure in 2005:
 
@@ -5219,3 +5219,4 @@
        Updated net/samba to 3.0.20.2 [jlam 2005-11-14]
        Updated mail/mailgraph to 1.12 [kleink 2005-11-14]
        Updated comms/birda to 1.2 [augustss 2005-11-14]
+       Updated pkgtools/pkglint to 4.42 [rillig 2005-11-14]
diff -r e1678c37f144 -r 7a08514aa975 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Mon Nov 14 10:43:14 2005 +0000
+++ b/pkgtools/pkglint/Makefile Mon Nov 14 11:45:52 2005 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.294 2005/11/14 04:05:22 rillig Exp $
+# $NetBSD: Makefile,v 1.295 2005/11/14 11:45:52 rillig Exp $
 #
 
-DISTNAME=      pkglint-4.41
+DISTNAME=      pkglint-4.42
 CATEGORIES=    pkgtools devel
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r e1678c37f144 -r 7a08514aa975 pkgtools/pkglint/files/pkglint.0
--- a/pkgtools/pkglint/files/pkglint.0  Mon Nov 14 10:43:14 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.0  Mon Nov 14 11:45:52 2005 +0000
@@ -52,6 +52,10 @@
 
            nnoonnee                Disable all checks.
 
+           [[nnoo--]]AALLTTEERRNNAATTIIVVEESS   Check the alternatives file.
+
+           [[nnoo--]]IINNSSTTAALLLL        Check the INSTALL and DEINSTALL scripts.
+
            [[nnoo--]]MMaakkeeffiillee       Check the package Makefile, including all
                                included files.
 
diff -r e1678c37f144 -r 7a08514aa975 pkgtools/pkglint/files/pkglint.1
--- a/pkgtools/pkglint/files/pkglint.1  Mon Nov 14 10:43:14 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.1  Mon Nov 14 11:45:52 2005 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkglint.1,v 1.26 2005/11/14 04:05:22 rillig Exp $
+.\"    $NetBSD: pkglint.1,v 1.27 2005/11/14 11:45:52 rillig Exp $
 .\"    From FreeBSD: portlint.1,v 1.8 1997/11/25 14:53:14 itojun Exp
 .\"
 .\" Copyright (c) 1997 by Jun-ichiro Itoh <itojun%itojun.org@localhost>.
@@ -67,6 +67,10 @@
 Enable all checks.
 .It Cm none
 Disable all checks.
+.It Cm [no-]ALTERNATIVES
+Check the alternatives file.
+.It Cm [no-]INSTALL
+Check the INSTALL and DEINSTALL scripts.
 .It Cm [no-]Makefile
 Check the package Makefile, including all included files.
 .It Cm [no-]MESSAGE
diff -r e1678c37f144 -r 7a08514aa975 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Mon Nov 14 10:43:14 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Mon Nov 14 11:45:52 2005 +0000
@@ -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.353 2005/11/14 05:57:54 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.354 2005/11/14 11:45:52 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -502,20 +502,24 @@
 
 # Command Line Options
 
+my $opt_check_ALTERNATIVES = true;
 my $opt_check_bl3      = true;
 my $opt_check_DESCR    = true;
 my $opt_check_distinfo = true;
-my $opt_check_extra    = true;
+my $opt_check_extra    = false;
+my $opt_check_INSTALL  = true;
 my $opt_check_Makefile = true;
 my $opt_check_MESSAGE  = true;
 my $opt_check_mk       = true;
 my $opt_check_patches  = true;
 my $opt_check_PLIST    = true;
 my (%checks) = (
+       "ALTERNATIVES"  => [\$opt_check_ALTERNATIVES, "check ALTERNATIVES files"],
        "bl3"           => [\$opt_check_bl3, "check buildlink3 files"],
        "DESCR"         => [\$opt_check_DESCR, "check DESCR file"],
        "distinfo"      => [\$opt_check_distinfo, "check distinfo file"],
        "extra"         => [\$opt_check_extra, "check various additional files"],
+       "INSTALL"       => [\$opt_check_INSTALL, "check INSTALL and DEINSTALL scripts"],
        "Makefile"      => [\$opt_check_Makefile, "check Makefiles"],
        "MESSAGE"       => [\$opt_check_MESSAGE, "check MESSAGE files"],
        "mk"            => [\$opt_check_mk, "check other .mk files"],
@@ -2252,6 +2256,32 @@
        return true;
 }
 
+sub checkfile_ALTERNATIVES($) {
+       my ($fname) = @_;
+       my ($lines);
+
+       log_subinfo("checkfile_ALTERNATIVES", $fname, NO_LINE_NUMBER, undef);
+
+       checkperms($fname);
+       if (!($lines = load_file($fname))) {
+               log_error($fname, NO_LINE_NUMBER, "Cannot be read.");
+               return;
+       }
+}
+
+sub checkfile_INSTALL($) {
+       my ($fname) = @_;
+       my ($lines);
+
+       log_subinfo("checkfile_INSTALL", $fname, NO_LINE_NUMBER, undef);
+
+       checkperms($fname);
+       if (!($lines = load_file($fname))) {
+               log_error($fname, NO_LINE_NUMBER, "Cannot be read.");
+               return;
+       }
+}
+
 sub checkfile_mk($) {
        my ($fname) = @_;
        my ($lines);
@@ -2548,6 +2578,77 @@
        checklines_Makefile_varuse($lines);
 }
 
+sub checkfile($) {
+       my ($fname) = @_;
+       my ($st, $basename);
+
+       log_subinfo("checkfile", $fname, NO_LINE_NUMBER, undef);
+
+       $basename = basename($fname);
+       if ($basename =~ qr"^(?:work.*|.*~|.*\.orig|.*\.rej)$") {
+               if ($opt_import) {
+                       log_error($fname, NO_LINE_NUMBER, "Must be cleaned up before committing the package.");
+               }
+               return;
+       }
+
+       if (!($st = lstat($fname))) {
+               log_error($fname, NO_LINE_NUMBER, "$!");
+               return;
+       }
+       if (S_ISDIR($st->mode)) {
+               if ($basename eq "files" || $basename eq "patches" || $basename eq "CVS") {
+                       # Ok
+
+               } else {
+                       log_warning($fname, NO_LINE_NUMBER, "Unknown directory name.");
+               }
+
+       } elsif (!S_ISREG($st->mode)) {
+               log_error($fname, NO_LINE_NUMBER, "Only files and directories are allowed in pkgsrc.");
+
+       } elsif ($basename eq "ALTERNATIVES") {
+               $opt_check_ALTERNATIVES and checkfile_ALTERNATIVES($fname);
+
+       } elsif ($basename eq "buildlink3.mk") {
+               $opt_check_bl3 and checkfile_mk($fname);
+
+       } elsif ($basename =~ qr"^(?:.*\.mk|Makefile.*)$") {
+               $opt_check_mk and checkfile_mk($fname);
+
+       } elsif ($basename =~ qr"^DESCR") {
+               $opt_check_DESCR and checkfile_DESCR($fname);
+
+       } elsif ($basename =~ qr"^distinfo") {
+               $opt_check_distinfo and checkfile_distinfo($fname);
+
+       } elsif ($basename eq "DEINSTALL" || $basename eq "INSTALL") {
+               $opt_check_INSTALL and checkfile_INSTALL($fname);
+
+       } elsif ($basename =~ qr"^MESSAGE") {
+               $opt_check_MESSAGE and checkfile_MESSAGE($fname);
+
+       } elsif ($basename =~ qr"^patch-[A-Za-z0-9]*$") {
+               $opt_check_patches and checkfile_patches_patch($fname);
+
+       } elsif ($fname =~ qr"(?:^|/)patches/[^/]*$") {
+               log_warning($fname, NO_LINE_NUMBER, "Patch files should be named \"patch-\", followed by letters and digits only.");
+
+       } elsif ($basename =~ qr"^PLIST") {
+               $opt_check_PLIST and checkfile_PLIST($fname);
+
+       } elsif ($basename eq "TODO") {
+               # Ok
+
+       } elsif (!-T $fname) {
+               log_warning($fname, NO_LINE_NUMBER, "Unexpectedly found a binary file.");
+
+       } else {
+               log_warning($fname, NO_LINE_NUMBER, "Unexpected file found.");
+               $opt_check_extra and checkfile_extra($fname);
+       }
+}
+
 sub checkdir_root() {
        my ($fname) = "${current_dir}/Makefile";
        my ($lines, $prev_subdir, @subdirs);
@@ -2786,49 +2887,6 @@
        }
 }
 
-sub checkfile($) {
-       my ($fname) = @_;
-
-       if      ($fname =~ qr"(?:work[^/]*|~|\.orig|\.rej)$") {
-               if ($opt_import) {
-                       log_error($fname, NO_LINE_NUMBER, "Must be cleaned up before committing the package.");
-               }
-
-       } elsif (!-f $fname) {
-               # We don't have a check for non-regular files yet.
-
-       } elsif ($fname =~ qr"(?:^|/)buildlink3\.mk$") {
-               $opt_check_bl3 and checkfile_mk($fname);
-
-       } elsif ($fname =~ qr"\.mk$") {
-               $opt_check_mk and checkfile_mk($fname);
-
-       } elsif ($fname =~ qr"(?:^|/)DESCR[^/]*$") {
-               $opt_check_DESCR and checkfile_DESCR($fname);
-
-       } elsif ($fname =~ qr"(?:^|/)distinfo$") {
-               $opt_check_distinfo and checkfile_distinfo($fname);
-
-       } elsif ($fname =~ qr"(?:^|/)MESSAGE[^/]*$") {
-               $opt_check_MESSAGE and checkfile_MESSAGE($fname);
-
-       } elsif ($fname =~ qr"(?:^|/)PLIST[^/]*$") {
-               $opt_check_PLIST and checkfile_PLIST($fname);
-
-       } elsif ($fname =~ qr"(?:^|/)patches/patch-[A-Za-z0-9]*$") {
-               $opt_check_patches and checkfile_patches_patch($fname);
-
-       } elsif ($fname =~ qr"(?:^|/)patches/[^/]*$") {
-               log_warning($fname, NO_LINE_NUMBER, "Patch files should be named \"patch-\", followed by letters and digits only.");
-
-       } elsif (-T $fname) {
-               $opt_check_extra and checkfile_extra($fname);
-
-       } else {
-               log_warning($fname, NO_LINE_NUMBER, "Unexpectedly found a binary file.");
-       }
-}
-
 sub checkdir_package() {
        my ($whole, $lines, $have_distinfo, $have_patches);
 
@@ -2842,7 +2900,9 @@
        if ($pkgdir ne ".") {
                push(@files, <${current_dir}/${pkgdir}/*>);
        }
-       push(@files, <${current_dir}/${filesdir}/*>);
+       if ($opt_check_extra) {
+               push(@files, <${current_dir}/${filesdir}/*>);
+       }
        push(@files, <${current_dir}/${patchdir}/*>);
        if ($distinfo_file !~ qr"^(?:\./)?distinfo$") {
                push(@files, "${current_dir}/${distinfo_file}");



Home | Main Index | Thread Index | Old Index