summaryrefslogtreecommitdiffstats
path: root/perl-install/pkgs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-27 13:56:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-27 13:56:51 +0000
commitb12f41944e8bf36e9ec614ec4d417735b5d3dde6 (patch)
tree772220596147585799fb61a188efd7c48a20e0ca /perl-install/pkgs.pm
parent4933d89786ac38b9052c0cd3200bd899401aae24 (diff)
downloaddrakx-backup-do-not-use-b12f41944e8bf36e9ec614ec4d417735b5d3dde6.tar
drakx-backup-do-not-use-b12f41944e8bf36e9ec614ec4d417735b5d3dde6.tar.gz
drakx-backup-do-not-use-b12f41944e8bf36e9ec614ec4d417735b5d3dde6.tar.bz2
drakx-backup-do-not-use-b12f41944e8bf36e9ec614ec4d417735b5d3dde6.tar.xz
drakx-backup-do-not-use-b12f41944e8bf36e9ec614ec4d417735b5d3dde6.zip
enhance packageCallbackChoices and %preferred
(uses new URPM::Resolve feature allowing multiple choices)
Diffstat (limited to 'perl-install/pkgs.pm')
-rw-r--r--perl-install/pkgs.pm36
1 files changed, 22 insertions, 14 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 02c60d989..962ee81de 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -16,7 +16,7 @@ use loopback;
use c;
-our %preferred = map { $_ => undef } qw(perl-GTK postfix mdkkdm myspell-en_US gcc gcc-cpp gcc-c++ proftpd ghostscript-X vim-minimal kernel db1 db2 ispell-en Bastille-Curses-module nautilus libxpm4 zlib1 libncurses5 harddrake cups apache);
+our %preferred = map { $_ => undef } qw(perl-base XFree86-libs gstreamer-oss openjade ctags glibc curl sane-backends perl-GTK postfix mdkkdm gcc gcc-cpp gcc-c++ proftpd ghostscript-X vim-minimal kernel db1 db2 libxpm4 zlib1 libncurses5 harddrake cups apache);
#- lower bound on the left ( aka 90 means [90-100[ )
our %compssListDesc = (
@@ -218,21 +218,29 @@ sub packageRequest {
sub packageCallbackChoices {
my ($urpm, $_db, $_state, $choices) = @_;
- my $prefer;
- foreach my $pkg (@$choices) {
- #- examine first an explicitely prefered package.
- exists $preferred{$pkg->name} and $prefer = $pkg;
- #- or if a kernel has to be chosen, chose the basic one.
- $pkg->name =~ /kernel-\d/ and $prefer ||= $pkg;
- #- or even if a package requires a specific locales which
- #- is already selected.
- foreach ($pkg->requires_nosense) {
- /locales-/ or next;
- my $p = packageByName($urpm, $_) or next;
- $p->flag_available and $prefer ||= $pkg;
+ if (my $prefer = find { exists $preferred{$_->name} } @$choices) {
+ $prefer;
+ } else {
+ my @l = grep {
+ #- or if a kernel has to be chosen, chose the basic one.
+ $_->name =~ /kernel-\d/ and return $_;
+
+ #- or even if a package requires a specific locales which
+ #- is already selected.
+ find {
+ /locales-/ && do {
+ my $p = packageByName($urpm, $_);
+ $p && $p->flag_available;
+ };
+ } $_->requires_nosense;
+ } @$choices;
+ if (!@l) {
+ push @l, $choices->[0];
+ log::l("packageCallbackChoices: default choice from ", join(",", map { $urpm->{depslist}[$_]->name } keys %{$_state->{selected}}), " in ", join(",", map { $_->name } @$choices));
}
+ #-log::l("packageCallbackChoices: chosen " . join(" ", map { $_->name } @l));
+ @l;
}
- $prefer || $choices->[0]; #- first one (for instance).
}
#- selection, unselection of package.