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.43.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/1cb5de8b9b68
branches:  trunk
changeset: 503385:1cb5de8b9b68
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Nov 19 17:22:21 2005 +0000

description:
Updated pkglint to 4.43.

Changes since 4.42:
- Reduced the number of duplicate diagnostics when checking multiple files.
  Only diagnostics concerning the current package are printed.
- Added checks for EXTRACT_SUFX and PKG_INSTALLATION_TYPES.
- Added a work-around for the PHP patches warnings.
- PERL5_PACKLIST should not contain references to other variables.
- Added the -s|--source command line option to show the code along with the
  diagnostics.
- Fixed a bug in get_logical_line(); logical lines have not had their
  physical lines attached.
- Deprecated variables are not only checked when they are defined but also
  when they are used.

diffstat:

 pkgtools/pkglint/Makefile           |   5 +-
 pkgtools/pkglint/files/makevars.map |   3 +-
 pkgtools/pkglint/files/pkglint.0    |   4 ++
 pkgtools/pkglint/files/pkglint.1    |   5 ++-
 pkgtools/pkglint/files/pkglint.pl   |  68 +++++++++++++++++++++++++++++++-----
 5 files changed, 70 insertions(+), 15 deletions(-)

diffs (273 lines):

diff -r 798e4bbfbe0b -r 1cb5de8b9b68 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Sat Nov 19 16:24:57 2005 +0000
+++ b/pkgtools/pkglint/Makefile Sat Nov 19 17:22:21 2005 +0000
@@ -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 @@
 NO_CHECKSUM=   yes
 NO_BUILD=      yes
 USE_LANGUAGES= # empty
+FOO_BAR=       ${NO_CDROM}
 
 INSTALLATION_DIRS=     bin man/cat1 man/man1 share/pkglint
 
diff -r 798e4bbfbe0b -r 1cb5de8b9b68 pkgtools/pkglint/files/makevars.map
--- a/pkgtools/pkglint/files/makevars.map       Sat Nov 19 16:24:57 2005 +0000
+++ b/pkgtools/pkglint/files/makevars.map       Sat Nov 19 17:22:21 2005 +0000
@@ -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_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 -r 798e4bbfbe0b -r 1cb5de8b9b68 pkgtools/pkglint/files/pkglint.0
--- a/pkgtools/pkglint/files/pkglint.0  Sat Nov 19 16:24:57 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.0  Sat Nov 19 17:22:21 2005 +0000
@@ -40,6 +40,10 @@
                                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 -r 798e4bbfbe0b -r 1cb5de8b9b68 pkgtools/pkglint/files/pkglint.1
--- a/pkgtools/pkglint/files/pkglint.1  Sat Nov 19 16:24:57 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.1  Sat Nov 19 17:22:21 2005 +0000
@@ -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@localhost>.
@@ -53,6 +53,9 @@
 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 -r 798e4bbfbe0b -r 1cb5de8b9b68 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Sat Nov 19 16:24:57 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Sat Nov 19 17:22:21 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.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 @@
                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 $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 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 @@
        exit($errors != 0);
 }
 
+sub is_verbose() {
+       return $verbose_flag;
+}
 sub set_verbose($) {
        my ($verbose) = @_;
        $verbose_flag = $verbose;
@@ -208,6 +217,13 @@
        $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 @@
        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 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 @@
                        }
 
                        $value .= $text;
+                       push(@{$physlines}, $lines->[$lineno]);
 
                        if ($cont eq "\\") {
                                $value .= " ";
@@ -386,7 +422,8 @@
            $firstlineno == $lastlineno
                ? $firstlineno
                : "$firstlineno--$lastlineno",
-           $value);
+           $value,
+           $physlines);
 }
 
 sub load_lines($$) {
@@ -594,6 +631,11 @@
          "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 @@
 
                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_deprecated_variables($) {
        my ($lines) = @_;
        my ($fname) = (conf_datadir."/deprecated.map");
-       my ($deprecated) = load_file($fname);
-       my %vars = ();
-
-       if (!$deprecated) {
+       my ($deprecated, $varnames, $varuse_regex, %vars);
+
+       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 @@
                        $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}");
+                       }
                }
        }
 }



Home | Main Index | Thread Index | Old Index