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

lintian: r767 - in trunk: checks debian testset testset/debconf/debian



Author: rra
Date: 2006-11-11 05:09:01 +0100 (Sat, 11 Nov 2006)
New Revision: 767

Added:
   trunk/testset/debconf/debian/debconf-test-preinst.postrm
   trunk/testset/debconf/debian/debconf-test-preinst.preinst
   trunk/testset/debconf/debian/debconf-test-preinst.templates
Modified:
   trunk/checks/debconf
   trunk/checks/debconf.desc
   trunk/debian/changelog
   trunk/testset/debconf/debian/control
   trunk/testset/debconf/debian/rules
   trunk/testset/tags.debconf
Log:
* checks/debconf{.desc,}:
  + [RA] Only require debconf be loaded in the postinst script if a
    config script exists.  Reported by Josselin Mouette.
  + [RA] Require pre-depends on debconf if debconf is used in the
    preinst script.  Update the long description to deprecate only
    depending on debconf and falling back on another configuration
    system.  Reported by Josselin Mouette.  (Closes: #395468)

Modified: trunk/checks/debconf
===================================================================
--- trunk/checks/debconf	2006-11-11 03:30:38 UTC (rev 766)
+++ trunk/checks/debconf	2006-11-11 04:09:01 UTC (rev 767)
@@ -64,6 +64,18 @@
 my $usespreinst='';
 my $usesmultiselect='';
 
+if (open(PREINST, "control/preinst")) {
+    while (<PREINST>) {
+	s/#.*//;    # Not perfect for Perl, but should be OK
+	if (m,/usr/share/debconf/confmodule, or
+	        m/(?:Debconf|Debian::DebConf)::Client::ConfModule/) {
+	    $usespreinst=1;
+	    last;
+	}
+    }
+    close PREINST;
+}
+
 if (-f "control/config") {
     $seenconfig=1;
 }
@@ -71,7 +83,10 @@
     $seentemplates=1;
 }
 
-return unless $seenconfig or $seentemplates;
+# This still misses packages that use debconf only in the postrm.  Packages
+# that ask debconf questions in the postrm should load the confmodule in the
+# postinst so that debconf can register their templates.
+return unless $seenconfig or $seentemplates or $usespreinst;
 
 # parse depends info for later checks
 
@@ -116,7 +131,7 @@
 # Check that both debconf control area files are present.
 if ($seenconfig and not $seentemplates and not $usesdbconfig) {
     tag "no-debconf-templates", "";
-} elsif ($seentemplates and not $seenconfig and $type ne 'udeb') {
+} elsif ($seentemplates and not $seenconfig and not $usespreinst and $type ne 'udeb') {
     tag "no-debconf-config", "";
 }
 
@@ -314,18 +329,6 @@
 
 # Check the maintainer scripts.
 
-if (open(PREINST, "control/preinst")) {
-    while (<PREINST>) {
-	s/#.*//;    # Not perfect for Perl, but should be OK
-	if (m,/usr/share/debconf/confmodule, or
-	        m/(?:Debconf|Debian::DebConf)::Client::ConfModule/) {
-	    $usespreinst=1;
-	    last;
-	}
-    }
-    close PREINST;
-}
-
 for my $file (qw(config postinst)) {
     if (open(IN, "control/$file")) {
 	my $usesconfmodule='';
@@ -379,14 +382,14 @@
 	}
 
 	unless ($usesconfmodule) {
-	    tag "$file-does-not-load-confmodule", "" 
-		unless $type eq 'udeb';
+	    tag "$file-does-not-load-confmodule", ""
+		unless ($type eq 'udeb' || ($file eq 'postinst' && !$seenconfig));
 	}
 
 	close IN;
     } elsif ($file eq 'postinst') {
-	tag "$file-does-not-load-confmodule", "" 
-	    unless $type eq 'udeb';
+	tag "$file-does-not-load-confmodule", ""
+	    unless ($type eq 'udeb' || !$seenconfig);
     }
 }
 
