pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Added a check for valid CATEGOR...
details: https://anonhg.NetBSD.org/pkgsrc/rev/4948b45d0ad0
branches: trunk
changeset: 502151:4948b45d0ad0
user: rillig <rillig%pkgsrc.org@localhost>
date: Wed Nov 02 20:16:02 2005 +0000
description:
Added a check for valid CATEGORIES. The new type List* is the same as
List, except that no warning is reported for not using the "+="
operator.
diffstat:
pkgtools/pkglint/files/makevars.map | 5 ++-
pkgtools/pkglint/files/pkglint.pl | 39 +++++++++++++++++++++++++++++++-----
2 files changed, 36 insertions(+), 8 deletions(-)
diffs (98 lines):
diff -r b52166df006f -r 4948b45d0ad0 pkgtools/pkglint/files/makevars.map
--- a/pkgtools/pkglint/files/makevars.map Wed Nov 02 20:11:47 2005 +0000
+++ b/pkgtools/pkglint/files/makevars.map Wed Nov 02 20:16:02 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: makevars.map,v 1.21 2005/11/01 21:39:31 rillig Exp $
+# $NetBSD: makevars.map,v 1.22 2005/11/02 20:16:02 rillig Exp $
#
# This file contains the guessed type of some variables, according to
@@ -45,6 +45,7 @@
# some variables found in package Makefiles
+CATEGORIES List* of Category
PKGREVISION PkgRevision
GNU_CONFIGURE Yes
HOMEPAGE URL
@@ -74,7 +75,7 @@
MAKE_FLAGS List
CONFIGURE_ARGS List
PLIST_SUBST List
-MASTER_SITES List of URL
+MASTER_SITES List* of URL
USE_TOOLS List of Tool
PKGVERSION Readonly
diff -r b52166df006f -r 4948b45d0ad0 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Nov 02 20:11:47 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Wed Nov 02 20:16:02 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.318 2005/11/02 19:00:16 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.319 2005/11/02 20:16:02 rillig Exp $
#
# This version contains lots of changes necessary for NetBSD packages
# done by:
@@ -691,7 +691,7 @@
if ($line->text =~ qr"^(?:#.*|\s*)$") {
# ignore empty and comment lines
- } elsif ($line->text =~ qr"^([\w\d_.]+)\s+([\w_ ]+)$") {
+ } elsif ($line->text =~ qr"^([\w\d_.]+)\s+([\w_* ]+)$") {
$vartypes->{$1} = $2;
} else {
@@ -1440,7 +1440,34 @@
sub checktext_basic_vartype($$$$$) {
my ($line, $varname, $type, $value, $comment) = @_;
- if ($type eq "Dependency") {
+ if ($type eq "Category") {
+ my $allowed_categories = join("|", qw(
+ archivers audio
+ benchmarks biology
+ cad chat chinese comms converters cross crosspkgtools
+ databases devel
+ editors emulators
+ finance fonts
+ games geography gnome gnustep graphics
+ ham
+ inputmethod
+ japanese java
+ kde korean
+ lang
+ mail math mbone meta-pkgs misc multimedia
+ net news
+ packages parallel perl5 pkgtools plan9 print python
+ ruby
+ security shells sysutils
+ tcl textproc time tk
+ windowmaker wm www
+ x11 xmms
+ ));
+ if ($value !~ qr"^(?:${allowed_categories})$") {
+ $line->log_error("Invalid category \"${value}\".");
+ }
+
+ } elsif ($type eq "Dependency") {
if ($value =~ regex_unresolved) {
# don't even try to check anything
} elsif ($value =~ qr":\.\./\.\./") {
@@ -1545,11 +1572,11 @@
if (!defined($type)) {
$line->log_info("[checkline_Makefile_vartype] Unchecked variable ${varname}");
- } elsif ($type =~ qr"^List(?: of (.*))?$") {
- my ($element_type) = ($1);
+ } elsif ($type =~ qr"^List(\*?)(?: of (.*))?$") {
+ my ($append_only, $element_type) = ($1 eq "", $2);
my (@values) = split(qr"\s+", $value); # XXX: This may be too simple
- if ($op ne "+=" && !($value eq "" && defined($comment) && $comment =~ qr"^#") && $varname ne "MASTER_SITES") {
+ if ($append_only && $op ne "+=" && !($value eq "" && defined($comment) && $comment =~ qr"^#")) {
$line->log_warning("${varname} should be modified using \"+=\".");
}
Home |
Main Index |
Thread Index |
Old Index