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

[SCM] Debian package checker branch, master, updated. 2.2.6-17-gae9fa2e



The following commit has been merged in the master branch:
commit 509bd59a4570f409727abda98ad85b4e42d00cc9
Author: Russ Allbery <rra@debian.org>
Date:   Sat Feb 28 21:22:04 2009 -0800

    Cache doc-base section list reference and use all caps for globals
    
    * checks/menus:
      + [RA] Cache the reference to the section list.  Thanks, Raphael
        Geissert.  Also use all caps for global variables.

diff --git a/checks/menus b/checks/menus
index 0392b6f..d106331 100644
--- a/checks/menus
+++ b/checks/menus
@@ -33,19 +33,24 @@ use Util;
 
 # Known fields for doc-base files.  The value is 1 for required fields and 0
 # for optional fields.
-my %known_docbase_main_fields = (
+our %KNOWN_DOCBASE_MAIN_FIELDS = (
 	'document' => 1,
 	'title'    => 1,
 	'section'  => 1,
 	'abstract' => 0,
 	'author'   => 0
 );
-my %known_docbase_format_fields = (
+our %KNOWN_DOCBASE_FORMAT_FIELDS = (
 	'format'  => 1,
 	'files'   => 1,
 	'index'   => 0
 );
 
+# Will contain the list of valid sections as a Lintian::Data object if it's
+# needed.  We don't load it unless we need it since many packages don't have
+# doc-base files.
+our $SECTIONS;
+
 sub run {
 
 my $pkg = shift;
@@ -228,7 +233,7 @@ sub check_doc_base_file {
         or fail("cannot open doc-base file $dbfile for reading.");
 
     my (@files, $field, @vals);
-    my $knownfields = \%known_docbase_main_fields;
+    my $knownfields = \%KNOWN_DOCBASE_MAIN_FIELDS;
     $line           = 0;  # global
     my %sawfields   = (); # local for each section of control file
     my %sawformats  = (); # global for control file
@@ -276,7 +281,7 @@ sub check_doc_base_file {
             %sawfields = ();
 
             # Each section except the first one is format section.
-            $knownfields = \%known_docbase_format_fields;
+            $knownfields = \%KNOWN_DOCBASE_FORMAT_FIELDS;
 
         # Everything else is a syntax error.
         } else {
@@ -390,14 +395,12 @@ sub check_doc_base_field {
 
     # Section field.
     } elsif ($field eq 'section') {
-	my $sections = Lintian::Data->new('doc-base/sections');
+	$SECTIONS = Lintian::Data->new('doc-base/sections') unless $SECTIONS;
 	$_ = join (' ', @$vals);
-	unless ($sections->known($_)) {
-	    if (m;^App(?:lication)?s/(.+)$;
-		and $sections->known($1)) {
+	unless ($SECTIONS->known($_)) {
+	    if (m,^App(?:lication)?s/(.+)$, and $SECTIONS->known($1)) {
 		tag "doc-base-uses-applications-section", "$dbfile:$line", $_;
-	    } elsif (m;^(.+)/([^/]+)$;
-		    and $sections->known($1)) {
+	    } elsif (m,^(.+)/([^/]+)$, and $SECTIONS->known($1)) {
 		# allows creating a new subsection to a known section
 	    } else {
 		tag "doc-base-unknown-section", "$dbfile:$line", $_;
diff --git a/debian/changelog b/debian/changelog
index 8feda97..e48cec1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -29,6 +29,9 @@ lintian (2.2.7) UNRELEASED; urgency=low
   * checks/manpages:
     + [CW] Run man with '-E UTF-8' to avoid producing bogus warnings on
       localised manual pages due to attempting to recode through ASCII.
+  * checks/menus:
+    + [RA] Cache the reference to the section list.  Thanks, Raphael
+      Geissert.  Also use all caps for global variables.
   * checks/shared-libs:
     + [ADB] When parsing symbols files, correctly ensure that meta-information
       occurs between the end of the dependency template(s) and the start of

-- 
Debian package checker


Reply to: