aboutsummaryrefslogtreecommitdiffstats
path: root/URPM/Resolve.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-25 20:49:01 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-25 20:49:01 +0000
commitc66332f83de6cad7b18a33b6ebb67007ab7758b4 (patch)
tree0f929833000779f3bf48a291750723f208b29a6d /URPM/Resolve.pm
parentdcce48051ac6abdac65d9104c7a6f2bde8fe94ae (diff)
downloadperl-URPM-c66332f83de6cad7b18a33b6ebb67007ab7758b4.tar
perl-URPM-c66332f83de6cad7b18a33b6ebb67007ab7758b4.tar.gz
perl-URPM-c66332f83de6cad7b18a33b6ebb67007ab7758b4.tar.bz2
perl-URPM-c66332f83de6cad7b18a33b6ebb67007ab7758b4.tar.xz
perl-URPM-c66332f83de6cad7b18a33b6ebb67007ab7758b4.zip
- add filesize to synthesis, add ->filesize to get it, and add
selected_size_filesize() to compute the sum (backport from HEAD)
Diffstat (limited to 'URPM/Resolve.pm')
-rw-r--r--URPM/Resolve.pm23
1 files changed, 21 insertions, 2 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index eb9bfef..659ed1c 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -1340,11 +1340,30 @@ sub disable_selected_and_unrequested_dependencies {
#- side-effects: none
sub selected_size {
my ($urpm, $state) = @_;
- my $size;
+ my ($size) = _selected_size_filesize($urpm, $state, 0);
+ $size;
+}
+#- side-effects: none
+sub selected_size_filesize {
+ my ($urpm, $state) = @_;
+ _selected_size_filesize($urpm, $state, 1);
+}
+#- side-effects: none
+sub _selected_size_filesize {
+ my ($urpm, $state, $compute_filesize) = @_;
+ my ($size, $filesize, $bad_filesize);
foreach (keys %{$state->{selected} || {}}) {
my $pkg = $urpm->{depslist}[$_];
$size += $pkg->size;
+ $compute_filesize or next;
+
+ if (my $n = $pkg->filesize) {
+ $filesize += $n;
+ } elsif (!$bad_filesize) {
+ $urpm->{debug} and $urpm->{debug}("no filesize for package " . $pkg->fullname);
+ $bad_filesize = 1;
+ }
}
foreach (values %{$state->{rejected} || {}}) {
@@ -1352,7 +1371,7 @@ sub selected_size {
$size -= $_->{size};
}
- $size;
+ $size, $bad_filesize ? 0 : $filesize;
}
#- compute installed flags for all packages in depslist.