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

lintian: r781 - in trunk: checks debian testset testset/manpages/debian



Author: rra
Date: 2006-11-15 09:52:44 +0100 (Wed, 15 Nov 2006)
New Revision: 781

Modified:
   trunk/checks/infofiles
   trunk/checks/infofiles.desc
   trunk/debian/changelog
   trunk/testset/manpages/debian/rules
   trunk/testset/tags.manpages
Log:
  + [RA] debhelper no longer adds a --section flag to install-info, so
    don't warn about any install-info invocation without --section.
    Instead, check each info file for INFO-DIR-SECTION and diagnose
    calling install-info without --section if any info file is missing
    this information.  (Closes: #97502, #398670)
  + [RA] Checks for the compression and suffixes of info files were not
    being run due to a mistake in specifying either /usr/info or
    /usr/share/info as an info directory.  Re-enable them.

Modified: trunk/checks/infofiles
===================================================================
--- trunk/checks/infofiles	2006-11-11 10:18:35 UTC (rev 780)
+++ trunk/checks/infofiles	2006-11-15 08:52:44 UTC (rev 781)
@@ -37,6 +37,8 @@
 my %prerm;
 my %postrm;
 
+my %missing_section;
+
 # check maintainer scripts (for install-info invocation)
 check_script("preinst", \%preinst) if (-f "control/preinst");
 check_script("postinst", \%postinst) if (-f "control/postinst");
@@ -76,13 +78,12 @@
     my ($fname, $path, $suffix) = fileparse($file);
 
     next unless ($perm =~ m,^[\-l],o)
-            and ($path =~ m,^usr/share/info,)
-            and ($path =~ m,^usr/info,);
+	    and ($path =~ m,^usr/share/info, or $path =~ m,^usr/info,);
 
     my @fname_pieces = split /\./, $fname;
     my $ext = pop @fname_pieces;
     if ($ext eq "gz") { # ok!
-        if ($perm =~ m,^-,o) { # compressed with maximum compression rate?
+	if ($perm =~ m,^-,o) { # compressed with maximum compression rate?
 	    my $info = $file_info{$file};
 	    if ($info !~ m/gzip compressed data/o) {
 		tag "info-document-not-compressed-with-gzip", "$file";
@@ -91,16 +92,39 @@
 		    tag "info-document-not-compressed-with-max-compression", "$file";
 		}
 	    }
-        }
+	}
     } else {
+	push (@fname_pieces, $ext);
 	tag "info-document-not-compressed", "$file";
     }
     my $infoext = pop @fname_pieces;
