pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint 3.91:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/99d88626eaa4
branches:  trunk
changeset: 481037:99d88626eaa4
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Fri Sep 24 15:33:26 2004 +0000

description:
3.91:
- added options for enabling/disabling specific checks
- added options for enabling/disabling specific warnings
- improved the --help message
and corresponding man page updates.
>From Roland Illig with slight fixes by me.

diffstat:

 pkgtools/pkglint/Makefile         |    4 +-
 pkgtools/pkglint/files/pkglint.1  |   99 ++++++++++--
 pkgtools/pkglint/files/pkglint.pl |  293 +++++++++++++++++++++++++++++--------
 3 files changed, 308 insertions(+), 88 deletions(-)

diffs (truncated from 567 to 300 lines):

diff -r 783dee2d4049 -r 99d88626eaa4 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Fri Sep 24 15:31:44 2004 +0000
+++ b/pkgtools/pkglint/Makefile Fri Sep 24 15:33:26 2004 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.203 2004/09/05 23:12:36 seb Exp $
+# $NetBSD: Makefile,v 1.204 2004/09/24 15:33:26 wiz Exp $
 #
 
-DISTNAME=      pkglint-3.90
+DISTNAME=      pkglint-3.91
 CATEGORIES=    pkgtools devel
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r 783dee2d4049 -r 99d88626eaa4 pkgtools/pkglint/files/pkglint.1
--- a/pkgtools/pkglint/files/pkglint.1  Fri Sep 24 15:31:44 2004 +0000
+++ b/pkgtools/pkglint/files/pkglint.1  Fri Sep 24 15:33:26 2004 +0000
@@ -1,18 +1,19 @@
-.\"    $NetBSD: pkglint.1,v 1.7 2003/05/28 16:32:22 wiz Exp $
+.\"    $NetBSD: pkglint.1,v 1.8 2004/09/24 15:33:26 wiz 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>.
 .\" All Rights Reserved.  Absolutely no warranty.
 .\"
-.Dd September 5, 2000
+.\" Roland Illig <roland.illig%gmx.de@localhost>, 2004.
+.\"
+.Dd September 23, 2004
 .Dt PKGLINT 1
 .Sh NAME
 .Nm pkglint
 .Nd a verifier for pkgsrc directories
 .Sh SYNOPSIS
 .Nm pkglint
-.Op Fl hvIN
-.Op Fl B Ar n
+.Op Fl options
 .Op Ar dir
 .Sh DESCRIPTION
 .Nm
@@ -43,7 +44,9 @@
 (by default,
 .Ar n
 is 1.)
-.It Fl h
+.It Fl C{[no-]check,...}
+Enable or disable specific checks. For a list of checks, see below.
+.It Fl h Ns | Ns Fl -help
 Show the summary of command line options, then exit.
 .It Fl I
 Show the Makefile that is constructed by including all the files that
@@ -54,27 +57,82 @@
 Adds several checks specific to newly submitted packages.
 If you are willing to submit the directory to be checked as a new package,
 use this option.
-.It Fl v
+This option is deprecated.
+Use
+.Fl C Ns Ar newpkg
+instead.
+.It Fl v Ns | Ns Fl -verbose
 Be verbose.
 Show the progress report for items that are being checked.
+.It Fl W{[no-]warn,...}
+Enable or disable specific warnings.
+For a list of warnings, see below.
+.El
+.Pp
+.Sy Checks
+.Bl -tag -width Fl
+.It all
+Enable all checks.
+.It none
+Disable all checks.
+Currently the Makefile is checked in every case to
+get meta information about the package structure.
+.It [no-]MESSAGE
+Check MESSAGE files.
+.It [no-]PLIST
+Check PLIST files.
+.It [no-]distinfo
+Check the distinfo file.
+.It [no-]extra
+Check remaining files in the package directory.
+.It [no-]newpkg
+Enable special checks for uncommitted packages.
+.It [no-]patches
+Check the pkgsrc specific patch files.
+.El
+.Pp
+.Sy Warnings
+.Bl -tag -width Fl
+.It all
+Enable all warnings.
+.It none
+Disable all warnings.
+.It [no-]absname
+Warn if a file contains an absolute pathname.
+.It [no-]directcmd
+Warn if a system command name is used instead of a variable (e.g. sed
+instead of ${SED}).
+.It [no-]exec
+Warn if a file in the package directory is executable.
+Most files should not be executable until they are installed.
+.It [no-]paren
+Warn if variables are used like $(VAR) in Makefiles.
+They should always be used like ${VAR}.
+.It [no-]patches
+Warn if a patch file patches more than one file or if the patches differ
+from what is recorded in the distinfo file.
+.El
+.Pp
+.Bl -tag -width Fl
+.Sy Other arguments
 .It dir
 The pkgsrc directory to be checked.
 If omitted, all checks will be performed on the current directory.
 .El
 .Sh FILES
 .Bl -tag -width /usr/share/mk/bsd.port.mk -compact
