1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/usr/bin/perl
use MDK::Common;
use Getopt::Long;
use lib qw(/usr/lib/libDrakX);
use run_program;
# alleged i18n packages for french (useful to spot missing requires on locales-fr)
# rpm -qa \*-fr\* --qf '%{name}\n' | perl -n -e '/^(.*)-fr(_.+)?$/ and print "$1\n"' | sort -u
# my @packages = (
# aspell
# kde-i18n
# locales
# mozilla-firefox
# myspell
# myspell-hyph
# openoffice.org-l10n
# );
my ($prefix, $ooo_version);
GetOptions(
"prefix=s" => \$prefix,
"ooo=s" => \$ooo_version,
);
my @misowned_dirs = qw(
/usr/lib/ooo-${ooo_version}
/usr/lib/ooo-${ooo_version}/help
/usr/share/apps
/usr/share/apps/khangman
/usr/share/apps/khangman/data
/usr/share/apps/ktuberling
/usr/share/apps/ktuberling/sounds
/usr/share/doc/HTML
/usr/share/locale
);
my @dirs = qw(
/usr/share/man
/usr/share/doc/HTML
);
my @files = qw(
/usr/lib/ooo-${ooo_version}/share/dict/$L.*
/usr/lib/ooo-${ooo_version}/share/dict/$L_comb.*
/usr/lib/ooo-${ooo_version}/share/dict/hyph_$L.*
/usr/lib/ooo-${ooo_version}/share/dict/th_$L.*
/usr/lib/ooo-${ooo_version}/share/dict/th_$L_v2.*
);
my %per_locale_files = (
zh => [
#- disables anti-aliasing by default
'/etc/fonts/conf.d/99-ttf-arphic-uming-bitmaps.conf'
],
);
my @locale_packages = run_program::rooted_get_stdout($prefix, 'rpm', '-qa', 'locales-*', '--qf', '%{name}\n');
my @locales = sort(map { s/^locales-//; chomp; $_ } @locale_packages);
sub expand_files {
my ($p, $o_lang) = @_;
$p =~ s/\$L/$o_lang/ if $o_lang;
map { s/^$prefix//; $_ } grep { -e $_ } glob($prefix . $p);
}
foreach my $l (@locales) {
my @list;
my $locale_pkg = "locales-$l";
#my $l_pattern = qr/^$l([_.@].+)?$/;
#my @l_packages = map { ("$_-$l", "$_-${l}_*") } @packages;
my @l_packages = chomp_(run_program::rooted_get_stdout($prefix, 'rpm', '-q', '--qf', '%{name}\n', '--whatrequires', $locale_pkg));
unshift @l_packages, $locale_pkg;
my @list = chomp_(run_program::rooted_get_stdout($prefix, 'rpm', '-ql', @l_packages));
my @all_locales = map { m!^/usr/share/locale/([^/]+)$! } chomp_(run_program::rooted_get_stdout($prefix, 'rpm', '-ql', $locale_pkg));
# skip misowned directories such as /usr/share/locale
@list = grep { ! -d $prefix . $_ || member(basename($_), @all_locales) } @list;
#@list = difference2(\@list, \@misowned_dirs);
foreach my $l2 (@all_locales) {
foreach my $d (@dirs) {
my $l_d = $d . '/' . $l2;
push @list, $l_d if -e $prefix . $l_d;
}
push @list, expand_files($_, $l2) foreach @files;
}
push @list, expand_files($_) foreach @{$per_locale_files{$l} || []};
output_p($prefix . "/root/drakx/i18n-$l.lst", map { "$_\n" } sort(@list));
}
|