pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/lintpkgsrc



Module Name:    pkgsrc
Committed By:   rillig
Date:           Tue Aug  9 18:14:22 UTC 2022

Modified Files:
        pkgsrc/pkgtools/lintpkgsrc: Makefile
        pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl
        pkgsrc/pkgtools/lintpkgsrc/files/t: glob.t

Log Message:
lintpkgsrc: fix conversion of glob pattern to regular expression

It is used for evaluating expression modifiers of the form
':S,from,to,'.

Bump version.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 pkgsrc/pkgtools/lintpkgsrc/Makefile
cvs rdiff -u -r1.56 -r1.57 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
cvs rdiff -u -r1.4 -r1.5 pkgsrc/pkgtools/lintpkgsrc/files/t/glob.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/Makefile
diff -u pkgsrc/pkgtools/lintpkgsrc/Makefile:1.46 pkgsrc/pkgtools/lintpkgsrc/Makefile:1.47
--- pkgsrc/pkgtools/lintpkgsrc/Makefile:1.46    Thu Aug  4 21:55:57 2022
+++ pkgsrc/pkgtools/lintpkgsrc/Makefile Tue Aug  9 18:14:22 2022
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.46 2022/08/04 21:55:57 rillig Exp $
+# $NetBSD: Makefile,v 1.47 2022/08/09 18:14:22 rillig Exp $
 
-PKGNAME=       lintpkgsrc-4.99
+PKGNAME=       lintpkgsrc-2022.08.09
 CATEGORIES=    pkgtools
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
@@ -10,7 +10,6 @@ COMMENT=      Sanity checks on the complete p
 DEPENDS+=      digest>=20010101:../../pkgtools/digest
 TEST_DEPENDS+= p5-File-Slurp>=0:../../devel/p5-File-Slurp
 TEST_DEPENDS+= p5-IO-Null>=0:../../devel/p5-IO-Null
-CONFLICTS+=    pkglint<4.82
 
 USE_TOOLS+=    perl:run
 

Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.56 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.57
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.56 Thu Aug  4 21:55:58 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl      Tue Aug  9 18:14:22 2022
@@ -1,6 +1,6 @@
 #!@PERL5@
 
-# $NetBSD: lintpkgsrc.pl,v 1.56 2022/08/04 21:55:58 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.57 2022/08/09 18:14:22 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -874,6 +874,9 @@ sub list_pkgsrc_pkgdirs($$) {
        @pkgdirs;
 }
 
+# Convert the glob pattern to a regular expression.
+# Return '' if the regular expression equals the glob expression.
+# Return undef on error.
 sub glob2regex($) {
        my ($glob) = @_;
        my (@chars, $in_alt);
@@ -886,8 +889,8 @@ sub glob2regex($) {
                } elsif ($_ eq '?') {
                        $regex .= '.';
                } elsif ($_ eq '+') {
-                       $regex .= '.';
-               } elsif ($_ eq '\\+') {
+                       $regex .= '\\+';
+               } elsif ($_ eq '\\') {
                        $regex .= $_ . shift @chars;
                } elsif ($_ eq '.' || $_ eq '|') {
                        $regex .= quotemeta;

Index: pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t
diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.4 pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.5
--- pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.4       Tue Aug  9 17:53:47 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t   Tue Aug  9 18:14:22 2022
@@ -1,4 +1,4 @@
-# $NetBSD: glob.t,v 1.4 2022/08/09 17:53:47 rillig Exp $
+# $NetBSD: glob.t,v 1.5 2022/08/09 18:14:22 rillig Exp $
 
 use strict;
 use warnings;
@@ -14,24 +14,19 @@ sub test_glob2regex() {
 
        ok(glob2regex('?'), '^.$');
 
-       # The '' means that the regular expression equals the glob.
        ok(glob2regex('[a-z]'), '');
 
-       # The '' means that the regular expression equals the glob.
        ok(glob2regex('[a-z0-9]'), '');
 
-       # The '' means that the regular expression equals the glob.
        ok(glob2regex('[a-z0-9_]'), '');
 
        # Outside of braces, the ',' is a regular character.
-       # The '' means that the regular expression equals the glob.
        ok(glob2regex('a,b'), '');
 
        # FIXME: Inside brackets, the '*' is a literal '*'.
        ok(glob2regex('[*]'), '^[.*]$');
 
-       # FIXME: After a backslash, the '*' must be preserved.
-       ok(glob2regex('\*'), '^\.*$');
+       ok(glob2regex('\*'), '');
 
        ok(glob2regex('*.[ch]'), '^.*\.[ch]$');
 
@@ -42,21 +37,20 @@ sub test_glob2regex() {
        # There is an unbalanced '}' at the very end.
        ok(glob2regex('{{thi,fou}r,fif}teen}'), undef);
 
-       # XXX: Why is '+' turned into '.'?
-       ok(glob2regex('a+b|c'), '^a.b\|c$');
+       ok(glob2regex('a+b|c'), '^a\+b\|c$');
 
-       # XXX: Typo in the code, the case '\\+' is unreachable.
-       # Escaping the backslash works nevertheless.
        ok(glob2regex('a\[b*'), '^a\[b.*$');
 
-       ok(glob2regex('a\+b'), '^a\.b$');
+       ok(glob2regex('a\+b'), '');
 
-       # FIXME: Must be '^a\?b$' instead.
-       ok(glob2regex('a\?b'), '^a\.b$');
+       ok(glob2regex('a\?b'), '');
 
        # XXX: Depending on the exact implementation, the '\n' may be
        # interpreted as a newline, a literal 'n' or a literal '\' 'n'.
        ok(glob2regex('a\n*'), '^a\n.*$');
+
+       # https://gnats.netbsd.org/12996
+       ok(glob2regex('libsigc++'), '^libsigc\+\+$');
 }
 
 test_glob2regex();



Home | Main Index | Thread Index | Old Index