summaryrefslogtreecommitdiffstats
path: root/perl-install/install_steps_interactive.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-03-19 16:09:59 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-03-19 16:09:59 +0000
commit2ca86a25e8cd37f5a3b3c738bdc9278717eed472 (patch)
tree5bef524ccb37d2eec1f4f648b79874837a102bf4 /perl-install/install_steps_interactive.pm
parent9f2607e3e4d659b82063136418940da050930af8 (diff)
downloaddrakx-2ca86a25e8cd37f5a3b3c738bdc9278717eed472.tar
drakx-2ca86a25e8cd37f5a3b3c738bdc9278717eed472.tar.gz
drakx-2ca86a25e8cd37f5a3b3c738bdc9278717eed472.tar.bz2
drakx-2ca86a25e8cd37f5a3b3c738bdc9278717eed472.tar.xz
drakx-2ca86a25e8cd37f5a3b3c738bdc9278717eed472.zip
(chooseGroups):
- make the computed size work - unselectAll when a profile is unselected
Diffstat (limited to 'perl-install/install_steps_interactive.pm')
-rw-r--r--perl-install/install_steps_interactive.pm30
1 files changed, 24 insertions, 6 deletions
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index f344e5caa..e24f2144b 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -520,10 +520,21 @@ sub choosePackagesTree {
sub chooseGroups {
my ($o, $packages, $compssUsers, $min_level, $individual, $max_size) = @_;
+ my $b = pkgs::saveSelected($packages);
+ pkgs::unselectAllPackages($packages);
+ pkgs::setSelectedFromCompssList($packages, {}, $min_level, $max_size);
my $system_size = pkgs::selectedSize($packages);
- my $sizes = pkgs::computeGroupSize($packages, $min_level);
+ my ($sizes, $pkgs) = pkgs::computeGroupSize($packages, $min_level);
+ pkgs::restoreSelected($b);
+ log::l("system_size: $system_size");
+
+ my @groups = @{$o->{compssUsersSorted}};
+ my %stable_flags = grep_each { $::b } %{$o->{compssUsersChoice}};
+ delete $stable_flags{$_} foreach map { @{$compssUsers->{$_}{flags}} } @groups;
+
my $compute_size = sub {
- my %flags; @flags{@_} = ();
+ my %pkgs;
+ my %flags = %stable_flags; @flags{@_} = ();
my $total_size;
A: while (my ($k, $size) = each %$sizes) {
Or: foreach (split "\t", $k) {
@@ -531,24 +542,31 @@ sub chooseGroups {
exists $flags{$_} or next Or;
}
$total_size += $size;
+ $pkgs{$_} = 1 foreach @{$pkgs->{$k}};
next A;
}
}
+ log::l("computed size $total_size");
+ log::l("chooseGroups: ", join(" ", sort keys %pkgs));
+
int $total_size;
};
- my @groups = @{$o->{compssUsersSorted}};
my %val;
foreach (@groups) {
$val{$_} = ! grep { ! $o->{compssUsersChoice}{$_} } @{$compssUsers->{$_}{flags}};
}
# @groups = grep { $size{$_} = round_down($size{$_} / sqr(1024), 10) } @groups; #- don't display the empty or small one (eg: because all packages are below $min_level)
- my ($all, $size_text, $path);
+ my ($all, $size_text, $old_size, $path);
my $update_size = sub {
my $size = $system_size + $compute_size->(map { @{$compssUsers->{$_}{flags}} } grep { $val{$_} } @groups);
+
+ #- if a profile is deselected, deselect everything (easier than deselecting the profile packages)
+ $old_size > $size and pkgs::unselectAllPackages($packages);
+ $old_size = $size;
$size_text = _("Selected size %d%s", pkgs::correctSize($size / sqr(1024)), _("MB"));
}; &$update_size;
$o->ask_from_entries_refH('', _("Package Group Selection"), [
-# { val => \$size_text, type => 'label' }, {},
+ { val => \$size_text, type => 'label' }, {},
(map {;
my $old = $path;
$path = $o->{compssUsers}{$_}{path};
@@ -570,7 +588,7 @@ sub chooseGroups {
if_($individual, { text => _("Individual package selection"), val => $individual, advanced => 1, type => 'bool' }),
], changed => $update_size) or return;
if ($all) {
- $o->{compssUsersChoice}{$_} = 1 foreach map { @{$compssUsers->{$_}{flags}} } @{$o->{compssUsersSorted}};
+ $o->{compssUsersChoice}{$_} = 1 foreach map { @{$compssUsers->{$_}{flags}} } @groups;
} else {
$o->{compssUsersChoice}{$_} = 0 foreach map { @{$compssUsers->{$_}{flags}} } grep { !$val{$_} } keys %val;
$o->{compssUsersChoice}{$_} = 1 foreach map { @{$compssUsers->{$_}{flags}} } grep { $val{$_} } keys %val;