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 (currently disabled) code...
details: https://anonhg.NetBSD.org/pkgsrc/rev/aaeb56a8a08d
branches: trunk
changeset: 502875:aaeb56a8a08d
user: rillig <rillig%pkgsrc.org@localhost>
date: Thu Nov 10 07:46:24 2005 +0000
description:
Added (currently disabled) code to scan for variable names in
pkgsrc/mk/defaults/mk.conf. All those variable names are then checked as
being of type Userdefined. As that file is currently too unstructured
and contains too much garbage, this check cannot yet be enabled.
diffstat:
pkgtools/pkglint/files/pkglint.pl | 57 +++++++++++++++++++++++++++-----------
1 files changed, 40 insertions(+), 17 deletions(-)
diffs (92 lines):
diff -r 23242b1de17e -r aaeb56a8a08d pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Nov 10 07:25:32 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Nov 10 07:46:24 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.341 2005/11/08 22:55:22 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.342 2005/11/10 07:46:24 rillig Exp $
#
# This version contains lots of changes necessary for NetBSD packages
# done by:
@@ -93,7 +93,7 @@
@ISA = qw(Exporter);
@EXPORT_OK = qw(
NO_FILE NO_LINE_NUMBER
- log_error log_warning log_note log_info log_subinfo
+ log_fatal log_error log_warning log_note log_info log_subinfo
print_summary_and_exit set_verbose is_verbose
set_gcc_output_format
);
@@ -483,7 +483,7 @@
);
import PkgLint::Logging qw(
NO_FILE NO_LINE_NUMBER
- log_error log_warning log_info log_subinfo
+ log_fatal log_error log_warning log_info log_subinfo
print_summary_and_exit
);
import PkgLint::FileUtil qw(
@@ -705,24 +705,47 @@
}
sub load_make_vars_typemap() {
- my ($lines, $vartypes);
-
- if (!($lines = (load_file(conf_datadir."/makevars.map")))) {
- return false;
- }
+ my ($vartypes);
+ my ($fname);
+
$vartypes = {};
- foreach my $line (@{$lines}) {
- if ($line->text =~ qr"^(?:#.*|\s*)$") {
- # ignore empty and comment lines
-
- } elsif ($line->text =~ qr"^([\w\d_.]+)\s+([-.+\w\d_* \{\}]+)$") {
- $vartypes->{$1} = $2;
-
- } else {
- $line->log_fatal("Unknown line format.");
+ $fname = conf_datadir."/makevars.map";
+ if ((my $lines = load_file($fname))) {
+ foreach my $line (@{$lines}) {
+ if ($line->text =~ qr"^(?:#.*|\s*)$") {
+ # ignore empty and comment lines
+
+ } elsif ($line->text =~ qr"^([\w\d_.]+)\s+([-.+\w\d_* \{\}]+)$") {
+ $vartypes->{$1} = $2;
+
+ } else {
+ $line->log_fatal("Unknown line format.");
+ }
}
+ } else {
+ log_fatal($fname, NO_LINE_NUMBER, "Cannot be read.");
}
+
+# TODO: Enable when the time is ripe.
+if (false) {
+ # Additionally, scan mk/defaults/mk.conf for variable
+ # definitions. All these variables are reserved for the user and
+ # must not be set within packages.
+ $fname = "${pkgsrcdir}/mk/defaults/mk.conf";
+ if ((my $lines = load_file($fname))) {
+ foreach my $line (@{$lines}) {
+ if ($line->text =~ qr"^#?([\w_]+)\?=") {
+ my ($varname) = ($1);
+ $line->log_info("Found user-definable variable ${varname}.");
+ $vartypes->{$varname} = "Userdefined";
+ }
+ }
+ } else {
+ log_fatal($fname, NO_LINE_NUMBER, "Cannot be read.");
+ }
+}
+
return $vartypes;
}
Home |
Main Index |
Thread Index |
Old Index