aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/e_installed_repository.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/e/e_installed_repository.cc')
-rw-r--r--paludis/repositories/e/e_installed_repository.cc81
1 files changed, 37 insertions, 44 deletions
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 21ed73243..861dcd1eb 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -46,6 +46,10 @@
#include <paludis/hook.hh>
#include <paludis/dep_tag.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/selection.hh>
using namespace paludis;
using namespace paludis::erepository;
@@ -158,50 +162,6 @@ EInstalledRepository::perform_hook(const Hook & hook) const
return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
-const std::tr1::shared_ptr<const SetSpecTree>
-EInstalledRepository::package_set(const SetName & s) const
-{
- using namespace std::tr1::placeholders;
-
- Context context("When fetching package set '" + stringify(s) + "' from '" +
- stringify(name()) + "':");
-
- if ("everything" == s.data())
- {
- std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
- std::tr1::shared_ptr<GeneralSetDepTag> tag(new GeneralSetDepTag(SetName("everything"), stringify(name())));
-
- std::tr1::shared_ptr<const CategoryNamePartSet> cats(category_names());
- for (CategoryNamePartSet::ConstIterator i(cats->begin()), i_end(cats->end()) ;
- i != i_end ; ++i)
- {
- std::tr1::shared_ptr<const QualifiedPackageNameSet> pkgs(package_names(*i));
- for (QualifiedPackageNameSet::ConstIterator e(pkgs->begin()), e_end(pkgs->end()) ;
- e != e_end ; ++e)
- {
- std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(make_package_dep_spec(
- PartiallyMadePackageDepSpecOptions()).package(*e)));
- spec->set_tag(tag);
- result->root()->append(spec);
- }
- }
-
- return result;
- }
- else
- return make_null_shared_ptr();
-}
-
-std::tr1::shared_ptr<const SetNameSet>
-EInstalledRepository::sets_list() const
-{
- Context context("While generating the list of sets:");
-
- std::tr1::shared_ptr<SetNameSet> result(new SetNameSet);
- result->insert(SetName("everything"));
- return result;
-}
-
std::tr1::shared_ptr<const CategoryNamePartSet>
EInstalledRepository::unimportant_category_names() const
{
@@ -413,3 +373,36 @@ EInstalledRepository::perform_info(
}
}
+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
+EInstalledRepository::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);
+}
+