diff options
author | Francois Pons <fpons@mandriva.com> | 2000-11-23 10:38:28 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2000-11-23 10:38:28 +0000 |
commit | e4ac9bbbd0a936d754c5b3951f9321405e8bbd25 (patch) | |
tree | 34634427d69f77b0d6153ef47d1604377e9da597 /perl-install | |
parent | 2fa70b5930971d81cb4fe292e758c9cd2a9d8504 (diff) | |
download | drakx-backup-do-not-use-e4ac9bbbd0a936d754c5b3951f9321405e8bbd25.tar drakx-backup-do-not-use-e4ac9bbbd0a936d754c5b3951f9321405e8bbd25.tar.gz drakx-backup-do-not-use-e4ac9bbbd0a936d754c5b3951f9321405e8bbd25.tar.bz2 drakx-backup-do-not-use-e4ac9bbbd0a936d754c5b3951f9321405e8bbd25.tar.xz drakx-backup-do-not-use-e4ac9bbbd0a936d754c5b3951f9321405e8bbd25.zip |
updated with structural change of pkgs.
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/install_any.pm | 18 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 10 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 35 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 18 |
4 files changed, 40 insertions, 41 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 2e2f66a6f..cc1305627 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -67,7 +67,7 @@ sub changeMedium($$) { } sub relGetFile($) { local $_ = $_[0]; - m|\.rpm$| ? "$::o->{packages}[2]{$asked_medium}{rpmsdir}/$_" : $_; + m|\.rpm$| ? "$::o->{packages}{mediums}{$asked_medium}{rpmsdir}/$_" : $_; } sub askChangeMedium($$) { my ($method, $medium) = @_; @@ -81,7 +81,7 @@ sub errorOpeningFile($) { my ($file) = @_; $file eq 'XXX' and return; #- special case to force closing file after rpmlib transaction. $current_medium eq $asked_medium and log::l("errorOpeningFile $file"), return; #- nothing to do in such case. - $::o->{packages}[2]{$asked_medium}{selected} or return; #- not selected means no need for worying about. + $::o->{packages}{mediums}{$asked_medium}{selected} or return; #- not selected means no need for worying about. my $max = 32; #- always refuse after $max tries. if ($::o->{method} eq "cdrom") { @@ -107,7 +107,7 @@ sub errorOpeningFile($) { #- keep in mind the asked medium has been refused on this way. #- this means it is no more selected. - $::o->{packages}[2]{$asked_medium}{selected} = undef; + $::o->{packages}{mediums}{$asked_medium}{selected} = undef; #- on cancel, we can expect the current medium to be undefined too, #- this enable remounting if selecting a package back. @@ -186,7 +186,7 @@ sub setup_postinstall_rpms($$) { #- the complete filename of each package. #- copy the package files in the postinstall RPMS directory. #- last arg is default medium '' known as the CD#1. - pkgs::extractHeaders($prefix, \@toCopy, $packages->[2]{1}); + pkgs::extractHeaders($prefix, \@toCopy, $packages->{mediums}{1}); commands::cp((map { "/tmp/rhimage/" . relGetFile(pkgs::packageFile($_)) } @toCopy), $postinstall_rpms); } sub clean_postinstall_rpms() { @@ -280,7 +280,7 @@ sub setPackages($) { my ($o) = @_; require pkgs; - if (!$o->{packages} || is_empty_hash_ref($o->{packages}[0])) { + if (!$o->{packages} || is_empty_hash_ref($o->{packages}{names})) { $o->{packages} = pkgs::psUsingHdlists($o->{prefix}, $o->{method}); push @{$o->{default_packages}}, "nfs-utils-clients" if $o->{method} eq "nfs"; @@ -318,7 +318,8 @@ sub setPackages($) { push @l, "Glide_V5" if detect_devices::matching_desc('Voodoo 5'); push @l, "Glide_V3-DRI" if detect_devices::matching_desc('Voodoo (3|Banshee)'); push @l, "Device3Dfx", "XFree86-glide-module" if detect_devices::matching_desc('Voodoo'); - $_->{values} = [ map { $_ + 50 } @{$_->{values}} ] foreach grep {$_} map { pkgs::packageByName($o->{packages}, $_) } @l; + pkgs::packageSetValues([ map { $_ + 50 } @{pkgs::packageValues($_)} ]) + foreach grep {$_} map { pkgs::packageByName($o->{packages}, $_) } @l; #- add OpenGL games that are only usefull if a 3D accelerated card is installed. my @gl = (); @@ -339,7 +340,8 @@ sub setPackages($) { push @gl, "csmash", "gltron" if (!detect_devices::matching_desc('Rage 128')); #- does not work well on transparancy. push @gl, "spacecup", "chromium", "tuxracer", "openuniverse"; } - $_->{values} = [ map { $_ + 60 } @{$_->{values}} ] foreach grep {$_} map { pkgs::packageByName($o->{packages}, $_) } @gl; + pkgs::packageSetValues([ map { $_ + 60 } @{pkgs::packageValues($_)} ]) + foreach grep {$_} map { pkgs::packageByName($o->{packages}, $_) } @gl; } else { #- this has to be done to make sure necessary files for urpmi are #- present. @@ -530,7 +532,7 @@ sub g_auto_install(;$) { my $o = {}; require pkgs; - $o->{default_packages} = [ map { pkgs::packageName($_) } grep { pkgs::packageFlagSelected($_) && !pkgs::packageFlagBase($_) } values %{$::o->{packages}[0]} ]; + $o->{default_packages} = [ map { pkgs::packageName($_) } grep { pkgs::packageFlagSelected($_) && !pkgs::packageFlagBase($_) } values %{$::o->{packages}{names}} ]; my @fields = qw(mntpoint type size); $o->{partitions} = [ map { my %l; @l{@fields} = @$_{@fields}; \%l } grep { $_->{mntpoint} } @{$::o->{fstab}} ]; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 9e1a7041f..e07cba7ac 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -244,7 +244,7 @@ sub setPackages { my ($o) = @_; install_any::setPackages($o); pkgs::selectPackagesAlreadyInstalled($o->{packages}, $o->{prefix}) - if -r "$o->{prefix}/var/lib/rpm/packages.rpm" && !$o->{isUpgrade}; + if !$o->{isUpgrade} && (-r "$o->{prefix}/var/lib/rpm/packages.rpm" || -r "$o->{prefix}/var/lib/rpm/Packages"); } sub selectPackagesToUpgrade { my ($o) = @_; @@ -263,7 +263,7 @@ sub choosePackages { my $availableCorrected = pkgs::invCorrectSize($available / sqr(1024)) * sqr(1024); log::l(sprintf "available size %dMB (corrected %dMB)", $available / sqr(1024), $availableCorrected / sqr(1024)); - foreach (values %{$packages->[0]}) { + foreach (values %{$packages->{names}}) { pkgs::packageSetFlagSkip($_, 0); } @@ -299,7 +299,7 @@ sub beforeInstallPackages { network::add2hosts("$o->{prefix}/etc/hosts", "localhost.localdomain", "127.0.0.1"); require pkgs; - pkgs::init_db($o->{prefix}, $o->{isUpgrade}); + pkgs::init_db($o->{prefix}); } sub pkg_install { @@ -363,7 +363,7 @@ sub installPackages($$) { #- complete REWORK, TODO and TOCHECK! my $time = time; $ENV{DURING_INSTALL} = 1; - pkgs::install($o->{prefix}, $o->{isUpgrade}, \@toInstall, $packages->[1], $packages->[2]); + pkgs::install($o->{prefix}, $o->{isUpgrade}, \@toInstall, $packages->{depslist}, $packages->{mediums}); delete $ENV{DURING_INSTALL}; run_program::rooted($o->{prefix}, 'ldconfig') or die "ldconfig failed!" unless $::g_auto_install; log::l("Install took: ", formatTimeRaw(time - $time)); @@ -440,7 +440,7 @@ Consoles 1,3,4,7 may also contain interesting information"; if ($pkg && pkgs::packageSelectedOrInstalled($pkg)) { install_any::install_urpmi($o->{prefix}, $::oem ? 'cdrom' : $o->{method}, #- HACK - $o->{packages}[2]); + $o->{packages}{mediums}); } if (my $charset = lang::charset($o->{lang}, $o->{prefix})) { eval { update_userkderc("$o->{prefix}/usr/share/config/kdeglobals", 'Locale', Charset => $charset) }; diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index a3ca086a4..ee8d7a2c3 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -298,8 +298,8 @@ sub choosePackagesTree { }; my $add_node = sub { my ($leaf, $root) = @_; - my $p = $packages->[0]{$leaf} or return; - $p->{medium}{selected} or return; + my $p = pkgs::packageByName($packages,$leaf) or return; + pkgs::packageMedium($p)->{selected} or return; my $node = $tree->insert_node($add_parent->($root), undef, [$leaf, '', ''], 5, (undef) x 4, 1, 0); my $pix = pkgs::packageFlagBase($p) ? $pix_base : pkgs::packageFlagSelected($p) ? $pix_selected : pkgs::packageFlagInstalled($p) ? $pix_installed : $pix_unselect; @@ -315,12 +315,12 @@ sub choosePackagesTree { my ($root, $leaf); if ($flat = $_[0]) { $add_node->($_, undef) foreach sort grep { my $pkg = pkgs::packageByName($packages, $_); - $pkg->{medium}{selected} } keys %{$packages->[0]}; + pkgs::packageMedium($pkg)->{selected} } keys %{$packages->{names}}; } else { foreach (sort @$compss) { ($root, $leaf) = m|(.*)/(.+)|o or ($root, $leaf) = ('', $_); my $pkg = pkgs::packageByName($packages, $leaf); - $add_node->($leaf, $root) if $pkg->{medium}{selected}; + $add_node->($leaf, $root) if pkgs::packageMedium($pkg)->{selected}; } } $tree->thaw; @@ -341,20 +341,22 @@ sub choosePackagesTree { $toolbar->set_style("icons"); my $display_info = sub { - my $p = $packages->[0]{$curr} or return gtktext_insert($info_widget, ''); - pkgs::extractHeaders($o->{prefix}, [$p], $p->{medium}); - $p->{header} or die; + my $p = pkgs::packageByName($packages, $curr) or return gtktext_insert($info_widget, ''); + pkgs::extractHeaders($o->{prefix}, [$p], pkgs::packageMedium($p)); + pkgs::packageHeader($p) or die; my $ind = $o->{compssListLevels}{$o->{installClass}}; - my $imp = translate($pkgs::compssListDesc{pkgs::packageFlagBase($p) ? 100 : round_down($p->{values}[$ind], 10)}); + my $imp = translate($pkgs::compssListDesc{pkgs::packageFlagBase($p) ? + 100 : round_down(pkgs::packageValues($p)->[$ind], 10)}); gtktext_insert($info_widget, $@ ? _("Bad package") : _("Name: %s\n", pkgs::packageName($p)) . _("Version: %s\n", pkgs::packageVersion($p) . '-' . pkgs::packageRelease($p)) . _("Size: %d KB\n", pkgs::packageSize($p) / 1024) . ($imp && _("Importance: %s\n", $imp)) . "\n" . - formatLines(c::headerGetEntry($p->{header}, 'description'))); - c::headerFree(delete $p->{header}); + formatLines(c::headerGetEntry(pkgs::packageHeader($p), 'description'))); + pkgs::packageFreeHeader($p); + #c::headerFree(delete $p->[$HEADER]); 0; }; @@ -375,7 +377,7 @@ sub choosePackagesTree { #- check for size before trying to select. my $size = pkgs::selectedSize($packages); foreach (@l) { - my $p = $packages->[0]{$_}; + my $p = $packages->{names}{$_}; pkgs::packageFlagSelected($p) or $size += pkgs::packageSize($p); } if (pkgs::correctSize($size / sqr(1024)) > install_any::getAvailableSpace($o) / sqr(1024)) { @@ -388,7 +390,7 @@ sub choosePackagesTree { join(", ", common::truncate_list(20, sort @l)) ], 1) || return; $isSelection ? pkgs::selectPackage($packages, $_) : pkgs::unselectPackage($packages, $_) foreach @_; foreach (@l) { - my $p = $packages->[0]{$_}; + my $p = $packages->{names}{$_}; my $pix = pkgs::packageFlagSelected($p) ? $pix_selected : $pix_unselect; $tree->node_set_pixmap($_, 1, $pix->[0], $pix->[1]) foreach @{$ptree{$_}}; } @@ -397,7 +399,7 @@ sub choosePackagesTree { $o->ask_warn('', _("You can't select/unselect this package")); } }; - my $children = sub { map { $packages->[0]{($tree->node_get_pixtext($_, 0))[0]} } gtkctree_children($_[0]) }; + my $children = sub { map { $packages->{names}{($tree->node_get_pixtext($_, 0))[0]} } gtkctree_children($_[0]) }; my $toggle = sub { if (ref $curr && ! $_[0]) { $tree->toggle_expansion($curr); @@ -411,7 +413,7 @@ sub choosePackagesTree { $select->(@p); $parent = $curr; } else { - my $p = $packages->[0]{$curr} or return; + my $p = $packages->{names}{$curr} or return; if (pkgs::packageFlagBase($p)) { return $o->ask_warn('', _("This is a mandatory package, it can't be unselected")); } elsif (pkgs::packageFlagInstalled($p)) { @@ -499,8 +501,9 @@ sub installPackages { my $name = $_[0]; $msg->set(_("Installing package %s", $name)); $current_total_size += $last_size; - $last_size = c::headerGetEntry($o->{packages}[0]{$name}{header}, 'size'); - $text->set((split /\n/, c::headerGetEntry($o->{packages}[0]{$name}{header}, 'summary'))[0] || ''); + my $p = pkgs::packageByName($o->{packages}, $name); + $last_size = c::headerGetEntry(pkgs::packageHeader($p), 'size'); + $text->set((split /\n/, c::headerGetEntry(pkgs::packageHeader($p), 'summary'))[0] || ''); $w->flush; } elsif ($m =~ /^Progressing installing package/) { $progress->update($_[2] ? $_[1] / $_[2] : 0); diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 2d9e48083..379b58ecb 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -487,7 +487,7 @@ sub chooseGroups { my $base = pkgs::selectedSize($packages); foreach (@{$o->{compssUsersSorted}}) { my $b = pkgs::saveSelected($packages); - $_->{values}[$ind] < $min_level or pkgs::selectPackage($packages, $_) foreach @{$compssUsers->{$_}}; + pkgs::packageValues($_)->[$ind] < $min_level or pkgs::selectPackage($packages, $_) foreach @{$compssUsers->{$_}}; $size{$_} = pkgs::selectedSize($packages) - $base; pkgs::restoreSelected($b); } @@ -498,7 +498,7 @@ sub chooseGroups { my $b = pkgs::saveSelected($packages); foreach (@{$o->{compssUsersSorted}}) { - $_->{values}[$ind] < $min_level or pkgs::selectPackage($packages, $_) foreach @{$compssUsers->{$_}}; + pkgs::packageValues($_)->[$ind] < $min_level or pkgs::selectPackage($packages, $_) foreach @{$compssUsers->{$_}}; } $size{Miscellaneous} = $max_size - pkgs::selectedSize($packages); pkgs::restoreSelected($b); @@ -526,7 +526,7 @@ sub chooseGroups { unless ($o->{compssUsersChoice}{Miscellaneous}) { my %l; $l{@{$compssUsers->{$_}}} = () foreach @{$o->{compssUsersSorted}}; - exists $l{$_} or pkgs::packageSetFlagSkip($_, 1) foreach values %{$packages->[0]}; + exists $l{$_} or pkgs::packageSetFlagSkip($_, 1) foreach values %{$packages->{names}}; } foreach (@{$o->{compssUsersSorted}}) { $o->{compssUsersChoice}{$_} or pkgs::skipSetWithProvides($packages, @{$compssUsers->{$_}}); @@ -548,7 +548,7 @@ sub chooseCD { unless (grep { /ram3/ } cat_("/proc/mounts")) { #- mono-cd in case of no ramdisk - undef $packages->[2]{$_}{selected} foreach @mediums; + undef $packages->{mediums}{$_}{selected} foreach @mediums; log::l("low memory install, using single CD installation (as it is not ejectable)"); return; } @@ -562,7 +562,7 @@ sub chooseCD { foreach (@mediums) { my $descr = pkgs::mediumDescr($packages, $_); exists $mediumsDescr{$descr} or push @mediumsDescr, $descr; - $mediumsDescr{$descr} ||= $packages->[2]{$_}{selected}; + $mediumsDescr{$descr} ||= $packages->{mediums}{$_}{selected}; } $o->set_help('chooseCD'); @@ -582,17 +582,11 @@ If only some CDs are missing, unselect them, then click Ok."), #- restore true selection of medium (which may have been grouped together) foreach (@mediums) { my $descr = pkgs::mediumDescr($packages, $_); - $packages->[2]{$_}{selected} = $mediumsDescr{$descr}; + $packages->{mediums}{$_}{selected} = $mediumsDescr{$descr}; } } #------------------------------------------------------------------------------ -sub beforeInstallPackages($) { - my ($o) = @_; - my $w = $o->wait_message('', $o->{isUpgrade} ? _("Rebuilding package database") : _("Opening package database")); - $o->SUPER::beforeInstallPackages($o); -} - sub installPackages { my ($o, $packages) = @_; my ($current, $total) = 0; |