summaryrefslogtreecommitdiff
path: root/pkgtools/pkglint/files
diff options
context:
space:
mode:
authorrillig <rillig>2005-12-01 14:01:59 +0000
committerrillig <rillig>2005-12-01 14:01:59 +0000
commit2bcf87f2d5fec3c09864bac61d0539da5b75d91d (patch)
treef3abcdb9eb9e5f81831f7bcb51e67432e9f86c3b /pkgtools/pkglint/files
parent3250e15cf4af038265fbdf7c1961b3c935977d89 (diff)
downloadpkgsrc-2bcf87f2d5fec3c09864bac61d0539da5b75d91d.tar.gz
- 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 (limited to 'pkgtools/pkglint/files')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl29
1 files changed, 18 insertions, 11 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index d16f4c59075..bb3a16c1668 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -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 @@ sub checkline_rcsid($$) {
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 @@ sub checkline_basic_vartype($$$$$) {
} 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.");
- }
+ } elsif ($value =~ qr":(\.\./\.\./([^/]+)/([^/]+))$") {
+ my ($relpath, $cat, $pkg) = ($1, $2, $3);
- if (!-d "${pkgsrcdir}/${cat}/${pkg}") {
- $line->log_error("The package ${cat}/${pkg} does not exist.");
- }
+ 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 @@ sub checklines_package_Makefile($) {
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);