From f139df9027480b5807f6579fc52311add1f26e27 Mon Sep 17 00:00:00 2001 From: rillig Date: Wed, 8 Oct 2014 19:15:16 +0000 Subject: [PATCH] Fixed variable type of PYTHON_VERSIONED_DEPENDENCIES, so that build-time and run-time dependencies can be specified without pkglint warnings. --- pkgtools/pkglint/files/makevars.map | 9 ++++++--- pkgtools/pkglint/files/pkglint.pl | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/pkgtools/pkglint/files/makevars.map b/pkgtools/pkglint/files/makevars.map index 3f8d162863ff..1be6e487f505 100644 --- a/pkgtools/pkglint/files/makevars.map +++ b/pkgtools/pkglint/files/makevars.map @@ -1,4 +1,4 @@ -# $NetBSD: makevars.map,v 1.254 2014/08/07 20:35:34 wiz Exp $ +# $NetBSD: makevars.map,v 1.255 2014/10/08 19:15:16 rillig Exp $ # # This file contains the guessed type of some variables, according to @@ -10,9 +10,12 @@ # The type Yes is used for variables that are checked using # .if defined(VAR) # -# Type type List is used for lists of things. There are two types of lists, +# The type List is used for lists of things. There are two types of lists, # InternalList and List, which are described in the pkgsrc guide, chapter # "Makefiles". +# +# The other types are described in pkglint.pl, checkline_mk_vartype_basic. +# # # Some commonly used ACLs. For further documentation, see the chapter @@ -656,7 +659,7 @@ PYTHON_VERSIONS_ACCEPTED List of Version [$package] PYTHON_VERSIONS_INCOMPATIBLE List of Version [$package] PYTHON_VERSION_DEFAULT Version [$user] PYTHON_VERSION_REQD Version [$user] -PYTHON_VERSIONED_DEPENDENCIES List of Identifier [$package_list] +PYTHON_VERSIONED_DEPENDENCIES List of PythonDependency [$package_list] RANLIB ShellCommand [$system] RCD_SCRIPTS List of Filename [$package_list] RCD_SCRIPT_SRC.* List of Pathname [m:s] diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 91beb013e9ae..d36fd661d377 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.870 2014/09/08 12:05:10 wiz Exp $ +# $NetBSD: pkglint.pl,v 1.871 2014/10/08 19:15:16 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -4317,6 +4317,20 @@ sub checkline_mk_vartype_basic($$$$$$$$) { } }, + PythonDependency => sub { + if ($value ne $value_novar) { + $line->log_warning("Python dependencies should not contain variables."); + } + if ($value_novar !~ m"^[+\-.0-9A-Z_a-z]+(?:|:link|:build)$") { + $line->log_warning("Invalid Python dependency \"${value}\"."); + $line->explain_warning( +"Python dependencies must be an identifier for a package, as specified", +"in lang/python/versioned_dependencies.mk. This identifier may be", +"followed by :build for a build-time only dependency, or by :link for", +"a run-time only dependency."); + } + }, + RelativePkgDir => sub { checkline_relative_pkgdir($line, $value); },