summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig>2006-03-01 22:19:13 +0000
committerrillig <rillig>2006-03-01 22:19:13 +0000
commitb1427c13a67edd48aefb47175500b65d77ef3ff4 (patch)
tree74a68899c99a131a90a99cbbe0c2949c093d64f0 /pkgtools
parent97195f67fb88816626dc13e305d155c9daae41e2 (diff)
downloadpkgsrc-b1427c13a67edd48aefb47175500b65d77ef3ff4.tar.gz
Updated pkglint to 4.58.
Changes since 4.57: - New parser for patch files. - New command line options -Wplist-depr and -Wstyle. - Variable assignments are no longer allowed in variables that should only contain identifiers. - builtin.mk files must not be included directly. - Better checks for sed commands. - Some commands like ktrace should never appear in Makefiles. - The package version is compared to the requested update in file doc/TODO.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/Makefile5
-rw-r--r--pkgtools/pkglint/files/pkglint.pl73
2 files changed, 75 insertions, 3 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile
index f7b4ad82868..f177ee56e0c 100644
--- a/pkgtools/pkglint/Makefile
+++ b/pkgtools/pkglint/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.333 2006/02/25 15:56:24 rillig Exp $
+# $NetBSD: Makefile,v 1.334 2006/03/01 22:19:13 rillig Exp $
#
-DISTNAME= pkglint-4.57
+DISTNAME= pkglint-4.58
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
@@ -12,6 +12,7 @@ COMMENT= Verifier for NetBSD packages and complete pkgsrc tree
DEPENDS+= digest>=20010101:../../pkgtools/digest
DEPENDS+= p5-Digest-SHA1-[0-9]*:../../security/p5-Digest-SHA1
+DEPENDS+= p5-pkgsrc-Dewey>=1.0:../../pkgtools/p5-pkgsrc-Dewey
PKG_INSTALLATION_TYPES= overwrite pkgviews
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index c1c631c8d52..fd4fa68dd2c 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.538 2006/02/28 15:25:44 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.539 2006/03/01 22:19:13 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -1110,6 +1110,7 @@ use Fcntl qw(:mode);
use File::Basename;
use File::stat;
use Cwd;
+use pkgsrc::Dewey;
BEGIN {
import PkgLint::Util qw(
@@ -1808,6 +1809,52 @@ sub get_varname_to_toolname() {
return $load_tool_names_varname_to_toolname;
}
+my $get_doc_TODO_updates_result = undef;
+sub get_doc_TODO_updates() {
+
+ if (defined($get_doc_TODO_updates_result)) {
+ return $get_doc_TODO_updates_result;
+ }
+
+ my ($fname) = ("${current_dir}/${pkgsrcdir}/doc/TODO");
+ my ($lines, $updates, $state, $re_suggested_update);
+
+ if (!($lines = load_file($fname))) {
+ log_fatal($fname, NO_LINE_NUMBER, "Cannot be read.");
+ }
+
+ $updates = {};
+ $state = 0;
+ foreach my $line (@{$lines}) {
+ my $text = $line->text;
+
+ if ($state == 0 && $text eq "Suggested package updates") {
+ $state = 1;
+ } elsif ($state == 1 && $text eq "") {
+ $state = 2;
+ } elsif ($state == 2) {
+ $state = 3;
+ } elsif ($state == 3 && $text eq "") {
+ $state = 4;
+ }
+
+ if ($state == 3) {
+ if ($text =~ qr"^\to\s(\S+)") {
+ my ($spuname) = ($1);
+ if ($spuname =~ regex_pkgname) {
+ $updates->{$spuname} = $line;
+ } else {
+ $line->log_warning("Invalid package name $spuname");
+ }
+ } else {
+ $line->log_warning("Invalid line format $text");
+ }
+ }
+ }
+
+ return ($get_doc_TODO_updates_result = $updates);
+}
+
#
# Miscellaneous functions
#
@@ -4116,6 +4163,7 @@ sub checkfile_package_Makefile($$$) {
if (!defined($pkgname)) {
$pkgname = $distname;
+ $pkgname_line = $distname_line;
}
if (!exists($makevar->{"COMMENT"})) {
@@ -4127,6 +4175,29 @@ sub checkfile_package_Makefile($$$) {
$makevar->{"USE_X11"}->log_note("... USE_X11 superfluous.");
}
+ if (defined($pkgname) && $pkgname =~ regex_pkgname) {
+ my ($pkgbase, $pkgver) = ($1, $2);
+ my $updates = get_doc_TODO_updates();
+
+ foreach my $suggested_update (keys(%{$updates})) {
+ next unless ($suggested_update =~ regex_pkgname);
+ my ($suggbase, $suggver) = ($1, $2);
+
+ next unless $pkgbase eq $suggbase;
+ my $line = $updates->{$suggested_update};
+
+ if (dewey_cmp($pkgver, "<", $suggver)) {
+ $pkgname_line->log_warning("This package should be updated to ${suggver}.");
+ }
+ if (dewey_cmp($pkgver, "==", $suggver)) {
+ $pkgname_line->log_note("The update request to ${suggver} from doc/TODO has been done.");
+ }
+ if (dewey_cmp($pkgver, ">", $suggver)) {
+ $pkgname_line->log_note("This package is newer than the update request to ${suggver}.");
+ }
+ }
+ }
+
checklines_mk($lines);
checklines_package_Makefile_varorder($lines);
autofix($lines);