pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint Updated pkglint to 4.41.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7f9187f19082
branches:  trunk
changeset: 503090:7f9187f19082
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Nov 14 04:05:22 2005 +0000

description:
Updated pkglint to 4.41.

- Documented the --recursive option.
- Added an option -Cmk for checking .mk files besides buildlink3.mk.
- pkglint can handle individual files on the command line, not only
  packages. (experimental)
- Replaced checkfile_buildlink3_mk() with checkfile_mk().
- Factored out the checkfile() subroutine from checkdir_package().

diffstat:

 pkgtools/pkglint/Makefile         |    4 +-
 pkgtools/pkglint/files/pkglint.0  |    8 +
 pkgtools/pkglint/files/pkglint.1  |   11 +-
 pkgtools/pkglint/files/pkglint.pl |  193 ++++++++++++++++++++++---------------
 4 files changed, 132 insertions(+), 84 deletions(-)

diffs (truncated from 353 to 300 lines):

diff -r 7e66ed5e7086 -r 7f9187f19082 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Mon Nov 14 03:12:42 2005 +0000
+++ b/pkgtools/pkglint/Makefile Mon Nov 14 04:05:22 2005 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.293 2005/11/13 17:39:05 rillig Exp $
+# $NetBSD: Makefile,v 1.294 2005/11/14 04:05:22 rillig Exp $
 #
 
-DISTNAME=      pkglint-4.40
+DISTNAME=      pkglint-4.41
 CATEGORIES=    pkgtools devel
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r 7e66ed5e7086 -r 7f9187f19082 pkgtools/pkglint/files/pkglint.0
--- a/pkgtools/pkglint/files/pkglint.0  Mon Nov 14 03:12:42 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.0  Mon Nov 14 04:05:22 2005 +0000
@@ -36,6 +36,10 @@
            --RR|----rrccssiiddssttrriinngg    Allow other RCS Id strings than NetBSD.  Multi-
                                ple strings may be concatenated with `|'.
 
+           --rr                  Check subdirectories, too.  The subdirectories
+                               are those that are mentioned in a `SUBDIR+='
+                               line.
+
            --vv|----vveerrbboossee        Be verbose.  Show the progress report for items
                                that are being checked.
 
@@ -55,10 +59,14 @@
 
            [[nnoo--]]PPLLIISSTT          Check PLIST files.
 
+           [[nnoo--]]bbll33            Check buildlink3 Makefiles.
+
            [[nnoo--]]ddiissttiinnffoo       Check the distinfo file.
 
            [[nnoo--]]eexxttrraa          Check remaining files in the package directory.
 
+           [[nnoo--]]mmkk             Check Makefile fragments besides buildlink3.
+
            [[nnoo--]]ppaattcchheess        Check the pkgsrc specific patch files.
 
      WWaarrnniinnggss
diff -r 7e66ed5e7086 -r 7f9187f19082 pkgtools/pkglint/files/pkglint.1
--- a/pkgtools/pkglint/files/pkglint.1  Mon Nov 14 03:12:42 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.1  Mon Nov 14 04:05:22 2005 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkglint.1,v 1.25 2005/11/10 14:30:56 rillig Exp $
+.\"    $NetBSD: pkglint.1,v 1.26 2005/11/14 04:05:22 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>.
@@ -48,6 +48,11 @@
 Allow other RCS Id strings than NetBSD.
 Multiple strings may be concatenated with
 .Ql | .
+.It Fl r
+Check subdirectories, too.
+The subdirectories are those that are mentioned in a
+.Ql SUBDIR+=
+line.
 .It Fl v Ns | Ns Fl -verbose
 Be verbose.
 Show the progress report for items that are being checked.
@@ -68,10 +73,14 @@
 Check MESSAGE files.
 .It Cm [no-]PLIST
 Check PLIST files.
+.It Cm [no-]bl3
+Check buildlink3 Makefiles.
 .It Cm [no-]distinfo
 Check the distinfo file.
 .It Cm [no-]extra
 Check remaining files in the package directory.
+.It Cm [no-]mk
+Check Makefile fragments besides buildlink3.
 .It Cm [no-]patches
 Check the pkgsrc specific patch files.
 .El
diff -r 7e66ed5e7086 -r 7f9187f19082 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Mon Nov 14 03:12:42 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Mon Nov 14 04:05:22 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.347 2005/11/10 19:47:41 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.348 2005/11/14 04:05:22 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -506,6 +506,7 @@
 my $opt_check_extra    = 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) = (
@@ -515,6 +516,7 @@
        "extra"         => [\$opt_check_extra, "check various additional files"],
        "Makefile"      => [\$opt_check_Makefile, "check Makefiles"],
        "MESSAGE"       => [\$opt_check_MESSAGE, "check MESSAGE files"],
+       "mk"            => [\$opt_check_mk, "check other .mk files"],
        "patches"       => [\$opt_check_patches, "check patches"],
        "PLIST"         => [\$opt_check_PLIST, "check PLIST files"],
 );
@@ -615,7 +617,7 @@
 my $seen_USE_PKGLOCALEDIR;     # Does the package use PKGLOCALEDIR?
 my $seen_Makefile_common;      # Does the package have any .includes?
 
-my @todo_dirs;                 # The list of directories that still need
+my @todo_items;                        # The list of directory entries that still need
                                # to be checked. Mostly relevant with
                                # --recursive.
 
