diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-03-15 08:08:49 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-03-15 08:08:49 +0000 |
commit | 06393d7adde205875cd9c575c5f7226ac9df8fae (patch) | |
tree | c32430ca1871c2e138fb5088e75c9cb39303e354 | |
parent | 4e0350388b3b010a164dde661a6bdbda7cb7bc2d (diff) | |
download | mgatools-06393d7adde205875cd9c575c5f7226ac9df8fae.tar mgatools-06393d7adde205875cd9c575c5f7226ac9df8fae.tar.gz mgatools-06393d7adde205875cd9c575c5f7226ac9df8fae.tar.bz2 mgatools-06393d7adde205875cd9c575c5f7226ac9df8fae.tar.xz mgatools-06393d7adde205875cd9c575c5f7226ac9df8fae.zip |
make some if () {} blocks more readable
-rw-r--r-- | pm/MGATools/rpmsrate.pm | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/pm/MGATools/rpmsrate.pm b/pm/MGATools/rpmsrate.pm index 0e0ec53..4f66a2d 100644 --- a/pm/MGATools/rpmsrate.pm +++ b/pm/MGATools/rpmsrate.pm @@ -90,13 +90,21 @@ sub cleanrpmsrate { 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 ] } - if (/^$kernel_like-(\d+\.\d+)(.*)/) { $rpms{"$1-$2"} = [ $3, "$1-$2" ] } + if (!$rpms{"$1$3"}) { + $rpms{"$1$3"} = [ $2, $1, $3 ]; + } elsif (URPM::ranges_overlap("== $2", "> $rpms{'$1$3'}")) { + $rpms{"$1$3"} = [ $2, $1, $3 ]; + } + if (/^$kernel_like-(\d+\.\d+)(.*)/) { + $rpms{"$1-$2"} = [ $3, "$1-$2" ]; + } } elsif (/^$dkms_like$/) { my $vname = "$1$2kernel$4"; - if (!$rpms{$vname}) { $rpms{$vname} = [ $3, $vname ] } - elsif (URPM::ranges_overlap("== $3", "> $rpms{$vname}[0]")) { $rpms{$vname} = [ $3, $vname ] } + if (!$rpms{$vname}) { + $rpms{$vname} = [ $3, $vname ]; + } elsif (URPM::ranges_overlap("== $3", "> $rpms{$vname}[0]")) { + $rpms{$vname} = [ $3, $vname ]; + } } elsif (my ($pg, $loc) = /^(.*)-([^-+]+)$/) { if ($potloc{$pg}) { my $pkg; @@ -159,7 +167,10 @@ sub cleanrpmsrate { push @flags, split(' ', $flags); #push @flags, grep { s/\s//; !/(\|\||[A-Z_]+"[^"]+")/ } split(' ', $flags); - if (!@$data) { $text .= "$indent$r$flags$postfix\n"; next } + if (!@$data) { + $text .= "$indent$r$flags$postfix\n"; + next; + } my @k; my $flat_path = join ' ', @flags; @@ -202,7 +213,8 @@ sub cleanrpmsrate { push @k, $c; push @{$done{$c}}, $flat_path; } - if (@k) { $text .= "$indent$r$flags@k$postfix\n" } + + $text .= "$indent$r$flags@k$postfix\n" if @k; @rate{@k} = ($rate) x @k; my $path; foreach (@flags) { |