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 backtrace() subroutin...
details: https://anonhg.NetBSD.org/pkgsrc/rev/eeb7e1c2a213
branches: trunk
changeset: 507934:eeb7e1c2a213
user: rillig <rillig%pkgsrc.org@localhost>
date: Sat Feb 11 16:14:40 2006 +0000
description:
- Added a backtrace() subroutine that prints a backtrace when debugging
mode and very verbose mode are activated. Currently unused, but it's
handy to have it defined.
- Removed two subroutine calls that had resulted in duplicate warnings.
- Variables whose names end in _VAR may appear inside double quotes.
diffstat:
pkgtools/pkglint/files/pkglint.pl | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
diffs (70 lines):
diff -r e5752d1e4234 -r eeb7e1c2a213 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Sat Feb 11 16:14:23 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Sat Feb 11 16:14:40 2006 +0000
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.509 2006/02/11 12:47:05 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.510 2006/02/11 16:14:40 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -1904,6 +1904,25 @@
return $retval;
}
+sub backtrace() {
+ my (@callers);
+
+ return unless $opt_debug;
+
+ my $n = 0;
+ while (my @info = caller($n)) {
+ push(@callers, [$info[2], $info[3]]);
+ $n++;
+ }
+
+ for (my $i = $#callers; $i >= 0; $i--) {
+ my $info = $callers[$i];
+ log_debug(NO_FILE, NO_LINE_NUMBER,
+ sprintf("%sline %4d in %s", (" " x ($n - 1 - $i)),
+ $info->[0], $info->[1]));
+ }
+}
+
#
# Loading package-specific data from files.
#
@@ -2091,6 +2110,7 @@
sub checkline_trailing_whitespace($) {
my ($line) = @_;
+
if ($line->text =~ /\s+$/) {
$line->log_note("Trailing white-space.");
}
@@ -2220,8 +2240,6 @@
checkline_rcsid_regex($line, qr"#\s+", "# ");
}
- checkline_trailing_whitespace($line);
-
if ($text =~ qr"\$\{WRKSRC\}/\.\./") {
$line->log_warning("Using \"\${WRKSRC}/..\" is conceptually wrong. Please use a combination of WRKSRC, CONFIGURE_DIRS and BUILD_DIRS instead.");
}
@@ -2320,7 +2338,7 @@
} elsif ($state == SWST_SQUOT && $varname =~ qr"^(?:.*DIRS?|.*FILES?|.*PATH|PREFIX|LOCALBASE|PKGNAME)$") {
# Fine, too.
- } elsif ($state == SWST_DQUOT && $varname =~ qr"^(?:PKGNAME)$") {
+ } elsif ($state == SWST_DQUOT && $varname =~ qr"^(?:.*_VAR|PKGNAME)$") {
# Some variables may even be used in double quotes.
} elsif ($state == SWST_DQUOT && defined($mod) && $mod =~ qr":Q$") {
@@ -3113,7 +3131,6 @@
if ($varname !~ qr"_MK$") {
$opt_debug and $line->log_warning("[checkline_mk_vartype] Unchecked variable ${varname}.");
}
- checkline_mk_text($line, $value);
} elsif ($op eq "!=") {
$opt_debug and $line->log_info("Use of !=: ${value}");
Home |
Main Index |
Thread Index |
Old Index