aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/gems/installed_gems_repository.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/gems/installed_gems_repository.cc')
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc38
1 files changed, 37 insertions, 1 deletions
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index a7026ba..96c5e09 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -41,6 +41,10 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/distribution.hh>
#include <paludis/action.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/selection.hh>
#include <tr1/unordered_map>
using namespace paludis;
@@ -100,7 +104,6 @@ InstalledGemsRepository::InstalledGemsRepository(const gems::InstalledRepository
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
- value_for<n::sets_interface>(static_cast<RepositorySetsInterface *>(0)),
value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
)),
@@ -418,3 +421,36 @@ InstalledGemsRepository::repository_factory_create(
)));
}
+namespace
+{
+ std::tr1::shared_ptr<SetSpecTree> get_everything_set(
+ const Environment * const env,
+ const Repository * const repo)
+ {
+ Context context("When making 'everything' set from '" + stringify(repo->name()) + "':");
+
+ std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
+
+ std::tr1::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly(
+ generator::InRepository(repo->name()))]);
+ for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ result->root()->append(make_shared_ptr(new PackageDepSpec(
+ make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
+ .package((*i)->name())
+ )));
+
+ return result;
+ }
+}
+
+void
+InstalledGemsRepository::populate_sets() const
+{
+ _imp->params.environment()->add_set(
+ SetName("everything"),
+ SetName("everything::" + stringify(name())),
+ std::tr1::bind(get_everything_set, _imp->params.environment(), this),
+ true);
+}
+