pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files The *.mk files need two passes ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/8509765dec64
branches: trunk
changeset: 518056:8509765dec64
user: rillig <rillig%pkgsrc.org@localhost>
date: Wed Aug 30 05:41:19 2006 +0000
description:
The *.mk files need two passes to make the BUILD_DEFS check work
reasonably well. In the first pass, all variables that are added to
BUILD_DEFS are collected, and in the second pass it is checked whether
any remaining user-defined variables are used but have not been added to
BUILD_DEFS. This way, it does not matter in which order the variables
appear in the files.
diffstat:
pkgtools/pkglint/files/pkglint.pl | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diffs (50 lines):
diff -r ed48336cdd2e -r 8509765dec64 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Aug 30 04:51:05 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Wed Aug 30 05:41:19 2006 +0000
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.670 2006/08/28 12:41:49 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.671 2006/08/30 05:41:19 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -5429,14 +5429,6 @@
"It is this meaning that should be described.");
}
- if ($varname eq "BUILD_DEFS") {
- assert(defined($mkctx_build_defs), "The build_defs variable must be defined here.");
- foreach my $bdvar (split(qr"\s+", $value)) {
- $mkctx_build_defs->{$bdvar} = true;
- $opt_debug_misc and $line->log_debug("${bdvar} is added to BUILD_DEFS.");
- }
- }
-
if ($value =~ qr"\$\{(PKGNAME|PKGVERSION)[:\}]") {
my ($pkgvarname) = ($1);
if ($varname =~ qr"^PKG_.*_REASON$") {
@@ -5673,6 +5665,24 @@
}
}
+ #
+ # In the first pass, all additions to BUILD_DEFS are collected,
+ # to make the order of the definitions irrelevant.
+ #
+
+ foreach my $line (@{$lines}) {
+ if ($line->has("is_varassign") && $line->get("varname") eq "BUILD_DEFS") {
+ foreach my $varname (split(qr"\s+", $line->get("value"))) {
+ $mkctx_build_defs->{$varname} = true;
+ $opt_debug_misc and $line->log_debug("${varname} is added to BUILD_DEFS.");
+ }
+ }
+ }
+
+ #
+ # In the second pass, all "normal" checks are done.
+ #
+
if (0 <= $#{$lines}) {
checkline_rcsid_regex($lines->[0], qr"^#\s+", "# ");
}
Home |
Main Index |
Thread Index |
Old Index