pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/lintpkgsrc/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Fri Aug 12 22:45:14 UTC 2022

Modified Files:
        pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl
        pkgsrc/pkgtools/lintpkgsrc/files/t: parse_makefile.t

Log Message:
lintpkgsrc: fix parsing of modifiers in makefiles


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
cvs rdiff -u -r1.9 -r1.10 pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.80 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.81
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.80 Fri Aug 12 22:40:40 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl      Fri Aug 12 22:45:14 2022
@@ -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 @@ sub expand_modifiers($file, $varname, $l
 
        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);

Index: pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t
diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.9 pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.10
--- pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.9     Fri Aug 12 22:40:40 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t Fri Aug 12 22:45:14 2022
@@ -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 @@ sub test_expand_modifiers() {
 
        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