pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files It's pretty tricky to get the b...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/adc94506d99b
branches:  trunk
changeset: 550323:adc94506d99b
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Nov 18 21:17:53 2008 +0000

description:
It's pretty tricky to get the bmake substitution right. At least if
you're a lazy programmer. Now the ${DISTNAME:S...} is interpreted
correctly.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 72dd2d41fb80 -r adc94506d99b pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Tue Nov 18 21:07:30 2008 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Tue Nov 18 21:17:53 2008 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.787 2008/11/18 19:39:49 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.788 2008/11/18 21:17:53 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -6891,11 +6891,16 @@
        if (defined($distname) && defined($pkgname)) {
                $pkgname =~ s/\$\{DISTNAME\}/$distname/;
 
-               if ($pkgname =~ m"^(.*)\$\{DISTNAME:S(.)([^:]*)\2([^:]*)\2\}(.*)$") {
+               if ($pkgname =~ m"^(.*)\$\{DISTNAME:S(.)([^:]*)\2([^:]*)\2g?\}(.*)$") {
                        my ($before, $separator, $old, $new, $after) = ($1, $2, $3, $4, $5);
                        my $newname = $distname;
+                       $old = quotemeta($old);
+                       $old =~ s/^\\\^/^/;
+                       $old =~ s/\\\$$/\$/;
                        $newname =~ s/$old/$new/;
+                       $opt_debug_misc and $pkgname_line->log_debug("old pkgname=$pkgname");
                        $pkgname = $before . $newname . $after;
+                       $opt_debug_misc and $pkgname_line->log_debug("new pkgname=$pkgname");
                }
        }
 



Home | Main Index | Thread Index | Old Index