summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-02-27 23:34:24 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-02-27 23:34:24 +0000
commita7f6e83d669be2b2b8649ab198159972e890072e (patch)
treeaa04618b1df023d0b16e25975fddb58dda794a8b
parentf4de5e067c51b8200230eda2ae3a973cf9052426 (diff)
downloaddrakx-a7f6e83d669be2b2b8649ab198159972e890072e.tar
drakx-a7f6e83d669be2b2b8649ab198159972e890072e.tar.gz
drakx-a7f6e83d669be2b2b8649ab198159972e890072e.tar.bz2
drakx-a7f6e83d669be2b2b8649ab198159972e890072e.tar.xz
drakx-a7f6e83d669be2b2b8649ab198159972e890072e.zip
error out when a listed lang doesn't have a png lang file
when doing the check of lang.pm, first show the warnings, then the errors at make-install time, remove pang lang files corresponding to disabled langs
-rw-r--r--perl-install/Makefile1
-rw-r--r--perl-install/lang.pm19
2 files changed, 16 insertions, 4 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile
index 13d0de222..9aea2d732 100644
--- a/perl-install/Makefile
+++ b/perl-install/Makefile
@@ -165,6 +165,7 @@ endif
cd share ; cp -a consolefonts $(DEST)/usr/share
-cd share ; cp -f *.png $(DEST)/usr/share
-cd pixmaps ; cp -af *.png *.xpm langs $(DEST)/usr/share ; rm -f $(DEST)/usr/share/wiz_*
+ unneeded=`perl -I. -Mlang -e 'lang::get_unneeded_png_lang_files'`; cd $(DEST)/usr/share; rm -f $$unneeded
cd share ; cp compssUsers compssUsers.* rpmsrate $(ROOTDEST)/Mandrake/base
clean-rpmsrate $(ROOTDEST)/Mandrake/base/rpmsrate $(ROOTDEST)/Mandrake/RPMS*
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index ebbe7d80b..c9bb45557 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -973,6 +973,9 @@ sub during_install__l2charset {
uc($c);
}
+sub get_unneeded_png_lang_files {
+ print join(' ', map { m|(langs/lang-(.*)\.png)|; if_(!member($2, list_langs()), $1) } glob("pixmaps/langs/lang-*.png"));
+}
sub check {
$^W = 0;
@@ -986,8 +989,7 @@ sub check {
};
my @wanted_charsets = uniq map { l2charset($_) } list_langs();
- $err->("invalid charset $_ ($_ does not exist in \%charsets)") foreach difference2(\@wanted_charsets, [ keys %charsets ]);
- $err->("invalid charset $_ in \%charset2kde_font ($_ does not exist in \%charsets)") foreach difference2([ keys %charset2kde_font ], [ 'default', keys %charsets ]);
+ print "\tWarnings:\n";
$warn->("unused charset $_ (given in \%charsets, but not used in \%langs)") foreach difference2([ keys %charsets ], \@wanted_charsets);
$warn->("unused entry $_ in \%xim") foreach grep { !/UTF-8/ } difference2([ keys %xim ], [ map { l2locale($_) } list_langs() ]);
@@ -1005,14 +1007,23 @@ sub check {
$warn->("no KDE charset for charsets " . join(" ", @l));
}
+ $warn->("no country corresponding to default locale $_->[1] of lang $_->[0]")
+ foreach grep { $_->[1] =~ /^.._(..)/ && !exists $countries{$1} } map { [ $_, l2locale($_) ] } list_langs();
+
+ print "\tErrors:\n";
+
+ $err->("invalid charset $_ ($_ does not exist in \%charsets)") foreach difference2(\@wanted_charsets, [ keys %charsets ]);
+ $err->("invalid charset $_ in \%charset2kde_font ($_ does not exist in \%charsets)") foreach difference2([ keys %charset2kde_font ], [ 'default', keys %charsets ]);
+
$err->("default locale $_->[1] of lang $_->[0] isn't listed in \@locales")
foreach grep { !member($_->[1], @locales) } map { [ $_, l2locale($_) ] } list_langs();
+ $err->("lang image for lang $_->[0] is missing (file $_->[1])")
+ foreach grep { !(-e $_->[1]) } map { [ $_, "pixmaps/langs/lang-$_.png" ] } list_langs();
+
$err->("default locale $_->[1] of country $_->[0] isn't listed in \@locales")
foreach grep { !member($_->[1], @locales) } map { [ $_, c2locale($_) ] } list_countries();
- $warn->("no country corresponding to default locale $_->[1] of lang $_->[0]")
- foreach grep { $_->[1] =~ /^.._(..)/ && !exists $countries{$1} } map { [ $_, l2locale($_) ] } list_langs();
exit($ok ? 0 : 1);
}