summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-04-21 09:42:01 +0000
committerrillig <rillig@pkgsrc.org>2006-04-21 09:42:01 +0000
commit0b63ee04f7f4881e1ba5853b628cd06e018d81da (patch)
treedbd3dab3ccc24fce65565834fe6cb3c1ab14b71f
parent4963a9186b33d3e783d77ef9f8e47f685d3ce1d0 (diff)
downloadpkgsrc-0b63ee04f7f4881e1ba5853b628cd06e018d81da.tar.gz
- Added checks for wrapper transformation and reordering rules.
- Added checks for redundant library files in PLISTs.
-rw-r--r--pkgtools/pkglint/files/makevars.map7
-rw-r--r--pkgtools/pkglint/files/pkglint.pl50
2 files changed, 51 insertions, 6 deletions
diff --git a/pkgtools/pkglint/files/makevars.map b/pkgtools/pkglint/files/makevars.map
index f2d7f97da0d..3b3d91b4b33 100644
--- a/pkgtools/pkglint/files/makevars.map
+++ b/pkgtools/pkglint/files/makevars.map
@@ -1,4 +1,4 @@
-# $NetBSD: makevars.map,v 1.81 2006/04/12 09:23:36 rillig Exp $
+# $NetBSD: makevars.map,v 1.82 2006/04/21 09:42:01 rillig Exp $
#
# This file contains the guessed type of some variables, according to
@@ -74,7 +74,7 @@ BUILDLINK_PKGSRCDIR RelativePkgDir
BUILDLINK_PREFIX Pathname
BUILDLINK_RPATHDIRS List of Pathname
BUILDLINK_TARGETS List+ of Identifier
-BUILDLINK_TRANSFORM List+
+BUILDLINK_TRANSFORM List+ of WrapperTransform
BUILD_DEFS List+ of Varname
BUILD_DEPENDS InternalList+ of DependencyWithPath
BUILD_DIRS List of WrksrcSubdirectory
@@ -423,7 +423,8 @@ USE_PKGSRC_GCC Userdefined
USE_TOOLS List+ of Tool
USE_X11 Yes
USE_X11BASE Yes
-WRAPPER_REORDER_CMDS List+ of ShellWord
+WRAPPER_REORDER_CMDS List+ of WrapperReorder
+WRAPPER_TRANSFORM_CMDS List+ of WrapperTransform
WRKSRC WrkdirSubdirectory
X11_PKGSRCDIR Readonly
X11_TYPE Userdefined
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 151db26b4ba..f1f1fd44f39 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.560 2006/04/18 00:35:18 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.561 2006/04/21 09:42:01 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -3367,6 +3367,34 @@ sub checkline_mk_vartype_basic($$$$$$$) {
$line->log_warning("\"${value}\" is not a valid variable name.");
}
+ } elsif ($type eq "WrapperReorder") {
+ if ($value =~ qr"^reorder:l:([\w]+):([\w]+)$") {
+ my ($lib1, $lib2) = ($1, $2);
+ # Fine.
+ } else {
+ $line->log_warning("Invalid wrapper reorder command \"${value}\".");
+ }
+
+ } elsif ($type eq "WrapperTransform") {
+ if ($value =~ qr"^rm:(?:-[DILOUWflm].*|-std=.*)$") {
+ # Fine.
+
+ } elsif ($value =~ qr"^l:([^:]+):(.+)$") {
+ my ($lib, $replacement_libs) = ($1, $2);
+ # Fine.
+
+ } elsif ($value =~ qr"^'?(?:opt|rename|rm-optarg|rmdir):.*$") {
+ # FIXME: This is cheated.
+ # Fine.
+
+ } elsif ($value eq "-e" || $value =~ qr"^\"?'?s[|:,]") {
+ # FIXME: This is cheated.
+ # Fine.
+
+ } else {
+ $line->log_warning("Invalid wrapper transform command \"${value}\".");
+ }
+
} elsif ($type eq "WrkdirSubdirectory") {
$opt_debug and $line->log_warning("Unchecked subdirectory \"${value}\" of \${WRKSRC}.");
@@ -4640,7 +4668,7 @@ sub checkfile_patch($) {
sub checkfile_PLIST($) {
my ($fname) = @_;
- my ($plist, $last_file_seen);
+ my ($plist, $last_file_seen, $libtool_libs);
log_info($fname, NO_LINE_NUMBER, "[checkfile_PLIST]");
@@ -4655,7 +4683,16 @@ sub checkfile_PLIST($) {
}
checkline_rcsid($plist->[0], "\@comment ");
- line:
+ # Get all libtool libraries from the PLIST.
+ $libtool_libs = {};
+ foreach my $line (@{$plist}) {
+ my $text = $line->text;
+
+ if ($text =~ qr"^(.*)\.la$") {
+ $libtool_libs->{$1} = $line;
+ }
+ }
+
foreach my $line (@{$plist}) {
my $text = $line->text;
@@ -4728,6 +4765,13 @@ sub checkfile_PLIST($) {
$line->log_warning(".orig files should not be in the PLIST.");
}
+ if ($text =~ qr"^(.*)(\.a|\.so[0-9.]*)$") {
+ my ($basename, $ext) = ($1, $2);
+
+ if (exists($libtool_libs->{$basename})) {
+ $line->log_warning("Redundant library found. The libtool library is in line " . $libtool_libs->{$basename}->lines . ".");
+ }
+ }
} else {
$line->log_error("Unknown line type.");
}