summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install2.pm7
-rw-r--r--perl-install/install_any.pm7
-rw-r--r--perl-install/install_steps.pm13
-rw-r--r--perl-install/install_steps_interactive.pm23
-rw-r--r--perl-install/pkgs.pm42
5 files changed, 74 insertions, 18 deletions
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 3819c649e..52fa053ca 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -361,8 +361,13 @@ sub formatPartitions {
#------------------------------------------------------------------------------
sub choosePackages {
require pkgs;
+
+ #- always setPackages as it may have to copy hdlist files and depslist file.
+ $o->setPackages;
+
+ #- for the first time, select package to upgrade.
+ #- TOCHECK this may not be the best place for that as package are selected at some other point.
if ($_[1] == 1) {
- $o->setPackages;
$o->selectPackagesToUpgrade($o) if $o->{isUpgrade};
$o->{compssUsersChoice}{$_} = 1 foreach @{$o->{compssUsersSorted}}, 'Miscellaneous';
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 07b80e222..1ec391071 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -297,8 +297,11 @@ sub setPackages($) {
$_->{values} = [ map { $_ + 50 } @{$_->{values}} ] foreach grep {$_} map { pkgs::packageByName($o->{packages}, $_) } @l;
} else {
- #- remove upgrade flag with selection one.
- pkgs::unselectAllPackagesIncludingUpgradable($o->{packages});
+ #- this has to be done to make sure the hdlist files and depslist file are present.
+ pkgs::psUpdateHdlistsDeps($o->{prefix}, $o->{method});
+
+ #- remove upgrade flag with selection one. TOCHECK
+ #pkgs::unselectAllPackagesIncludingUpgradable($o->{packages});
}
}
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 151d6f3fc..99d338c89 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -238,11 +238,16 @@ sub choosePackages {
pkgs::packageSetFlagSkip($_, 0);
pkgs::packageSetFlagUnskip($_, 0);
}
- pkgs::unselectAllPackages($packages);
- pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}};
- add2hash_($o, { compssListLevel => $::expert ? 90 : 80 }) unless $::auto_install;
- pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $o->{compssListLevel}, $availableCorrected, $o->{installClass}) if exists $o->{compssListLevel};
+ #- avoid destroying user selection of packages. TOCHECK
+ if ($first_time) {
+ pkgs::unselectAllPackages($packages);
+ pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}};
+
+ add2hash_($o, { compssListLevel => $::expert ? 90 : 80 }) unless $::auto_install;
+ pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $o->{compssListLevel}, $availableCorrected, $o->{installClass}) if exists $o->{compssListLevel};
+ }
+
$availableCorrected;
}
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index e42245ba3..924f1a6ea 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -285,22 +285,27 @@ sub choosePackages {
$o->chooseGroups($packages, $compssUsers, $compssUsersSorted, \$individual) unless $::beginner || $::corporate;
- my $min_mark = $::beginner ? 25 : 1;
- my @l = values %{$packages->[0]};
- my @flags = map { pkgs::packageFlagSelected($_) } @l;
- pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, 0, $o->{installClass});
- my $max_size = 1 + pkgs::selectedSize($packages); #- avoid division by zero.
- mapn { pkgs::packageSetFlagSelected(@_) } \@l, \@flags;
+ #- avoid reselection of package if individual selection is requested and this is not the first time.
+ if ($first_time || !$individual) {
+ my $min_mark = $::beginner ? 25 : 1;
+ my @l = values %{$packages->[0]};
+ my @flags = map { pkgs::packageFlagSelected($_) } @l;
+ pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, 0, $o->{installClass});
+ my $max_size = 1 + pkgs::selectedSize($packages); #- avoid division by zero.
+ mapn { pkgs::packageSetFlagSelected(@_) } \@l, \@flags;
#- if (!$::beginner && $max_size > $availableC) {
#- $o->ask_okcancel('',
#-_("You need %dMB for a full install of the groups you selected.
#-You can go on anyway, but be warned that you won't get all packages", $max_size / sqr(1024)), 1) or goto &choosePackages
#- }
- my $size2install = $::beginner && $first_time ? $availableC * 0.7 : $o->chooseSizeToInstall($packages, $min_size, $max_size, $availableC, $individual) or goto &choosePackages;
+ my $size2install = $::beginner && $first_time ? $availableC * 0.7 :
+ $o->chooseSizeToInstall($packages, $min_size, $max_size, $availableC, $individual) or goto &choosePackages;
+
+ ($o->{packages_}{ind}) =
+ pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, $size2install, $o->{installClass});
+ }
- ($o->{packages_}{ind}) =
- pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, $size2install, $o->{installClass});
$o->choosePackagesTree($packages, $compss) if $individual;
}
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index a9096a51f..4a90ee3e8 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -361,6 +361,44 @@ sub skipSetWithProvides {
packageSetFlagSkip($_, 1) foreach grep { $_ } map { $_, packageProvides($_) } @l;
}
+sub psUpdateHdlistsDeps {
+ my ($prefix, $method) = @_;
+ my $listf = install_any::getFile('hdlists') or die "no hdlists found";
+
+ #- WARNING: this function should be kept in sync with functions
+ #- psUsingHdlists and psUsingHdlist.
+ #- it purpose it to update hdlist files on system to install.
+
+ #- parse hdlist.list file.
+ my $medium = 1;
+ foreach (<$listf>) {
+ chomp;
+ s/\s*#.*$//;
+ /^\s*$/ and next;
+ m/^\s*(hdlist\S*\.cz2?)\s+(\S+)\s*(.*)$/ or die "invalid hdlist description \"$_\" in hdlists file";
+
+ my ($hdlist, $rpmsdir, $descr) = ($1, $2, $3);
+ my $f = install_any::getFile($hdlist) or die "no $hdlist found";
+
+ #- copy hdlist file directly to $prefix/var/lib/urpmi, this will be used
+ #- for getting header of package during installation or after by urpmi.
+ my $fakemedium = $method . $medium;
+ my $newf = "$prefix/var/lib/urpmi/hdlist.$fakemedium.cz2";
+ -e $newf and do { unlink $newf or die "cannot remove $newf: $!"; };
+ local *F;
+ open F, ">$newf" or die "cannot create $newf: $!";
+ my ($buf, $sz); while (($sz = sysread($f, $buf, 16384))) { syswrite(F, $buf) }
+ close F;
+ symlinkf $newf, "/tmp/$hdlist";
+
+ ++$medium;
+ }
+
+ #- this is necessary for urpmi, but also as hdlist are copied here,
+ #- we can make consistent the directory.
+ install_any::getAndSaveFile("depslist", "$prefix/var/lib/urpmi/depslist");
+}
+
sub psUsingHdlists {
my ($prefix, $method) = @_;
my $listf = install_any::getFile('hdlists') or die "no hdlists found";
@@ -417,7 +455,6 @@ sub psUsingHdlist {
open F, ">$newf" or die "cannot create $newf: $!";
my ($buf, $sz); while (($sz = sysread($f, $buf, 16384))) { syswrite(F, $buf) }
close F;
-
symlinkf $newf, "/tmp/$hdlist";
#- extract filename from archive, this take advantage of verifying
@@ -475,7 +512,8 @@ sub getOtherDeps($$) {
$pkg or log::l("ignoring package $name-$version-$release in depslist is not in hdlist"), next;
$version eq packageVersion($pkg) and $release eq packageRelease($pkg)
- or log::l("warning package $name-$version-$release in depslist mismatch version or release in hdlist ($version ne ", packageVersion($pkg), " or $release ne ", packageRelease($pkg), ")"), next;
+ or log::l("warning package $name-$version-$release in depslist mismatch version or release in hdlist ($version ne ",
+ packageVersion($pkg), " or $release ne ", packageRelease($pkg), ")"), next;
my $index = scalar @{$packages->[1]};
$index >= $pkg->{medium}{min} && $index <= $pkg->{medium}{max}