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

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



On Tue, Apr 06, 2004 at 08:39:34AM +0200, Denis Barbier wrote:
> 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 ;)

Thanks, I think I'll add it. Some remarks though:

> 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;

I consider this a better readable replacement:

		unless (-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";
> +}

I prefer a simple depends now, I agree with others such notes are ugly,
a depends should simply solve this. debhelper already depends on
gettext, and the target audience already has debhelper installed (92% of
the source packages use debhelper).

Or do others think it's not okay to include a 5MB (installed-size)
depends for lintian?

>  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.

A tip about running debconf-updatepo in the clean target would be in
place here IMHO.

Also, it's wrong to say PO files haven't been updated, as that is not
where we test for. More correct:

debconf-updatepo has not been run since the last change to your debconf
template(s)

--Jeroen

-- 
Jeroen van Wolffelaar
Jeroen@wolffelaar.nl (also for Jabber & MSN; ICQ: 33944357)
http://Jeroen.A-Eskwadraat.nl



Reply to: