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

Re: lintian: r23 - in trunk: checks debian



On Mon, Feb 09, 2004 at 12:17:08PM +0100, Jeroen van Wolffelaar wrote:
[...]
> > I am not that familiar with subversion, please tell me how to checkout
> > this version and I will test it.
> 
> svn checkout http://svn.wolffelaar.nl/lintian/trunk

Thanks, I got it.

[...]
> I do not have experience with po-debconf (my own package soon to be
> uploaded failed this test as I didn't use po-debconf yet :)), it'd be
> great to check for about any mistake that one could do: po-debconf(7)
> lists quite some requirements and old files to clean up, that could be
> quite easily checked for.
> 
> You can either write them yourself, or provide good test-packages (see
> subdirs of 'testset'), and simply state which tests (even if they are to
> be written) should fail/succeed on each package.
> 
> The latter is even preferred, as testpackages ensure that these tests
> will never be broken again.

I do not understand how to hack 'testset', so here is a (tested) patch
against 'checks'.  It adds a new test: missing-files-from-potfiles-in
to ensure that files listed under debian/po/POTFILES.in are available.
When checking not-using-po-debconf, a dependency against debconf is
also added.  Other tests could be added later, they are less important
than the current ones.
Thanks.

Denis
Index: checks/po-debconf.desc
===================================================================
--- checks/po-debconf.desc	(revision 25)
+++ checks/po-debconf.desc	(working copy)
@@ -17,6 +17,11 @@
 Info: The required file POTFILES.in is missing from debian/po
  See po-debconf(7).
 
+Tag: missing-files-from-potfiles-in
+Type: warning
+Info: Some files listed in debian/po/POTFILES.in are missing.
+ See po-debconf(7).
+
 Tag: missing-templates-pot
 Type: warning
 Info: The required file templates.pot is missing from debian/po
Index: checks/po-debconf
===================================================================
--- checks/po-debconf	(revision 25)
+++ checks/po-debconf	(working copy)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 # po-debconf -- lintian check script
 
-# Copyright (C) 2002-2003 by Denis Barbier <barbier@linuxfr.org>
+# Copyright (C) 2002-2004 by Denis Barbier <barbier@linuxfr.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -32,9 +32,17 @@
 opendir(DEB, 'debfiles')
 	or fail("Can't open debfiles directory.");
 my $has_template = 0;
-for (readdir(DEB)) {
-	if ($_ =~ m/^(.+\.)?templates$/) {
-		$has_template = 1;
+for my $file (readdir(DEB)) {
+	if ($file =~ m/^(.+\.)?templates$/) {
+		open(IN,"debfiles/control")
+			or fail("Can't open debfiles/control.");
+		while (<IN>) {
+			if (m/^Depends:/i) {
+				$has_template = 1
+					if m/\bdebconf(-[.\d]+)?\b/;
+			}
+		}
+		close(IN);
 		last;
 	}
 }
@@ -47,7 +55,21 @@
 #   Exit if package does not seem to use po-debconf
 -d "debfiles/po" or exit(0);
 
-if (! -f "debfiles/po/POTFILES.in") {
+if (-f "debfiles/po/POTFILES.in") {
+	open(POTFILES,"debfiles/po/POTFILES.in")
+		or fail("Can't open debfiles/po/POTFILES.in.");
+	my $failed = 0;
+	while (<POTFILES>) {
+		chomp;
+		s/.*\]\s*//;
+		#  Cannot check files which are not under debian/
+		next if m,^\.\./,;
+		$failed = 1 unless -f "debfiles/$_";
+	}
+	close(POTFILES);
+	print "W: $pkg $type: missing-files-from-potfiles-in\n"
+		if $failed;
+} else {
 	print "W: $pkg $type: missing-potfiles-in\n";
 }
 if (! -f "debfiles/po/templates.pot") {
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 25)
+++ debian/changelog	(working copy)
@@ -32,6 +32,7 @@
      + Based on patch by Denis Barbier <barbier@debian.org>, Closes: #210576
      + Check whether po-debconf is used at all, and warn if it isn't
      + Check for required POTFILES.in and template.pot in debian/po
+     + Check for files listed in debian/po/POTFILES.in
 
   Frank Lichtenheld <djpig@debian.org>
    * checks/debhelper:

Reply to: