aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2007-08-21 13:07:22 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2007-08-21 13:07:22 +0000
commit25981d8ed90ad9ce04a9d462f12b713f7652e09c (patch)
tree17b101cd9624dbf8ff2e6c1c8dd69b74f3e29166
parentbad3b34ff1b860b0c593504e3692d60512c1813a (diff)
downloadrpm-setup-25981d8ed90ad9ce04a9d462f12b713f7652e09c.tar
rpm-setup-25981d8ed90ad9ce04a9d462f12b713f7652e09c.tar.gz
rpm-setup-25981d8ed90ad9ce04a9d462f12b713f7652e09c.tar.bz2
rpm-setup-25981d8ed90ad9ce04a9d462f12b713f7652e09c.tar.xz
rpm-setup-25981d8ed90ad9ce04a9d462f12b713f7652e09c.zip
- when a file/dir is owned by multiple language, we assume it should be always installed
-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});
}
}