From 63b06831d3c1ee0eb8d6cb5f53a5682b512fb5dd Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 13 Oct 2009 17:00:12 +0000 Subject: check the FS has enough space before trying to download all packages --- urpm/get_pkgs.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'urpm/get_pkgs.pm') diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm index 972e1fba..1da874ca 100644 --- a/urpm/get_pkgs.pm +++ b/urpm/get_pkgs.pm @@ -165,6 +165,27 @@ sub verify_partial_rpm_and_move { "$cachedir/rpms/$filename"; } +# get the filesize of packages to download from remote media. +sub get_distant_media_filesize { + my ($urpm, $blists, $sources) = @_; + + my $filesize; + #- get back all ftp and http accessible rpm files into the local cache + foreach my $blist (@$blists) { + #- examine all files to know what can be indexed on multiple media. + while (my ($id, $pkg) = each %{$blist->{pkgs}}) { + #- the given URL is trusted, so the file can safely be ignored. + defined $sources->{$id} and next; + if (!urpm::is_local_medium($blist->{medium})) { + if (my $n = $pkg->filesize) { + $filesize += $n; + } + } + } + } + $filesize; +} + # download packages listed in $blists, # and put the result in $sources or $error_sources # -- cgit v1.2.1