@@ -411,9 +414,7 @@
 # Check that the right dependencies are in the control file.
 
 if ($usespreinst) {
-    unless (Dep::implies($dependencies{'pre-depends'},
-	                 Dep::parse('debconf'))
-	    or Dep::implies($dependencies{'depends'}, Dep::parse('debconf'))) {
+    unless (Dep::implies($dependencies{'pre-depends'}, Dep::parse('debconf'))) {
 	tag "missing-debconf-dependency-for-preinst", ""
 	    unless $type eq 'udeb';
     }

Modified: trunk/checks/debconf.desc
===================================================================
--- trunk/checks/debconf.desc	2006-11-11 03:30:38 UTC (rev 766)
+++ trunk/checks/debconf.desc	2006-11-11 04:09:01 UTC (rev 767)
@@ -14,9 +14,10 @@
 
 Tag: missing-debconf-dependency-for-preinst
 Type: warning
-Info: Packages using debconf in their preinst script must either pre-depend
- on debconf, with appropriate discussion on &debdev;, or else
- depend on debconf and fall back to a different configuration system.
+Info: Packages using debconf in their preinst script must pre-depend
+ on debconf, with appropriate discussion on &debdev;.  Since debconf is
+ almost always already installed, this is normally better than depending
+ on it and falling back to a different configuration system.
  
 Tag: duplicate-fields-in-templates
 Type: error

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-11-11 03:30:38 UTC (rev 766)
+++ trunk/debian/changelog	2006-11-11 04:09:01 UTC (rev 767)
@@ -7,9 +7,15 @@
     + [RA] Diagnose a control file that creates binary packages in a
       different archive category from the source package or the other
       binary packages.  Idea from Yann Dirson.  (Closes: #394720)
-  * checks/debconf:
+  * checks/debconf{.desc,}:
     + [RA] Take into account comma escaping when checking the number of
       translated choices.  Reported by Frans Pop.  (Closes: #395028)
+    + [RA] Only require debconf be loaded in the postinst script if a
+      config script exists.  Reported by Josselin Mouette.
+    + [RA] Require pre-depends on debconf if debconf is used in the
+      preinst script.  Update the long description to deprecate only
+      depending on debconf and falling back on another configuration
+      system.  Reported by Josselin Mouette.  (Closes: #395468)
   * checks/fields{.desc,}:
     + [RA] Clarify in missing-build-dependency why lintian does not take
       into account transitive build dependencies.  (Closes: #393975)
@@ -19,7 +25,7 @@
     + [RA] Remove stray commas in Ref strings since the reporting code
       considers commas to be separating two different references.
 
- -- Russ Allbery <rra@debian.org>  Fri, 10 Nov 2006 19:30:25 -0800
+ -- Russ Allbery <rra@debian.org>  Fri, 10 Nov 2006 20:04:11 -0800
 
 lintian (1.23.25) unstable; urgency=low
 

Modified: trunk/testset/debconf/debian/control
===================================================================
--- trunk/testset/debconf/debian/control	2006-11-11 03:30:38 UTC (rev 766)
+++ trunk/testset/debconf/debian/control	2006-11-11 04:09:01 UTC (rev 767)
@@ -16,6 +16,12 @@
 Description: Test package for the debconf checks of lintian
  Package missing postinst/postrm/config
 
+Package: debconf-test-preinst
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Test package for the debconf checks of lintian
+ Package uses debconf only in preinst
+
 Package: debconf-udeb
 Section: debian-installer
 XC-Package-Type: udeb

Added: trunk/testset/debconf/debian/debconf-test-preinst.postrm
===================================================================
--- trunk/testset/debconf/debian/debconf-test-preinst.postrm	2006-11-11 03:30:38 UTC (rev 766)
+++ trunk/testset/debconf/debian/debconf-test-preinst.postrm	2006-11-11 04:09:01 UTC (rev 767)
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
+    . /usr/share/debconf/confmodule
+    db_purge
+fi
+#DEBHELPER#

Added: trunk/testset/debconf/debian/debconf-test-preinst.preinst
===================================================================
--- trunk/testset/debconf/debian/debconf-test-preinst.preinst	2006-11-11 03:30:38 UTC (rev 766)
+++ trunk/testset/debconf/debian/debconf-test-preinst.preinst	2006-11-11 04:09:01 UTC (rev 767)
@@ -0,0 +1,10 @@
+#!/bin/sh
+set -e
+
+. /usr/share/debconf/confmodule
+
+db_input medium debconf/test
+
+#DEBHELPER#
+
+true

Added: trunk/testset/debconf/debian/debconf-test-preinst.templates
===================================================================
--- trunk/testset/debconf/debian/debconf-test-preinst.templates	2006-11-11 03:30:38 UTC (rev 766)
+++ trunk/testset/debconf/debian/debconf-test-preinst.templates	2006-11-11 04:09:01 UTC (rev 767)
@@ -0,0 +1,3 @@
+Template: debconf/test
+Type: text
+_description: Enter something:

Modified: trunk/testset/debconf/debian/rules
===================================================================
--- trunk/testset/debconf/debian/rules	2006-11-11 03:30:38 UTC (rev 766)
+++ trunk/testset/debconf/debian/rules	2006-11-11 04:09:01 UTC (rev 767)
@@ -32,6 +32,7 @@
 	dh_installdocs -a
 	dh_installdebconf -pdebconf-test
 	dh_installdebconf -pdebconf-test-noscripts --noscripts
+	dh_installdebconf -pdebconf-test-preinst --noscripts
 	dh_installdebconf -pdebconf-udeb
 
 	# Not needed, but it tests dh_python build dependencies.

Modified: trunk/testset/tags.debconf
===================================================================
--- trunk/testset/tags.debconf	2006-11-11 03:30:38 UTC (rev 766)
+++ trunk/testset/tags.debconf	2006-11-11 04:09:01 UTC (rev 767)
@@ -19,8 +19,9 @@
 W: debconf source: unknown-encoding-in-po-file debian/po/fr.po
 W: debconf-test-noscripts: no-debconf-config
 W: debconf-test-noscripts: old-fsf-address-in-copyright-file
-W: debconf-test-noscripts: postinst-does-not-load-confmodule
 W: debconf-test-noscripts: postrm-does-not-purge-debconf
+W: debconf-test-preinst: missing-debconf-dependency-for-preinst
+W: debconf-test-preinst: old-fsf-address-in-copyright-file
 W: debconf-test: making-assumptions-about-interfaces-in-templates debconf/1st-person
 W: debconf-test: making-assumptions-about-interfaces-in-templates debconf/testboolean
 W: debconf-test: malformed-prompt-in-templates debconf/testmulti



Reply to: