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 checks for wrapper tran...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2b45e72007f3
branches:  trunk
changeset: 511766:2b45e72007f3
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Apr 21 09:42:01 2006 +0000

description:
- Added checks for wrapper transformation and reordering rules.
- Added checks for redundant library files in PLISTs.

diffstat:

 pkgtools/pkglint/files/makevars.map |   7 ++--
 pkgtools/pkglint/files/pkglint.pl   |  50 ++++++++++++++++++++++++++++++++++--
 2 files changed, 51 insertions(+), 6 deletions(-)

diffs (114 lines):

diff -r c8b510fb33cd -r 2b45e72007f3 pkgtools/pkglint/files/makevars.map
--- a/pkgtools/pkglint/files/makevars.map       Fri Apr 21 09:29:46 2006 +0000
+++ b/pkgtools/pkglint/files/makevars.map       Fri Apr 21 09:42:01 2006 +0000
@@ -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_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_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 -r c8b510fb33cd -r 2b45e72007f3 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Fri Apr 21 09:29:46 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Fri Apr 21 09:42:01 2006 +0000
@@ -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 @@
                        $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_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 @@
        }
        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 @@
                                $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.");
                }



Home | Main Index | Thread Index | Old Index