Author: rra
Date: 2007-04-28 04:22:47 +0200 (Sat, 28 Apr 2007)
New Revision: 864

Modified:
   trunk/checks/menus
   trunk/checks/menus.desc
   trunk/debian/changelog
   trunk/testset/binary/debian/doc-base
   trunk/testset/tags.binary
Log:
* checks/menus{.desc,}:
  + [RA] In doc-base control files, check for Index fields for HTML and
    Info documents and require that each section after the header have a
    Format field.  Thanks, Bernhard R. Link.  (Closes: #419847)

Modified: trunk/checks/menus
===================================================================
--- trunk/checks/menus  2007-04-27 02:58:15 UTC (rev 863)
+++ trunk/checks/menus  2007-04-28 02:22:47 UTC (rev 864)
@@ -161,7 +161,8 @@
     # check the contents of the doc-base file(s)
     opendir DOCBASEDIR, "doc-base" or fail("cannot read doc-base directory.");
     while (my $dbfile = readdir DOCBASEDIR) {
-       next if -x "doc-base/$dbfile"; # don't try to parse executables, plus 
we already warned about it
+       # don't try to parse executables, plus we already warned about it
+       next if -x "doc-base/$dbfile";
        open IN, "doc-base/$dbfile" or
            fail("cannot open doc-base file $dbfile for reading.");
 
@@ -176,7 +177,7 @@
        # lines for the field.  As a result, all tags will be reported on the
        # last continuation line of the field, rather than possibly where the
        # offending file name is.
-       my (@files, $field);
+       my (@files, $field, $sawindex, $sawdocument, $format);
        while (1) {
            $_ = <IN>;
            if ((!defined ($_) || /^\S/ || /^$/) && $field) {
@@ -205,18 +206,33 @@
                undef @files;
                undef $field;
            }
-           last unless defined $_;
-           if (/^\s/ && $field) {
-               push (@files, split ' ');
-           }
-           if (/^(Index|Files)\s*:\s*(.*?)\s*$/i) {
+           if (defined ($_) && /^(Index|Files)\s*:\s*(.*?)\s*$/i) {
                $field = lc $1;
                @files = split (' ', $2);
-           } elsif (/^Format\s*:\s*(.*?)\s*$/i) {
-               my $format = lc $1;
+               if ($field eq 'index') {
+                   $sawindex = 1;
+               }
+           } elsif (defined ($_) && /^Format\s*:\s*(.*?)\s*$/i) {
+               $format = lc $1;
                tag "doc-base-file-unknown-format", "$dbfile:$.", $format
                    unless $known_doc_base_formats{$format};
+           } elsif (defined ($_) && /^Document\s*:/i) {
+               $sawdocument = 1;
+           } elsif (defined ($_) && /^\s/ && $field) {
+               push (@files, split ' ');
            }
+           if (!defined ($_) || /^$/) {
+               tag "doc-base-file-no-format", "$dbfile:$."
+                   unless $format || $sawdocument;
+               if ($format && ($format eq 'html' || $format eq 'info')) {
+                   tag "doc-base-file-no-index", "$dbfile:$."
+                       unless $sawindex;
+               }
+               last unless defined $_;
+               undef $format;
+               undef $sawdocument;
+               undef $sawindex;
+           }
        }
        close IN;
     }

Modified: trunk/checks/menus.desc
===================================================================
--- trunk/checks/menus.desc     2007-04-27 02:58:15 UTC (rev 863)
+++ trunk/checks/menus.desc     2007-04-28 02:22:47 UTC (rev 864)
@@ -177,3 +177,17 @@
  that is not supported.  Recognized formats are "HTML", "Text", "PDF",
  "PostScript", "Info", "DVI", and "DebianDoc-SGML" (case-insensitive).
 Ref: Debian doc-base Manual section 2.3
+
+Tag: doc-base-file-no-format
+Type: error
+Info: A format section of this doc-base control file didn't specify a
+ format.  Each section after the first must specify a format.
+Ref: Debian doc-base Manual section 2.3.2.2
+
+Tag: doc-base-file-no-index
+Type: error
+Info: Format sections in doc-base control files for HTML or Info documents
+ must contain an Index field specifying the starting document for the
+ documentation.  Even if the documentation is a single file, this field
+ must be present.
+Ref: Debian doc-base Manual section 2.3.2.2

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2007-04-27 02:58:15 UTC (rev 863)
+++ trunk/debian/changelog      2007-04-28 02:22:47 UTC (rev 864)
@@ -36,6 +36,10 @@
       /etc/X11.  (seyon does something weird but probably legitimate.)
     + [RA] Fix manpage-for-non-x11-binary-in-wrong-directory and
       manpage-for-x11-binary-in-wrong-directory output.
+  * checks/menus{.desc,}:
+    + [RA] In doc-base control files, check for Index fields for HTML and
+      Info documents and require that each section after the header have a
+      Format field.  Thanks, Bernhard R. Link.  (Closes: #419847)
   * checks/rules:
     + [RA] Listing a rule as a dependency of .PHONY is sufficient to mark
       it as present for GNU make and hence sufficient for Policy's
@@ -53,7 +57,7 @@
     + [RA] Diagnose use of /bin/env with a more specific message than the
       generic unusual interpreter tag.
 
- -- Russ Allbery <[EMAIL PROTECTED]>  Thu, 26 Apr 2007 19:58:01 -0700
+ -- Russ Allbery <[EMAIL PROTECTED]>  Fri, 27 Apr 2007 19:22:32 -0700
 
 lintian (1.23.29) unstable; urgency=low
 

Modified: trunk/testset/binary/debian/doc-base
===================================================================
--- trunk/testset/binary/debian/doc-base        2007-04-27 02:58:15 UTC (rev 
863)
+++ trunk/testset/binary/debian/doc-base        2007-04-28 02:22:47 UTC (rev 
864)
@@ -22,3 +22,6 @@
 Index: /usr/share/doc/binary/html/index.html
 Files: /usr/share/doc/binary/html/ch?.h*l
        /usr/share/doc/binary/hml/*.html
+
+Format: inFO
+Files: /usr/share/info/binary.info.gz

Modified: trunk/testset/tags.binary
===================================================================
--- trunk/testset/tags.binary   2007-04-27 02:58:15 UTC (rev 863)
+++ trunk/testset/tags.binary   2007-04-28 02:22:47 UTC (rev 864)
@@ -2,10 +2,13 @@
 E: binary-data: md5sums-control-file-is-empty
 E: binary: debian-changelog-file-missing-or-wrong-name
 E: binary: depends-on-x-metapackage depends: xorg
+E: binary: doc-base-file-no-format binary:20
+E: binary: doc-base-file-no-index binary:27
 E: binary: doc-base-file-references-missing-file binary:11 
/usr/share/doc/binary/binary.sgml.gz
 E: binary: doc-base-file-references-missing-file binary:15 
/usr/share/doc/binary/binary.txt
 E: binary: doc-base-file-references-missing-file binary:19 
/usr/share/doc/binary/html/ch4.html
 E: binary: doc-base-file-references-missing-file binary:24 
/usr/share/doc/binary/hml/*.html
+E: binary: doc-base-file-references-missing-file binary:27 
/usr/share/info/binary.info.gz
 E: binary: doc-base-index-references-multiple-files binary:19
 E: binary: file-directly-in-usr-share usr/share/baz
 E: binary: lengthy-symlink usr/share/doc/binary/html/ch2.html 
../html/./ch1.html


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to