summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkgtools/pkglint/Makefile5
-rw-r--r--pkgtools/pkglint/files/makevars.map3
-rw-r--r--pkgtools/pkglint/files/pkglint.04
-rw-r--r--pkgtools/pkglint/files/pkglint.15
-rw-r--r--pkgtools/pkglint/files/pkglint.pl66
5 files changed, 69 insertions, 14 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile
index d51332bda28..99badd867d7 100644
--- a/pkgtools/pkglint/Makefile
+++ b/pkgtools/pkglint/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.299 2005/11/19 13:34:41 rillig Exp $
+# $NetBSD: Makefile,v 1.300 2005/11/19 17:22:21 rillig Exp $
#
-DISTNAME= pkglint-4.42.2
+DISTNAME= pkglint-4.43
CATEGORIES= pkgtools devel
MASTER_SITES= # empty
DISTFILES= # empty
@@ -20,6 +20,7 @@ WRKSRC= ${WRKDIR}
NO_CHECKSUM= yes
NO_BUILD= yes
USE_LANGUAGES= # empty
+FOO_BAR= ${NO_CDROM}
INSTALLATION_DIRS= bin man/cat1 man/man1 share/pkglint
diff --git a/pkgtools/pkglint/files/makevars.map b/pkgtools/pkglint/files/makevars.map
index ff6ed640970..7f901ab5c4b 100644
--- a/pkgtools/pkglint/files/makevars.map
+++ b/pkgtools/pkglint/files/makevars.map
@@ -1,4 +1,4 @@
-# $NetBSD: makevars.map,v 1.34 2005/11/19 13:34:41 rillig Exp $
+# $NetBSD: makevars.map,v 1.35 2005/11/19 17:22:21 rillig Exp $
#
# This file contains the guessed type of some variables, according to
@@ -134,6 +134,7 @@ PKG_APACHE_DEFAULT Userdefined
PKG_DEBUG_LEVEL Userdefined
PKG_DEFAULT_OPTIONS Userdefined
PKG_FAIL_REASON List
+PKG_INSTALLATION_TYPES List* of { overwrite pkgviews }
PKG_JAVA_HOME Readonly
PKG_JVM Readonly
PKG_JVMS_ACCEPTED List* of { blackdown-jdk13 jdk jdk14 kaffe sun-jdk13 sun-jdk14 sun-jdk15 }
diff --git a/pkgtools/pkglint/files/pkglint.0 b/pkgtools/pkglint/files/pkglint.0
index 27937e18a34..ea413640653 100644
--- a/pkgtools/pkglint/files/pkglint.0
+++ b/pkgtools/pkglint/files/pkglint.0
@@ -40,6 +40,10 @@ DDEESSCCRRIIPPTTIIOONN
are those that are mentioned in a `SUBDIR+='
line.
+ --ss|----ssoouurrccee For all diagnostics having file and line number
+ information, show the source code along with
+ the diagnostics.
+
--vv|----vveerrbboossee Be verbose. Show the progress report for items
that are being checked.
diff --git a/pkgtools/pkglint/files/pkglint.1 b/pkgtools/pkglint/files/pkglint.1
index 8405564d4bb..04bd634890d 100644
--- a/pkgtools/pkglint/files/pkglint.1
+++ b/pkgtools/pkglint/files/pkglint.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkglint.1,v 1.27 2005/11/14 11:45:52 rillig Exp $
+.\" $NetBSD: pkglint.1,v 1.28 2005/11/19 17:22:21 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>.
@@ -53,6 +53,9 @@ Check subdirectories, too.
The subdirectories are those that are mentioned in a
.Ql SUBDIR+=
line.
+.It Fl s Ns | Ns Fl -source
+For all diagnostics having file and line number information, show the
+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.
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 83bb9a41a21..6858c36aee9 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.362 2005/11/19 13:34:41 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.363 2005/11/19 17:22:21 rillig Exp $
#
# This version contains lots of changes necessary for NetBSD packages
# done by:
@@ -96,6 +96,7 @@ BEGIN {
log_fatal log_error log_warning log_note log_info log_subinfo
print_summary_and_exit set_verbose is_verbose
set_gcc_output_format
+ get_show_source_flag set_show_source_flag
);
import PkgLint::Util qw(
false true
@@ -109,6 +110,7 @@ my $errors = 0;
my $warnings = 0;
my $verbose_flag = false;
my $gcc_output_format = false;
+my $show_source_flag = false;
sub log_message($$$$$$) {
my ($out, $file, $subr, $lineno, $type, $message) = @_;
@@ -189,6 +191,10 @@ sub log_subinfo($$$$) {
sub print_summary_and_exit($) {
my ($quiet) = @_;
+ if ($show_source_flag) {
+ print("\n");
+ }
+
if (!$quiet) {
if ($errors != 0 || $warnings != 0) {
print("$errors errors and $warnings warnings found.\n");
@@ -199,6 +205,9 @@ sub print_summary_and_exit($) {
exit($errors != 0);
}
+sub is_verbose() {
+ return $verbose_flag;
+}
sub set_verbose($) {
my ($verbose) = @_;
$verbose_flag = $verbose;
@@ -208,6 +217,13 @@ sub set_gcc_output_format() {
$gcc_output_format = true;
}
+sub get_show_source_flag() {
+ return $show_source_flag;
+}
+sub set_show_source_flag() {
+ $show_source_flag = true;
+}
+
#== End of PkgLint::Logging ===============================================
package PkgLint::FileUtil::Line;
@@ -252,24 +268,42 @@ sub is_changed($) {
return shift(@_)->[CHANGED];
}
+sub show_source($$) {
+ my ($self, $out) = @_;
+
+ if (PkgLint::Logging::get_show_source_flag()) {
+ printf $out ("\n");
+ foreach my $line (@{$self->physlines}) {
+ printf $out ("> %s", $line->[1]);
+ }
+ }
+}
+
sub log_fatal($$) {
my ($self, $text) = @_;
+ $self->show_source(*STDERR);
PkgLint::Logging::log_fatal($self->[FILE], $self->[LINES], $text);
}
sub log_error($$) {
my ($self, $text) = @_;
+ $self->show_source(*STDOUT);
PkgLint::Logging::log_error($self->[FILE], $self->[LINES], $text);
}
sub log_warning($$) {
my ($self, $text) = @_;
+ $self->show_source(*STDOUT);
PkgLint::Logging::log_warning($self->[FILE], $self->[LINES], $text);
}
sub log_note($$) {
my ($self, $text) = @_;
+ $self->show_source(*STDOUT);
PkgLint::Logging::log_note($self->[FILE], $self->[LINES], $text);
}
sub log_info($$) {
my ($self, $text) = @_;
+ if (PkgLint::Logging::is_verbose()) {
+ $self->show_source(*STDOUT);
+ }
PkgLint::Logging::log_info($self->[FILE], $self->[LINES], $text);
}
sub to_string($) {
@@ -348,12 +382,13 @@ sub load_physical_lines($) {
sub get_logical_line($$$) {
my ($fname, $lines, $ref_lineno) = @_;
- my ($value, $lineno, $first, $firstlineno, $lastlineno);
+ my ($value, $lineno, $first, $firstlineno, $lastlineno, $physlines);
$value = "";
$first = true;
$lineno = ${$ref_lineno};
$firstlineno = $lines->[$lineno]->[0];
+ $physlines = [];
for (; $lineno <= $#{$lines}; $lineno++) {
if ($lines->[$lineno]->[1] =~ qr"^([ \t]*)(.*?)([ \t]*)(\\?)\n?$") {
@@ -365,6 +400,7 @@ sub get_logical_line($$$) {
}
$value .= $text;
+ push(@{$physlines}, $lines->[$lineno]);
if ($cont eq "\\") {
$value .= " ";
@@ -386,7 +422,8 @@ sub get_logical_line($$$) {
$firstlineno == $lastlineno
? $firstlineno
: "$firstlineno--$lastlineno",
- $value);
+ $value,
+ $physlines);
}
sub load_lines($$) {
@@ -594,6 +631,11 @@ my (@options) = (
"quiet|q", \$opt_quiet ],
[ "-r|--recursive", "Recursive---check subdirectories, too",
"recursive|r", \$opt_recursive ],
+ [ "-s|--source", "Show the source lines together with diagnostics",
+ "source|s",
+ sub {
+ PkgLint::Logging::set_show_source_flag();
+ } ],
[ "-v|--verbose", "print progress messages",
"verbose|v",
sub {
@@ -1124,9 +1166,6 @@ sub checkfile_PLIST($) {
checkline_trailing_whitespace($line);
- if ($text =~ /<\$ARCH>/) {
- $line->log_warning("use of <\$ARCH> is deprecated, use \${MACHINE_ARCH} instead.");
- }
if ($text =~ /^\@([a-z]+)\s+(.*)/) {
my ($cmd, $arg) = ($1, $2);
@@ -1814,14 +1853,14 @@ sub checklines_Makefile_varuse($) {
sub checklines_deprecated_variables($) {
my ($lines) = @_;
my ($fname) = (conf_datadir."/deprecated.map");
- my ($deprecated) = load_file($fname);
- my %vars = ();
+ my ($deprecated, $varnames, $varuse_regex, %vars);
- if (!$deprecated) {
+ if (!($deprecated = load_file($fname))) {
log_error($fname, NO_LINE_NUMBER, "Cannot be read.");
return;
}
+ %vars = ();
foreach my $line (@{$deprecated}) {
if ($line->text =~ qr"^#" || $line->text =~ qr"^\s*$") {
next;
@@ -1833,13 +1872,20 @@ sub checklines_deprecated_variables($) {
$line->log_fatal("Unknown line format.");
}
}
+ $varnames = join("|", sort(keys(%vars)));
+ $varuse_regex = qr"\$\{(${varnames})[:}]";
foreach my $line (@{$lines}) {
if ($line->text =~ regex_varassign) {
- my ($varname, undef, undef) = ($1, $2, $3);
+ my ($varname, undef, $value) = ($1, $2, $3);
if (exists($vars{$varname})) {
$line->log_warning("${varname} is deprecated. $vars{$varname}");
}
+
+ if ($value =~ $varuse_regex) {
+ my ($varuse_name) = ($1);
+ $line->log_warning("Use of ${varuse_name} is deprecated. $vars{$varuse_name}");
+ }
}
}
}