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



details:   https://anonhg.NetBSD.org/pkgsrc/rev/92bd8ee4c7e3
branches:  trunk
changeset: 502383:92bd8ee4c7e3
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Nov 04 08:40:59 2005 +0000

description:
Updated pkglint to 4.34.

Fixed the --autofix handling of category Makefiles. Added an --import
option that helps importing packages from pkgsrc-wip. When checked with
--import, the package is checked as if it weren't part of pkgsrc-wip.

diffstat:

 pkgtools/pkglint/Makefile         |   4 +-
 pkgtools/pkglint/files/pkglint.pl |  45 +++++++++++++++++++++++---------------
 2 files changed, 29 insertions(+), 20 deletions(-)

diffs (128 lines):

diff -r e1bf770f0143 -r 92bd8ee4c7e3 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Fri Nov 04 08:29:08 2005 +0000
+++ b/pkgtools/pkglint/Makefile Fri Nov 04 08:40:59 2005 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.277 2005/11/03 18:49:32 rillig Exp $
+# $NetBSD: Makefile,v 1.278 2005/11/04 08:40:59 rillig Exp $
 #
 
-DISTNAME=      pkglint-4.33.1
+DISTNAME=      pkglint-4.34
 CATEGORIES=    pkgtools devel
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r e1bf770f0143 -r 92bd8ee4c7e3 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Fri Nov 04 08:29:08 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Fri Nov 04 08:40:59 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.324 2005/11/03 18:49:33 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.325 2005/11/04 08:41:00 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -220,10 +220,12 @@
 use constant TEXT      => 2;
 use constant PHYSLINES => 3;
 use constant CHANGED   => 4;
+use constant BEFORE    => 5;
+use constant AFTER     => 6;
        
 sub new($$$$) {
        my ($class, $file, $lines, $text, $physlines) = @_;
-       my ($self) = ([$file, $lines, $text, $physlines, false]);
+       my ($self) = ([$file, $lines, $text, $physlines, false, [], []]);
        bless($self, $class);
        return $self;
 }
@@ -237,7 +239,8 @@
        return shift(@_)->[TEXT];
 }
 sub physlines($) {
-       return shift(@_)->[PHYSLINES];
+       my ($self) = @_;
+       return [@{$self->[BEFORE]}, @{$self->[PHYSLINES]}, @{$self->[AFTER]}];
 }
 sub is_changed($) {
        return shift(@_)->[CHANGED];
@@ -264,26 +267,29 @@
        return sprintf("%s:%s: %s", $self->[FILE], $self->[LINES], $self->[TEXT]);
 }
 
-sub insert_before($$) {
+sub prepend_before($$) {
        my ($self, $text) = @_;
-       unshift(@{$self->[PHYSLINES]}, [0, "$text\n"]);
+       unshift(@{$self->[BEFORE]}, [0, "$text\n"]);
        $self->[CHANGED] = true;
 }
-sub insert_after($$) {
+sub append_before($$) {
+       my ($self, $text) = @_;
+       push(@{$self->[BEFORE]}, [0, "$text\n"]);
+       $self->[CHANGED] = true;
+}
+sub prepend_after($$) {
        my ($self, $text) = @_;
-       push(@{$self->[PHYSLINES]}, [0, "$text\n"]);
+       unshift(@{$self->[AFTER]}, [0, "$text\n"]);
+       $self->[CHANGED] = true;
+}
+sub append_after($$) {
+       my ($self, $text) = @_;
+       push(@{$self->[AFTER]}, [0, "$text\n"]);
        $self->[CHANGED] = true;
 }
 sub delete($) {
        my ($self) = @_;
-       my ($newlines) = ([]);
-
-       foreach my $line (@{$self->[PHYSLINES]}) {
-               if ($line->[0] == 0) {
-                       push(@{$newlines}, $line);
-               }
-       }
-       $self->[PHYSLINES] = $newlines;
+       $self->[PHYSLINES] = [];
        $self->[CHANGED] = true;
 }
 
@@ -528,6 +534,7 @@
 
 my $opt_autofix                = false;
 my $opt_dumpmakefile   = false;
+my $opt_import         = false;
 my $opt_quiet          = false;
 my $opt_recursive      = false;
 my $opt_rcsidstring    = conf_rcsidstring;
@@ -567,7 +574,9 @@
          sub {
                help(*STDOUT, 0, 1);
          } ],
-       [ "-q|--quiet", "don't print a summary line when finishing",
+       [ "-i|--import", "Prepare the import of a wip package",
+         "import|i", \$opt_import ],
+       [ "-q|--quiet", "Don't print a summary line when finishing",
          "quiet|q", \$opt_quiet ],
        [ "-r|--recursive", "Recursive---check subdirectories, too",
          "recursive|r", \$opt_recursive ],
@@ -2607,7 +2616,7 @@
                if (!$f_atend && ($m_atend || $f_current lt $m_current)) {
                        if (!exists($m_check{$f_current})) {
                                $line->log_error("${f_current} exists in the file system, but not in the Makefile.");
-                               $line->insert_before("SUBDIR+=\t${f_current}");
+                               $line->append_before("SUBDIR+=\t${f_current}");
                        }
                        $f_neednext = true;
 
@@ -2751,7 +2760,7 @@
        my ($dir) = @_;
 
        $current_dir = $dir;
-       $is_wip = ((Cwd::abs_path($dir) =~ qr"/wip(?:/|$)") ? true : false);
+       $is_wip = !$opt_import && (Cwd::abs_path($dir) =~ qr"/wip(?:/|$)");
 
        if (-f "${dir}/../../mk/bsd.pkg.mk") {
                checkdir_package();



Home | Main Index | Thread Index | Old Index