aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--find-lang.pl26
1 files changed, 22 insertions, 4 deletions
diff --git a/find-lang.pl b/find-lang.pl
index 91cfe19..382ed80 100644
--- a/find-lang.pl
+++ b/find-lang.pl
@@ -15,12 +15,19 @@ GetOptions(
'with-html' => \my $withhtml,
'without-mo' => \my $withoutmo,
'with-man' => \my $withman,
+ 'debug' => \my $debug,
) or pod2usage();
my ($buildroot, @searchname) = @ARGV;
+$buildroot or die "No buildroot given\n";
$buildroot =~ s:/+$::; # removing trailing /
my ($pkgname) = @searchname or die "Main name to find missing\n";
-$buildroot or die "No buildroot given\n";
+
+sub debug {
+ $debug or return;
+ my ($msg, @val) = @_;
+ printf("DEBUG: $msg\n", @val);
+}
my %finallist; # filename => attr, easy way to perform uniq
@@ -63,7 +70,13 @@ File::Find::find(
my $rpmlang = $lang eq 'C' ? "" : "%lang($lang)";
parent_to_own($parent, $file, $rpmlang);
- $finallist{$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});
},
$buildroot || '/'
@@ -83,9 +96,14 @@ sub parent_to_own {
my ($parent, $file, $lang) = @_;
my @subdir = grep { $_ } split('/', substr($file, length($parent)));
pop(@subdir);
- #$finallist{$parent} = "$lang %dir";
while (my $part = shift(@subdir)) {
$parent .= "/$part";
- $finallist{$parent} = "$lang %dir ";
+ if (defined($finallist{$parent})) {
+ # Own multiple time, match all lang, so no %lang()
+ $finallist{$parent} = "%dir ";
+ } else {
+ $finallist{$parent} = "$lang %dir ";
+ }
+ debug("File %s will be %s", $parent, $finallist{$parent});
}
}