pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Fixed the XXX from the last com...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8e0519b07b5d
branches:  trunk
changeset: 535080:8e0519b07b5d
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Nov 07 12:11:18 2007 +0000

description:
Fixed the XXX from the last commit. PLIST conditionals are read in when
a package is checked and discarded for the directory and filename
checks.

diffstat:

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

diffs (63 lines):

diff -r e886d6ad04a4 -r 8e0519b07b5d pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Nov 07 11:58:57 2007 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Wed Nov 07 12:11:18 2007 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.729 2007/11/07 11:58:57 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.730 2007/11/07 12:11:18 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -1836,6 +1836,9 @@
 my $pkgctx_vardef;             # { varname => line }
 my $pkgctx_varuse;             # { varname => line }
 my $pkgctx_bl3;                        # buildlink3.mk name => line of inclusion
+my $pkgctx_plist_subst_cond;   # { varname => 1 } list of all variables
+                               # that are used as conditionals (@comment
+                               # or nothing) in PLISTs.
 my $seen_Makefile_common;      # Does the package have any .includes?
 
 # Context of the Makefile that is currently checked.
@@ -5729,6 +5732,12 @@
                        "append that variable with PLIST_SUBST+= \${MY_PLIST_SUBST}.");
        }
 
+       # Mark the variable as PLIST condition. This is later used in
+       # checkfile_PLIST.
+       if (defined($pkgctx_plist_subst_cond) && $value =~ qr"(.+)=.*\@comment.*") {
+               $pkgctx_plist_subst_cond->{$1}++;
+       }
+
        use constant op_to_use_time => {
                ":="    => VUC_TIME_LOAD,
                "!="    => VUC_TIME_LOAD,
@@ -7334,6 +7343,13 @@
        foreach my $line (@{$extra_lines}, @{$lines}) {
                my $text = $line->text;
 
+               if ($text =~ qr"\$\{([\w_]+)\}(.*)") {
+                       if (defined($pkgctx_plist_subst_cond) && exists($pkgctx_plist_subst_cond->{$1})) {
+                               $opt_debug_misc and $line->log_debug("Removed PLIST_SUBST conditional $1.");
+                               $text = $2;
+                       }
+               }
+               
                if ($text =~ qr"^[\w\$]") {
                        $all_files->{$text} = $line;
                        my $dir = $text;
@@ -7944,6 +7960,7 @@
        $pkgctx_vardef = {%{get_userdefined_variables()}};
        $pkgctx_varuse = {};
        $pkgctx_bl3 = {};
+       $pkgctx_plist_subst_cond = {};
        $seen_Makefile_common = false;
 
        # we need to handle the Makefile first to get some variables
@@ -8013,6 +8030,7 @@
        $pkgctx_vardef = undef;
        $pkgctx_varuse = undef;
        $pkgctx_bl3 = undef;
+       $pkgctx_plist_subst_cond = undef;
        $seen_Makefile_common = undef;
 }
 



Home | Main Index | Thread Index | Old Index