summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-02-15 17:08:53 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-02-15 17:08:53 +0000
commit2dda5943253074f31ffcf811300365048bf4e6ce (patch)
tree1161c7969042a7331022373d04f13d498d3a2f67
parentfebcdcc30fe947ca4d9b8c12d728434299c8732b (diff)
downloaddrakx-2dda5943253074f31ffcf811300365048bf4e6ce.tar
drakx-2dda5943253074f31ffcf811300365048bf4e6ce.tar.gz
drakx-2dda5943253074f31ffcf811300365048bf4e6ce.tar.bz2
drakx-2dda5943253074f31ffcf811300365048bf4e6ce.tar.xz
drakx-2dda5943253074f31ffcf811300365048bf4e6ce.zip
Support media size check when copying every rpm on HD
-rw-r--r--perl-install/install_steps_gtk.pm14
-rw-r--r--perl-install/pkgs.pm17
2 files changed, 22 insertions, 9 deletions
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index f3cc15d7a..4c54164fa 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -224,7 +224,7 @@ sub reallyChooseGroups {
gtkpack_($w->create_box_with_title(N("Package Group Selection")),
1, $o->{gtk_display_compssUsers}->($entry),
1, '',
- 0, gtknew('HBox', children_loose => [
+ 0, gtknew('HBox', children_loose => [
gtknew('Button', text => N("Help"), clicked => $o->interactive_help_sub_display_id('choosePackages')),
$w_size,
if_($individual,
@@ -235,7 +235,7 @@ sub reallyChooseGroups {
),
);
$w->main;
- 1;
+ 1;
}
sub choosePackagesTree {
@@ -634,11 +634,12 @@ sub summary_prompt {
sub deselectFoundMedia {
#- group by CD
- my ($o, $hdlists) = @_;
+ my ($o, $hdlists, $mediumsize) = @_;
my %cdlist;
my @hdlist2;
my @corresp;
my $i = 0;
+ my $totalsize = 0;
foreach (@$hdlists) {
(my $cd) = $_->[3] =~ /\bCD ?(\d+)\b/;
if (!$cd || !@{$cdlist{$cd} || []}) {
@@ -652,15 +653,20 @@ sub deselectFoundMedia {
$cdlist{$1} ||= [];
push @{$cdlist{$1}}, $i;
}
+ $mediumsize->{$_->[0]} == 0 and $totalsize = -1; #- don't check size, total medium size unknown
+ $totalsize >= 0 and $totalsize += $mediumsize->{$_->[0]};
++$i;
}
my @selection = (1) x @hdlist2;
my $copy_rpms_on_disk = 0;
+ #- check available size for copying rpms from infos in hdlists file
+ if ($totalsize >= 0) {
+ # TODO my $availvar = install_any::getAvailableSpace_mounted('/var');
+ }
if ($o->{method} !~ /-iso$/) {
my $w = ugtk2->new("");
$i = -1;
$w->sync;
- #- TODO check available size for copying rpms from infos in hdlists file
ugtk2::gtkadd(
$w->{window},
gtkpack(
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 595159efa..3a421368b 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -404,7 +404,7 @@ sub psUsingHdlists {
#- parse hdlists file.
my $medium_name = $o_initialmedium || 1;
- my @hdlists;
+ my (@hdlists, %mediumsize);
foreach (<$listf>) {
chomp;
s/\s*#.*$//;
@@ -416,16 +416,23 @@ sub psUsingHdlists {
#- in this hdlist is allowed
if (/^askmedia/) { $deselectionAllowed = 1; next }
my $cdsuppl = index($medium_name, 's') >= 0;
- m/^\s*(noauto:)?(hdlist\S*\.cz2?)\s+(\S+)\s*(.*)$/ or die qq(invalid hdlist description "$_" in hdlists file);
- push @hdlists, [ $2, $medium_name, $3, $4, !$1,
+ my ($noauto, $hdlist, $rpmsdir, $descr, $size) = m/^\s*(noauto:)?(hdlist\S*\.cz2?)\s+(\S+)\s*([^(]*)(\(.+\))?$/
+ or die qq(invalid hdlist description "$_" in hdlists file);
+ $descr =~ s/\s+$//;
+ push @hdlists, [ $hdlist, $medium_name, $rpmsdir, $descr, !$noauto,
#- hdlist path, suppl CDs are mounted on /mnt/cdrom :
- $o_hdlistsprefix ? ($is_ftp ? "media/media_info/$2" : "$o_hdlistsprefix/media/media_info/$2") : undef,
+ $o_hdlistsprefix ? ($is_ftp ? "media/media_info/$hdlist" : "$o_hdlistsprefix/media/media_info/$hdlist") : undef,
];
+ if ($size) {
+ ($mediumsize{$hdlist}) = $size =~ /(\d+)/;
+ } else {
+ $mediumsize{$hdlist} = 0;
+ }
$cdsuppl ? ($medium_name = ($medium_name + 1) . 's') : ++$medium_name;
}
my $copy_rpms_on_disk = 0;
if ($deselectionAllowed && !defined $o_initialmedium) {
- (my $finalhdlists, $copy_rpms_on_disk) = $o->deselectFoundMedia(\@hdlists);
+ (my $finalhdlists, $copy_rpms_on_disk) = $o->deselectFoundMedia(\@hdlists, \%mediumsize);
@hdlists = @$finalhdlists;
}