-.\".It FreeBSD:
-.\".It Pa /usr/share/mk/bsd.port.mk
-.\"master Makefile for ports
-.\".It Pa /usr/ports/*
-.\"port collection
-.\".Pp
-.\".It NetBSD:
 .It Pa /usr/pkgsrc/mk/bsd.pkg.mk
 master Makefile for pkgsrc
 .It Pa /usr/pkgsrc/*
 pkgsrc collection
 .El
+.Sh EXAMPLES
+.Bl -tag -width Fl
+.Ic "pkglint -Cnone,patches ."
+Checks the patches of the package in the current directory.
+.Ic "pkglint -Wall /usr/pkgsrc/devel"
+Checks the category Makefile and reports any warnings it can find.
+.El
 .Sh DIAGNOSTICS
 Messages will be sent to standard output, not standard error.
 .Bl -tag -width "WARN: foobaa"
@@ -83,8 +141,8 @@
 in the pkgsrc directory.
 For example, if some files need a rewrite, or if
 some necessary files are missing, this message will show up.
-This kind of error should be fixed BEFORE submitting
-a pkgsrc via send-pr to the comitters.
+This kind of error should be fixed BEFORE submitting a package via
+.Xr send-pr 1 .
 .\"If a submitter submit it without update, committers will need to rewrite
 .\"on behalf of the submitters, which may result in delay of
 .\"the development of operating system itself.
@@ -107,11 +165,14 @@
 .El
 .Sh AUTHORS
 Jun-ichiro Itoh
-.Aq itojun%itojun.org@localhost
-and
+.Aq itojun%itojun.org@localhost ,
 Yoshishige Arai
-.Aq ryo2%on.rim.or.jp@localhost .
+.Aq ryo2%on.rim.or.jp@localhost ,
+and Roland Illig
+.Aq roland.illig%gmx.de@localhost .
 Many people have contributed patches and comments/suggestions.
 .Sh BUGS
 .Nm
-is not a magic wand, as described above.
+still emits too many false positive warnings.
+Many of the warnings concerning Makefiles do not print the file
+and line number where the warning originated.
diff -r 783dee2d4049 -r 99d88626eaa4 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Fri Sep 24 15:31:44 2004 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Fri Sep 24 15:33:26 2004 +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.118 2004/08/24 15:18:29 wiz Exp $
+# $NetBSD: pkglint.pl,v 1.119 2004/09/24 15:33:26 wiz Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by Hubert Feyrer <hubertf%netbsd.org@localhost>,
@@ -81,6 +81,9 @@
 sub log_message($$$$)
 {
        my ($file, $lineno, $type, $message) = @_;
+       if ($file ne NO_FILE) {
+               $file =~ s,^(?:\./)+,,;
+       }
        if ($file eq NO_FILE) {
                printf("%s: %s\n", $type, $message);
        } elsif ($lineno == NO_LINE_NUMBER) {
@@ -204,7 +207,7 @@
 use strict;
 use warnings;
 
-use Getopt::Std;
+use Getopt::Long qw(:config no_ignore_case bundling require_order);
 use File::Basename;
 use FileHandle;
 use Cwd;
@@ -229,13 +232,50 @@
 my $conf_make          = '@MAKE@';
 
 # Command Line Options
-my $opt_extrafile      = true; # check all files we can find for simple errors
-my $opt_parenwarn      = true; # warn about use for $(VAR) instead of ${VAR}
-my $opt_committer      = true; # check items especially for package developers
-my $opt_newpackage     = false; # consider this package new (uncommitted)
-my $opt_dumpmakefile   = false; # dump the Makefile after parsing
-my $opt_contblank      = 1; # number of allowed contiguous blank lines
-my $opt_packagedir     = "."; # directory to check
+my $opt_committer      = true;
+my $opt_dumpmakefile   = false;
+my $opt_contblank      = 1;
+my $opt_packagedir     = ".";
+my (%options) = (
+       "-p"            => "warn about use of \$(VAR) instead of \${VAR}",
+       "-d"            => "check items useful for package developers",
+       "-I"            => "dump the Makefile after parsing",
+       "-N"            => "assume a new (still uncommitted) package",
+       "-B#"           => "allow # contiguous blank lines in Makefiles",
+       "-C{check,...}" => "enable or disable specific checks",
+       "-W{warn,...}"  => "enable or disable specific warnings",
+       "-h|--help"     => "print a detailed help message",
+       "-V|--version"  => "print the version number of pkglint",
+       "-v|--verbose"  => "print progress messages on STDERR",
+);
+
+my $opt_check_distinfo = true;
+my $opt_check_extra    = true;
+my $opt_check_MESSAGE  = true;
+my $opt_check_patches  = true;
+my $opt_check_PLIST    = true;
+my $opt_check_newpkg   = false;
+my (%checks) = (
+       "distinfo"      => [\$opt_check_distinfo, "check distinfo file"],
+       "extra"         => [\$opt_check_extra, "check various additional files"],
+       "MESSAGE"       => [\$opt_check_MESSAGE, "check MESSAGE files"],
+       "patches"       => [\$opt_check_patches, "check patches"],
+       "PLIST"         => [\$opt_check_PLIST, "check PLIST files"],
+       "newpkg"        => [\$opt_check_newpkg, "special checks for uncommitted packages"],
+);
+
+my $opt_warn_patches   = true;
+my $opt_warn_exec      = true;
+my $opt_warn_absname   = true;
+my $opt_warn_directcmd = true;
+my $opt_warn_paren     = true;
+my (%warnings) = (
+       "patches"       => [\$opt_warn_patches, "warn on non-optimal patch files"],
+       "exec"          => [\$opt_warn_exec, "warn if source files are executable"],
+       "absname"       => [\$opt_warn_absname, "warn about use of absolute file names"],
+       "directcmd"     => [\$opt_warn_directcmd, "warn about use of direct command names instead of Make variables"],
+       "paren"         => [\$opt_warn_paren, "warn about usa of \$(VAR) instead of \${VAR} in Makefiles"],
+);
 
 # Constants
 my $regex_rcsidstr     = qr"\$($conf_rcsidstr)(?::[^\$]*|)\$";
@@ -280,29 +320,127 @@
 sub category_check();
 sub check_package();
 
+sub print_table($$)
+{
+       my ($out, $table) = @_;
+       my (@width) = ();
+       foreach my $row (@$table) {
+               foreach my $i (0..(scalar(@$row)-1)) {
+                       if (!defined($width[$i]) || length($row->[$i]) > $width[$i]) {
+                               $width[$i] = length($row->[$i]);
+                       }
+               }
+       }
+       foreach my $row (@$table) {
+               my ($max) = (scalar(@$row) - 1);
+               foreach my $i (0..$max) {
+                       if ($i != 0) {
+                               print $out ("  ");
+                       }
+                       print $out ($row->[$i]);
+                       if ($i != $max) {
+                               print $out (" " x ($width[$i] - length($row->[$i])));
+                       }
+               }
+               print $out ("\n");
+       }
+       return 1;
+}
+
+sub help($$$) {
+       my ($out, $exitval, $show_all) = @_;
+       my ($prog) = (basename($0));
+       print $out ("usage: $prog [options] [package_directory]\n\n");
+
+       my (@option_table) = ();
+       foreach my $opt (sort keys %options) {
+               push(@option_table, ["  ", $opt, $options{$opt}]);



Home | Main Index | Thread Index | Old Index