summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig>2005-11-04 08:40:59 +0000
committerrillig <rillig>2005-11-04 08:40:59 +0000
commita8dfdcbe89f4f9974e1b95710405b15ddbfd9680 (patch)
treef1ac77d34cb65cf1fd025787504b21e8ee204ba8 /pkgtools
parent7367b0c5d654f300a5fc389f2b41fddcf3665b93 (diff)
downloadpkgsrc-a8dfdcbe89f4f9974e1b95710405b15ddbfd9680.tar.gz
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 (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/Makefile4
-rw-r--r--pkgtools/pkglint/files/pkglint.pl45
2 files changed, 29 insertions, 20 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile
index 1beca6bc301..b2c4579ad8d 100644
--- a/pkgtools/pkglint/Makefile
+++ b/pkgtools/pkglint/Makefile
@@ -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 --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index d41b5257cc3..ec7f08a901c 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.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 LINES => 1;
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 @@ sub text($) {
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 @@ sub to_string($) {
return sprintf("%s:%s: %s", $self->[FILE], $self->[LINES], $self->[TEXT]);
}
-sub insert_before($$) {
+sub prepend_before($$) {
+ my ($self, $text) = @_;
+ unshift(@{$self->[BEFORE]}, [0, "$text\n"]);
+ $self->[CHANGED] = true;
+}
+sub append_before($$) {
+ my ($self, $text) = @_;
+ push(@{$self->[BEFORE]}, [0, "$text\n"]);
+ $self->[CHANGED] = true;
+}
+sub prepend_after($$) {
my ($self, $text) = @_;
- unshift(@{$self->[PHYSLINES]}, [0, "$text\n"]);
+ unshift(@{$self->[AFTER]}, [0, "$text\n"]);
$self->[CHANGED] = true;
}
-sub insert_after($$) {
+sub append_after($$) {
my ($self, $text) = @_;
- push(@{$self->[PHYSLINES]}, [0, "$text\n"]);
+ 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 (%warnings) = (
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 @@ my (@options) = (
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 @@ sub checkdir_category() {
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 @@ sub checkdir($) {
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();