diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-05-26 05:23:24 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-05-26 05:23:24 +0000 |
commit | 15459009833f8cb01fbb9b6fe00d1b65822d1e57 (patch) | |
tree | 06b24e3ad2e596e560581219ecfd42de443c814f /perl-install | |
parent | 7f26f4486207e8775f6e1d5df5658687737368fb (diff) | |
download | drakx-backup-do-not-use-15459009833f8cb01fbb9b6fe00d1b65822d1e57.tar drakx-backup-do-not-use-15459009833f8cb01fbb9b6fe00d1b65822d1e57.tar.gz drakx-backup-do-not-use-15459009833f8cb01fbb9b6fe00d1b65822d1e57.tar.bz2 drakx-backup-do-not-use-15459009833f8cb01fbb9b6fe00d1b65822d1e57.tar.xz drakx-backup-do-not-use-15459009833f8cb01fbb9b6fe00d1b65822d1e57.zip |
More refactorisation
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/install_any.pm | 9 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 4 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 2 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 10 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 9 |
5 files changed, 14 insertions, 20 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index c33c65d19..e491a8f8e 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -697,7 +697,7 @@ sub copy_rpms_on_disk { mkdir "$o->{prefix}/$_", 0755 foreach qw(var var/ftp var/ftp/pub var/ftp/pub/Mandrivalinux var/ftp/pub/Mandrivalinux/media); local *changeMedium = sub { my ($method, $medium) = @_; - my $name = pkgs::mediumDescr($o->{packages}, $medium); + my $name = install_medium::by_id($medium, $o->{packages})->{descr}; if (method_allows_medium_change($method)) { my $r; if ($method =~ /-iso$/) { @@ -965,8 +965,9 @@ sub warnAboutFilesStillOpen() { } sub install_urpmi { - my ($method, $packages, $mediums) = @_; + my ($method, $packages) = @_; + my @mediums = values %{$packages->{mediums}}; my $hdInstallPath = any::hdInstallPath(); #- rare case where urpmi cannot be installed (no hd install path). @@ -980,7 +981,7 @@ sub install_urpmi { #- import pubkey in rpmdb. my $db = pkgs::rpmDbOpenForInstall(); $packages->parse_pubkeys(db => $db); - foreach my $medium (values %$mediums) { + foreach my $medium (@mediums) { $packages->import_needed_pubkeys($medium->{pubkey}, db => $db, callback => sub { my (undef, undef, $_k, $id, $imported) = @_; if ($id) { @@ -991,7 +992,7 @@ sub install_urpmi { } my @cfg; - foreach (sort { $a->{medium} <=> $b->{medium} } values %$mediums) { + foreach (sort { $a->{medium} <=> $b->{medium} } @mediums) { my $name = $_->{fakemedium}; if ($_->ignored || $_->selected) { my $curmethod = $_->method || $::o->{method}; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 55bfd897d..27f79862a 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -605,9 +605,7 @@ sub install_urpmi { my $pkg = pkgs::packageByName($o->{packages}, 'urpmi'); if ($pkg && ($pkg->flag_selected || $pkg->flag_installed)) { - install_any::install_urpmi($o->{method}, - $o->{packages}, - $o->{packages}{mediums}); + install_any::install_urpmi($o->{method}, $o->{packages}); pkgs::saveCompssUsers($o->{packages}, $o->{compssUsers}); } } diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 158c63717..764fae2f8 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -545,7 +545,7 @@ sub installPackages { #- if not using a cdrom medium or an iso image, always abort. return if !install_any::method_allows_medium_change($method); - my $name = pkgs::mediumDescr($o->{packages}, $medium); + my $name = install_medium::by_id($medium, $o->{packages})->{descr}; local $| = 1; print "\a"; my $time = time(); my $r = $name !~ /commercial/i || ($o->{useless_thing_accepted2} ||= $o->ask_from_list_('', formatAlaTeX(install_messages::com_license()), [ N_("Accept"), N_("Refuse") ], "Accept") eq "Accept"); diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 1d5189fdb..408021516 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -655,12 +655,12 @@ sub chooseCD { my %mediumsDescr; #- the boot medium is already selected. - $mediumsDescr{pkgs::mediumDescr($packages, $install_any::boot_medium)} = 1; + $mediumsDescr{install_medium::by_id($install_any::boot_medium, $packages)->{descr}} = 1; - #- build mediumDescr according to mediums, this avoids asking multiple times + #- build mediumsDescr according to mediums, this avoids asking multiple times #- all the media grouped together on only one CD. foreach (@mediums) { - my $descr = pkgs::mediumDescr($packages, $_); + my $descr = install_medium::by_id($_, $packages)->{descr}; $packages->{mediums}{$_}->ignored and next; exists $mediumsDescr{$descr} or push @mediumsDescr, $descr; $mediumsDescr{$descr} ||= $packages->{mediums}{$_}->selected; @@ -692,7 +692,7 @@ If only some CDs are missing, unselect them, then click Ok."), #- restore true selection of medium (which may have been grouped together) foreach (@mediums) { $packages->{mediums}{$_}->ignored and next; - my $descr = pkgs::mediumDescr($packages, $_); + my $descr = install_medium::by_id($_, $packages)->{descr}; if ($mediumsDescr{$descr}) { $packages->{mediums}{$_}->select; } else { @@ -730,7 +730,7 @@ sub installPackages { #- if not using a cdrom medium or an iso image, always abort. return if !install_any::method_allows_medium_change($method); - my $name = pkgs::mediumDescr($o->{packages}, $medium); + my $name = install_medium::by_id($medium, $o->{packages})->{descr}; local $| = 1; print "\a"; my $r = $name !~ /commercial/i || ($o->{useless_thing_accepted2} ||= $o->ask_from_list_('', formatAlaTeX(install_messages::com_license()), [ N_("Accept"), N_("Refuse") ], "Accept") eq "Accept"); if ($method =~ /-iso$/) { diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index f8e9c8583..8f3d784e6 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -241,11 +241,6 @@ sub allMediums { } keys %{$packages->{mediums}}; } -sub mediumDescr { - my ($packages, $medium_name) = @_; - $packages->{mediums}{$medium_name}{descr}; -} - sub packageRequest { my ($packages, $pkg) = @_; @@ -1483,10 +1478,10 @@ sub new { my ($class, %h) = @_; bless \%h, $class } sub by_id { my ($medium_id, $o_packages) = @_; $o_packages = $::o->{packages} unless defined $o_packages; - log::l("select $medium_id among ".join(",",keys%{$o_packages->{mediums}})); defined $o_packages->{mediums}{$medium_id} ? $o_packages->{mediums}{$medium_id} - : bless { invalid => 1 }; + #- if the medium is not known, return a placeholder + : bless { invalid => 1, medium => $medium_id }; } #- is this medium a supplementary medium ? |