diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-09-09 09:52:40 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-09-09 09:52:40 +0000 |
commit | ab7170507346c8ebb28e4b4bfe9a0713dd0e591c (patch) | |
tree | 6d48c68af2b34b8c8915830cc407b50038a03537 /perl-install | |
parent | 49790b1e7e8fed6b7735c3f57813c932ea5e3317 (diff) | |
download | drakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.tar drakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.tar.gz drakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.tar.bz2 drakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.tar.xz drakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.zip |
Re-read all hdlists in reverse order when there are supplementary media.
Don't unselect every single media when doing an installation from iso images.
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/install_any.pm | 84 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 2 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 16 |
3 files changed, 74 insertions, 28 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 4d37e6c1f..4ad8321b8 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -363,6 +363,7 @@ sub preConfigureTimezone { } sub deselectFoundMedia { + #- TODO group by CD my ($o, $hdlists) = @_; my $l = $o->ask_many_from_list('', N("The following installation media have been found. @@ -396,6 +397,27 @@ Do you have a supplementary installation media to configure?", return $suppl; } +#- if the supplementary media is networked, but not the main one, network +#- support must be installed and network started. +sub prep_net_suppl_media { + return if our $net_suppl_media_configured; + $net_suppl_media_configured = 1; + my ($o) = @_; + #- install basesystem now + $::o->do_pkgs->ensure_is_installed('basesystem', undef, 1); + #- from install_steps_interactive: + local $::expert = $::expert; + require network::netconnect; + network::netconnect::main($o->{prefix}, $o->{netcnx} ||= {}, $o, $o->{modules_conf}, $o->{netc}, $o->{mouse}, $o->{intf}, 0, 1); + require install_interactive; + install_interactive::upNetwork($o); + #- force reinitialisation of network modules + delete $INC{'IO/Socket.pm'}; + delete $INC{'IO/Socket/UNIX.pm'}; + delete $INC{'IO/Socket/INET.pm'}; + require IO::Socket; +} + sub selectSupplMedia { my ($o, $suppl_method) = @_; #- ask whether there are supplementary media @@ -411,24 +433,9 @@ sub selectSupplMedia { my $medium_name = $suppl_method eq 'cdrom' ? (max(map { $_->{medium} =~ /^(\d+)s$/ ? $1 : 0 } values %{$o->{packages}{mediums}}) + 1) . "s" : int(keys %{$o->{packages}{mediums}}) + 1; - local $::isWizard = 0; #- configure network if needed - if (!(our $asked) && !scalar keys %{$o->{intf}} && $suppl_method !~ /^(?:cdrom|disk)/) { - $asked = 1; - #- install basesystem now - $::o->do_pkgs->ensure_is_installed('basesystem', undef, 1); - #- from install_steps_interactive: - local $::expert = $::expert; - require network::netconnect; - network::netconnect::main($o->{prefix}, $o->{netcnx} ||= {}, $o, $o->{modules_conf}, $o->{netc}, $o->{mouse}, $o->{intf}, 0, 1); - require install_interactive; - install_interactive::upNetwork($o); - #- force reinitialisation of network modules - delete $INC{'IO/Socket.pm'}; - delete $INC{'IO/Socket/UNIX.pm'}; - delete $INC{'IO/Socket/INET.pm'}; - require IO::Socket; - } + prep_net_suppl_media($o) if !scalar keys %{$o->{intf}} && $suppl_method !~ /^(?:cdrom|disk)/; + local $::isWizard = 0; my $main_method = $o->{method}; local $o->{method} = $suppl_method; if ($suppl_method eq 'cdrom') { @@ -535,15 +542,51 @@ sub setup_suppl_medium { $supplmedium->{with_hdlist} = 'media_info/hdlist.cz'; #- for install_urpmi } +sub _media_rank { + my ($x) = @_; + my ($y, $s) = $x =~ /(\d+)(s?)\)\.cz/; + $s and $y += 100; + $y; +} + sub setPackages { my ($o, $rebuild_needed) = @_; require pkgs; if (!$o->{packages} || is_empty_array_ref($o->{packages}{depslist})) { ($o->{packages}, my $suppl_method) = pkgs::psUsingHdlists($o, $o->{method}); - - 1 while - $suppl_method = $o->selectSupplMedia($suppl_method); + my $nb_suppl_media = 0; + + ++$nb_suppl_media while $suppl_method = $o->selectSupplMedia($suppl_method); + + if ($nb_suppl_media) { + #- reread all hdlists and recompute dependencies + log::l("re-read hdlists"); + pkgs::cleanHeaders($o->{prefix}); + %pkgs::uniq_pkg_seen = (); + my $oldmediums = $o->{packages}{mediums}; + delete $o->{packages}{rpmdb}; delete $o->{packages}; + $o->{packages} = new URPM; + @{$o->{packages}}{qw(count mediums)} = (0, {}); #- add additional fields used by DrakX + for my $h (sort { _media_rank($b) <=> _media_rank($a) } glob(pkgs::urpmidir($o->{prefix}) . "/hdlist.*.cz")) { + my ($description, $method, $medium_name) = $h =~ /hdlist\.(.*) \(([-a-z]*)(\d+s?)\)\.cz/; + my $m = pkgs::psUsingHdlist( + $o->{prefix}, + $method, + $o->{packages}, + $oldmediums->{$medium_name}{hdlist}, + $medium_name, + $oldmediums->{$medium_name}{rpmsdir}, + $description, + 1, #- selected + $h, #- fhdlist + undef, #- pubkey + 1, #- nocopy + ); + defined $oldmediums->{$medium_name}{$_} and $m->{$_} = $oldmediums->{$medium_name}{$_} for qw(hdlist_size synthesis_hdlist_size with_hdlist ftp_prefix pubkey); + } + #$o->{packages}->compute_deps; + } #- open rpm db according to right mode needed. $o->{packages}{rpmdb} ||= pkgs::rpmDbOpen($o->{prefix}, $rebuild_needed); @@ -767,6 +810,7 @@ sub install_urpmi { #- rare case where urpmi cannot be installed (no hd install path). $method eq 'disk' && !any::hdInstallPath() and return; + log::l("install_urpmi $method"); #- clean to avoid opening twice the rpm db. delete $packages->{rpmdb}; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 51bcd3776..cc1b2865a 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -649,7 +649,7 @@ sub chooseCD { } if (install_any::method_is_from_ISO_images($o->{method})) { - $mediumsDescr{$_} = to_bool(install_any::find_ISO_image_labelled($_)) foreach @mediumsDescr; + $mediumsDescr{$_} = install_any::method_is_from_ISO_images($packages->{mediums}{$_}{method}) ? to_bool(install_any::find_ISO_image_labelled($_)) : 1; } elsif ($o->{method} eq "cdrom") { #- if no other medium available or a poor beginner, we are choosing for him! #- note first CD is always selected and should not be unselected! diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index ff7b3aaf2..9fbbed53f 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -428,7 +428,7 @@ sub psUsingHdlists { } sub psUsingHdlist { - my ($prefix, $method, $packages, $hdlist, $medium_name, $rpmsdir, $descr, $selected, $o_fhdlist, $o_pubkey) = @_; + my ($prefix, $method, $packages, $hdlist, $medium_name, $rpmsdir, $descr, $selected, $o_fhdlist, $o_pubkey, $o_nocopy) = @_; my $fakemedium = "$descr ($method$medium_name)"; my $urpmidir = urpmidir($prefix); log::l("trying to read $hdlist for medium $medium_name"); @@ -447,14 +447,16 @@ sub psUsingHdlist { #- copy hdlist file directly to urpmi directory, this will be used #- for getting header of package during installation or after by urpmi. my $newf = "$urpmidir/hdlist.$fakemedium.cz" . ($hdlist =~ /\.cz2/ && "2"); - -e $newf and do { unlink $newf or die "cannot remove $newf: $!" }; - install_any::getAndSaveFile($o_fhdlist || "media/media_info/$hdlist", $newf) or do { unlink $newf; die "no $hdlist found" }; - $m->{hdlist_size} = -s $newf; #- keep track of size for post-check. - symlinkf $newf, "/tmp/$hdlist"; + unless ($o_nocopy) { + -e $newf and do { unlink $newf or die "cannot remove $newf: $!" }; + install_any::getAndSaveFile($o_fhdlist || "media/media_info/$hdlist", $newf) or do { unlink $newf; die "no $hdlist found" }; + $m->{hdlist_size} = -s $newf; #- keep track of size for post-check. + symlinkf $newf, "/tmp/$hdlist"; + } - #- if $o_fhdlist is a filehandle, this is preferable not to try to find the associated synthesis. my $newsf = "$urpmidir/synthesis.hdlist.$fakemedium.cz" . ($hdlist =~ /\.cz2/ && "2"); - unless (ref $o_fhdlist) { + #- if $o_fhdlist is a filehandle, it's preferable not to try to find the associated synthesis. + if (!$o_nocopy && !ref $o_fhdlist) { #- copy existing synthesis file too. my $synth; if ($o_fhdlist) { |