diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-03-15 08:08:46 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-03-15 08:08:46 +0000 |
commit | 4e0350388b3b010a164dde661a6bdbda7cb7bc2d (patch) | |
tree | 283c60015ea1399c08b668a200b07483fa29e3f9 /pm | |
parent | 9569d831bcd68615a4a7dc34d9033d4137dbd745 (diff) | |
download | mgatools-4e0350388b3b010a164dde661a6bdbda7cb7bc2d.tar mgatools-4e0350388b3b010a164dde661a6bdbda7cb7bc2d.tar.gz mgatools-4e0350388b3b010a164dde661a6bdbda7cb7bc2d.tar.bz2 mgatools-4e0350388b3b010a164dde661a6bdbda7cb7bc2d.tar.xz mgatools-4e0350388b3b010a164dde661a6bdbda7cb7bc2d.zip |
add spacing
Diffstat (limited to 'pm')
-rw-r--r-- | pm/MGATools/rpmsrate.pm | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/pm/MGATools/rpmsrate.pm b/pm/MGATools/rpmsrate.pm index 97d5eaa..0e0ec53 100644 --- a/pm/MGATools/rpmsrate.pm +++ b/pm/MGATools/rpmsrate.pm @@ -81,12 +81,14 @@ sub cleanrpmsrate { my $dkms_like = "(.*)([-_])kernel-([0-9]+(?:\.[0-9]+){2,3}-[0-9]+(?:.[^.]+){0,2}md[vk])(.*)"; my $rpmsrate_dkms_like = "(.*[-_]kernel)(.*)"; my $urpm2 = new URPM; + foreach my $dir (keys %$reprpms) { - foreach (@{$reprpms->{$dir}}) { + foreach (@{$reprpms->{$dir}}) { my $rpm = "$_.rpm"; my $key = $_; s/-[^-]+-[^-]+\.[^.]+$// or next; any { $rpm =~ /$_/ } @$norpmsrate and next; + if (/(.*?)([_-]*[\d._]+)(-.*)?-devel$/ || /^$kernel_like(-[^.]+(?:\.[^.]+){3,6}md[vk])$/) { if (!$rpms{"$1$3"}) { $rpms{"$1$3"} = [ $2, $1, $3 ] } elsif (URPM::ranges_overlap("== $2", "> $rpms{'$1$3'}")) { $rpms{"$1$3"} = [ $2, $1, $3 ] } @@ -99,14 +101,17 @@ sub cleanrpmsrate { if ($potloc{$pg}) { my $pkg; $pkg = $urpm->{rpm}{$urpm->{rpmkey}{key}{$key}} if ref $urpm; + if (!$pkg) { my $id = $urpm2->parse_rpm("$dir/$rpm"); $pkg = $urpm2->{depslist}[$id]; } + if (!$pkg) { print "ERROR cleanrpmsrate: parse_rpm $dir/$rpm ($key) failed\n"; next; } + # some i18n packages does not require the same locale, e.g. kde-i18n-nb and nn requires locales-no # if (grep { s/locales-// && $loc =~ /^$_(_|$)/ } @{$header{REQUIRENAME}}) { if (any { /^locales-...?$/ } $pkg->requires) { @@ -117,15 +122,15 @@ sub cleanrpmsrate { } } } + my (%done, @flags, @tree_rate, $prev_level); foreach (@rpmsrate) { if (!$_->[0]) { $text .= "$_->[2]$_->[4]\n"; - if ($_->[2]) { - @flags = $_->[2]; - } + @flags = $_->[2] if $_->[2]; next; } + my ($indent, $r, $flags, $data, $postfix) = @$_; my $level = (length $indent)/2 - 1; my $rate; @@ -148,13 +153,16 @@ sub cleanrpmsrate { } $rate = $tree_rate[$level]; } + $prev_level = $level; @flags = @flags[0 .. $level]; push @flags, split(' ', $flags); #push @flags, grep { s/\s//; !/(\|\||[A-Z_]+"[^"]+")/ } split(' ', $flags); - my $flat_path = join ' ', @flags; + if (!@$data) { $text .= "$indent$r$flags$postfix\n"; next } + my @k; + my $flat_path = join ' ', @flags; foreach (@$data) { my $c = $_; next if ref $done{$_} && any { $flat_path eq $_ } @{$done{$_}}; @@ -163,9 +171,10 @@ sub cleanrpmsrate { my ($f) = $flat_path =~ /^[^ ]+ (.*)/; !/^[^ ]+ (.*)/ || $1 ne $f; } @{$done{$_}}; + my ($d) = /(.*)-[^-]+/; - my ($a, $b, $e); - my $do; + my ($a, $b, $e, $do); + if ((!member($flags[0], @plain_flags) && s/(-devel)// ? ($b = "-devel") : /^$kernel_like/) && (($rpms{$_}) || (defined $rpms{"lib$_"} and $a = "lib") || (defined $rpms{"lib64$_"} and $a = "lib64") || (s/^lib(.*?)[_-]*[\d._]*(-.*)?$/$1$2/g && defined $rpms{"lib64$_"} and $a = 'lib64'))) { $e = $rpms{"$a$_"}[1] . $rpms{"$a$_"}[0] . $rpms{"$a$_"}[2] . $b; $do = 1; @@ -173,6 +182,7 @@ sub cleanrpmsrate { $e = "$1-" . $rpms{"$1$2"}[0] . $2; $do = 1; } + if ($do) { $keyword{$c} = $e; if (!ref $done{$e} || member($flags[0], @plain_flags) && !(any { $flat_path eq $_ } @{$done{$e}}) || $flat_path =~ /DRIVER|HW/) { @@ -180,6 +190,7 @@ sub cleanrpmsrate { push @k, $e; } } + if ($locale{$d} && $localized_pkg{$c}) { foreach (sort @{$locale{$d}}) { next if member($flat_path, @{$done{"$d-$_"}}); @@ -199,6 +210,7 @@ sub cleanrpmsrate { push @{$section{$path}}, @k; } } + if (%rpms || $output || %locale) { if (%$reprpms || $output) { $output ||= $rpmsrate; @@ -210,6 +222,7 @@ sub cleanrpmsrate { } } } + [\%rate, \%section, \%keyword]; } |