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

[SCM] Debian package checker branch, master, updated. 2.5.0-rc3-24-gdf92d26



The following commit has been merged in the master branch:
commit 73cc90752e69796103548f27f24f6663a045af30
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Apr 27 21:29:23 2011 +0200

    Allow override wildcards any where in the additional info part
    
    Previously we only allowed it in the begining or/and in the end.

diff --git a/debian/changelog b/debian/changelog
index 79707b8..68d02f3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,9 @@ lintian (2.5.0~rc4) UNRELEASED; urgency=low
     + [NT] Properly handle if the changes file is located directly in the
       file system root.  Thanks to Trent W. Buck for the bug report.
       (Closes: #624149)
+  * lib/Lintian/Tags.pm:
+    + [NT] Allow overrides to use wildcards anywhere instead of only in
+      the beginning or the end.  (Closes: #617991)
 
  -- Adam D. Barratt <adam@adam-barratt.org.uk>  Sat, 23 Apr 2011 13:37:52 +0100
 
diff --git a/debian/copyright b/debian/copyright
index f5fb30d..8463f43 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -46,7 +46,7 @@ Portions Copyright (C) 2008-2010 Raphael Geissert
 Portions Copyright (C) 2008-2010 Adam D. Barratt
 Portions Copyright (C) 2009 Stéphane Glondu
 Portions Copyright (C) 2010 Raphaël Hertzog
-Portions Copyright (C) 2010 Niels Thykier
+Portions Copyright (C) 2010-2011 Niels Thykier
 Portions Copyright (C) 2011 Gerfried Fuchs
 
 This program is free software; you may redistribute it and/or modify
diff --git a/doc/lintian.xml b/doc/lintian.xml
index feb27d7..150c19e 100644
--- a/doc/lintian.xml
+++ b/doc/lintian.xml
@@ -528,11 +528,14 @@ foo source: configure-generated-file-in-source config.cache
         completely by specifying its name (first line in the examples)
         or only one occurrence of it by specifying the additional
         info, too (second line in the examples).  If you add an
-        asterisk (<literal>*</literal>) at the start and/or end of the
-        additional info, this will match arbitrary strings similar to
-        the shell wildcard.  Asterisks located at any other place in
-        the info have no special meaning.  This wildcard support was
-        added in Lintian version 2.0.0.
+        asterisk (<literal>*</literal>) in the additional info, this
+        will match arbitrary strings similar to the shell wildcard.
+      </para>
+      <para>
+        The first wildcard support appeared in Lintian 2.0.0, which
+        only allowed the wildcards in the very beginning or end.
+        Version 2.5.0~rc4 extended this to allow wildcards any where
+        in the additional info.
       </para>
     </sect1>
   </chapter>
diff --git a/lib/Lintian/Tags.pm b/lib/Lintian/Tags.pm
index 7f6b4cf..8d570a8 100644
--- a/lib/Lintian/Tags.pm
+++ b/lib/Lintian/Tags.pm
@@ -201,11 +201,24 @@ sub _check_overrides {
     } elsif ($extra ne '') {
         for (sort keys %$overrides) {
             my $pattern = $_;
-            next unless ($pattern =~ /^\*/ or $pattern =~ /\*\z/);
-            my ($start, $end) = ('', '');
-            $start = '.*' if $pattern =~ s/^\*//;
-            $end   = '.*' if $pattern =~ s/\*$//;
-            if ($extra =~ /^$start\Q$pattern\E$end\z/) {
+            my $end = '';
+            my $pat = '';
+            next unless $pattern =~ m/\Q*\E/o;
+            # Split does not help us if $text ends with *
+            # so we deal with that now
+            if ($pattern =~ s/\Q*\E+\z//o){
+                $end = '.*';
+            }
+            # Are there any * left (after the above)?
+            if ($pattern =~ m/\Q*\E/o) {
+                # this works even if $text starts with a *, since
+                # that is split as '', <text>
+                my @pargs = split(m/\Q*\E++/o, $pattern);
+                $pat = join('.*', map { quotemeta($_) } @pargs);
+            } else {
+                $pat = $pattern;
+            }
+            if ($extra =~ m/^$pat$end\z/) {
                 $overrides->{$_}++;
                 return "$tag $_";
             }
diff --git a/t/tests/overrides/debian/debian/overrides.lintian-overrides b/t/tests/overrides/debian/debian/overrides.lintian-overrides
index 16ac4da..23f3eb5 100644
--- a/t/tests/overrides/debian/debian/overrides.lintian-overrides
+++ b/t/tests/overrides/debian/debian/overrides.lintian-overrides
@@ -6,5 +6,4 @@ hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:4
 hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:2*
 hyphen-used-as-minus-sign */foo.1.gz:5
 hyphen-used-as-minus-sign */foo.1.gz:3*
-# misused wildcard
 hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz * more occurrences not shown
diff --git a/t/tests/overrides/tags b/t/tests/overrides/tags
index bf32a7d..01a576c 100644
--- a/t/tests/overrides/tags
+++ b/t/tests/overrides/tags
@@ -1,7 +1,5 @@
-I: overrides: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz 2 more occurrences not shown
 I: overrides: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:12
 I: overrides: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:13
 I: overrides: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:14
 I: overrides: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:6
-I: overrides: unused-override hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz * more occurrences not shown
-N: 7 tags overridden (1 warning, 6 info)
+N: 8 tags overridden (1 warning, 7 info)

-- 
Debian package checker


Reply to: