aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--URPM/Resolve.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index a168c1b..2621928 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -11,6 +11,11 @@ use Config;
# perl_checker: require URPM
#- a few functions from MDK::Common copied here:
+sub any(&@) {
+ my $f = shift;
+ $f->($_) and return 1 foreach @_;
+ 0;
+}
sub listlength {
my (@l) = @_;
scalar @l;
@@ -388,7 +393,7 @@ sub _score_for_locales {
} else {
0; # bad locale
}
- } elsif (grep { /locales-en/ } @r) {
+ } elsif (any { /locales-en/ } @r) {
2; #
} else {
1;
@@ -1719,7 +1724,7 @@ sub request_packages_to_upgrade {
$pkg = undef;
}
}
- if ($pkg && $options{idlist} && !grep { $pkg->id == $_ } @{$options{idlist}}) {
+ if ($pkg && $options{idlist} && !any { $pkg->id == $_ } @{$options{idlist}}) {
$urpm->{debug_URPM}("not auto-selecting " . $pkg->fullname . "because it's not in search medias") if $urpm->{debug_URPM};
$pkg = undef;
}
@@ -1809,7 +1814,7 @@ sub sort_graph {
# don't care
} elsif (exists $added{$p_id}) {
# already done
- } elsif (grep { $_ == $p_id } @ids) {
+ } elsif (any { $_ == $p_id } @ids) {
my $begin = 1;
my @l = grep { $begin &&= $_ != $p_id } @ids;
$loop_ahead = 1;