From 25981d8ed90ad9ce04a9d462f12b713f7652e09c Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Tue, 21 Aug 2007 13:07:22 +0000 Subject: - when a file/dir is owned by multiple language, we assume it should be always installed --- find-lang.pl | 26 ++++++++++++++++++++++---- 1 file 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}); } } -- cgit v1.2.1