aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-28 19:59:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-28 19:59:48 +0000
commite73fa3ac11891c1db89e1a600b1edeb9395d86c9 (patch)
tree33e6e5dd22b3966adb597560e0b2974227486870
parent39c10fbf49ba2fa25bd02353a74cf1cb0273dbe7 (diff)
downloadpaludis-e73fa3ac11891c1db89e1a600b1edeb9395d86c9.tar.gz
paludis-e73fa3ac11891c1db89e1a600b1edeb9395d86c9.tar.xz
r3632@snowflake: ciaranm | 2007-06-28 20:59:15 +0100
Move some repository interfaces into ID methods
-rw-r--r--paludis/contents-fwd.hh55
-rw-r--r--paludis/contents.hh25
-rw-r--r--paludis/dep_list/dep_list.cc5
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/metadata_key-fwd.hh2
-rw-r--r--paludis/metadata_key.cc10
-rw-r--r--paludis/metadata_key.hh30
-rw-r--r--paludis/package_id.hh4
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc1
-rw-r--r--paludis/repositories/fake/fake_package_id.cc24
-rw-r--r--paludis/repositories/fake/fake_package_id.hh4
-rw-r--r--paludis/repositories/fake/fake_repository.cc1
-rw-r--r--paludis/repositories/gems/gem_specification.cc24
-rw-r--r--paludis/repositories/gems/gem_specification.hh5
-rw-r--r--paludis/repositories/gems/gem_specification_TEST.cc8
-rw-r--r--paludis/repositories/gems/gems_repository.cc1
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc1
-rw-r--r--paludis/repositories/gentoo/e_key.cc151
-rw-r--r--paludis/repositories/gentoo/e_key.hh33
-rw-r--r--paludis/repositories/gentoo/ebuild_id.cc24
-rw-r--r--paludis/repositories/gentoo/ebuild_id.hh4
-rw-r--r--paludis/repositories/gentoo/portage_repository.cc1
-rw-r--r--paludis/repositories/gentoo/vdb_id.cc124
-rw-r--r--paludis/repositories/gentoo/vdb_id.hh4
-rw-r--r--paludis/repositories/gentoo/vdb_repository.cc117
-rw-r--r--paludis/repositories/gentoo/vdb_repository.hh8
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc1
-rw-r--r--paludis/repositories/virtuals/package_id.cc24
-rw-r--r--paludis/repositories/virtuals/package_id.hh4
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc1
-rw-r--r--paludis/repository-fwd.hh1
-rw-r--r--paludis/repository.cc16
-rw-r--r--paludis/repository.hh56
-rw-r--r--paludis/repository.sr1
-rw-r--r--src/clients/paludis/do_contents.cc5
-rw-r--r--src/clients/paludis/owner.cc7
-rw-r--r--src/output/console_query_task.cc10
37 files changed, 553 insertions, 241 deletions
diff --git a/paludis/contents-fwd.hh b/paludis/contents-fwd.hh
new file mode 100644
index 0000000..13563e9
--- /dev/null
+++ b/paludis/contents-fwd.hh
@@ -0,0 +1,55 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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_CONTENTS_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_CONTENTS_FWD_HH 1
+
+#include <iosfwd>
+#include <paludis/util/attributes.hh>
+
+namespace paludis
+{
+ struct ContentsEntry;
+ struct ContentsFileEntry;
+ struct ContentsDirEntry;
+ struct ContentsSymEntry;
+ struct ContentsFifoEntry;
+ struct ContentsDevEntry;
+ struct ContentsMiscEntry;
+
+ struct Contents;
+
+ struct ContentsVisitorTypes;
+
+ /**
+ * Write a ContentsSymEntry to a stream
+ *
+ * \ingroup grpcontents
+ */
+ std::ostream & operator<< (std::ostream &, const ContentsSymEntry &) PALUDIS_VISIBLE;
+
+ /**
+ * Write a ContentsEntry to a stream
+ *
+ * \ingroup grpcontents
+ */
+ std::ostream & operator<< (std::ostream &, const ContentsEntry &) PALUDIS_VISIBLE;
+}
+
+#endif
diff --git a/paludis/contents.hh b/paludis/contents.hh
index 3595576..df086dd 100644
--- a/paludis/contents.hh
+++ b/paludis/contents.hh
@@ -20,6 +20,8 @@
#ifndef PALUDIS_GUARD_PALUDIS_CONTENTS_HH
#define PALUDIS_GUARD_PALUDIS_CONTENTS_HH 1
+#include <paludis/contents-fwd.hh>
+
#include <paludis/util/visitor.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
@@ -36,14 +38,6 @@
namespace paludis
{
- struct ContentsEntry;
- struct ContentsFileEntry;
- struct ContentsDirEntry;
- struct ContentsSymEntry;
- struct ContentsFifoEntry;
- struct ContentsDevEntry;
- struct ContentsMiscEntry;
-
/**
* Visit a contents heirarchy.
*
@@ -251,21 +245,6 @@ namespace paludis
///\}
};
-
- /**
- * Write a ContentsSymEntry to a stream
- *
- * \ingroup grpcontents
- */
- std::ostream & operator<< (std::ostream &, const ContentsSymEntry &) PALUDIS_VISIBLE;
-
- /**
- * Write a ContentsEntry to a stream
- *
- * \ingroup grpcontents
- */
- std::ostream & operator<< (std::ostream &, const ContentsEntry &) PALUDIS_VISIBLE;
-
}
#endif
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 5f395f6..0e4a3f5 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -1325,7 +1325,10 @@ DepList::prefer_installed_over_uninstalled(const PackageID & installed,
(installed.version().is_scm() || is_scm(installed.name())))
{
static time_t current_time(time(0)); /* static to avoid weirdness */
- time_t installed_time(installed.repository()->installed_interface->installed_time(installed));
+ time_t installed_time(current_time);
+ if (installed.installed_time_key())
+ installed_time = installed.installed_time_key()->value();
+
do
{
switch (_imp->opts->reinstall_scm)
diff --git a/paludis/files.m4 b/paludis/files.m4
index e9f3686..41417ed 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -10,7 +10,7 @@ dnl on this file at present...
add(`about', `hh', `test')
add(`config_file', `hh', `cc', `se', `test', `testscript')
-add(`contents', `hh', `cc')
+add(`contents', `hh', `cc', `fwd')
add(`dep_spec', `hh', `cc', `se', `test', `fwd')
add(`dep_spec_flattener', `hh', `cc')
add(`dep_spec_pretty_printer', `hh', `cc', `test')
diff --git a/paludis/metadata_key-fwd.hh b/paludis/metadata_key-fwd.hh
index 95810a3..d0562a2 100644
--- a/paludis/metadata_key-fwd.hh
+++ b/paludis/metadata_key-fwd.hh
@@ -30,6 +30,8 @@ namespace paludis
class MetadataKey;
class MetadataPackageIDKey;
class MetadataStringKey;
+ class MetadataContentsKey;
+ class MetadataTimeKey;
template <typename C_> class MetadataCollectionKey;
template <typename C_> class MetadataSpecTreeKey;
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index d7d4e83..c00de6c 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -77,6 +77,16 @@ MetadataStringKey::MetadataStringKey(const std::string & r, const std::string &
{
}
+MetadataTimeKey::MetadataTimeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
+ MetadataKey(r, h, t)
+{
+}
+
+MetadataContentsKey::MetadataContentsKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
+ MetadataKey(r, h, t)
+{
+}
+
MetadataPackageIDKey::MetadataPackageIDKey(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 48f7101..bbd96fb 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -24,6 +24,8 @@
#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
+#include <paludis/contents-fwd.hh>
+#include <paludis/repository-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
@@ -46,7 +48,9 @@ namespace paludis
MetadataSpecTreeKey<URISpecTree>,
MetadataSpecTreeKey<ProvideSpecTree>,
MetadataSpecTreeKey<RestrictSpecTree>,
- MetadataStringKey
+ MetadataStringKey,
+ MetadataContentsKey,
+ MetadataTimeKey
>
{
};
@@ -91,6 +95,30 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
+ class PALUDIS_VISIBLE MetadataTimeKey :
+ public MetadataKey,
+ public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataTimeKey>
+ {
+ protected:
+ MetadataTimeKey(const std::string &, const std::string &, const MetadataKeyType);
+
+ public:
+ virtual const time_t value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
+ class PALUDIS_VISIBLE MetadataContentsKey :
+ public MetadataKey,
+ public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataContentsKey>
+ {
+ protected:
+ MetadataContentsKey(const std::string &, const std::string &, const MetadataKeyType);
+
+ public:
+ virtual const tr1::shared_ptr<const Contents> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
template <typename C_>
class PALUDIS_VISIBLE MetadataCollectionKey :
public MetadataKey,
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index e2cd543..66daa11 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -76,6 +76,10 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const = 0;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const = 0;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const = 0;
+ virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const = 0;
+ virtual const tr1::shared_ptr<const MetadataTimeKey> installed_time_key() const = 0;
+ virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const = 0;
+ virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const = 0;
///\}
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index b337b4f..6a6ad94 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -35,7 +35,6 @@ FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, co
FakeRepositoryBase(e, our_name, RepositoryCapabilities::create()
.installable_interface(0)
.installed_interface(this)
- .contents_interface(0)
.mask_interface(this)
.sets_interface(this)
.syncable_interface(0)
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 1db8b24..0314616 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -440,6 +440,30 @@ FakePackageID::long_description_key() const
return tr1::shared_ptr<const MetadataStringKey>();
}
+const tr1::shared_ptr<const MetadataContentsKey>
+FakePackageID::contents_key() const
+{
+ return tr1::shared_ptr<const MetadataContentsKey>();
+}
+
+const tr1::shared_ptr<const MetadataTimeKey>
+FakePackageID::installed_time_key() const
+{
+ return tr1::shared_ptr<const MetadataTimeKey>();
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+FakePackageID::source_origin_key() const
+{
+ return tr1::shared_ptr<const MetadataStringKey>();
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+FakePackageID::binary_origin_key() const
+{
+ return tr1::shared_ptr<const MetadataStringKey>();
+}
+
void
FakePackageID::set_slot(const SlotName & s)
{
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index d16ebd9..76b5cdb 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -138,6 +138,10 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
+ virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
+ virtual const tr1::shared_ptr<const MetadataTimeKey> installed_time_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
const tr1::shared_ptr<FakeMetadataKeywordCollectionKey> keywords_key();
const tr1::shared_ptr<FakeMetadataIUseCollectionKey> iuse_key();
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 55e0a79..3eb4d50 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -51,7 +51,6 @@ FakeRepository::FakeRepository(const Environment * const e, const RepositoryName
FakeRepositoryBase(e, our_name, RepositoryCapabilities::create()
.installable_interface(this)
.installed_interface(0)
- .contents_interface(0)
.mask_interface(this)
.sets_interface(this)
.syncable_interface(0)
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index 28b0afc..f96c05a 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -460,6 +460,30 @@ GemSpecification::long_description_key() const
return _imp->description_key;
}
+const tr1::shared_ptr<const MetadataContentsKey>
+GemSpecification::contents_key() const
+{
+ return tr1::shared_ptr<const MetadataContentsKey>();
+}
+
+const tr1::shared_ptr<const MetadataTimeKey>
+GemSpecification::installed_time_key() const
+{
+ return tr1::shared_ptr<const MetadataTimeKey>();
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+GemSpecification::source_origin_key() const
+{
+ return tr1::shared_ptr<const MetadataStringKey>();
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+GemSpecification::binary_origin_key() const
+{
+ return tr1::shared_ptr<const MetadataStringKey>();
+}
+
bool
GemSpecification::arbitrary_less_than_comparison(const PackageID &) const
{
diff --git a/paludis/repositories/gems/gem_specification.hh b/paludis/repositories/gems/gem_specification.hh
index dfcddad..0813b6c 100644
--- a/paludis/repositories/gems/gem_specification.hh
+++ b/paludis/repositories/gems/gem_specification.hh
@@ -108,6 +108,11 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
+ virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
+ virtual const tr1::shared_ptr<const MetadataTimeKey> installed_time_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
+
virtual bool arbitrary_less_than_comparison(const PackageID &) const;
virtual std::size_t extra_hash_value() const;
};
diff --git a/paludis/repositories/gems/gem_specification_TEST.cc b/paludis/repositories/gems/gem_specification_TEST.cc
index 4b07f73..8afc22f 100644
--- a/paludis/repositories/gems/gem_specification_TEST.cc
+++ b/paludis/repositories/gems/gem_specification_TEST.cc
@@ -82,6 +82,14 @@ namespace
void visit(const MetadataSpecTreeKey<URISpecTree> &)
{
}
+
+ void visit(const MetadataContentsKey &)
+ {
+ }
+
+ void visit(const MetadataTimeKey &)
+ {
+ }
};
}
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index 71014c2..5fbec27 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -74,7 +74,6 @@ GemsRepository::GemsRepository(const gems::RepositoryParams & params) :
.mirrors_interface(0)
.virtuals_interface(0)
.provides_interface(0)
- .contents_interface(0)
.config_interface(0)
.destination_interface(0)
.licenses_interface(0)
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index 7b8642d..0571912 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -82,7 +82,6 @@ InstalledGemsRepository::InstalledGemsRepository(const gems::InstalledRepository
.mirrors_interface(0)
.virtuals_interface(0)
.provides_interface(0)
- .contents_interface(0)
.config_interface(0)
.destination_interface(this)
.licenses_interface(0)
diff --git a/paludis/repositories/gentoo/e_key.cc b/paludis/repositories/gentoo/e_key.cc
index 72adf0a..edf96b0 100644
--- a/paludis/repositories/gentoo/e_key.cc
+++ b/paludis/repositories/gentoo/e_key.cc
@@ -25,14 +25,19 @@
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/iterator.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/log.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/eapi.hh>
+#include <paludis/contents.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <list>
+#include <vector>
+#include <fstream>
using namespace paludis;
using namespace paludis::erepository;
@@ -428,3 +433,149 @@ EInheritedKey::value() const
return _imp->value;
}
+namespace paludis
+{
+ template <>
+ struct Implementation<EContentsKey>
+ {
+ const tr1::shared_ptr<const PackageID> id;
+ const FSEntry filename;
+ mutable tr1::shared_ptr<Contents> value;
+
+ Implementation(const tr1::shared_ptr<const PackageID> & i, const FSEntry & v) :
+ id(i),
+ filename(v)
+ {
+ }
+ };
+}
+
+EContentsKey::EContentsKey(const tr1::shared_ptr<const PackageID> & id,
+ const std::string & r, const std::string & h, const FSEntry & v, const MetadataKeyType t) :
+ MetadataContentsKey(r, h, t),
+ PrivateImplementationPattern<EContentsKey>(new Implementation<EContentsKey>(id, v)),
+ _imp(PrivateImplementationPattern<EContentsKey>::_imp.get())
+{
+}
+
+EContentsKey::~EContentsKey()
+{
+}
+
+const tr1::shared_ptr<const Contents>
+EContentsKey::value() const
+{
+ if (_imp->value)
+ return _imp->value;
+
+ Context context("When creating contents for VDB key '" + stringify(*_imp->id) + "' from '" + stringify(_imp->filename) + "':");
+
+ _imp->value.reset(new Contents);
+
+ FSEntry f(_imp->filename);
+ if (! f.is_regular_file_or_symlink_to_regular_file())
+ {
+ Log::get_instance()->message(ll_warning, lc_context) << "CONTENTS lookup failed for request for '" <<
+ *_imp->id << "' using '" << _imp->filename << "'";
+ return _imp->value;
+ }
+
+ std::ifstream ff(stringify(f).c_str());
+ if (! ff)
+ throw ConfigurationError("Could not read '" + stringify(f) + "'");
+
+ std::string line;
+ unsigned line_number(0);
+ while (std::getline(ff, line))
+ {
+ ++line_number;
+
+ std::vector<std::string> tokens;
+ WhitespaceTokeniser::get_instance()->tokenise(line, std::back_inserter(tokens));
+ if (tokens.empty())
+ continue;
+
+ if (tokens.size() < 2)
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context) << "CONTENTS has broken line " <<
+ line_number << ", skipping";
+ continue;
+ }
+
+ if ("obj" == tokens.at(0))
+ _imp->value->add(tr1::shared_ptr<ContentsEntry>(new ContentsFileEntry(tokens.at(1))));
+ else if ("dir" == tokens.at(0))
+ _imp->value->add(tr1::shared_ptr<ContentsEntry>(new ContentsDirEntry(tokens.at(1))));
+ else if ("misc" == tokens.at(0))
+ _imp->value->add(tr1::shared_ptr<ContentsEntry>(new ContentsMiscEntry(tokens.at(1))));
+ else if ("fif" == tokens.at(0))
+ _imp->value->add(tr1::shared_ptr<ContentsEntry>(new ContentsFifoEntry(tokens.at(1))));
+ else if ("dev" == tokens.at(0))
+ _imp->value->add(tr1::shared_ptr<ContentsEntry>(new ContentsDevEntry(tokens.at(1))));
+ else if ("sym" == tokens.at(0))
+ {
+ if (tokens.size() < 4)
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context) << "CONTENTS has broken sym line " <<
+ line_number << ", skipping";
+ continue;
+ }
+
+ _imp->value->add(tr1::shared_ptr<ContentsEntry>(new ContentsSymEntry(tokens.at(1), tokens.at(3))));
+ }
+ }
+
+ return _imp->value;
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<ECTimeKey>
+ {
+ const tr1::shared_ptr<const PackageID> id;
+ const FSEntry filename;
+ mutable tr1::shared_ptr<time_t> value;
+
+ Implementation(const tr1::shared_ptr<const PackageID> & i, const FSEntry & v) :
+ id(i),
+ filename(v)
+ {
+ }
+ };
+}
+
+ECTimeKey::ECTimeKey(const tr1::shared_ptr<const PackageID> & id,
+ const std::string & r, const std::string & h, const FSEntry & v, const MetadataKeyType t) :
+ MetadataTimeKey(r, h, t),
+ PrivateImplementationPattern<ECTimeKey>(new Implementation<ECTimeKey>(id, v)),
+ _imp(PrivateImplementationPattern<ECTimeKey>::_imp.get())
+{
+}
+
+ECTimeKey::~ECTimeKey()
+{
+}
+
+const time_t
+ECTimeKey::value() const
+{
+ if (_imp->value)
+ return *_imp->value;
+
+ _imp->value.reset(new time_t(0));
+
+ try
+ {
+ *_imp->value = _imp->filename.ctime();
+ }
+ catch (const FSError & e)
+ {
+ Log::get_instance()->message(ll_warning, lc_context) << "Couldn't get ctime for '"
+ << _imp->filename << "' for ID '" << *_imp->id << "' due to exception '" << e.message()
+ << "' (" << e.what() << ")";
+ }
+
+ return *_imp->value;
+}
+
diff --git a/paludis/repositories/gentoo/e_key.hh b/paludis/repositories/gentoo/e_key.hh
index ee456fc..bdcf17e 100644
--- a/paludis/repositories/gentoo/e_key.hh
+++ b/paludis/repositories/gentoo/e_key.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GENTOO_E_KEY_HH 1
#include <paludis/metadata_key.hh>
+#include <paludis/util/fs_entry-fwd.hh>
namespace paludis
{
@@ -186,6 +187,38 @@ namespace paludis
const tr1::shared_ptr<const InheritedCollection> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ class EContentsKey :
+ public MetadataContentsKey,
+ private PrivateImplementationPattern<EContentsKey>
+ {
+ private:
+ Implementation<EContentsKey> * const _imp;
+
+ public:
+ EContentsKey(const tr1::shared_ptr<const PackageID> &,
+ const std::string &, const std::string &, const FSEntry &, const MetadataKeyType);
+ ~EContentsKey();
+
+ const tr1::shared_ptr<const Contents> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class ECTimeKey :
+ public MetadataTimeKey,
+ private PrivateImplementationPattern<ECTimeKey>
+ {
+ private:
+ Implementation<ECTimeKey> * const _imp;
+
+ public:
+ ECTimeKey(const tr1::shared_ptr<const PackageID> &,
+ const std::string &, const std::string &, const FSEntry &, const MetadataKeyType);
+ ~ECTimeKey();
+
+ const time_t value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
}
diff --git a/paludis/repositories/gentoo/ebuild_id.cc b/paludis/repositories/gentoo/ebuild_id.cc
index 9f14d75..ceb0ed8 100644
--- a/paludis/repositories/gentoo/ebuild_id.cc
+++ b/paludis/repositories/gentoo/ebuild_id.cc
@@ -405,6 +405,30 @@ EbuildID::long_description_key() const
return tr1::shared_ptr<const MetadataStringKey>();
}
+const tr1::shared_ptr<const MetadataContentsKey>
+EbuildID::contents_key() const
+{
+ return tr1::shared_ptr<const MetadataContentsKey>();
+}
+
+const tr1::shared_ptr<const MetadataTimeKey>
+EbuildID::installed_time_key() const
+{
+ return tr1::shared_ptr<const MetadataTimeKey>();
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+EbuildID::source_origin_key() const
+{
+ return tr1::shared_ptr<const MetadataStringKey>();
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+EbuildID::binary_origin_key() const
+{
+ return tr1::shared_ptr<const MetadataStringKey>();
+}
+
const tr1::shared_ptr<const MetadataCollectionKey<InheritedCollection> >
EbuildID::inherited_key() const
{
diff --git a/paludis/repositories/gentoo/ebuild_id.hh b/paludis/repositories/gentoo/ebuild_id.hh
index 6cfa1fe..04440b4 100644
--- a/paludis/repositories/gentoo/ebuild_id.hh
+++ b/paludis/repositories/gentoo/ebuild_id.hh
@@ -78,6 +78,10 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
+ virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
+ virtual const tr1::shared_ptr<const MetadataTimeKey> installed_time_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/gentoo/portage_repository.cc b/paludis/repositories/gentoo/portage_repository.cc
index 67631ae..ec2b47e 100644
--- a/paludis/repositories/gentoo/portage_repository.cc
+++ b/paludis/repositories/gentoo/portage_repository.cc
@@ -254,7 +254,6 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
.virtuals_interface(DistributionData::get_instance()->distribution_from_string(
p.environment->default_distribution())->support_old_style_virtuals ? this : 0)
.provides_interface(0)
- .contents_interface(0)
.config_interface(0)
.destination_interface(p.enable_destinations ? this : 0)
.licenses_interface(this)
diff --git a/paludis/repositories/gentoo/vdb_id.cc b/paludis/repositories/gentoo/vdb_id.cc
index b88fd2d..10d583f 100644
--- a/paludis/repositories/gentoo/vdb_id.cc
+++ b/paludis/repositories/gentoo/vdb_id.cc
@@ -77,6 +77,20 @@ namespace paludis
tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > src_uri;
tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage;
tr1::shared_ptr<const MetadataStringKey> short_description;
+ tr1::shared_ptr<const MetadataContentsKey> contents;
+ tr1::shared_ptr<const MetadataTimeKey> installed_time;
+ tr1::shared_ptr<const MetadataStringKey> source_origin;
+ tr1::shared_ptr<const MetadataStringKey> binary_origin;
+
+ tr1::shared_ptr<const MetadataStringKey> asflags;
+ tr1::shared_ptr<const MetadataStringKey> cbuild;
+ tr1::shared_ptr<const MetadataStringKey> cflags;
+ tr1::shared_ptr<const MetadataStringKey> chost;
+ tr1::shared_ptr<const MetadataStringKey> ctarget;
+ tr1::shared_ptr<const MetadataStringKey> cxxflags;
+ tr1::shared_ptr<const MetadataStringKey> ldflags;
+ tr1::shared_ptr<const MetadataStringKey> pkgmanager;
+ tr1::shared_ptr<const MetadataStringKey> vdb_format;
Implementation(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
@@ -114,10 +128,6 @@ VDBID::need_keys_added() const
Context context("When loading VDB ID keys from '" + stringify(_imp->dir) + "':");
-#if 0
- source_origin;
-#endif
-
if ((_imp->dir / "USE").exists())
{
_imp->use.reset(new EUseKey(shared_from_this(), "USE", "Use flags", file_contents(_imp->dir / "USE"), mkt_internal));
@@ -200,6 +210,84 @@ VDBID::need_keys_added() const
file_contents(_imp->dir / "HOMEPAGE"), mkt_significant));
add_key(_imp->homepage);
}
+
+ _imp->contents.reset(new EContentsKey(shared_from_this(), "CONTENTS", "Contents",
+ _imp->dir / "CONTENTS", mkt_internal));
+ add_key(_imp->contents);
+
+ _imp->installed_time.reset(new ECTimeKey(shared_from_this(), "INSTALLED_TIME", "Installed time",
+ _imp->dir / "CONTENTS", mkt_normal));
+ add_key(_imp->installed_time);
+
+ if ((_imp->dir / "REPOSITORY").exists())
+ {
+ _imp->source_origin.reset(new EStringKey(shared_from_this(), "REPOSITORY", "Source repository",
+ file_contents(_imp->dir / "REPOSITORY"), mkt_normal));
+ add_key(_imp->source_origin);
+ }
+
+ if ((_imp->dir / "BINARY_REPOSITORY").exists())
+ {
+ _imp->binary_origin.reset(new EStringKey(shared_from_this(), "BINARY_REPOSITORY", "Binary repository",
+ file_contents(_imp->dir / "BINARY_REPOSITORY"), mkt_normal));
+ add_key(_imp->binary_origin);
+ }
+
+ if ((_imp->dir / "ASFLAGS").exists())
+ {
+ _imp->asflags.reset(new EStringKey(shared_from_this(), "ASFLAGS", "ASFLAGS",
+ file_contents(_imp->dir / "ASFLAGS"), mkt_internal));
+ add_key(_imp->asflags);
+ }
+
+ if ((_imp->dir / "CBUILD").exists())
+ {
+ _imp->cbuild.reset(new EStringKey(shared_from_this(), "CBUILD", "CBUILD",
+ file_contents(_imp->dir / "CBUILD"), mkt_internal));
+ add_key(_imp->cbuild);
+ }
+
+ if ((_imp->dir / "CFLAGS").exists())
+ {
+ _imp->cflags.reset(new EStringKey(shared_from_this(), "CFLAGS", "CFLAGS",
+ file_contents(_imp->dir / "CFLAGS"), mkt_internal));
+ add_key(_imp->cflags);
+ }
+
+ if ((_imp->dir / "CHOST").exists())
+ {
+ _imp->chost.reset(new EStringKey(shared_from_this(), "CHOST", "CHOST",
+ file_contents(_imp->dir / "CHOST"), mkt_internal));
+ add_key(_imp->chost);
+ }
+
+ if ((_imp->dir / "CXXFLAGS").exists())
+ {
+ _imp->cxxflags.reset(new EStringKey(shared_from_this(), "CXXFLAGS", "CXXFLAGS",
+ file_contents(_imp->dir / "CXXFLAGS"), mkt_internal));
+ add_key(_imp->cxxflags);
+ }
+
+ if ((_imp->dir / "LDFLAGS").exists())
+ {
+ _imp->ldflags.reset(new EStringKey(shared_from_this(), "LDFLAGS", "LDFLAGS",
+ file_contents(_imp->dir / "LDFLAGS"), mkt_internal));
+ add_key(_imp->ldflags);
+ }
+
+ if ((_imp->dir / "PKGMANAGER").exists())
+ {
+ _imp->pkgmanager.reset(new EStringKey(shared_from_this(), "PKGMANAGER", "Installed using",
+ file_contents(_imp->dir / "PKGMANAGER"), mkt_normal));
+ add_key(_imp->pkgmanager);
+ }
+
+ if ((_imp->dir / "VDB_FORMAT").exists())
+ {
+ _imp->vdb_format.reset(new EStringKey(shared_from_this(), "VDB_FORMAT", "VDB Format",
+ file_contents(_imp->dir / "VDB_FORMAT"), mkt_internal));
+ add_key(_imp->vdb_format);
+ }
}
const std::string
@@ -405,6 +493,34 @@ VDBID::long_description_key() const
return tr1::shared_ptr<const MetadataStringKey>();
}
+const tr1::shared_ptr<const MetadataContentsKey>
+VDBID::contents_key() const
+{
+ need_keys_added();
+ return _imp->contents;
+}
+
+const tr1::shared_ptr<const MetadataTimeKey>
+VDBID::installed_time_key() const
+{
+ need_keys_added();
+ return _imp->installed_time;
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+VDBID::source_origin_key() const
+{
+ need_keys_added();
+ return _imp->source_origin;
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+VDBID::binary_origin_key() const
+{
+ need_keys_added();
+ return _imp->binary_origin;
+}
+
bool
VDBID::arbitrary_less_than_comparison(const PackageID &) const
{
diff --git a/paludis/repositories/gentoo/vdb_id.hh b/paludis/repositories/gentoo/vdb_id.hh
index 6cf0af7..2c14db3 100644
--- a/paludis/repositories/gentoo/vdb_id.hh
+++ b/paludis/repositories/gentoo/vdb_id.hh
@@ -73,6 +73,10 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> > homepage_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
+ virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
+ virtual const tr1::shared_ptr<const MetadataTimeKey> installed_time_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/gentoo/vdb_repository.cc b/paludis/repositories/gentoo/vdb_repository.cc
index 2ea2b9d..81185d9 100644
--- a/paludis/repositories/gentoo/vdb_repository.cc
+++ b/paludis/repositories/gentoo/vdb_repository.cc
@@ -137,7 +137,6 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
.virtuals_interface(0)
.destination_interface(this)
.config_interface(this)
- .contents_interface(this)
.licenses_interface(0)
.portage_interface(0)
.pretend_interface(0)
@@ -241,122 +240,6 @@ VDBRepository::do_package_ids(const QualifiedPackageName & n) const
return _imp->ids.find(n)->second;
}
-#if 0
-tr1::shared_ptr<const VersionMetadata>
-VDBRepository::do_version_metadata(
- const QualifiedPackageName & q, const VersionSpec & v) const
-{
- Context context("When fetching metadata for '" + stringify(q) +
- "-" + stringify(v) + "':");
-
- if (! _imp->entries_valid)
- _imp->load_entries_for(q.category);
-
- std::pair<std::vector<VDBEntry>::iterator, std::vector<VDBEntry>::iterator>
- r(std::equal_range(_imp->entries.begin(), _imp->entries.end(), std::make_pair(
- q, v), VDBEntry::CompareVersion()));
-
- if (r.first == r.second)
- throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, name())));
- else
- {
- if (! r.first->metadata)
- _imp->load_entry(r.first);
- return r.first->metadata;
- }
-}
-#endif
-
-tr1::shared_ptr<const Contents>
-VDBRepository::do_contents(const PackageID & id) const
-{
- Context context("When fetching contents for '" + stringify(id) + "':");
- tr1::shared_ptr<Contents> result(new Contents);
-
- FSEntry f(_imp->params.location / stringify(id.name().category) /
- (stringify(id.name().package) + "-" + stringify(id.version())));
- if (! (f / "CONTENTS").is_regular_file_or_symlink_to_regular_file())
- {
- Log::get_instance()->message(ll_warning, lc_context,
- "CONTENTS lookup failed for request for '" +
- stringify(id) + "' in vdb '" +
- stringify(_imp->params.location) + "'");
- return result;
- }
-
- std::ifstream ff(stringify(f / "CONTENTS").c_str());
- if (! ff)
- throw VDBRepositoryKeyReadError("Could not read '" + stringify(f / "CONTENTS") + "'");
-
- std::string line;
- unsigned line_number(0);
- while (std::getline(ff, line))
- {
- ++line_number;
-
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(line, std::back_inserter(tokens));
- if (tokens.empty())
- continue;
-
- if (tokens.size() < 2)
- {
- Log::get_instance()->message(ll_warning, lc_no_context, "CONTENTS for '" +
- stringify(id) + "' in vdb '" +
- stringify(_imp->params.location) + "' has broken line " +
- stringify(line_number) + ", skipping");
- continue;
- }
-
- if ("obj" == tokens.at(0))
- result->add(tr1::shared_ptr<ContentsEntry>(new ContentsFileEntry(tokens.at(1))));
- else if ("dir" == tokens.at(0))
- result->add(tr1::shared_ptr<ContentsEntry>(new ContentsDirEntry(tokens.at(1))));
- else if ("misc" == tokens.at(0))
- result->add(tr1::shared_ptr<ContentsEntry>(new ContentsMiscEntry(tokens.at(1))));
- else if ("fif" == tokens.at(0))
- result->add(tr1::shared_ptr<ContentsEntry>(new ContentsFifoEntry(tokens.at(1))));
- else if ("dev" == tokens.at(0))
- result->add(tr1::shared_ptr<ContentsEntry>(new ContentsDevEntry(tokens.at(1))));
- else if ("sym" == tokens.at(0))
- {
- if (tokens.size() < 4)
- {
- Log::get_instance()->message(ll_warning, lc_no_context, "CONTENTS for '" +
- stringify(id) + "' in vdb '" +
- stringify(_imp->params.location) + "' has broken sym line " +
- stringify(line_number) + ", skipping");
- continue;
- }
-
- result->add(tr1::shared_ptr<ContentsEntry>(new ContentsSymEntry(
- tokens.at(1), tokens.at(3))));
- }
- }
-
- return result;
-}
-
-time_t
-VDBRepository::do_installed_time(const PackageID & id) const
-{
- Context context("When finding installed time for '" + stringify(id) + "':");
-
- FSEntry f(_imp->params.location / stringify(id.name().category) / (stringify(id.name().package) + "-"
- + stringify(id.version())) / "CONTENTS");
- try
- {
- return f.ctime();
- }
- catch (const FSError & e)
- {
- Log::get_instance()->message(ll_warning, lc_no_context, "Can't get ctime of '"
- + stringify(f) + "' due to exception '" + e.message() + "' (" + e.what()
- + ")");
- return 0;
- }
-}
-
UseFlagState
VDBRepository::do_query_use(const UseFlagName & f, const PackageID & e) const
{
diff --git a/paludis/repositories/gentoo/vdb_repository.hh b/paludis/repositories/gentoo/vdb_repository.hh
index f4fcac3..0b8049d 100644
--- a/paludis/repositories/gentoo/vdb_repository.hh
+++ b/paludis/repositories/gentoo/vdb_repository.hh
@@ -55,7 +55,6 @@ namespace paludis
public RepositoryEnvironmentVariableInterface,
public RepositoryProvidesInterface,
public RepositoryDestinationInterface,
- public RepositoryContentsInterface,
public RepositoryConfigInterface,
public RepositoryHookInterface,
public tr1::enable_shared_from_this<VDBRepository>,
@@ -86,8 +85,6 @@ namespace paludis
/* RepositoryInstalledInterface */
- virtual time_t do_installed_time(const PackageID &) const;
-
virtual FSEntry root() const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -165,11 +162,6 @@ namespace paludis
virtual void merge(const MergeOptions &);
- /* RepositoryContentsInterface */
-
- virtual tr1::shared_ptr<const Contents> do_contents(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* RepositoryConfigInterface */
virtual void do_config(const tr1::shared_ptr<const PackageID> &) const;
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 39d595a..7581fdc 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -108,7 +108,6 @@ InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * con
.world_interface(0)
.provides_interface(0)
.virtuals_interface(0)
- .contents_interface(0)
.config_interface(0)
.destination_interface(0)
.licenses_interface(0)
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index b1ed7bd..ce6fce9 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -306,6 +306,30 @@ VirtualsPackageID::bin_uri_key() const
return tr1::shared_ptr<const MetadataSpecTreeKey<URISpecTree> >();
}
+const tr1::shared_ptr<const MetadataContentsKey>
+VirtualsPackageID::contents_key() const
+{
+ return tr1::shared_ptr<const MetadataContentsKey>();
+}
+
+const tr1::shared_ptr<const MetadataTimeKey>
+VirtualsPackageID::installed_time_key() const
+{
+ return tr1::shared_ptr<const MetadataTimeKey>();
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+VirtualsPackageID::source_origin_key() const
+{
+ return tr1::shared_ptr<const MetadataStringKey>();
+}
+
+const tr1::shared_ptr<const MetadataStringKey>
+VirtualsPackageID::binary_origin_key() const
+{
+ return tr1::shared_ptr<const MetadataStringKey>();
+}
+
bool
VirtualsPackageID::arbitrary_less_than_comparison(const PackageID & a) const
{
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index bdf5bf0..bbdd33d 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -102,6 +102,10 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > restrict_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> short_description_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> long_description_key() const;
+ virtual const tr1::shared_ptr<const MetadataContentsKey> contents_key() const;
+ virtual const tr1::shared_ptr<const MetadataTimeKey> installed_time_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
+ virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index f4e305c..2222e54 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -105,7 +105,6 @@ VirtualsRepository::VirtualsRepository(const Environment * const env) :
.virtuals_interface(0)
.destination_interface(0)
.config_interface(0)
- .contents_interface(0)
.licenses_interface(0)
.portage_interface(0)
.pretend_interface(0)
diff --git a/paludis/repository-fwd.hh b/paludis/repository-fwd.hh
index 684e56f..cc0b88c 100644
--- a/paludis/repository-fwd.hh
+++ b/paludis/repository-fwd.hh
@@ -46,7 +46,6 @@ namespace paludis
class RepositoryVirtualsInterface;
class RepositoryMakeVirtualsInterface;
class RepositoryDestinationInterface;
- class RepositoryContentsInterface;
class RepositoryConfigInterface;
class RepositoryPretendInterface;
class RepositoryLicensesInterface;
diff --git a/paludis/repository.cc b/paludis/repository.cc
index e88450c..21eeda8 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -208,10 +208,6 @@ RepositoryDestinationInterface::~RepositoryDestinationInterface()
{
}
-RepositoryContentsInterface::~RepositoryContentsInterface()
-{
-}
-
RepositoryConfigInterface::~RepositoryConfigInterface()
{
}
@@ -361,18 +357,6 @@ Repository::category_names() const
return do_category_names();
}
-time_t
-RepositoryInstalledInterface::installed_time(const PackageID & p) const
-{
- return do_installed_time(p);
-}
-
-tr1::shared_ptr<const Contents>
-RepositoryContentsInterface::contents(const PackageID & id) const
-{
- return do_contents(id);
-}
-
void
RepositoryConfigInterface::config(const tr1::shared_ptr<const PackageID> & id) const
{
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 1e48744..7130c84 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -31,7 +31,6 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/virtual_constructor.hh>
#include <paludis/version_spec.hh>
-#include <paludis/contents.hh>
#include <string>
#include <libwrapiter/libwrapiter_forward_iterator-fwd.hh>
@@ -394,29 +393,11 @@ namespace paludis
*/
class PALUDIS_VISIBLE RepositoryInstalledInterface
{
- protected:
- ///\name Implementation details
- ///\{
-
- /**
- * Override in descendents: when was a package installed.
- */
- virtual time_t do_installed_time(const PackageID &) const = 0;
-
- ///\}
-
public:
///\name Installed content queries
///\{
/**
- * When was a package installed.
- *
- * Can return time_t(0) if the installed time is unknown.
- */
- time_t installed_time(const PackageID &) const;
-
- /**
* What is our filesystem root?
*/
virtual FSEntry root() const
@@ -796,41 +777,6 @@ namespace paludis
};
/**
- * Interface for handling actions for repositories supporting contents queries.
- *
- * \see Repository
- * \ingroup grprepository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryContentsInterface
- {
- protected:
- ///\name Implementation details
- ///\{
-
- /**
- * Override in descendents: fetch the contents.
- */
- virtual tr1::shared_ptr<const Contents> do_contents(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- ///\}
-
- public:
- ///\name Installed content queries
- ///\{
-
- /**
- * Fetch contents.
- */
- tr1::shared_ptr<const Contents> contents(const PackageID &) const;
-
- ///\}
-
- virtual ~RepositoryContentsInterface();
- };
-
- /**
* Interface for handling actions for repositories supporting package configuration.
*
* \see Repository
@@ -855,7 +801,7 @@ namespace paludis
///\{
/**
- * Fetch contents.
+ * Configure.
*/
void config(const tr1::shared_ptr<const PackageID> &) const;
diff --git a/paludis/repository.sr b/paludis/repository.sr
index 4fff24f..146facf 100644
--- a/paludis/repository.sr
+++ b/paludis/repository.sr
@@ -57,7 +57,6 @@ make_class_RepositoryCapabilities()
key virtuals_interface "RepositoryVirtualsInterface *"
key make_virtuals_interface "RepositoryMakeVirtualsInterface *"
key destination_interface "RepositoryDestinationInterface *"
- key contents_interface "RepositoryContentsInterface *"
key config_interface "RepositoryConfigInterface *"
key pretend_interface "RepositoryPretendInterface *"
key licenses_interface "RepositoryLicensesInterface *"
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index 5dae469..bf89ba5 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -74,10 +74,9 @@ do_one_contents_entry(
{
cout << "* " << colour(cl_package_name, e) << endl;
- const RepositoryContentsInterface * const contents_interface(e.repository()->contents_interface);
- if (contents_interface)
+ if (e.contents_key())
{
- tr1::shared_ptr<const Contents> contents(contents_interface->contents(e));
+ tr1::shared_ptr<const Contents> contents(e.contents_key()->value());
ContentsDisplayer d;
std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(d));
}
diff --git a/src/clients/paludis/owner.cc b/src/clients/paludis/owner.cc
index 94c0220..02e77e4 100644
--- a/src/clients/paludis/owner.cc
+++ b/src/clients/paludis/owner.cc
@@ -99,8 +99,6 @@ do_one_owner(
{
if (! (*r)->installed_interface)
continue;
- if (! (*r)->contents_interface)
- continue;
tr1::shared_ptr<const CategoryNamePartCollection> cats((*r)->category_names());
for (CategoryNamePartCollection::Iterator c(cats->begin()),
@@ -113,7 +111,10 @@ do_one_owner(
tr1::shared_ptr<const PackageIDSequence> ids((*r)->package_ids(*p));
for (PackageIDSequence::Iterator v(ids->begin()), v_end(ids->end()) ; v != v_end ; ++v)
{
- tr1::shared_ptr<const Contents> contents((*r)->contents_interface->contents(**v));
+ if (! (*v)->contents_key())
+ continue;
+
+ tr1::shared_ptr<const Contents> contents((*v)->contents_key()->value());
ContentsFinder d(query, CommandLine::get_instance()->a_full_match.specified());
std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(d));
if (d.found)
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index e092138..9b66c0f 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -281,6 +281,16 @@ namespace
if (k.type() == type)
task->display_metadata_key(k.human_name(), k.raw_name(), k.value());
}
+
+ void visit(const MetadataTimeKey & k)
+ {
+ if (k.type() == type)
+ task->display_metadata_time(k.human_name(), k.raw_name(), k.value());
+ }
+
+ void visit(const MetadataContentsKey &)
+ {
+ }
};
}