summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2005-07-21 01:03:34 +0000
committerrillig <rillig@pkgsrc.org>2005-07-21 01:03:34 +0000
commite22a89a8ab86bbc5e73e266611a0df95e4bdbc3f (patch)
tree033e6132403853610d4afbf5f6d6b45000978dd2
parent72b09128cb66c5f0f5c2232a44122d8ec58ac25f (diff)
downloadpkgsrc-e22a89a8ab86bbc5e73e266611a0df95e4bdbc3f.tar.gz
The checkfile_Makefile subroutine is split into load_package_Makefile
and checkfile_package_Makefile. This made another command line option -CMakefile possible, which allows Makefile checking to be switched off (it is on by default).
-rw-r--r--pkgtools/pkglint/files/pkglint.pl82
1 files changed, 47 insertions, 35 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index ab38bf01fee..189169fb88c 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.213 2005/07/21 00:19:11 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.214 2005/07/21 01:03:34 rillig Exp $
#
# This version contains lots of changes necessary for NetBSD packages
# done by:
@@ -301,6 +301,7 @@ my (%options) = (
my $opt_check_distinfo = true;
my $opt_check_extra = true;
my $opt_check_bl3 = true;
+my $opt_check_Makefile = true;
my $opt_check_MESSAGE = true;
my $opt_check_patches = true;
my $opt_check_PLIST = true;
@@ -308,6 +309,7 @@ my (%checks) = (
"distinfo" => [\$opt_check_distinfo, "check distinfo file"],
"bl3" => [\$opt_check_bl3, "check buildlink3 files"],
"extra" => [\$opt_check_extra, "check various additional files"],
+ "Makefile" => [\$opt_check_Makefile, "check Makefiles"],
"MESSAGE" => [\$opt_check_MESSAGE, "check MESSAGE files"],
"patches" => [\$opt_check_patches, "check patches"],
"PLIST" => [\$opt_check_PLIST, "check PLIST files"],
@@ -358,7 +360,7 @@ my $pkgname;
# errors in the file) and C<false> if the file could not be checked.
sub checkfile_DESCR($$);
sub checkfile_distinfo($$);
-sub checkfile_Makefile($$);
+sub checkfile_package_Makefile($$$$);
sub checkfile_MESSAGE($$);
sub checkfile_patches_patch($$);
sub checkfile_PLIST($$);
@@ -569,11 +571,10 @@ sub main() {
sub check_package($) {
my ($dir) = @_;
- # FIXME: checkfile_Makefile should be split into load_package_info
- # and checkfile_Makefile.
+ my ($whole, $lines);
# we need to handle the Makefile first to get some variables
- if (!checkfile_Makefile($dir, "${dir}/Makefile")) {
+ if (!load_package_Makefile($dir, "${dir}/Makefile", \$whole, \$lines)) {
log_error("${dir}/Makefile", NO_LINE_NUMBER, "Cannot be read.");
return false;
}
@@ -591,7 +592,7 @@ sub check_package($) {
# We don't have a check for non-regular files yet.
} elsif ($f eq "${dir}/Makefile") {
- # has already been checked, but see the FIXME above
+ $opt_check_Makefile and checkfile_package_Makefile($dir, $f, $whole, $lines);
} elsif ($f =~ qr"/buildlink3.mk$") {
$opt_check_bl3 and checkfile_buildlink3_mk($dir, $f);
@@ -1328,24 +1329,14 @@ sub expand_variable($$$) {
return $value;
}
-sub checkfile_Makefile($$) {
- my ($dir, $fname) = @_;
- my ($tmp, $rawwhole, $whole, $idx, @sections);
- my (@varnames) = ();
- my ($distfiles, $svrpkgname, $distname, $extractsufx) = ('', '', '', '', '');
- my ($bogusdistfiles) = (0);
- my ($realwrksrc, $wrksrc) = ('', '');
- my ($category, $lines);
+sub load_package_Makefile($$$$) {
+ my ($dir, $fname, $refwhole, $reflines) = @_;
+ my ($whole, $lines);
log_info($fname, NO_LINE_NUMBER, "Checking package Makefile.");
- $category = basename(dirname(Cwd::abs_path($dir)));
-
- checkperms($fname);
-
- $tmp = 0;
- $rawwhole = readmakefile($dir, $fname, $lines = [], {});
- if (!$rawwhole) {
+ $whole = readmakefile($dir, $fname, $lines = [], {});
+ if (!$whole) {
log_error($fname, NO_LINE_NUMBER, "Cannot be read.");
return false;
}
@@ -1356,6 +1347,41 @@ sub checkfile_Makefile($$) {
}
}
+ $distinfo_file = expand_variable($whole, "DISTINFO_FILE", "distinfo");
+ $filesdir = expand_variable($whole, "FILESDIR", "files");
+ $patchdir = expand_variable($whole, "PATCHDIR", "patches");
+ $pkgdir = expand_variable($whole, "PKGDIR", ".");
+ $scriptdir = expand_variable($whole, "SCRIPTDIR", "scripts");
+
+ log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] DISTINFO_FILE=$distinfo_file");
+ log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] FILESDIR=$filesdir");
+ log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] PATCHDIR=$patchdir");
+ log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] PKGDIR=$pkgdir");
+ log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] SCRIPTDIR=$scriptdir");
+
+ ${$refwhole} = $whole;
+ ${$reflines} = $lines;
+ return true;
+}
+
+sub checkfile_package_Makefile($$$$) {
+ my ($dir, $fname, $rawwhole, $lines) = @_;
+ my ($tmp, $idx, @sections);
+ my (@varnames) = ();
+ my ($distfiles, $svrpkgname, $distname, $extractsufx) = ('', '', '', '', '');
+ my ($bogusdistfiles) = (0);
+ my ($realwrksrc, $wrksrc) = ('', '');
+ my ($category, $whole);
+
+ log_info($fname, NO_LINE_NUMBER, "Checking package Makefile.");
+
+ $category = basename(dirname(Cwd::abs_path($dir)));
+ $whole = "\n${rawwhole}";
+
+ checkperms($fname);
+
+ $tmp = 0;
+
{
my $cont = 0;
foreach my $line (@{$lines}) {
@@ -1366,8 +1392,6 @@ sub checkfile_Makefile($$) {
}
}
- $whole = "\n" . $rawwhole;
-
#
# whole file: $(VARIABLE)
#
@@ -1377,18 +1401,6 @@ sub checkfile_Makefile($$) {
}
}
- $distinfo_file = expand_variable($whole, "DISTINFO_FILE", "distinfo");
- $filesdir = expand_variable($whole, "FILESDIR", "files");
- $patchdir = expand_variable($whole, "PATCHDIR", "patches");
- $pkgdir = expand_variable($whole, "PKGDIR", ".");
- $scriptdir = expand_variable($whole, "SCRIPTDIR", "scripts");
-
- log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] DISTINFO_FILE=$distinfo_file");
- log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] FILESDIR=$filesdir");
- log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] PATCHDIR=$patchdir");
- log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] PKGDIR=$pkgdir");
- log_info(NO_FILE, NO_LINE_NUMBER, "[checkfile_Makefile] SCRIPTDIR=$scriptdir");
-
checklines_deprecated_variables($lines);
#