diff options
author | Francois Pons <fpons@mandriva.com> | 2002-07-18 09:35:04 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-07-18 09:35:04 +0000 |
commit | d092a9b069518c454d465169a2f523535abc8e88 (patch) | |
tree | 73721b8372ad6e55149022c57f7a20b13b280703 /perl-install/pkgs.pm | |
parent | 37608fad51b76a600479f1bc387deb0f2b96147b (diff) | |
download | drakx-backup-do-not-use-d092a9b069518c454d465169a2f523535abc8e88.tar drakx-backup-do-not-use-d092a9b069518c454d465169a2f523535abc8e88.tar.gz drakx-backup-do-not-use-d092a9b069518c454d465169a2f523535abc8e88.tar.bz2 drakx-backup-do-not-use-d092a9b069518c454d465169a2f523535abc8e88.tar.xz drakx-backup-do-not-use-d092a9b069518c454d465169a2f523535abc8e88.zip |
fix speed improvement for computeGroupSize by computing closure directly (in
order to have an approximative size, not the real one).
Diffstat (limited to 'perl-install/pkgs.pm')
-rw-r--r-- | perl-install/pkgs.pm | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 2ac5924a6..93b10e69d 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -864,9 +864,36 @@ sub computeGroupSize { my $flags = join("\t", @flags = or_ify(@flags)); $group{$p->name} = ($memo{$flags} ||= or_clean(@flags)); - #- determine the packages that will be selected when selecting $p. the packages are not selected. + #- determine the packages that will be selected when selecting $p. + #- make a fast selection (but potentially erroneous). my %newSelection; - selectPackage($packages, $p, 0, \%newSelection); + unless ($p->flag_available) { + my @l2 = ($p->id); + my $id; + + while (defined($id = shift @l2)) { + exists $newSelection{$id} and next; + $newSelection{$id} = undef; + + my $pkg = $packages->{depslist}[$id]; + foreach ($pkg->requires_nosense) { + my ($candidate_id, $prefer_id); + foreach (keys %{$packages->{provides}{$_} || {}}) { + my $ppkg = $packages->{depslist}[$_] or next; + if ($ppkg->flag_available) { + $candidate_id = undef; + last; + } else { + exists $preferred{$ppkg->name} and $prefer_id = $_; + $ppkg->name =~ /kernel-\d/ and $prefer_id ||= $_; + $candidate_id = $_; + } + } + push @l2, $prefer_id || $candidate_id; + } + } + } + foreach (keys %newSelection) { my $p = $packages->{depslist}[$_] or next; my $s = $group{$p->name} || do { @@ -1283,10 +1310,10 @@ sub installTransactionClosure { #- search first usable medium (sorted by medium ordering). foreach (sort { $a->{start} <=> $b->{start} } values %{$packages->{mediums}}) { $_->{selected} or next; - if ($l[0]->id <= $_->{end}) { + if ($l[0] <= $_->{end}) { #- we have a candidate medium, it could be the right one containing #- the first package of @l... - $l[0]->id >= $_->{start} and $medium = $_, last; + $l[0] >= $_->{start} and $medium = $_, last; #- ... but it could be necessary to find the first #- medium containing package of @l. foreach $id (@l) { |