diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-03-15 12:17:25 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-03-15 12:17:25 +0000 |
commit | 81849e8742c98a0bddd9c54c9522e8356cc446c8 (patch) | |
tree | e6da6b8da976c650c953b6bb0ef696c2263a5534 | |
parent | b71fde90eac8a4902cd6e86506b93b36ba5589c1 (diff) | |
download | mgatools-81849e8742c98a0bddd9c54c9522e8356cc446c8.tar mgatools-81849e8742c98a0bddd9c54c9522e8356cc446c8.tar.gz mgatools-81849e8742c98a0bddd9c54c9522e8356cc446c8.tar.bz2 mgatools-81849e8742c98a0bddd9c54c9522e8356cc446c8.tar.xz mgatools-81849e8742c98a0bddd9c54c9522e8356cc446c8.zip |
(cleanrpmsrate) factorize a test
-rw-r--r-- | pm/MGATools/rpmsrate.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pm/MGATools/rpmsrate.pm b/pm/MGATools/rpmsrate.pm index c325e5f..4cd35e4 100644 --- a/pm/MGATools/rpmsrate.pm +++ b/pm/MGATools/rpmsrate.pm @@ -192,8 +192,11 @@ sub cleanrpmsrate { foreach (@$data) { my $c = $_; next if ref $done{$_} && any { $flat_path eq $_ } @{$done{$_}}; + + my $is_plain_flag = member($flags[0], @plain_flags); + die "FATAL: too complicated flags for duplicate entry $c ($flat_path and " . join ',', @{$done{$_}} - if !member($flags[0], @plain_flags) && @flags > 1 && any { + if !$is_plain_flag && @flags > 1 && any { my ($f) = $flat_path =~ /^[^ ]+ (.*)/; !/^[^ ]+ (.*)/ || $1 ne $f; } @{$done{$_}}; @@ -201,7 +204,7 @@ sub cleanrpmsrate { my ($d) = /(.*)-[^-]+/; my ($a, $b, $e, $do); - if (!member($flags[0], @plain_flags)) { + if (!$is_plain_flag) { if ((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'))) { @@ -216,7 +219,7 @@ sub cleanrpmsrate { if ($do) { $keyword{$c} = $e; - if (!ref $done{$e} || member($flags[0], @plain_flags) && !(any { $flat_path eq $_ } @{$done{$e}}) || $flat_path =~ /DRIVER|HW/) { + if (!ref $done{$e} || $is_plain_flag && !(any { $flat_path eq $_ } @{$done{$e}}) || $flat_path =~ /DRIVER|HW/) { push @{$done{$e}}, $flat_path; push @k, $e; } |