-    unless ($infoext =~ /info(-\d)?/) { # it's not foo.info
-	unless (@fname_pieces) { # it's not foo{,-{1,2,3,...}}
+    unless ($infoext && $infoext =~ /info(-\d)?/) { # it's not foo.info
+	unless (!@fname_pieces) { # it's not foo{,-{1,2,3,...}}
 	    tag "info-document-has-wrong-extension", "$file";
 	}
     }
+
+    # If this is the main info file (no numeric extension). make sure it has
+    # appropriate dir entry information.
+    if ($fname !~ /-\d+\.gz/ && $file_info{$file} =~ /gzip compressed data/) {
+	my $pid = open INFO, '-|';
+	if (not defined $pid) {
+	    fail("cannot fork: $!");
+	} elsif ($pid == 0) {
+	    my %newenv = (LANG => 'C', PATH => $ENV{PATH});
+	    undef %ENV;
+	    %ENV = %newenv;
+	    exec "zcat \Qunpacked/$file\E 2>&1"
+		or fail("cannot run zcat: $!");
+	}
+	local $_;
+	my ($section, $start, $end);
+	while (<INFO>) {
+	    $section = 1 if /INFO-DIR-SECTION\s+\S/;
+	}
+	close INFO;
+	$missing_section{$file} = 1 unless $section;
+    }
 }
 close IN;
 
@@ -115,9 +139,6 @@
 if ($postinst{'calls-install-info'}) {
     tag "install-info-not-called-with-quiet-option", ""
 	unless $postinst{'calls-install-info-quiet'};
-    tag "install-info-not-called-with-section-option", ""
-	unless ( $postinst{'calls-install-info-section'}
-		 || $postinst{'calls-install-info-remove'} ) ;
 }
 if ($prerm{'calls-install-info'}) {
     # it must use the --quiet option
@@ -125,8 +146,15 @@
 	unless $prerm{'calls-install-info-quiet'};
 }
 
+# Currently we assume all the info pages are fine if any of them are.  It
+# would be nice to be stricter.
+for my $file (keys %missing_section) {
+    tag "info-document-missing-dir-section", "$file"
+	unless ($postinst{'calls-install-info-section'});
 }
 
+}
+
 # -----------------------------------
 
 sub check_script {
@@ -138,12 +166,12 @@
 	fail("cannot open maintainer script control/$script for reading: $!");
     $interp = <IN>;
     if ($interp =~ m,^\#\!\s*/bin/(a|ba|k|pdk)?sh,) {
-        $interp = 'sh';
+	$interp = 'sh';
     } elsif ($interp =~ m,^\#\!\s*/usr/bin/perl,) {
-        $interp = 'perl';
+	$interp = 'perl';
     } else {
 	if ($interp =~ m,^\#\!\s*(.+),) {
-            $interp = $1;
+	    $interp = $1;
 	}
 	else { # hmm, doesn't seem to start with #!
 	    # is it a binary? look for ELF header

Modified: trunk/checks/infofiles.desc
===================================================================
--- trunk/checks/infofiles.desc	2006-11-11 10:18:35 UTC (rev 780)
+++ trunk/checks/infofiles.desc	2006-11-15 08:52:44 UTC (rev 781)
@@ -3,13 +3,13 @@
 Abbrev: info
 Standards-Version: 3.5.6
 Type: binary
-Unpack-Level: 1
+Unpack-Level: 2
 Needs-Info: file-info
 Info: This script checks if a binary package conforms to info document policy.
 
 Tag: info-document-not-compressed
 Type: error
-Info: Info documents have to be installed compressed (using `<tt>gzip -9</tt>').
+Info: Info documents have to be installed compressed (using <tt>gzip -9</tt>).
 Ref: policy 12.2
 
 Tag: info-document-not-compressed-with-gzip
@@ -24,9 +24,29 @@
 
 Tag: info-document-has-wrong-extension
 Type: warning
-Info: The info document has an extension other than `info*.gz'.
+Info: The info document has an extension other than info*.gz.
 Ref: policy 12.2
 
+Tag: info-document-missing-dir-section
+Type: warning
+Info: This info document has no INFO-DIR-SECTION line and no
+ <tt>--section</tt> option is passed to <tt>install-info</tt> in the
+ package <tt>postinst</tt> maintainer script.  <tt>install-info</tt> will
+ be unable to determine the section into which this info page should be
+ put.  The best solution is to add a line like:
+ .
+   @dircategory Development
+ .
+ to the texinfo source so that the generated info file will contain a
+ section.  See /usr/share/info/dir for sections to choose from.
+ .
+ Another alternative that doesn't require modifying the source is to
+ explicitly pass a <tt>--section</tt> option to <tt>install-info</tt> in
+ the <tt>postinst</tt> maintainer script, although in this case you will
+ need to write the <tt>postinst</tt> yourself and not use tools like
+ debhelper to do it for you.
+Ref: policy 12.2
+
 Tag: postrm-calls-install-info
 Type: warning
 Ref: policy 12.2
@@ -45,15 +65,3 @@
 Info: The package installation scripts should avoid producing output which it
  is unnecessary for the user to see.  Policy specifically mentions install-info
  output as unnecessary.
-
-Tag: install-info-not-called-with-section-option
-Type: warning
-Ref: policy 12.2
-Info: It is a good idea to specify a section for the location of your program;
- this is done with the --section switch. To determine which section to use,
- you should look at the info dir file on your system and choose the most
- relevant (or create a new section if none of the current sections are
- relevant). 
- .
- Note that this warning is spurious in case your info file contains an
- appropriate INFO-DIR-SECTION (@dircategory in Texinfo sources).

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-11-11 10:18:35 UTC (rev 780)
+++ trunk/debian/changelog	2006-11-15 08:52:44 UTC (rev 781)
@@ -60,6 +60,14 @@
       from the warning for editor backup files.
   * checks/infofiles:
     + [RA] Close opened files.
+    + [RA] debhelper no longer adds a --section flag to install-info, so
+      don't warn about any install-info invocation without --section.
+      Instead, check each info file for INFO-DIR-SECTION and diagnose
+      calling install-info without --section if any info file is missing
+      this information.  (Closes: #97502, #398670)
+    + [RA] Checks for the compression and suffixes of info files were not
+      being run due to a mistake in specifying either /usr/info or
+      /usr/share/info as an info directory.  Re-enable them.
   * checks/md5sums{.desc,}:
     + [RA] Add a tag for a missing md5sums control file, but only at info
       level, at least for now.  (Closes: #133027)
@@ -89,7 +97,7 @@
   * man/lintian.1:
     + [RA] Document --fail-on-warning.
 
- -- Russ Allbery <rra@debian.org>  Sat, 11 Nov 2006 02:11:18 -0800
+ --
 
 lintian (1.23.25) unstable; urgency=low
 

Modified: trunk/testset/manpages/debian/rules
===================================================================
--- trunk/testset/manpages/debian/rules	2006-11-11 10:18:35 UTC (rev 780)
+++ trunk/testset/manpages/debian/rules	2006-11-15 08:52:44 UTC (rev 781)
@@ -53,10 +53,17 @@
 	install -d $(tmp)/usr/share/lintian/overrides
 	install -m644 debian/overrides $(tmp)/usr/share/lintian/overrides/manpages
 
+	install -d $(tmp)/usr/share/info
+	touch $(tmp)/usr/share/info/broken
+	gzip -c9 <foo.info >$(tmp)/usr/share/info/foo.info.gz
+	gzip -c1 </dev/null >$(tmp)/usr/share/info/bar.gz
+	install -m644 foo.info $(tmp)/usr/share/info/baz.broken.gz
+
 	install -d $(tmp)/usr/share/doc/manpages
 	cp debian/changelog $(tmp)/usr/share/doc/manpages/changelog
 	gzip -9 $(tmp)/usr/share/doc/manpages/changelog
 	install -d $(tmp)/DEBIAN
+	install -m755 debian/postinst $(tmp)/DEBIAN/postinst
 	dpkg-gencontrol -isp
 	dpkg --build $(tmp) ..
 

Modified: trunk/testset/tags.manpages
===================================================================
--- trunk/testset/tags.manpages	2006-11-11 10:18:35 UTC (rev 780)
+++ trunk/testset/tags.manpages	2006-11-15 08:52:44 UTC (rev 781)
@@ -7,6 +7,9 @@
 E: manpages: empty-manual-page usr/share/man/man1/usr-sbin-binary.1.gz
 E: manpages: empty-manual-page usr/share/man/man6/usr-games-binary.6.gz
 E: manpages: executable-manpage usr/share/man/de/man1/binary-without-english-manpage.1
+E: manpages: info-document-not-compressed usr/share/info/broken
+E: manpages: info-document-not-compressed-with-gzip usr/share/info/baz.broken.gz
+E: manpages: info-document-not-compressed-with-max-compression usr/share/info/bar.gz
 E: manpages: manpage-has-wrong-extension usr/X11R6/man/man6/X11R6-binary.man
 E: manpages: manpage-not-compressed usr/X11R6/man/man6/X11R6-binary.man
 E: manpages: manpage-not-compressed usr/share/man/de/man1/binary-without-english-manpage.1
@@ -35,6 +38,9 @@
 W: manpages: executable-not-elf-or-script ./usr/bin/usr-bin-binary-alt
 W: manpages: executable-not-elf-or-script ./usr/sbin/usr-sbin-binary
 W: manpages: executable-not-elf-or-script ./usr/share/man/de/man1/binary-without-english-manpage.1
+W: manpages: info-document-has-wrong-extension usr/share/info/baz.broken.gz
+W: manpages: info-document-missing-dir-section usr/share/info/bar.gz
+W: manpages: install-info-not-called-with-quiet-option
 W: manpages: link-to-undocumented-manpage usr/share/man/man1/bin-binary.1.gz
 W: manpages: link-to-undocumented-manpage usr/share/man/man3/function.3.gz
 W: manpages: manpage-has-bad-whatis-entry usr/X11R6/man/man1/rstartd.1x.gz



Reply to: