aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-09-11 16:55:39 +0000
committerThierry Vignaud <tv@mandriva.org>2007-09-11 16:55:39 +0000
commit6556095932121751194f34dc3ab9268a9d82d72c (patch)
tree628459b0435de4a109521bc8e0c9d5f889e5763d
parent1e10ef76f39fea5935fe88e52823d856ce67e763 (diff)
downloadrpmdrake-6556095932121751194f34dc3ab9268a9d82d72c.tar
rpmdrake-6556095932121751194f34dc3ab9268a9d82d72c.tar.gz
rpmdrake-6556095932121751194f34dc3ab9268a9d82d72c.tar.bz2
rpmdrake-6556095932121751194f34dc3ab9268a9d82d72c.tar.xz
rpmdrake-6556095932121751194f34dc3ab9268a9d82d72c.zip
(get_pkgs) reduce package enumeration by 10% (thanks to pixel) (#33334)
but in fact, we spent only 1sec out of 11sec (on my x86_64 machine with 29 media) there, all remaining time is spent in request_packages_to_upgrade(), resolve_requested() and compute_installed_flags()
-rw-r--r--Rpmdrake/pkg.pm33
1 files changed, 23 insertions, 10 deletions
diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm
index cdfc5abc..43e6c602 100644
--- a/Rpmdrake/pkg.pm
+++ b/Rpmdrake/pkg.pm
@@ -349,10 +349,29 @@ sub get_pkgs {
foreach my $pkg (@{$urpm->{depslist}}) {
$update->();
$pkg->flag_upgrade or next;
+ my $name = urpm_name($pkg);
+ push @installable_pkgs, $name;
+ $all_pkgs{$name} = { pkg => $pkg, summary => $pkg->summary };
+ }
+ foreach my $medium (@search_medias) {
+ $update->();
+ foreach my $pkg_id ($medium->{start} .. $medium->{end}) {
+ my $pkg = $urpm->{depslist}[$pkg_id];
+ $pkg->flag_upgrade or next;
+ my $name = urpm_name($pkg);
+ push @backports, $name;
+ $all_pkgs{$name} = { pkg => $pkg, summary => $pkg->summary };
+ }
+ }
+ foreach my $medium (@update_medias) {
+ $update->();
+ foreach my $pkg_id ($medium->{start} .. $medium->{end}) {
+ my $pkg = $urpm->{depslist}[$pkg_id];
+ $pkg->flag_upgrade or next;
my $selected = 0;
my $name = urpm_name($pkg);
- if (member($name, @requested) && any { $pkg->id >= $_->{start} && $pkg->id <= $_->{end} } @update_medias) {
+ if (member($name, @requested)) {
if ($::rpmdrake_options{'pkg-sel'} || $::rpmdrake_options{'pkg-nosel'}) {
my $n = $name;
$pkg_sel{$n} || $pkg_nosel{$n} or next;
@@ -362,17 +381,11 @@ sub get_pkgs {
$selected = member($name, @requested_strict);
}
push @updates, $name;
- } else {
- push @installable_pkgs, $name;
- if (@search_medias) {
- my $raw_medium = pkg2medium($pkg, $urpm);
- my $medium = $raw_medium->{name};
- push @backports, $name if any { $_->{start} <= $pkg->id && $pkg->id <= $_->{end} } @search_medias;
- }
- }
+ }
$all_pkgs{urpm_name($pkg)} = { selected => $selected, pkg => $pkg,
summary => $pkg->summary,
};
+ }
}
if ($::rpmdrake_options{'pkg-sel'} && $::rpmdrake_options{'pkg-nosel'}) {
push @{$::rpmdrake_options{'pkg-nosel'}}, @{$::rpmdrake_options{'pkg-sel'}};
@@ -383,7 +396,7 @@ sub get_pkgs {
# urpmi only care about the first medium where it found the package,
# so there's no need to list the same package several time:
- @installable_pkgs = uniq(@installable_pkgs);
+ @installable_pkgs = uniq(difference2(\@installable_pkgs, \@updates));
+{ urpm => $urpm,
all_pkgs => \%all_pkgs,