lintian: r766 - in trunk: checks debian testset testset/debconf/debian testset/debconf/debian/po
Author: rra
Date: 2006-11-11 04:30:38 +0100 (Sat, 11 Nov 2006)
New Revision: 766
Modified:
trunk/checks/debconf
trunk/debian/changelog
trunk/testset/debconf/debian/debconf-test.templates
trunk/testset/debconf/debian/po/de.po
trunk/testset/tags.debconf
Log:
* checks/debconf:
+ [RA] Take into account comma escaping when checking the number of
translated choices. Reported by Frans Pop. (Closes: #395028)
Modified: trunk/checks/debconf
===================================================================
--- trunk/checks/debconf 2006-11-11 03:02:50 UTC (rev 765)
+++ trunk/checks/debconf 2006-11-11 03:30:38 UTC (rev 766)
@@ -184,16 +184,16 @@
}
if ($template->{choices} && ($template->{choices} !~ /^\s*$/)) {
- my $nrchoices = ($template->{choices} =~ s/,\s/, /g);
- for my $key (keys %$template) {
- if ($key =~ /^choices-/) {
- if (! $template->{$key} || ($template->{$key} =~ /^\s*$/)) {
- tag "empty-translated-choices", "$template->{template} $key";
+ my $nrchoices = count_choices ($template->{choices});
+ for my $key (keys %$template) {
+ if ($key =~ /^choices-/) {
+ if (! $template->{$key} || ($template->{$key} =~ /^\s*$/)) {
+ tag "empty-translated-choices", "$template->{template} $key";
+ }
+ if (count_choices ($template->{$key}) != $nrchoices) {
+ tag "mismatch-translated-choices", "$template->{template} $key";
+ }
}
- if (($template->{$key} =~ s/,\s/, /g) != $nrchoices) {
- tag "mismatch-translated-choices", "$template->{template} $key";
- }
- }
}
}
@@ -454,6 +454,28 @@
} # </run>
+# -----------------------------------
+
+# Count the number of choices. Splitting code copied from debconf 1.5.8
+# (Debconf::Question).
+sub count_choices {
+ my ($choices) = @_;
+ my @items;
+ my $item = '';
+ for my $chunk (split /(\\[, ]|,\s+)/, $choices) {
+ if ($chunk =~ /^\\([, ])$/) {
+ $item .= $1;
+ } elsif ($chunk =~ /^,\s+$/) {
+ push (@items, $item);
+ $item = '';
+ } else {
+ $item .= $chunk;
+ }
+ }
+ push (@items, $item) if $item ne '';
+ return scalar (@items);
+}
+
1;
# vim: syntax=perl ts=8
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2006-11-11 03:02:50 UTC (rev 765)
+++ trunk/debian/changelog 2006-11-11 03:30:38 UTC (rev 766)
@@ -7,6 +7,9 @@
+ [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:
+ + [RA] Take into account comma escaping when checking the number of
+ translated choices. Reported by Frans Pop. (Closes: #395028)
* checks/fields{.desc,}:
+ [RA] Clarify in missing-build-dependency why lintian does not take
into account transitive build dependencies. (Closes: #393975)
@@ -16,7 +19,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:00:34 -0800
+ -- Russ Allbery <rra@debian.org> Fri, 10 Nov 2006 19:30:25 -0800
lintian (1.23.25) unstable; urgency=low
Modified: trunk/testset/debconf/debian/debconf-test.templates
===================================================================
--- trunk/testset/debconf/debian/debconf-test.templates 2006-11-11 03:02:50 UTC (rev 765)
+++ trunk/testset/debconf/debian/debconf-test.templates 2006-11-11 03:30:38 UTC (rev 766)
@@ -7,6 +7,11 @@
__Choices: foo, bar, boo
_Description: test comma usages in choices fields
+Template: debconf/testmulti-escape
+Type: multiselect
+_Choices: foo\, bar, boo
+_Description: test escaped comma usages in choices fields:
+
Template: debconf/testboolean
Type: boolean
_Description: Enter yes or no:
Modified: trunk/testset/debconf/debian/po/de.po
===================================================================
--- trunk/testset/debconf/debian/po/de.po 2006-11-11 03:02:50 UTC (rev 765)
+++ trunk/testset/debconf/debian/po/de.po 2006-11-11 03:30:38 UTC (rev 766)
@@ -53,6 +53,12 @@
msgid "test comma usages in choices fields"
msgstr ""
+#. Type: multiselect
+#. Choices
+#: ../debconf-test.templates:11
+msgid "foo\\, bar, boo"
+msgstr "foo, bar, boo"
+
#. Type: text
#. description
#: ../debconf-udeb.templates:3
Modified: trunk/testset/tags.debconf
===================================================================
--- trunk/testset/tags.debconf 2006-11-11 03:02:50 UTC (rev 765)
+++ trunk/testset/tags.debconf 2006-11-11 03:30:38 UTC (rev 766)
@@ -2,7 +2,7 @@
E: debconf source: missing-dh_python-build-dependency python | python-dev | python-all-dev
E: debconf source: package-needs-python-policy-debhelper
E: debconf-test: extended-description-is-empty
-E: debconf-test: mismatch-translated-choices debconf/testmulti choices-de.utf-8
+E: debconf-test: mismatch-translated-choices debconf/testmulti-escape choices-de.utf-8
E: debconf-test: no-template-description debconf/no-description
E: debconf-test: no-template-type debconf/language
E: debconf-test: settitle-requires-versioned-depends config
@@ -14,8 +14,8 @@
W: debconf source: maintainer-script-lacks-debhelper-token debian/debconf-test.postinst
W: debconf source: newer-debconf-templates
W: debconf source: stray-translated-debconf-templates debconf-test.templates.de
-W: debconf source: translated-default-field debconf-test.templates: 62
W: debconf source: translated-default-field debconf-test.templates: 67
+W: debconf source: translated-default-field debconf-test.templates: 72
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
@@ -29,6 +29,7 @@
W: debconf-test: malformed-title-in-templates debconf/testnote
W: debconf-test: old-fsf-address-in-copyright-file
W: debconf-test: partially-translated-question debconf/testmulti de.utf-8
+W: debconf-test: partially-translated-question debconf/testmulti-escape de.utf-8
W: debconf-test: postinst-uses-db-input
W: debconf-test: too-long-extended-description-in-templates debconf/teststring
W: debconf-test: too-long-short-description-in-templates debconf/testnote
Reply to: