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

lintian: r154 - in trunk: checks debian



Author: he
Date: 2004-04-14 17:49:23 +0200 (Wed, 14 Apr 2004)
New Revision: 154

Modified:
   trunk/checks/debconf
   trunk/checks/debconf.desc
   trunk/debian/changelog
Log:
checks/debconf:
  + [HE] Check for duplicate fields in templates. Fix based on
    patch by Denis Barbier <barbier@linuxfr.org>, thanks! (Closes: #233116)
		  


Modified: trunk/checks/debconf
===================================================================
--- trunk/checks/debconf	2004-04-14 09:10:39 UTC (rev 153)
+++ trunk/checks/debconf	2004-04-14 15:49:23 UTC (rev 154)
@@ -74,6 +74,34 @@
     print "E: $pkg $type: debconf-config-not-executable\n";
 }
 
+# First check that templates look valid
+if ($seentemplates) {
+    open(TMPL, "control/templates") or fail("Can't open control/templates: $!");
+    local $/ = "\n\n";
+    while (<TMPL>) {
+	chomp;
+	my %fields = ();
+	my $name = 'unknown';
+
+	foreach my $line (split "\n", $_) {
+	    if ($line =~ s/^([-_.A-Za-z0-9]+):\s*(.+)//) {
+		$fields{$1}++;
+		$name = $2 if ($1 eq 'Template');
+	    }
+	}
+
+	foreach (keys %fields) {
+	    if ($fields{$_} > 1) {
+		print "E: $pkg $type: duplicate-fields-in-templates $name $_\n";
+		#  Templates file is corrupted, no need to report
+		#  further errors
+		$seentemplates = '';
+	    }
+	}
+    }
+    close TMPL;
+}
+
 # Lots of template checks.
 
 my @templates = $seentemplates ? read_dpkg_control("control/templates") : ();

Modified: trunk/checks/debconf.desc
===================================================================
--- trunk/checks/debconf.desc	2004-04-14 09:10:39 UTC (rev 153)
+++ trunk/checks/debconf.desc	2004-04-14 15:49:23 UTC (rev 154)
@@ -25,6 +25,12 @@
  Some packages fall back to another configuration system throughout the
  package if debconf is not present; please contact &maint; so that this
  exception would be recognized in future versions of Lintian.
+ 
+Tag: duplicate-fields-in-templates
+Type: error
+Info: A template contains two identical fields (with identical values or
+ not). This is either an error in this template, or two templates are
+ not properly seperated by a lone newline.
 
 Tag: unknown-field-in-templates
 Type: error

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-04-14 09:10:39 UTC (rev 153)
+++ trunk/debian/changelog	2004-04-14 15:49:23 UTC (rev 154)
@@ -37,6 +37,8 @@
   * checks/debconf{,.desc}:
     + [JvW] Add an error for a bogus default for a boolean template
       (Closes: #236846)
+    + [HE] Check for duplicate fields in templates. Fix based on
+      patch by Denis Barbier <barbier@linuxfr.org>, thanks! (Closes: #233116)
   * checks/debian-readme:
     + [HE] Add check for the debmake template email address. Patch by Steffen
       Moeller <moeller@pzr.uni-rostock.de>, thanks!



Reply to: