summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig>2005-11-24 10:16:54 +0000
committerrillig <rillig>2005-11-24 10:16:54 +0000
commit1234d8eb49aae7a205c5ead07ab086f1bced7fbe (patch)
treed72e97e7f62a767591fe5d7c102e739fea65f672
parent9fd9523366be6bdce73a02531a5522cd31070a4c (diff)
downloadpkgsrc-1234d8eb49aae7a205c5ead07ab086f1bced7fbe.tar.gz
Updated pkglint to 4.46.
Changes since 4.45: - Added the type ShellWord. - Added quoting checks for variables that are appended to a List of ShellWord. - Multiple -v increase the verbosity. - The --autofix option is no longer undocumented, but still experimental, as this is the only part of pkglint that can modify external files. - Added an --explain option that provides additional help for the diagnostics. - Added checks for unportable CPP macro names in patches. - Updated the documentation.
-rw-r--r--doc/CHANGES3
-rw-r--r--pkgtools/pkglint/Makefile4
-rw-r--r--pkgtools/pkglint/files/pkglint.039
-rw-r--r--pkgtools/pkglint/files/pkglint.149
-rw-r--r--pkgtools/pkglint/files/pkglint.pl80
5 files changed, 144 insertions, 31 deletions
diff --git a/doc/CHANGES b/doc/CHANGES
index cefa8a31e3c..5ad6e4052ed 100644
--- a/doc/CHANGES
+++ b/doc/CHANGES
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.12029 2005/11/24 04:27:48 rh Exp $
+$NetBSD: CHANGES,v 1.12030 2005/11/24 10:17:25 rillig Exp $
Changes to the packages collection and infrastructure in 2005:
@@ -5383,3 +5383,4 @@ Changes to the packages collection and infrastructure in 2005:
Updated audio/snd to 7.15 [wiz 2005-11-23]
Updated security/p5-Digest-SHA to 5.31 [wiz 2005-11-23]
Updated devel/Gorm to 1.0.1 [rh 2005-11-24]
+ Updated pkgtools/pkglint to 4.46 [rillig 2005-11-24]
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile
index 9c920ee6559..aba1756f3a4 100644
--- a/pkgtools/pkglint/Makefile
+++ b/pkgtools/pkglint/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.308 2005/11/24 08:05:01 rillig Exp $
+# $NetBSD: Makefile,v 1.309 2005/11/24 10:16:54 rillig Exp $
#
-DISTNAME= pkglint-4.45.3
+DISTNAME= pkglint-4.46
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/pkglint/files/pkglint.0 b/pkgtools/pkglint/files/pkglint.0
index 89a873f4cb6..fa39069277a 100644
--- a/pkgtools/pkglint/files/pkglint.0
+++ b/pkgtools/pkglint/files/pkglint.0
@@ -19,23 +19,42 @@ DDEESSCCRRIIPPTTIIOONN
--CC{{[[nnoo--]]cchheecckk,,......}} Enable or disable specific checks. For a list
of checks, see below.
- --hh|----hheellpp Show the summary of command line options, then
- exit.
+ --FF| ----aauuttooffiixx Repair trivial things automatically. Currently
+ this only works for the synchronization of cat-
+ egory _M_a_k_e_f_i_l_es.
- --II Show the Makefile that is constructed by
+ --II Show the _M_a_k_e_f_i_l_e that is constructed by
including all the files that are slurped in via
- .include directives. This flag is mainly for
+ `.include' directives. This flag is mainly for
debugging.
+ --RR|----rrccssiiddssttrriinngg Allow other RCS Id strings than NetBSD. Multi-
+ ple strings may be concatenated with `|'.
+
+ --VV|----vveerrssiioonn Print the current ppkkgglliinntt version number and
+ exit.
+
+ --WW{{[[nnoo--]]wwaarrnn,,......}} Enable or disable specific warnings. For a
+ list of warnings, see below.
+
+ --ee|----eexxppllaaiinn Print further explanations for diagnostics.
+ Sometimes the reasons for diagnostics are not
+ obvious and need further explanation.
+
+ --gg|----ggcccc--oouuttppuutt--ffoorrmmaatt
+ Use a format for the diagnostics that is under-
+ stood by most programs, especially editors, so
+ they can provide a point-and-goto interface.
+
+ --hh|----hheellpp Show the summary of command line options, then
+ exit.
+
--ii|----iimmppoorrtt Check if a package is ready to be imported into
pkgsrc.
--qq|----qquuiieett Don't print the errors and warnings summary
before terminating.
- --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.
@@ -45,10 +64,8 @@ DDEESSCCRRIIPPTTIIOONN
the diagnostics.
--vv|----vveerrbboossee Be verbose. Show the progress report for items
- that are being checked.
-
- --WW{{[[nnoo--]]wwaarrnn,,......}} Enable or disable specific warnings. For a
- list of warnings, see below.
+ that are being checked. If given more than
+ once, debugging messages are also shown.
CChheecckkss
diff --git a/pkgtools/pkglint/files/pkglint.1 b/pkgtools/pkglint/files/pkglint.1
index 3bae5e6733b..7ee58311fa8 100644
--- a/pkgtools/pkglint/files/pkglint.1
+++ b/pkgtools/pkglint/files/pkglint.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkglint.1,v 1.29 2005/11/20 20:09:35 rillig Exp $
+.\" $NetBSD: pkglint.1,v 1.30 2005/11/24 10:16:54 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>.
@@ -29,25 +29,49 @@ packages and to allow automatic conformance tests.
Packages following these rules are assumed to make future changes to the
pkgsrc infrastructure easier.
.Pp
+.\" =======================================================================
.Sy Options
.Bl -tag -width 18n -offset indent
.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 F Ns | Fl -autofix
+Repair trivial things automatically.
+Currently this only works for the synchronization of category
+.Pa Makefile Ns
+s.
.It Fl I
-Show the Makefile that is constructed by including all the files that
-are slurped in via .include directives.
+Show the
+.Pa Makefile
+that is constructed by including all the files that
+are slurped in via
+.Ql .include
+directives.
This flag is mainly for debugging.
-.It Fl i Ns | Ns Fl -import
-Check if a package is ready to be imported into pkgsrc.
-.It Fl q Ns | Ns Fl -quiet
-Don't print the errors and warnings summary before terminating.
.It Fl R Ns | Ns Fl -rcsidstring
Allow other RCS Id strings than NetBSD.
Multiple strings may be concatenated with
.Ql | .
+.It Fl V Ns | Ns Fl -version
+Print the current
+.Nm
+version number and exit.
+.It Fl W{[no-]warn,...}
+Enable or disable specific warnings.
+For a list of warnings, see below.
+.It Fl e Ns | Ns Fl -explain
+Print further explanations for diagnostics.
+Sometimes the reasons for diagnostics are not obvious and need further
+explanation.
+.It Fl g Ns | Ns Fl -gcc-output-format
+Use a format for the diagnostics that is understood by most programs,
+especially editors, so they can provide a point-and-goto interface.
+.It Fl h Ns | Ns Fl -help
+Show the summary of command line options, then exit.
+.It Fl i Ns | Ns Fl -import
+Check if a package is ready to be imported into pkgsrc.
+.It Fl q Ns | Ns Fl -quiet
+Don't print the errors and warnings summary before terminating.
.It Fl r
Check subdirectories, too.
The subdirectories are those that are mentioned in a
@@ -59,11 +83,10 @@ source code along with the diagnostics.
.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.
+If given more than once, debugging messages are also shown.
.El
.Pp
+.\" =======================================================================
.Sy Checks
.Bl -tag -width 18n -offset indent
.It Cm all
@@ -92,6 +115,7 @@ Check Makefile fragments besides buildlink3.
Check the pkgsrc specific patch files.
.El
.Pp
+.\" =======================================================================
.Sy Warnings
.Bl -tag -width 18n -offset indent
.It Cm all
@@ -113,6 +137,7 @@ Warn for some Makefile variables if their assigned values do not match
their type.
.El
.Pp
+.\" =======================================================================
.Sy Other arguments
.Bl -tag -width 18n -offset indent
.It Ar dir ...
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index f1242f070ed..d84dba16ad2 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -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.382 2005/11/24 08:46:34 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.383 2005/11/24 10:16:54 rillig Exp $
#
# This version contains lots of changes necessary for NetBSD packages
# done by:
@@ -32,13 +32,16 @@ package PkgLint::Util;
#==========================================================================
# This package is a catch-all for subroutines that are not application-spe-
# cific. Currently it contains the boolean constants C<false> and C<true>,
-# as well as a function to print text in a table format.
+# as well as a function to print text in a table format, and a function
+# that converts an array into a hash. The latter is just for convenience
+# because I don't know of a Perl operator similar to qw() that can be used
+# for creating a hash.
#==========================================================================
BEGIN {
use Exporter;
use vars qw(@ISA @EXPORT_OK);
@ISA = qw(Exporter);
- @EXPORT_OK = qw(false print_table true);
+ @EXPORT_OK = qw(array_to_hash false print_table true);
}
use constant false => 0;
@@ -72,6 +75,15 @@ sub print_table($$) {
}
}
+sub array_to_hash(@) {
+ my ($result) = {};
+
+ foreach my $arg (@_) {
+ $result->{$arg} = 1;
+ }
+ return $result;
+}
+
#== End of PkgLint::Util ==================================================
package PkgLint::Logging;
@@ -100,8 +112,9 @@ BEGIN {
@EXPORT_OK = qw(
NO_FILE NO_LINE_NUMBER
log_fatal log_error log_warning log_note log_info log_debug
+ explain
print_summary_and_exit set_verbosity get_verbosity
- set_gcc_output_format
+ set_explain set_gcc_output_format
get_show_source_flag set_show_source_flag
);
import PkgLint::Util qw(
@@ -116,6 +129,7 @@ my $errors = 0;
my $warnings = 0;
my $verbosity = 0;
my $gcc_output_format = false;
+my $explain_flag = false;
my $show_source_flag = false;
sub log_message($$$$$) {
@@ -190,6 +204,14 @@ sub log_debug($$$) {
}
}
+sub explain($$$) {
+ my ($file, $lines, $msg) = @_;
+
+ if ($explain_flag) {
+ print STDOUT ("\t${msg}\n");
+ }
+}
+
sub print_summary_and_exit($) {
my ($quiet) = @_;
@@ -214,6 +236,9 @@ sub set_verbosity($) {
($verbosity) = @_;
}
+sub set_explain() {
+ $explain_flag = true;
+}
sub set_gcc_output_format() {
$gcc_output_format = true;
}
@@ -328,6 +353,10 @@ sub log_debug($$) {
}
PkgLint::Logging::log_debug($self->[FILE], $self->[LINES], $text);
}
+sub explain($$) {
+ my ($self, $text) = @_;
+ PkgLint::Logging::explain($self->[FILE], $self->[LINES], $text);
+}
sub to_string($) {
my ($self) = @_;
@@ -573,7 +602,7 @@ use Cwd;
BEGIN {
import PkgLint::Util qw(
- false true
+ array_to_hash false true
);
import PkgLint::Logging qw(
NO_FILE NO_LINE_NUMBER
@@ -638,6 +667,7 @@ my (%warnings) = (
my $opt_autofix = false;
my $opt_dumpmakefile = false;
+my $opt_explain = false;
my $opt_import = false;
my $opt_quiet = false;
my $opt_recursive = false;
@@ -668,6 +698,8 @@ my (@options) = (
my ($opt, $val) = @_;
parse_multioption($val, \%warnings);
} ],
+ [ "-e|--explain", "Explain the diagnostics or give further help",
+ "explain|e", \$opt_explain ],
[ "-g|--gcc-output-format", "Mimic the gcc output format",
"gcc-output-format|g",
sub {
@@ -1427,6 +1459,44 @@ sub checkfile_patches_patch($) {
my ($tag) = ($1);
$line->log_warning("Possible RCS tag \"\$${tag}\$\". Please remove it by reducing the number of context lines using pkgdiff or \"diff -U[210]\".");
}
+
+ if ($line->text =~ qr"^\+") {
+ use constant good_macros => PkgLint::Util::array_to_hash(qw(
+ __GNUC__ __GNUC_MINOR__
+ __SUNPRO_C
+
+ __i386
+ __mips
+ __sparc
+
+ __DragonFly__
+ __FreeBSD__
+ __linux__
+ __NetBSD__
+ __OpenBSD__
+ __SVR4
+ __sun
+ ));
+ use constant bad_macros => {
+ "__sun__" => "__sun",
+ "__svr4__" => "__SVR4",
+ };
+ my $rest = $line->text;
+ my $re_ifdef = qr"defined\((__[\w_]+)\)";
+
+ while ($rest =~ s/$re_ifdef//) {
+ my ($macro) = ($1);
+
+ if (exists(good_macros->{$macro})) {
+ $line->log_debug("Found good macro \"${macro}\".");
+ } elsif (exists(bad_macros->{$macro})) {
+ $line->log_warning("The macro \"${macro}\" is unportable. Please use \"".bad_macros->{$macro}."\" instead.");
+ $line->explain("See the pkgsrc guide, section \"CPP defines\" for details.");
+ } else {
+ $line->log_info("Found unknown macro \"${macro}\".");
+ }
+ }
+ }
}
checklines_trailing_empty_lines($lines);