@@ -1187,21 +1189,6 @@
        checklines_trailing_empty_lines($plist);
 }
 
-sub checkfile_buildlink3_mk($) {
-       my ($fname) = @_;
-       my ($lines);
-
-       log_subinfo("checkfile_buildlink3_mk", $fname, NO_LINE_NUMBER, undef);
-
-       if (!($lines = load_file($fname))) {
-               log_error($fname, NO_LINE_NUMBER, "Cannot be read.");
-               return;
-       }
-       checklines_deprecated_variables($lines);
-       checklines_trailing_empty_lines($lines);
-       checklines_direct_tools($lines);
-}
-
 sub checkfile_extra($) {
        my ($fname) = @_;
        my ($lines);
@@ -2267,6 +2254,24 @@
        return true;
 }
 
+sub checkfile_mk($) {
+       my ($fname) = @_;
+       my ($lines);
+
+       log_subinfo("checkfile_mk", $fname, NO_LINE_NUMBER, undef);
+
+       checkperms($fname);
+       if (!($lines = load_file($fname))) {
+               log_error($fname, NO_LINE_NUMBER, "Cannot be read.");
+               return;
+       }
+
+       checklines_deprecated_variables($lines);
+       checklines_direct_tools($lines);
+       checklines_package_Makefile($lines);
+       checklines_Makefile_varuse($lines);
+}
+
 sub checkfile_package_Makefile($$$) {
        my ($fname, $rawwhole, $lines) = @_;
        my ($distname, $category, $distfiles,
@@ -2594,7 +2599,7 @@
        }
 
        if ($opt_recursive) {
-               push(@todo_dirs, @subdirs);
+               push(@todo_items, @subdirs);
        }
 }
 
@@ -2780,7 +2785,50 @@
        }
 
        if ($opt_recursive) {
-               unshift(@todo_dirs, @subdirs);
+               unshift(@todo_items, @subdirs);
+       }
+}
+
+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.");
        }
 }
 
@@ -2813,46 +2861,16 @@
        }
        $have_distinfo = false;
        $have_patches = false;
-       foreach my $f (@files) {
-               if      ($f =~ qr"(?:work[^/]*|~|\.orig|\.rej)$") {
-                       if ($opt_import) {
-                               log_error($f, NO_LINE_NUMBER, "Must be cleaned up before committing the package.");
-                       }
-
-               } elsif (!-f $f) {
-                       # We don't have a check for non-regular files yet.
-
-               } elsif ($f eq "${current_dir}/Makefile") {
-                       $opt_check_Makefile and checkfile_package_Makefile($f, $whole, $lines);
-
-               } elsif ($f =~ qr"/buildlink3.mk$") {
-                       $opt_check_bl3 and checkfile_buildlink3_mk($f);
-
-               } elsif ($f =~ qr"/DESCR[^/]*$") {
-                       $opt_check_DESCR and checkfile_DESCR($f);
-
-               } elsif ($f =~ qr"/distinfo$") {
+       foreach my $fname (@files) {
+               if ($fname eq "${current_dir}/Makefile") {
+                       $opt_check_Makefile and checkfile_package_Makefile($fname, $whole, $lines);
+               } else {
+                       checkfile($fname);
+               }
+               if ($fname =~ qr"/patches/patch-[A-Za-z0-9]*$") {
+                       $have_patches = true;
+               } elsif ($fname =~ qr"/distinfo$") {
                        $have_distinfo = true;
-                       $opt_check_distinfo and checkfile_distinfo($f);
-
-               } elsif ($f =~ qr"/MESSAGE[^/]*$") {
-                       $opt_check_MESSAGE and checkfile_MESSAGE($f);
-
-               } elsif ($f =~ qr"/PLIST[^/]*$") {
-                       $opt_check_PLIST and checkfile_PLIST($f);
-
-               } elsif ($f =~ qr"/patches/patch-[A-Za-z0-9]*$") {
-                       $have_patches = true;
-                       $opt_check_patches and checkfile_patches_patch($f);
-
-               } elsif ($f =~ qr"/patches/[^/]*$") {
-                       log_warning($f, NO_LINE_NUMBER, "Patch files should be named \"patch-\", followed by letters and digits only.");
-
-               } elsif (-T $f) {
-                       $opt_check_extra and checkfile_extra($f);
-
-               } else {
-                       log_warning($f, NO_LINE_NUMBER, "Unexpectedly found a binary file.");
                }
        }
 
@@ -2867,27 +2885,40 @@
        }
 }
 
-sub checkdir($) {
-       my ($dir) = @_;
-
-       $current_dir = $dir;
-       $is_wip = !$opt_import && (Cwd::abs_path($dir) =~ qr"/wip(?:/|$)");
-
-       if (-f "${dir}/../../mk/bsd.pkg.mk") {
-               $pkgsrcdir = "${dir}/../..";
-               checkdir_package();
-
-       } elsif (-f "${dir}/../mk/bsd.pkg.mk") {
-               log_info(NO_FILE, NO_LINE_NUMBER, "Checking category Makefile.");
-               $pkgsrcdir = "${dir}/..";
-               checkdir_category();
-
-       } elsif (-f "${dir}/mk/bsd.pkg.mk") {
-               $pkgsrcdir = $dir;



Home | Main Index | Thread Index | Old Index