aboutsummaryrefslogtreecommitdiffstats
path: root/URPM/Resolve.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-01-09 13:57:55 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-01-09 13:57:55 +0000
commit843d286d89a3b8e969d9ea70ca67d980be2584c4 (patch)
tree1ea5db5fbf3e985ed3b3cee501acc2133adf1201 /URPM/Resolve.pm
parent9204f244a730b828802035fa659eb6773d8851b6 (diff)
downloadperl-URPM-843d286d89a3b8e969d9ea70ca67d980be2584c4.tar
perl-URPM-843d286d89a3b8e969d9ea70ca67d980be2584c4.tar.gz
perl-URPM-843d286d89a3b8e969d9ea70ca67d980be2584c4.tar.bz2
perl-URPM-843d286d89a3b8e969d9ea70ca67d980be2584c4.tar.xz
perl-URPM-843d286d89a3b8e969d9ea70ca67d980be2584c4.zip
factorize
Diffstat (limited to 'URPM/Resolve.pm')
-rw-r--r--URPM/Resolve.pm22
1 files changed, 10 insertions, 12 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 3b915af..d7bc84a 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -120,22 +120,20 @@ sub find_chosen_packages {
my $arch_score = ($p->is_arch_compat < min map { $_->is_arch_compat } @chosen) ? 10 : 0;
if ($p->flag_requested && $p->flag_installed) {
- $mode < 3 + $arch_score and @chosen = ();
- $mode = 3 + $arch_score;
+ $arch_score += 3;
$install = 1;
} elsif ($p->flag_requested) {
- $mode < 2 + $arch_score and @chosen = ();
- $mode > 2 + $arch_score and next;
- $mode = 2 + $arch_score;
+ $arch_score += 2;
} elsif ($p->flag_installed) {
- $mode < 1 + $arch_score and @chosen = ();
- $mode > 1 + $arch_score and next;
- $mode = 1 + $arch_score;
- } else {
- $mode < $arch_score and @chosen = ();
- $mode > $arch_score and next;
- $mode = $arch_score;
+ $arch_score += 1;
+ }
+ if ($mode > $arch_score) {
+ next;
+ } elsif ($mode < $arch_score) {
+ @chosen = ();
}
+ $mode = $arch_score;
+
push @chosen, $p;
}