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

lintian: r907 - in trunk: checks debian



Author: rra
Date: 2007-06-18 00:36:48 +0200 (Mon, 18 Jun 2007)
New Revision: 907

Modified:
   trunk/checks/menus
   trunk/debian/changelog
Log:
* checks/menus:
  + [RA] Avoid a quadratic search of the files in the package on
    doc-base files that list tons of files individually.  This speeds up
    a lintian check of openoffice.org-dev-doc enormously.


Modified: trunk/checks/menus
===================================================================
--- trunk/checks/menus	2007-06-17 14:48:42 UTC (rev 906)
+++ trunk/checks/menus	2007-06-17 22:36:48 UTC (rev 907)
@@ -28,7 +28,7 @@
 use Util;
 
 my $pkg;
-my @all_files = ();
+my %all_files = ();
 my %all_links = ();
 
 sub run {
@@ -192,14 +192,24 @@
 		    if ($file =~ m%^/usr/doc%) {
 			tag "doc-base-file-references-usr-doc", "$dbfile:$line";
 		    }
-		    my $regex = quotemeta (delink ($file));
-		    unless ($field eq 'index') {
-			next if $regex =~ /\[/;
-			$regex =~ s%\\\*%[^/]*%g;
-			$regex =~ s%\\\?%[^/]%g;
-			$regex .= '/?';
+		    my $realfile = delink ($file);
+
+		    # openoffic.org-dev-doc has thousands of files listed so
+		    # try to use the hash if possible.
+		    my $found;
+		    if ($realfile =~ /[*?]/) {
+			my $regex = quotemeta ($realfile);
+			unless ($field eq 'index') {
+			    next if $regex =~ /\[/;
+			    $regex =~ s%\\\*%[^/]*%g;
+			    $regex =~ s%\\\?%[^/]%g;
+			    $regex .= '/?';
+			}
+			$found = grep { /^$regex\z/ } keys %all_files;
+		    } else {
+			$found = $all_files{$realfile} || $all_files{"$realfile/"};
 		    }
-		    unless (grep { /^$regex\z/ } @all_files) {
+		    unless ($found) {
 			tag "doc-base-file-references-missing-file", "$dbfile:$line", $file;
 		    }
 		}
@@ -284,7 +294,7 @@
     $file =~ s%/+%/%g;				 # remove duplicated `/'
     ($file, $link) = split(/ -> /, $file);
 
-    push (@all_files, $file);
+    $all_files{$file} = 1;
 
     if (defined $link) {
 	if (not $link =~ m,^/,) {		  # not absolute link

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2007-06-17 14:48:42 UTC (rev 906)
+++ trunk/debian/changelog	2007-06-17 22:36:48 UTC (rev 907)
@@ -6,6 +6,10 @@
   * checks/files:
     + [RA] Limit the Zope license exception to only .dtml, .pt, and .cpt
       files.  Thanks, Bernd Zeimetz.
+  * checks/menus:
+    + [RA] Avoid a quadratic search of the files in the package on
+      doc-base files that list tons of files individually.  This speeds up
+      a lintian check of openoffice.org-dev-doc enormously.
   * checks/po-debconf:
     + [RA] Close the template file handle between files so that the line
       numbers for translated default fields are correct.
@@ -13,7 +17,7 @@
     + [RA] Add Octave as an interpreter, and allow both versioned and
       unversioned forms.  Thanks, Sebastian Harl.  (Closes: #428403)
 
- -- Russ Allbery <rra@debian.org>  Sun, 17 Jun 2007 07:48:19 -0700
+ -- Russ Allbery <rra@debian.org>  Sun, 17 Jun 2007 15:36:23 -0700
 
 lintian (1.23.31) unstable; urgency=low
 



Reply to: