pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc/files lintpkgsrc: fix parsing of m...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/88d7545c4d3e
branches:  trunk
changeset: 383139:88d7545c4d3e
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Aug 12 22:45:14 2022 +0000

description:
lintpkgsrc: fix parsing of modifiers in makefiles

diffstat:

 pkgtools/lintpkgsrc/files/lintpkgsrc.pl      |  7 +++----
 pkgtools/lintpkgsrc/files/t/parse_makefile.t |  9 +++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (47 lines):

diff -r 4fdda8b4648c -r 88d7545c4d3e pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Fri Aug 12 22:40:40 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Fri Aug 12 22:45:14 2022 +0000
@@ -1,6 +1,6 @@
 #!@PERL5@
 
-# $NetBSD: lintpkgsrc.pl,v 1.80 2022/08/12 22:40:40 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.81 2022/08/12 22:45:14 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -445,10 +445,9 @@
 
        debug("$file: substitutelist $varname ($result) $subvar (@mods)\n");
        foreach (@mods) {
-               # FIXME: Add '^' anchor.
-               if (m# (U) (.*) #x) {
+               if (m#^ (U) (.*) #x) {
                        $result ||= "fallback:$2";
-               } elsif (m# ([CS]) (.) ([^/\@]+) \2 ([^/\@]*) \2 ([1g]*) #x) {
+               } elsif (m#^ ([CS]) (.) ([^/\@]+) \2 ([^/\@]*) \2 ([1g]*) #x) {
                        # TODO: Use non-greedy repetitions above.
                        # TODO: Properly handle separators other than '/' and '@'.
                        my ($how, $from, $to, $global) = ($1, $3, $4, $5);
diff -r 4fdda8b4648c -r 88d7545c4d3e pkgtools/lintpkgsrc/files/t/parse_makefile.t
--- a/pkgtools/lintpkgsrc/files/t/parse_makefile.t      Fri Aug 12 22:40:40 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/parse_makefile.t      Fri Aug 12 22:45:14 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: parse_makefile.t,v 1.9 2022/08/12 22:40:40 rillig Exp $
+# $NetBSD: parse_makefile.t,v 1.10 2022/08/12 22:45:14 rillig Exp $
 
 use strict;
 use warnings;
@@ -101,9 +101,10 @@
 
        expand_modifiers('file.mk', 'VAR', '<', 'REF', 'S,U,X,', '>', $vars);
 
-       # FIXME: Should be 'VALXE', but the 'U' is wrongly interpreted as a
-       #  ':U' modifier.
-       ok($vars->{VAR}, '<VALUE>');
+       # Ensure that the 'U' in the modifier 'S,U,X,' is not interpreted as
+       # the modifier ':U'. Before lintpkgsrc.pl 1.81 from 2022-08-13,
+       # lintpkgsrc did exactly that.
+       ok($vars->{VAR}, '<VALXE>');
 
        expand_modifiers('file.mk', 'VAR', '<', 'REF', 'S,VAL,H,', '>', $vars);
 



Home | Main Index | Thread Index | Old Index