aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2008-01-02 02:25:11 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2008-01-02 02:25:11 +0000
commitd7efa945288cbb5802b6b0d9c368e05be2360aea (patch)
treee67d3c62ece62aa140b9b7af95031e6146c4e227
parent843c1e057121600a2869b5f0e2d77e665ee16dcc (diff)
downloadpaludis-d7efa945288cbb5802b6b0d9c368e05be2360aea.tar.gz
paludis-d7efa945288cbb5802b6b0d9c368e05be2360aea.tar.xz
Add MetadataSizeKey, and two new PackageID keys, UNDOWNLOADEDDISTFILESIZE and TOTALDISTFILESIZE.
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc6
-rw-r--r--paludis/metadata_key-fwd.hh1
-rw-r--r--paludis/metadata_key.cc5
-rw-r--r--paludis/metadata_key.hh35
-rw-r--r--paludis/package_id.hh14
-rw-r--r--paludis/repositories/cran/cran_package_id.cc11
-rw-r--r--paludis/repositories/cran/cran_package_id.hh3
-rw-r--r--paludis/repositories/e/Makefile.am2
-rw-r--r--paludis/repositories/e/distfiles_size_visitor.cc145
-rw-r--r--paludis/repositories/e/distfiles_size_visitor.hh71
-rw-r--r--paludis/repositories/e/e_key.cc70
-rw-r--r--paludis/repositories/e/e_key.hh23
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc43
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh49
-rw-r--r--paludis/repositories/e/ebuild_id.cc45
-rw-r--r--paludis/repositories/e/ebuild_id.hh2
-rw-r--r--paludis/repositories/e/qa/spec_keys.cc4
-rw-r--r--paludis/repositories/e/vdb_id.cc12
-rw-r--r--paludis/repositories/e/vdb_id.hh2
-rw-r--r--paludis/repositories/fake/fake_package_id.cc12
-rw-r--r--paludis/repositories/fake/fake_package_id.hh2
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc12
-rw-r--r--paludis/repositories/unpackaged/installed_id.hh2
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc12
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.hh2
-rw-r--r--paludis/repositories/virtuals/package_id.cc12
-rw-r--r--paludis/repositories/virtuals/package_id.hh2
-rw-r--r--python/metadata_key.cc5
-rw-r--r--ruby/metadata_key.cc23
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc5
-rw-r--r--src/clients/inquisitio/key_extractor.cc5
-rw-r--r--src/clients/instruo/instruo.cc5
-rw-r--r--src/clients/paludis/applets.cc5
-rw-r--r--src/clients/paludis/info.cc5
-rw-r--r--src/clients/qualudis/qualudis.cc5
-rw-r--r--src/output/console_install_task.cc23
-rw-r--r--src/output/console_install_task.hh1
-rw-r--r--src/output/console_query_task.cc17
-rw-r--r--src/output/mask_displayer.cc5
39 files changed, 703 insertions, 0 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index 8de9f39..404f297 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -58,6 +58,12 @@ namespace
cout << indent << left << setw(30) << " Value:" << " " << key.value() << endl;
}
+ void visit(const MetadataSizeKey & key)
+ {
+ cout << indent << left << setw(30) << " Class:" << " " << "MetadataSizeKey" << endl;
+ cout << indent << left << setw(30) << " Value:" << " " << key.value() << endl;
+ }
+
void visit(const MetadataFSEntryKey & key)
{
cout << indent << left << setw(30) << " Class:" << " " << "MetadataFSEntryKey" << endl;
diff --git a/paludis/metadata_key-fwd.hh b/paludis/metadata_key-fwd.hh
index 659096a..db69d35 100644
--- a/paludis/metadata_key-fwd.hh
+++ b/paludis/metadata_key-fwd.hh
@@ -37,6 +37,7 @@ namespace paludis
class MetadataKey;
class MetadataPackageIDKey;
class MetadataStringKey;
+ class MetadataSizeKey;
class MetadataContentsKey;
class MetadataTimeKey;
class MetadataRepositoryMaskInfoKey;
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index c1f75c1..9517ced 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -84,6 +84,11 @@ MetadataStringKey::MetadataStringKey(const std::string & r, const std::string &
{
}
+MetadataSizeKey::MetadataSizeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
+ MetadataKey(r, h, t)
+{
+}
+
MetadataFSEntryKey::MetadataFSEntryKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
MetadataKey(r, h, t)
{
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 862830a..ede5400 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -75,6 +75,7 @@ namespace paludis
MetadataSpecTreeKey<ProvideSpecTree>,
MetadataSpecTreeKey<RestrictSpecTree>,
MetadataStringKey,
+ MetadataSizeKey,
MetadataContentsKey,
MetadataTimeKey,
MetadataRepositoryMaskInfoKey,
@@ -203,6 +204,40 @@ namespace paludis
};
/**
+ * A MetadataSizeKey is a MetadataKey that represents the size of a file or
+ * some files on disk in bytes.
+ *
+ * \ingroup g_metadata_key
+ * \since 0.26
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE MetadataSizeKey :
+ public MetadataKey,
+ public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataSizeKey>
+ {
+ protected:
+ ///\name Basic operations
+ ///\{
+
+ MetadataSizeKey(const std::string &, const std::string &, const MetadataKeyType);
+
+ ///\}
+
+ public:
+ /**
+ * Fetch our raw value.
+ */
+ virtual long value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Get a pretty string version of our value.
+ */
+ virtual std::string pretty_print() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
+ /**
* A MetadataFSEntryKey is a MetadataKey that has an FSEntry as its value.
*
* \ingroup g_metadata_key
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 42c409d..a955bdd 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -281,6 +281,20 @@ namespace paludis
*/
virtual const tr1::shared_ptr<const MetadataFSEntryKey> fs_location_key() const = 0;
+ /**
+ * The size_of_download_required_key, if non-zero, contains a
+ * long integer representing the size of distfiles that still need
+ * to be downloaded.
+ */
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_download_required_key() const = 0;
+
+ /**
+ * The size_of_all_distfiles_key, if non-zero, contains a long
+ * integer representing the size of all distfiles used by the
+ * package with the current USE settings.
+ */
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const = 0;
+
///\}
///\name Finding and iterating over metadata keys
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index e2539ca..f00aeca 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -537,3 +537,14 @@ CRANPackageID::fs_location_key() const
return _imp->fs_location_key;
}
+const tr1::shared_ptr<const MetadataSizeKey>
+CRANPackageID::size_of_download_required_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
+const tr1::shared_ptr<const MetadataSizeKey>
+CRANPackageID::size_of_all_distfiles_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
diff --git a/paludis/repositories/cran/cran_package_id.hh b/paludis/repositories/cran/cran_package_id.hh
index 422cc55..5f50ae5 100644
--- a/paludis/repositories/cran/cran_package_id.hh
+++ b/paludis/repositories/cran/cran_package_id.hh
@@ -76,6 +76,9 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
virtual const tr1::shared_ptr<const MetadataPackageIDKey> contained_in_key() const;
virtual const tr1::shared_ptr<const MetadataFSEntryKey> fs_location_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_download_required_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const;
+
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const PALUDIS_ATTRIBUTE((noreturn));
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index ec36387..aa18120 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -80,6 +80,7 @@ paludis_repositories_e_include_HEADERS = \
make_ebuild_repository.hh \
manifest2_entry-sr.hh \
manifest2_reader.hh \
+ distfiles_size_visitor.hh \
package_dep_spec.hh \
pipe_command_handler.hh \
source_uri_finder.hh \
@@ -129,6 +130,7 @@ libpaludiserepository_la_SOURCES = \
make_ebin_repository.cc \
make_ebuild_repository.cc \
manifest2_reader.cc \
+ distfiles_size_visitor.cc \
package_dep_spec.cc \
pipe_command_handler.cc \
registration.cc \
diff --git a/paludis/repositories/e/distfiles_size_visitor.cc b/paludis/repositories/e/distfiles_size_visitor.cc
new file mode 100644
index 0000000..a5883bd
--- /dev/null
+++ b/paludis/repositories/e/distfiles_size_visitor.cc
@@ -0,0 +1,145 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Mike Kelly
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/distfiles_size_visitor.hh>
+#include <paludis/repositories/e/source_uri_finder.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/manifest2_reader.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_id.hh>
+#include <paludis/action.hh>
+#include <paludis/repository.hh>
+#include <paludis/about.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <iostream>
+#include <list>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<DistfilesSizeVisitor>
+ {
+ const Environment * const env;
+ const tr1::shared_ptr<const PackageID> id;
+ const FSEntry distdir;
+ tr1::shared_ptr<const URILabel> default_label;
+ bool everything;
+ const tr1::shared_ptr<Manifest2Reader> m2r;
+
+ std::list<const URILabel *> labels;
+ size_t size;
+
+ Implementation(
+ const Environment * const e,
+ const tr1::shared_ptr<const PackageID> & i,
+ const FSEntry & d,
+ const tr1::shared_ptr<const URILabel> & n,
+ const bool ev,
+ const tr1::shared_ptr<Manifest2Reader> mr) :
+ env(e),
+ id(i),
+ distdir(d),
+ default_label(n),
+ everything(ev),
+ m2r(mr),
+ size(0)
+ {
+ labels.push_front(default_label.get());
+ }
+ };
+}
+
+DistfilesSizeVisitor::DistfilesSizeVisitor(
+ const Environment * const e,
+ const tr1::shared_ptr<const PackageID> & i,
+ const FSEntry & d,
+ const tr1::shared_ptr<const URILabel> & n,
+ const bool ev,
+ const tr1::shared_ptr<Manifest2Reader> mr) :
+ PrivateImplementationPattern<DistfilesSizeVisitor>(new Implementation<DistfilesSizeVisitor>(e, i, d, n, ev, mr))
+{
+}
+
+DistfilesSizeVisitor::~DistfilesSizeVisitor()
+{
+}
+
+void
+DistfilesSizeVisitor::visit_sequence(const UseDepSpec & u,
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator end)
+{
+ if (_imp->env->query_use(u.flag(), *_imp->id) ^ u.inverse())
+ {
+ _imp->labels.push_front(* _imp->labels.begin());
+ std::for_each(cur, end, accept_visitor(*this));
+ _imp->labels.pop_front();
+ }
+}
+
+void
+DistfilesSizeVisitor::visit_sequence(const AllDepSpec &,
+ FetchableURISpecTree::ConstSequenceIterator cur,
+ FetchableURISpecTree::ConstSequenceIterator end)
+{
+ _imp->labels.push_front(* _imp->labels.begin());
+ std::for_each(cur, end, accept_visitor(*this));
+ _imp->labels.pop_front();
+}
+
+void
+DistfilesSizeVisitor::visit_leaf(const URILabelsDepSpec & l)
+{
+ for (URILabelsDepSpec::ConstIterator i(l.begin()), i_end(l.end()) ;
+ i != i_end ; ++i)
+ *_imp->labels.begin() = i->get();
+}
+
+void
+DistfilesSizeVisitor::visit_leaf(const FetchableURIDepSpec & u)
+{
+ Context context("When visiting URI dep spec '" + stringify(u.text()) + "':");
+
+ FSEntry destination(_imp->distdir / u.filename());
+
+ if (destination.exists() && ! _imp->everything)
+ return;
+ long s((*_imp->m2r->find("DIST", u.filename())).size);
+ Log::get_instance()->message(ll_debug, lc_context) << "Adding " << s << " to size. Was "
+ << _imp->size << ", is now " << (_imp->size + s);
+ _imp->size += s;
+}
+
+long
+DistfilesSizeVisitor::size()
+{
+ return _imp->size;
+}
diff --git a/paludis/repositories/e/distfiles_size_visitor.hh b/paludis/repositories/e/distfiles_size_visitor.hh
new file mode 100644
index 0000000..00a98b9
--- /dev/null
+++ b/paludis/repositories/e/distfiles_size_visitor.hh
@@ -0,0 +1,71 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Mike Kelly
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_FETCH_VISITOR_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_FETCH_VISITOR_HH 1
+
+#include <paludis/repositories/e/eapi-fwd.hh>
+#include <paludis/repositories/e/manifest2_reader.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/visitor-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
+#include <paludis/util/tr1_memory.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/dep_tree.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/environment-fwd.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ class PALUDIS_VISIBLE DistfilesSizeVisitor :
+ private PrivateImplementationPattern<DistfilesSizeVisitor>,
+ public ConstVisitor<FetchableURISpecTree>
+ {
+ public:
+ DistfilesSizeVisitor(
+ const Environment * const,
+ const tr1::shared_ptr<const PackageID> &,
+ const FSEntry &,
+ const tr1::shared_ptr<const URILabel> &,
+ const bool,
+ const tr1::shared_ptr<Manifest2Reader>);
+
+ ~DistfilesSizeVisitor();
+
+ void visit_sequence(const AllDepSpec &,
+ FetchableURISpecTree::ConstSequenceIterator,
+ FetchableURISpecTree::ConstSequenceIterator);
+
+ void visit_sequence(const UseDepSpec &,
+ FetchableURISpecTree::ConstSequenceIterator,
+ FetchableURISpecTree::ConstSequenceIterator);
+
+ void visit_leaf(const URILabelsDepSpec &);
+
+ void visit_leaf(const FetchableURIDepSpec &);
+
+ long size();
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 467b5a7..a0c086f 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -46,6 +46,7 @@
#include <vector>
#include <fstream>
#include <map>
+#include <iomanip>
using namespace paludis;
using namespace paludis::erepository;
@@ -1090,3 +1091,72 @@ ECTimeKey::value() const
return *_imp->value;
}
+namespace paludis
+{
+ template <>
+ struct Implementation<EDistSizeKey>
+ {
+ const tr1::shared_ptr<const EFetchableURIKey> src_uri;
+ const tr1::shared_ptr<DistfilesSizeVisitor> dsv;
+ mutable Mutex value_mutex;
+ mutable tr1::shared_ptr<long> value;
+
+ Implementation(const tr1::shared_ptr<const EFetchableURIKey> & s,
+ const tr1::shared_ptr<DistfilesSizeVisitor> & d) :
+ src_uri(s),
+ dsv(d)
+ {
+ }
+ };
+}
+
+EDistSizeKey::EDistSizeKey(const std::string & r, const std::string & h, const MetadataKeyType t,
+ const tr1::shared_ptr<const EFetchableURIKey> & s,
+ const tr1::shared_ptr<DistfilesSizeVisitor> & d) :
+ MetadataSizeKey(r, h, t),
+ PrivateImplementationPattern<EDistSizeKey>(new Implementation<EDistSizeKey>(s, d)),
+ _imp(PrivateImplementationPattern<EDistSizeKey>::_imp)
+{
+}
+
+EDistSizeKey::~EDistSizeKey()
+{
+}
+
+long
+EDistSizeKey::value() const
+{
+ Lock l(_imp->value_mutex);
+
+ if (_imp->value)
+ return *_imp->value;
+
+ _imp->value.reset(new long(0));
+
+ if (_imp->src_uri)
+ _imp->src_uri->value()->accept(*_imp->dsv);
+
+ *_imp->value = _imp->dsv->size();
+
+ return *_imp->value;
+}
+
+std::string
+EDistSizeKey::pretty_print() const
+{
+ double size(value());
+ int i(0);
+ std::string suffix[] = {"Bytes", "kBytes", "MBytes", "GBytes"};
+ std::ostringstream val;
+
+ while (size >= 1024.0 && i < 4)
+ {
+ size /= 1024.0;
+ i++;
+ val << std::fixed << std::setprecision(2);
+ }
+
+ val << size << " " << suffix[i];
+
+ return val.str();
+}
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index aee28d8..755c3ce 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -24,6 +24,8 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/set.hh>
+#include <paludis/repositories/e/distfiles_size_visitor.hh>
+
namespace paludis
{
namespace erepository
@@ -316,6 +318,27 @@ namespace paludis
time_t value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ class EDistSizeKey:
+ public MetadataSizeKey,
+ private PrivateImplementationPattern<EDistSizeKey>
+ {
+ private:
+ PrivateImplementationPattern<EDistSizeKey>::ImpPtr & _imp;
+
+ public:
+ EDistSizeKey(const std::string &, const std::string &, const MetadataKeyType,
+ const tr1::shared_ptr<const EFetchableURIKey> &,
+ const tr1::shared_ptr<DistfilesSizeVisitor> &);
+
+ ~EDistSizeKey();
+
+ long value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ std::string pretty_print() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
}
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 73b3510..389dfe4 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -1341,5 +1341,48 @@ namespace test_cases
}
}
} test_e_repository_install_exheres_0;
+
+ /**
+ * \test Test ERepository Distfile Size querying (total needed to
+ * download, and amount downloaded.
+ */
+ struct ERepositoryDistSizeTest : TestCase
+ {
+ ERepositoryDistSizeTest() : TestCase("dist_size") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ tr1::shared_ptr<Map<std::string, std::string> > keys(
+ new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", "e_repository_TEST_dir/repo16");
+ keys->insert("profiles", "e_repository_TEST_dir/repo16/profiles/profile");
+ tr1::shared_ptr<ERepository> repo(make_ebuild_repository(
+ &env, keys));
+ env.package_database()->add_repository(1, repo);
+
+ const tr1::shared_ptr<const PackageID> ida(*env.package_database()->
+ query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("category/package-a",
+ UserPackageDepSpecOptions()))), qo_order_by_version)->last());
+ const tr1::shared_ptr<const PackageID> idb(*env.package_database()->
+ query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("category/package-b",
+ UserPackageDepSpecOptions()))), qo_order_by_version)->last());
+ const tr1::shared_ptr<const PackageID> idc(*env.package_database()->
+ query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("category/package-c",
+ UserPackageDepSpecOptions()))), qo_order_by_version)->last());
+
+ TEST_CHECK_EQUAL(ida->size_of_download_required_key()->value(), 0);
+ TEST_CHECK_EQUAL(ida->size_of_all_distfiles_key()->value(), 10);
+ TEST_CHECK_EQUAL(idb->size_of_download_required_key()->value(),
+ idb->size_of_all_distfiles_key()->value());
+ TEST_CHECK_EQUAL(idc->size_of_download_required_key()->value(), 12);
+ TEST_CHECK_EQUAL(idc->size_of_all_distfiles_key()->value(), 22);
+ }
+ } test_e_repository_dist_size;
}
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index b4e01b0..c0dd251 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -910,5 +910,54 @@ virtual/three cat-three/pkg-three
END
cd ..
+mkdir -p repo16/{eclass,distfiles,profiles/profile} || exit 1
+mkdir -p repo16/category/package-{a,b,c} || exit 1
+cd repo16 || exit 1
+echo "test-repo-16" >> profiles/repo_name || exit 1
+echo "category" >> profiles/categories || exit 1
+cat <<END > profiles/profile/make.defaults
+ARCH=test
+END
+cat <<END > category/package-a/package-a-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI="foo"
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+DEPEND=""
+END
+cat <<END > category/package-b/package-b-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI="bar"
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+DEPEND=""
+END
+cat <<END > category/package-c/package-c-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI="foo bar"
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+DEPEND=""
+END
+echo "something" > distfiles/foo || exit 1
+cat <<END > Manifest || exit 1
+DIST bar 12 RMD160 90bd2a71cf9d8cf744b0afc0e9a00b999bb59f72 SHA256 27cd06afc317a809166e7730736663b9f09dd863fcc37b69d32d4f5eb58708b2
+DIST foo 10 RMD160 9e19cc1527a061585aa02dae8b7f4047dcd16275 SHA256 4bc453b53cb3d914b45f4b250294236adba2c0e09ff6f03793949e7e39fd4cc1
+END
+cp Manifest category/package-a/
+cp Manifest category/package-b/
+cp Manifest category/package-c/
+rm Manifest
+cd ..
+
cd ..
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 0ea7897..6b77f1b 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -26,6 +26,8 @@
#include <paludis/repositories/e/e_key.hh>
#include <paludis/repositories/e/e_mask.hh>
#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/distfiles_size_visitor.hh>
+#include <paludis/repositories/e/manifest2_reader.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
@@ -88,6 +90,8 @@ namespace paludis
mutable tr1::shared_ptr<const EDependenciesKey> build_dependencies;
mutable tr1::shared_ptr<const EDependenciesKey> run_dependencies;
mutable tr1::shared_ptr<const EDependenciesKey> post_dependencies;
+ mutable tr1::shared_ptr<const EDistSizeKey> size_of_download_required;
+ mutable tr1::shared_ptr<const EDistSizeKey> size_of_all_distfiles;
mutable tr1::shared_ptr<const EProvideKey> provide;
mutable tr1::shared_ptr<const ERestrictKey> restrictions;
mutable tr1::shared_ptr<const EFetchableURIKey> src_uri;
@@ -270,6 +274,33 @@ EbuildID::need_keys_added() const
_imp->profile_mask = make_shared_ptr(new EMutableRepositoryMaskInfoKey(shared_from_this(), "profile_mask", "Profile masked",
tr1::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(*this), mkt_internal));
add_metadata_key(_imp->profile_mask);
+
+ FSEntry m2(_imp->repository->layout()->package_directory(_imp->name) / "Manifest");
+ if (_imp->src_uri && m2.exists())
+ {
+ tr1::shared_ptr<Manifest2Reader> m2r(new Manifest2Reader(m2));
+
+ tr1::shared_ptr<DistfilesSizeVisitor> dsv(new DistfilesSizeVisitor(_imp->environment,
+ shared_from_this(),
+ _imp->repository->params().distdir,
+ _imp->src_uri->initial_label(),
+ false,
+ m2r));
+ tr1::shared_ptr<DistfilesSizeVisitor> dsv2(new DistfilesSizeVisitor(_imp->environment,
+ shared_from_this(),
+ _imp->repository->params().distdir,
+ _imp->src_uri->initial_label(),
+ true,
+ m2r));
+
+ _imp->size_of_download_required.reset(new EDistSizeKey("UNDOWNLOADEDDISTFILESIZE",
+ "Undownloaded Size", mkt_normal, _imp->src_uri, dsv));
+ add_metadata_key(_imp->size_of_download_required);
+
+ _imp->size_of_all_distfiles.reset(new EDistSizeKey("TOTALDISTFILESIZE",
+ "Total Distfiles Size", mkt_normal, _imp->src_uri, dsv2));
+ add_metadata_key(_imp->size_of_all_distfiles);
+ }
}
namespace
@@ -613,6 +644,20 @@ EbuildID::fs_location_key() const
return _imp->fs_location;
}
+const tr1::shared_ptr<const MetadataSizeKey>
+EbuildID::size_of_download_required_key() const
+{
+ need_keys_added();
+ return _imp->size_of_download_required;
+}
+
+const tr1::shared_ptr<const MetadataSizeKey>
+EbuildID::size_of_all_distfiles_key() const
+{
+ need_keys_added();
+ return _imp->size_of_all_distfiles;
+}
+
bool
EbuildID::arbitrary_less_than_comparison(const PackageID &) const
{
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 980b25b..08755d5 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -82,6 +82,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
virtual const tr1::shared_ptr<const MetadataPackageIDKey> contained_in_key() const;
virtual const tr1::shared_ptr<const MetadataFSEntryKey> fs_location_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_download_required_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const;
const tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const;
const tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const;
diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc
index 970b3f7..3e9b766 100644
--- a/paludis/repositories/e/qa/spec_keys.cc
+++ b/paludis/repositories/e/qa/spec_keys.cc
@@ -266,6 +266,10 @@ namespace
{
}
+ void visit(const MetadataSizeKey &)
+ {
+ }
+
void visit(const MetadataTimeKey &)
{
}
diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc
index 9944cc1..8dc6754 100644
--- a/paludis/repositories/e/vdb_id.cc
+++ b/paludis/repositories/e/vdb_id.cc
@@ -618,6 +618,18 @@ VDBID::fs_location_key() const
return _imp->fs_location;
}
+const tr1::shared_ptr<const MetadataSizeKey>
+VDBID::size_of_download_required_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
+const tr1::shared_ptr<const MetadataSizeKey>
+VDBID::size_of_all_distfiles_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
bool
VDBID::arbitrary_less_than_comparison(const PackageID &) const
diff --git a/paludis/repositories/e/vdb_id.hh b/paludis/repositories/e/vdb_id.hh
index 621ffe5..044f044 100644
--- a/paludis/repositories/e/vdb_id.hh
+++ b/paludis/repositories/e/vdb_id.hh
@@ -78,6 +78,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
virtual const tr1::shared_ptr<const MetadataPackageIDKey> contained_in_key() const;
virtual const tr1::shared_ptr<const MetadataFSEntryKey> fs_location_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_download_required_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const;
const tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const;
const tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const;
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 200bff4..5ad7ae0 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -902,6 +902,18 @@ FakePackageID::fs_location_key() const
return tr1::shared_ptr<const MetadataFSEntryKey>();
}
+const tr1::shared_ptr<const MetadataSizeKey>
+FakePackageID::size_of_download_required_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
+const tr1::shared_ptr<const MetadataSizeKey>
+FakePackageID::size_of_all_distfiles_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
std::string
FakeMetadataIUseSetKey::pretty_print_flat(const Formatter<IUseFlag> & f) const
{
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 119c18a..9925b4e 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -221,6 +221,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
virtual const tr1::shared_ptr<const MetadataPackageIDKey> contained_in_key() const;
virtual const tr1::shared_ptr<const MetadataFSEntryKey> fs_location_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_download_required_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const;
const tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const;
const tr1::shared_ptr<FakeMetadataKeywordSetKey> keywords_key();
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 178e18b..3918497 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -505,6 +505,18 @@ InstalledUnpackagedID::fs_location_key() const
return _imp->fs_location_key;
}
+const tr1::shared_ptr<const MetadataSizeKey>
+InstalledUnpackagedID::size_of_download_required_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
+const tr1::shared_ptr<const MetadataSizeKey>
+InstalledUnpackagedID::size_of_all_distfiles_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
namespace
{
struct SupportVisitor :
diff --git a/paludis/repositories/unpackaged/installed_id.hh b/paludis/repositories/unpackaged/installed_id.hh
index 496bffc..6e0e3cb 100644
--- a/paludis/repositories/unpackaged/installed_id.hh
+++ b/paludis/repositories/unpackaged/installed_id.hh
@@ -76,6 +76,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
virtual const tr1::shared_ptr<const MetadataFSEntryKey> fs_location_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_download_required_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 427405b..38b3301 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -274,6 +274,18 @@ UnpackagedID::fs_location_key() const
return _imp->fs_location_key;
}
+const tr1::shared_ptr<const MetadataSizeKey>
+UnpackagedID::size_of_download_required_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
+const tr1::shared_ptr<const MetadataSizeKey>
+UnpackagedID::size_of_all_distfiles_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
bool
UnpackagedID::supports_action(const SupportsActionTestBase & test) const
{
diff --git a/paludis/repositories/unpackaged/unpackaged_id.hh b/paludis/repositories/unpackaged/unpackaged_id.hh
index 2790dc9..a028d3a 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.hh
+++ b/paludis/repositories/unpackaged/unpackaged_id.hh
@@ -74,6 +74,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
virtual const tr1::shared_ptr<const MetadataFSEntryKey> fs_location_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_download_required_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 6304423..27c5a51 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -514,3 +514,15 @@ VirtualsPackageID::fs_location_key() const
return tr1::shared_ptr<const MetadataFSEntryKey>();
}
+const tr1::shared_ptr<const MetadataSizeKey>
+VirtualsPackageID::size_of_download_required_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
+const tr1::shared_ptr<const MetadataSizeKey>
+VirtualsPackageID::size_of_all_distfiles_key() const
+{
+ return tr1::shared_ptr<const MetadataSizeKey>();
+}
+
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index fe33c8c..e82afd3 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -102,6 +102,8 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
virtual const tr1::shared_ptr<const MetadataPackageIDKey> contained_in_key() const;
virtual const tr1::shared_ptr<const MetadataFSEntryKey> fs_location_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_download_required_key() const;
+ virtual const tr1::shared_ptr<const MetadataSizeKey> size_of_all_distfiles_key() const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index 8902fb3..fa613ae 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -59,6 +59,11 @@ class MetadataKeySptrToPythonVisitor :
obj = bp::object(tr1::static_pointer_cast<const MetadataStringKey>(_m_ptr));
}
+ void visit(const MetadataSizeKey & k)
+ {
+ obj = bp::object(tr1::static_pointer_cast<const MetadataSizeKey>(_m_ptr));
+ }
+
void visit(const MetadataTimeKey & k)
{
obj = bp::object(tr1::static_pointer_cast<const MetadataTimeKey>(_m_ptr));
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index 421e307..7557559 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -37,6 +37,7 @@ namespace
static VALUE c_metadata_key;
static VALUE c_metadata_package_id_key;
static VALUE c_metadata_string_key;
+ static VALUE c_metadata_size_key;
static VALUE c_metadata_time_key;
static VALUE c_metadata_contents_key;
static VALUE c_metadata_repository_mask_info_key;
@@ -107,6 +108,12 @@ namespace
new tr1::shared_ptr<const MetadataKey>(mm));
}
+ void visit(const MetadataSizeKey &)
+ {
+ value = Data_Wrap_Struct(c_metadata_size_key, 0, &Common<tr1::shared_ptr<const MetadataKey> >::free,
+ new tr1::shared_ptr<const MetadataKey>(mm));
+ }
+
void visit(const MetadataTimeKey &)
{
value = Data_Wrap_Struct(c_metadata_time_key, 0, &Common<tr1::shared_ptr<const MetadataKey> >::free,
@@ -246,6 +253,14 @@ namespace
}
VALUE
+ metadata_size_key_value(VALUE self)
+ {
+ tr1::shared_ptr<const MetadataKey> * self_ptr;
+ Data_Get_Struct(self, tr1::shared_ptr<const MetadataKey>, self_ptr);
+ return LONG2NUM((tr1::static_pointer_cast<const MetadataSizeKey>(*self_ptr))->value());
+ }
+
+ VALUE
metadata_fsentry_key_value(VALUE self)
{
tr1::shared_ptr<const MetadataKey> * self_ptr;
@@ -378,6 +393,14 @@ namespace
rb_define_method(c_metadata_string_key, "value", RUBY_FUNC_CAST(&metadata_string_key_value), 0);
/*
+ * Document-class: Paludis::MetadataSizeKey
+ *
+ * Metadata class for file sizes
+ */
+ c_metadata_size_key = rb_define_class_under(paludis_module(), "MetadataSizeKey", c_metadata_key);
+ rb_define_method(c_metadata_size_key, "value", RUBY_FUNC_CAST(&metadata_size_key_value), 0);
+
+ /*
* Document-class: Paludis::MetadataFSEntryKey
*
* Metadata class for FSEntry
diff --git a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
index 155cd62..bf154ee 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
@@ -174,6 +174,11 @@ namespace gtkpaludis
got_key(k, markup_escape(stringify(k.value())));
}
+ void visit(const MetadataSizeKey & k)
+ {
+ got_key(k, markup_escape(stringify(k.value())));
+ }
+
void visit(const MetadataTimeKey & k)
{
char buf[255];
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index ccdfa74..250d598 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -202,6 +202,11 @@ namespace
result = _m(s.value());
}
+ void visit(const MetadataSizeKey & s)
+ {
+ result = _m(stringify(s.value()));
+ }
+
void visit(const MetadataTimeKey & s)
{
result = _m(stringify(s.value()));
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 231a169..1813f3d 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -55,6 +55,11 @@ namespace
const std::string & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
+ void visit(const MetadataSizeKey & k)
+ {
+ long PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ }
+
void visit(const MetadataPackageIDKey & k)
{
const tr1::shared_ptr<const PackageID> & PALUDIS_ATTRIBUTE((unused)) p(k.value());
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 5c32a1a..f439113 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -57,6 +57,11 @@ namespace
std::cout << k.value() << std::endl;
}
+ void visit(const MetadataSizeKey & k)
+ {
+ std::cout << k.value() << std::endl;
+ }
+
void visit(const MetadataFSEntryKey & k)
{
std::cout << k.value() << std::endl;
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 3ae98fb..7bc2696 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -82,6 +82,11 @@ namespace
cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl;
}
+ void visit(const MetadataSizeKey & k)
+ {
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl;
+ }
+
void visit(const MetadataFSEntryKey & k)
{
cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl;
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index 37b6e50..eae8324 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -130,6 +130,11 @@ namespace
stream << k.raw_name() << ": " << k.value() << "\n";
}
+ void visit(const MetadataSizeKey & k)
+ {
+ stream << k.raw_name() << ": " << k.value() << "\n";
+ }
+
void visit(const MetadataTimeKey & k)
{
stream << k.raw_name() << ": " << k.value() << "\n";
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 84b15eb..9de4e6c 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -370,6 +370,7 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
display_merge_list_entry_package_tags(d, m);
display_merge_list_entry_description(d, existing_repo, existing_slot_repo, m);
display_merge_list_entry_use(d, existing_repo, existing_slot_repo, m);
+ display_merge_list_entry_distsize(d, m);
if (want_compact())
display_merge_list_entry_package_tags(d, m);
display_merge_list_entry_end(d, m);
@@ -1158,6 +1159,28 @@ ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
}
void
+ConsoleInstallTask::display_merge_list_entry_distsize(const DepListEntry & d,
+ const DisplayMode m)
+{
+ if (normal_entry != m && suggested_entry != m)
+ return;
+
+ if (! d.package_id->size_of_download_required_key() || d.package_id->size_of_download_required_key()->value() == 0)
+ return;
+
+ if (want_compact())
+ output_no_endl(" ");
+ else
+ {
+ output_endl();
+ output_no_endl(" ");
+ }
+
+ output_stream() << d.package_id->size_of_download_required_key()->pretty_print()
+ << " to download";
+}
+
+void
ConsoleInstallTask::display_merge_list_entry_non_package_tags(const DepListEntry & d, const DisplayMode m)
{
if (d.tags->empty())
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index f18ed86..cb80ac6 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -226,6 +226,7 @@ namespace paludis
virtual void display_merge_list_entry_use(const DepListEntry &,
tr1::shared_ptr<const PackageIDSequence>,
tr1::shared_ptr<const PackageIDSequence>, const DisplayMode);
+ virtual void display_merge_list_entry_distsize(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_non_package_tags(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_package_tags(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_end(const DepListEntry &, const DisplayMode);
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 50e0c22..dbd0d7f 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -519,6 +519,23 @@ namespace
}
}
+ void visit(const MetadataSizeKey & k)
+ {
+ if (k.type() == type)
+ {
+ if (task->want_raw())
+ {
+ task->output_left_column(k.raw_name() + ":", in);
+ task->output_right_column(stringify(k.value()));
+ }
+ else
+ {
+ task->output_left_column(k.human_name() + ":", in);
+ task->output_right_column(k.pretty_print());
+ }
+ }
+ }
+
void visit(const MetadataSectionKey & k)
{
if (k.type() == type)
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index a1d0e49..7e4c83f 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.cc
@@ -69,6 +69,11 @@ namespace
s << k.value();
}
+ void visit(const MetadataSizeKey & k)
+ {
+ s << k.value();
+ }
+
void visit(const MetadataSectionKey & k)
{
s << "(";