diff options
author | Olivier Thauvin <nanardon@mandriva.org> | 2007-08-22 12:32:17 +0000 |
---|---|---|
committer | Olivier Thauvin <nanardon@mandriva.org> | 2007-08-22 12:32:17 +0000 |
commit | fed3d61c23582242c3fc50489d9024a16fa77b18 (patch) | |
tree | a1c05f73ec746ae594bdb6ce24a69b85abba50fb | |
parent | 82be47ba3d1e085914cc1250e1e7deb661764950 (diff) | |
download | rpm-setup-fed3d61c23582242c3fc50489d9024a16fa77b18.tar rpm-setup-fed3d61c23582242c3fc50489d9024a16fa77b18.tar.gz rpm-setup-fed3d61c23582242c3fc50489d9024a16fa77b18.tar.bz2 rpm-setup-fed3d61c23582242c3fc50489d9024a16fa77b18.tar.xz rpm-setup-fed3d61c23582242c3fc50489d9024a16fa77b18.zip |
- tagging all files one by one, as rpm seems to not include content of dir having %lang
- ensure parent dir for gnome are listed
- improve multiple lang on dir filtering (aka no %lang)
-rw-r--r-- | find-lang.pl | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/find-lang.pl b/find-lang.pl index f12af1f..57f4b7a 100644 --- a/find-lang.pl +++ b/find-lang.pl @@ -34,23 +34,26 @@ my %finallist; # filename => attr, easy way to perform uniq File::Find::find( sub { my $file = substr($File::Find::name, length($buildroot)); + -f $File::Find::name or return; + debug("next file is %s", $file); my ($pkg, $lang, $parent); if ($file =~ m:^((.*/share/locale)/([^/_@]+)[^/]*).*/([^/]+)\.mo:) { if ($withoutmo) { return; } ($pkg, $lang, $parent) = ($4, $3, $2); - } elsif ($file =~ m:^(.*/gnome/help/([^/]+))/([^/_]+)$:) { + } elsif ($file =~ m:^(.*/gnome/help/([^/]+))/([^/_]+).*$:) { if (!$withgnome) { return; } ($pkg, $lang, $parent) = ($2, $3, $1); - } elsif ($file =~ m:^(.*/doc/kde/HTML)/([^/_@]+)[^/]*/([^/]+)$:) { + print "$pkg, $lang, $parent\n"; + } elsif ($file =~ m:^(.*/doc/kde/HTML)/([^/_@]+)[^/]*/([^/]+)/.*$:) { if (!$withkde) { return; } ($pkg, $lang, $parent) = ($2, $3, $1); - } elsif ($file =~ m:^(.*/doc/HTML)/([^/_@]+)[^/]*/([^/]+)$:) { + } elsif ($file =~ m:^(.*/doc/HTML)/([^/_@]+)[^/]*/([^/_]+).*$:) { if (!$withhtml) { return; } @@ -67,16 +70,10 @@ File::Find::find( if (! ((grep { $_ eq $pkg } @searchname) || $allname)) { return; } - my $rpmlang = $lang eq 'C' ? "" : "%lang($lang)"; - parent_to_own($parent, $file, $rpmlang); - if (defined($finallist{$file})) { - # Own multiple time, match all lang, so no %lang() - $finallist{$file} = ""; - } else { - $finallist{$file} = "$rpmlang "; - } - debug("File %s will be %s", $file, $finallist{$file}); + parent_to_own($parent, $file, $lang); + $finallist{$file}{'lang'}{$lang} = 1; + debug("File %s will be %s", $file, $lang); }, $buildroot || '/' @@ -84,8 +81,18 @@ File::Find::find( open(my $hlang, '>', "$pkgname.lang") or die "canno't open $pkgname.lang\n"; -foreach (sort keys %finallist) { - print $hlang "$finallist{$_}$_\n"; +foreach my $f (sort keys %finallist) { + my ($lang, @otherlang) = keys %{ $finallist{$f}{'lang'} || {}}; + my $l = sprintf("%s%s%s", + $finallist{$f}{'dir'} ? '%dir ' : '', + @otherlang == 0 && $lang && !$finallist{$f}{'dir'} + ? "%lang($lang) " + : '', # skeep if multiple lang + $f + ); + debug('OUT: %s', $l); + print $hlang "$l\n"; + } close($hlang); @@ -98,12 +105,8 @@ sub parent_to_own { pop(@subdir); while (my $part = shift(@subdir)) { $parent .= "/$part"; - if (defined($finallist{$parent})) { - # Own multiple time, match all lang, so no %lang() - $finallist{$parent} = "%dir "; - } else { - $finallist{$parent} = "$lang %dir "; - } - debug("Parent %s will be %s", $parent, $finallist{$parent}); + $finallist{$parent}{dir} = 1; + $finallist{$file}{'lang'}{$lang} = 1; + debug("Parent %s will be %s", $parent, $lang); } } |