pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - In resolve_relative_path, the...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5bf2546e9e66
branches:  trunk
changeset: 506052:5bf2546e9e66
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Jan 11 12:25:19 2006 +0000

description:
- In resolve_relative_path, the depth of the path should only be adjusted
  in about half the cases -- added an additional parameter.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r 99c7d17ee031 -r 5bf2546e9e66 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Jan 11 11:42:27 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Wed Jan 11 12:25:19 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@ -w
-# $NetBSD: pkglint.pl,v 1.461 2006/01/11 04:29:12 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.462 2006/01/11 12:25:19 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -1315,15 +1315,17 @@
        }
 }
 
-sub resolve_relative_path($) {
-       my ($relpath) = @_;
+sub resolve_relative_path($$) {
+       my ($relpath, $adjust_depth) = @_;
 
        $relpath =~ s,\$\{PKGSRCDIR\},$current_dir/$pkgsrcdir,;
        $relpath =~ s,\$\{\.CURDIR\},.,;
        $relpath =~ s,\$\{PHPPKGSRCDIR\},../../lang/php5,;
        $relpath =~ s,\$\{SUSE_DIR_PREFIX\},suse91,;
        $relpath =~ s,\$\{PYPKGSRCDIR\},../../lang/python23,;
-       $relpath =~ s,\.\./\.\.,$pkgsrcdir,;
+       if ($adjust_depth) {
+               $relpath =~ s,\.\./\.\.,$pkgsrcdir,;
+       }
        if (defined($pkgdir)) {
                $relpath =~ s,\$\{PKGDIR\},$pkgdir,g;
        }
@@ -1347,7 +1349,7 @@
                return undef;
        }
 
-       $value = resolve_relative_path($value);
+       $value = resolve_relative_path($value, true);
        if ($value =~ regex_unresolved) {
                log_info(NO_FILE, NO_LINE_NUMBER, "[expand_variable] The variable ${varname} could not be resolved completely. Its value is \"${value}\".");
        }
@@ -1398,7 +1400,7 @@
                # try to get any included file
                my $is_include_line = false;
                if ($text =~ qr"^\.\s*include\s+\"(.*)\"$") {
-                       $includefile = resolve_relative_path($1);
+                       $includefile = resolve_relative_path($1, true);
                        if ($includefile =~ regex_unresolved) {
                                if ($file !~ qr"/mk/") {
                                        $line->log_note("Skipping include file \"${includefile}\". This may result in false warnings.");
@@ -1580,7 +1582,7 @@
        if (!$is_wip && $path =~ qr"/wip/") {
                $line->log_error("A pkgsrc package must not depend on any outside package.");
        }
-       $path = resolve_relative_path($path);
+       $path = resolve_relative_path($path, true);
        if ($path =~ regex_unresolved) {
                $line->log_info("Unresolved path: \"${path}\".");
        } elsif (!-e "${current_dir}/${path}") {
@@ -1592,7 +1594,7 @@
        my ($line, $path) = @_;
 
        checkline_relative_path($line, $path);
-       $path = resolve_relative_path($path);
+       $path = resolve_relative_path($path, false);
 
        if ($path !~ qr"^\.\./\.\./[^/]+/[^/]+$") {
                $line->log_warning("\"${path}\" is not a valid relative package directory.");



Home | Main Index | Thread Index | Old Index