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

Bug#242345: po-debconf: check for outdated templates.pot files



Package: lintian
Version: 1.22.12
Severity: wishlist

Hi,

here is a patch to check whether templates.pot files are outdated wrt
debconf templates files.  A similar test appeared in lintian 1.22.9,
but I asked for its removal in 1.22.11 when the po-debconf stuff was
rewritten, because I did not like how this test was performed and I
(wrongly) thought that this problem won't occur anymore after some
changes in the po-debconf package.
This new test is much better, so I am quite confident that I won't 
ask for its removal soon ;)

Denis
Index: po-debconf
===================================================================
--- po-debconf	(revision 122)
+++ po-debconf	(working copy)
@@ -55,6 +55,7 @@
 #   Exit if package does not seem to use po-debconf
 -d "debfiles/po" or exit(0);
 
+my $missing_files = 0;
 if (-f "debfiles/po/POTFILES.in") {
 	open(POTFILES,"debfiles/po/POTFILES.in")
 		or fail("Can't open debfiles/po/POTFILES.in.");
@@ -63,15 +64,18 @@
 		s/.*\]\s*//;
 		#  Cannot check files which are not under debian/
 		next if m,^\.\./,;
-		print "W: $pkg $type: missing-file-from-potfiles-in $_\n"
-			 unless -f "debfiles/$_";
+		next if -f "debfiles/$_";
+		print "W: $pkg $type: missing-file-from-potfiles-in $_\n";
+		$missing_files = 1;
 	}
 	close(POTFILES);
 } else {
 	print "W: $pkg $type: missing-potfiles-in\n";
+	$missing_files = 1;
 }
 if (! -f "debfiles/po/templates.pot") {
 	print "W: $pkg $type: missing-templates-pot\n";
+	$missing_files = 1;
 }
 
 opendir(DEBIAN, 'debfiles/po')
@@ -80,6 +84,17 @@
     print "N: Warning: msgfmt (package gettext) not available, not\n";
     print "N: going to check *.po syntax\n";
 }
+if (-x "/usr/bin/msgcmp" && -x "/usr/share/intltool-debian/intltool-update" ) {
+	if ($missing_files == 0) {
+		system("cd debfiles/po && /usr/share/intltool-debian/intltool-update --gettext-package=test --pot");
+		system("/usr/bin/msgcmp debfiles/po/test.pot debfiles/po/templates.pot >/dev/null 2>&1") == 0
+                	or print "W: $pkg $type: newer-debconf-templates\n";
+	}
+} else {
+	print "N: Warning: msgcmp (package gettext) or intltool-update\n";
+	print "N: (package intltool-debian) not available, not going to\n";
+	print "N: check if PO files are outdated\n";
+}
 while (defined(my $file=readdir(DEBIAN))) {
         next unless $file =~ m/\.po$/;
         local ($/) = "\n\n";
Index: po-debconf.desc
===================================================================
--- po-debconf.desc	(revision 122)
+++ po-debconf.desc	(working copy)
@@ -37,3 +37,12 @@
 Type: warning
 Info: Some errors are found in PO files and their content will be
  discarded.  Run 'msgfmt' to see error messages.
+
+Tag: newer-debconf-templates
+Type: warning
+Info: Some debconf templates files have been updated, but PO files do
+ not reflect these changes.
+ .
+ You should run debconf-updatepo whenever debconf templates files are
+ changed so that translators can be warned that their files are
+ outdated.

Reply to: