aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-09-26 19:12:16 +0000
committerThierry Vignaud <tv@mageia.org>2012-09-26 19:12:16 +0000
commit10c031a753e989577676f7e3b738fed012bc5acc (patch)
tree9b95a5a93daf8b3b64164eb18ff0054a64b411f8
parente18bb6cc843623a26ca3003c4aec6970c6127d04 (diff)
downloadperl-URPM-10c031a753e989577676f7e3b738fed012bc5acc.tar
perl-URPM-10c031a753e989577676f7e3b738fed012bc5acc.tar.gz
perl-URPM-10c031a753e989577676f7e3b738fed012bc5acc.tar.bz2
perl-URPM-10c031a753e989577676f7e3b738fed012bc5acc.tar.xz
perl-URPM-10c031a753e989577676f7e3b738fed012bc5acc.zip
introduce any() from MDK::Common and resuse it
-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;