aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-02-22 19:24:20 +0000
committerThierry Vignaud <tv@mageia.org>2012-02-22 19:24:20 +0000
commite512ae2d399dc67e05335e0543975d1d467fd299 (patch)
tree597e8b246162ffb30e361e03f947c3fb68fbbee3
parentd96d2995b711af8cc5b44f5193f179825093d4a3 (diff)
downloadperl-URPM-e512ae2d399dc67e05335e0543975d1d467fd299.tar
perl-URPM-e512ae2d399dc67e05335e0543975d1d467fd299.tar.gz
perl-URPM-e512ae2d399dc67e05335e0543975d1d467fd299.tar.bz2
perl-URPM-e512ae2d399dc67e05335e0543975d1d467fd299.tar.xz
perl-URPM-e512ae2d399dc67e05335e0543975d1d467fd299.zip
(compute_flags) fix slow matching of individual regexes for skipping
dependencies by creating a large regex to match them all at once (mdv#61389, Shlomi Fish) (backported from trunk)
-rw-r--r--NEWS3
-rw-r--r--URPM/Resolve.pm6
2 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index f8219f9..8e8e62f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- fix slow matching of individual regexes for skipping dependencies by creating
+ a large regex to match them all at once (mdv#61389, Shlomi Fish)
+
Version 3.38.1 - 16 November 2010
- fix crashing while removing several packages (#248)
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index b82b45b..51fda20 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -1616,9 +1616,11 @@ sub compute_flags {
#- now search packages which fullname match given regexps
if (@regex) {
- #- very costly :-(
+ my $large_re_s = join("|", map { "(?:$_)" } @regex);
+ my $re = qr/$large_re_s/;
+
foreach my $pkg (@{$urpm->{depslist}}) {
- if (grep { $pkg->fullname =~ /$_/ } @regex) {
+ if ($pkg->fullname =~ $re){
compute_flag($urpm, $pkg, %options);
}
}