aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-23 07:25:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-23 07:25:30 +0000
commit5e426948b85259c62038494d2a850a900dfa9023 (patch)
treed052f28d39d9721e2b7398a0d5d9118bc1fe79f6 /src
parent950188b3424c66b395db6583073533d6cbf5e421 (diff)
downloadpaludis-5e426948b85259c62038494d2a850a900dfa9023.tar.gz
paludis-5e426948b85259c62038494d2a850a900dfa9023.tar.xz
Display size of downloads as part of pretend install output. (Victor Meyerson)
Diffstat (limited to 'src')
-rw-r--r--src/output/console_install_task.cc8
-rw-r--r--src/output/console_install_task.hh11
2 files changed, 19 insertions, 0 deletions
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index cc8550d..bbc1423 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -23,6 +23,7 @@
#include "mask_displayer.hh"
#include <paludis/util/log.hh>
+#include <paludis/util/pretty_print.h>
#include <paludis/util/sr.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/tokeniser.hh>
@@ -122,6 +123,7 @@ ConsoleInstallTask::ConsoleInstallTask(Environment * const env,
const DepListOptions & options,
tr1::shared_ptr<const DestinationsSet> d) :
InstallTask(env, options, d),
+ _download_size(0),
_all_tags(new Set<DepTagEntry>),
_all_use_descriptions(new Set<UseDescription, UseDescriptionComparator>),
_all_expand_prefixes(new UseFlagNameSet)
@@ -573,6 +575,11 @@ ConsoleInstallTask::display_merge_list_post_counts()
need_comma = true;
}
s << ")";
+
+ if (get_download_size())
+ {
+ s << ", at most " << pretty_print_bytes(get_download_size()) << " to download";
+ }
}
if (count<max_count>() && count<error_count>())
@@ -1180,6 +1187,7 @@ ConsoleInstallTask::display_merge_list_entry_distsize(const DepListEntry & d,
output_stream() << d.package_id->size_of_download_required_key()->pretty_print()
<< " to download";
+ set_download_size(get_download_size() + d.package_id->size_of_download_required_key()->value());
}
void
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index cb80ac6..35e2fcf 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -113,6 +113,7 @@ namespace paludis
private:
int _counts[last_count];
+ long _download_size;
tr1::shared_ptr<Set<DepTagEntry> > _all_tags;
tr1::shared_ptr<Set<UseDescription, UseDescriptionComparator> > _all_use_descriptions;
tr1::shared_ptr<UseFlagNameSet> _all_expand_prefixes;
@@ -270,6 +271,16 @@ namespace paludis
_counts[count_] = value;
}
+ long get_download_size() const
+ {
+ return _download_size;
+ }
+
+ void set_download_size(const long value)
+ {
+ _download_size = value;
+ }
+
tr1::shared_ptr<Set<DepTagEntry> > all_tags()
{
return _all_tags;