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 the subroutine checklin...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e617e81f82f4
branches:  trunk
changeset: 503850:e617e81f82f4
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Dec 01 14:01:59 2005 +0000

description:
- Added the subroutine checkline_relative_path().
- Added a check for .include lines in all Makefiles and *.mk files to make
  sure that only existant files are referenced and that pkgsrc packages do
  not contain references to packages in pkgsrc-wip.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diffs (62 lines):

diff -r 9df06c9f2446 -r e617e81f82f4 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Dec 01 13:44:11 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Dec 01 14:01:59 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.401 2005/12/01 13:40:39 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.402 2005/12/01 14:01:59 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -1147,6 +1147,19 @@
        checkline_rcsid_regex($line, quotemeta($prefix), $prefix);
 }
 
+sub checkline_relative_path($$) {
+       my ($line, $path) = @_;
+       my ($fname);
+
+       if (!$is_wip && $path =~ qr"/wip/") {
+               $line->log_error("A pkgsrc package must not depend on any outside package.");
+       }
+       ($fname = $path) =~ s/^\.\.\/\.\.\//${pkgsrcdir}\//;
+       if (!-d $fname && !-f $fname) {
+               $line->log_error("\"${path}\" does not exist.");
+       }
+}
+
 #
 # Procedures to check an array of lines, part 1.
 #
@@ -1836,16 +1849,10 @@
        } elsif ($type eq "DependencyWithPath") {
                if ($value =~ regex_unresolved) {
                        # don't even try to check anything
-               } elsif ($value =~ qr":\.\./\.\./([^/]+)/([^/]+)$") {
-                       my ($cat, $pkg) = ($1, $2);
-
-                       if (!$is_wip && $cat eq "wip") {
-                               $line->log_error("A pkgsrc package must not depend on any outside package.");
-                       }
-
-                       if (!-d "${pkgsrcdir}/${cat}/${pkg}") {
-                               $line->log_error("The package ${cat}/${pkg} does not exist.");
-                       }
+               } elsif ($value =~ qr":(\.\./\.\./([^/]+)/([^/]+))$") {
+                       my ($relpath, $cat, $pkg) = ($1, $2, $3);
+
+                       checkline_relative_path($line, $relpath);
 
                        if ($pkg eq "msgfmt" || $pkg eq "gettext") {
                                $line->log_warning("Please use BUILD_USES_MSGFMT=yes instead of this dependency.");
@@ -2682,7 +2689,7 @@
                        my ($includefile) = ($1);
 
                        $line->log_debug("includefile=${includefile}");
-                       # TODO: check the includefile.
+                       checkline_relative_path($line, $includefile);
 
                } elsif ($text =~ qr"^\.\s*(if|ifdef|ifndef|else|elif|endif|for|endfor|undef)(?:\s+([^\s#][^#]*?))?\s*(?:#.*)?$") {
                        my ($directive, $args) = ($1, $2);



Home | Main Index | Thread Index | Old Index