diff options
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | find-lang-root/usr/share/gnome/help/lang/pt_BR/any.html | 0 | ||||
-rw-r--r-- | find-lang-root/usr/share/locale/pt_BR/LC_MESSAGES/lang.mo | 0 | ||||
-rw-r--r-- | find-lang.pl | 25 | ||||
-rw-r--r-- | tests/findlang.pl | 10 |
5 files changed, 22 insertions, 17 deletions
diff --git a/Makefile.am b/Makefile.am index 7a71599..31bc3fd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,7 +69,9 @@ EXTRA_DIST = \ rpm-spec-mode.el \ tests.sh tests/macros.sh \ tests/findlang.pl tests/findlang.sh \ - find-lang-root/usr/share/man/fr/man1/lang.1.lzma + find-lang-root/usr/share/man/fr/man1/lang.1.lzma \ + find-lang-root/usr/share/locale/pt_BR/LC_MESSAGES/lang.mo \ + find-lang-root/usr/share/gnome/help/lang/pt_BR/any.html edit = sed \ -e 's,@RPMVENDOR\@,$(RPMVENDOR),g' \ diff --git a/find-lang-root/usr/share/gnome/help/lang/pt_BR/any.html b/find-lang-root/usr/share/gnome/help/lang/pt_BR/any.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/find-lang-root/usr/share/gnome/help/lang/pt_BR/any.html diff --git a/find-lang-root/usr/share/locale/pt_BR/LC_MESSAGES/lang.mo b/find-lang-root/usr/share/locale/pt_BR/LC_MESSAGES/lang.mo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/find-lang-root/usr/share/locale/pt_BR/LC_MESSAGES/lang.mo diff --git a/find-lang.pl b/find-lang.pl index 3c66e13..8b4f007 100644 --- a/find-lang.pl +++ b/find-lang.pl @@ -37,31 +37,32 @@ File::Find::find( -f $File::Find::name or return; debug("next file is %s", $file); my ($pkg, $lang, $parent); + my $langfile = $file; if ($file =~ m:^((.*/share/locale)/([^/@]+)[^/]*).*/([^/]+)\.mo:) { if ($withoutmo) { return; } - ($pkg, $lang, $parent) = ($4, $3, $2); - } elsif ($file =~ m:^(.*/gnome/help)/([^/]+)/([^/]+).*$:) { + ($pkg, $lang, $parent, $langfile) = ($4, $3, $2, $1); + } elsif ($file =~ m:^((.*/gnome/help)/([^/]+)/([^/]+)).*$:) { if (!$withgnome) { return; } - ($pkg, $lang, $parent) = ($2, $3, $1); - } elsif ($file =~ m:^(.*/doc/kde)/HTML/([^/@]+)[^/]*/([^/]+)/.*$:) { + ($pkg, $lang, $parent, $langfile) = ($3, $4, $2, $1); + } elsif ($file =~ m:^((.*/doc/kde)/HTML/([^/@]+)[^/]*)/([^/]+)/.*$:) { if (!$withkde) { return; } - ($pkg, $lang, $parent) = ($2, $3, $1); - } elsif ($file =~ m:^(.*/doc)/HTML/([^/@]+)[^/]*/([^/_]+).*$:) { + ($pkg, $lang, $parent, $langfile) = ($4, $3, $2, $1); + } elsif ($file =~ m:^((.*/doc)/HTML/([^/@]+)[^/]*)/([^/_]+).*$:) { if (!$withhtml) { return; } - ($pkg, $lang, $parent) = ($3, $2, $1); - } elsif ($file =~ m:^(/+usr/share/man)/([^/@\.]+)[^/]*/man[^/]+/([^/.]+)\.\d[^/]*$:) { + ($pkg, $lang, $parent, $langfile) = ($4, $3, $2, $1); + } elsif ($file =~ m:^((/+usr/share/man)/([^/@\.]+)[^/]*)/man[^/]+/([^/.]+)\.\d[^/]*$:) { if (!$withman) { return; } - ($pkg, $lang, $parent) = ($3, $2, $1); + ($pkg, $lang, $parent, $langfile) = ($4, $3, undef, $1); $file =~ s/\.[^\.]+$//; $file .= '.*'; } else { @@ -71,9 +72,9 @@ File::Find::find( return; } - parent_to_own($parent, $file, $lang); - $finallist{$file}{'lang'}{$lang} = 1; - debug("File %s will be %s", $file, $lang); + parent_to_own($parent, $langfile, $lang) if ($parent); + $finallist{$langfile}{'lang'}{$lang} = 1; + debug("File %s will be %s", $langfile, $lang); }, $buildroot || '/' diff --git a/tests/findlang.pl b/tests/findlang.pl index 58dfa52..12deb62 100644 --- a/tests/findlang.pl +++ b/tests/findlang.pl @@ -12,17 +12,19 @@ my $testarbo = "$pwd/find-lang-root"; my %files = ( # file => [ lang, is_dir ] - '/usr/share/man/fr' => [ 'fr', 1 ], - '/usr/share/man/fr/man1' => [ 'fr', 1 ], - '/usr/share/man/fr/man1/lang.1.*' => [ 'fr', 0 ], + '/usr/share/man/fr' => [ 'fr', 0 ], + '/usr/share/locale/pt_BR' => [ 'pt_BR', 0 ], + '/usr/share/gnome/help/lang/pt_BR' => [ 'pt_BR', 0 ], + '/usr/share/gnome/help/lang' => [ '', 1 ], ); -system("/usr/bin/perl find-lang.pl $testarbo lang --with-man") and die "can't run find-lang $@"; +system("/usr/bin/perl find-lang.pl $testarbo lang --with-man --with-gnome") and die "can't run find-lang $@"; open(my $h, '<', 'lang.lang') or die "can't open lang.lang"; while (my $line = <$h>) { chomp($line); + $line =~ /svn/ and next; my ($file) = $line =~ / ([^ ]+)$/; my ($lang) = $line =~ /%lang\(([^\)]+)\)/; $lang ||= ''; |