aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/e')
-rw-r--r--paludis/repositories/e/e_installed_repository.cc81
-rw-r--r--paludis/repositories/e/e_installed_repository.hh16
-rw-r--r--paludis/repositories/e/e_repository.cc68
-rw-r--r--paludis/repositories/e/e_repository.hh14
-rw-r--r--paludis/repositories/e/e_repository_sets_TEST.cc19
-rw-r--r--paludis/repositories/e/exndbam_repository.cc1
-rw-r--r--paludis/repositories/e/vdb_repository.cc1
7 files changed, 110 insertions, 90 deletions
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 21ed732..861dcd1 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);
+}
+
diff --git a/paludis/repositories/e/e_installed_repository.hh b/paludis/repositories/e/e_installed_repository.hh
index ca1adba..4b9660c 100644
--- a/paludis/repositories/e/e_installed_repository.hh
+++ b/paludis/repositories/e/e_installed_repository.hh
@@ -43,7 +43,6 @@ namespace paludis
class EInstalledRepository :
public Repository,
- public RepositorySetsInterface,
public RepositoryEnvironmentVariableInterface,
public RepositoryDestinationInterface,
public RepositoryHookInterface,
@@ -57,14 +56,6 @@ namespace paludis
~EInstalledRepository();
public:
- /* RepositorySetsInterface */
-
- virtual const std::tr1::shared_ptr<const SetSpecTree> package_set(const SetName & id) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const SetNameSet> sets_list() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* RepositoryEnvironmentVariableInterface */
virtual std::string get_environment_variable(
@@ -110,6 +101,13 @@ namespace paludis
const InfoAction &) const;
///\}
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
}
}
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 021dafc..d2d753c 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -509,7 +509,6 @@ ERepository::ERepository(const ERepositoryParams & p) :
#else
value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
#endif
- value_for<n::sets_interface>(this),
value_for<n::syncable_interface>(this),
value_for<n::virtuals_interface>((*DistributionData::get_instance()->distribution_from_string(p.environment()->distribution())).support_old_style_virtuals() ? this : 0)
)),
@@ -733,24 +732,6 @@ ERepository::need_mirrors() const
}
}
-const std::tr1::shared_ptr<const SetSpecTree>
-ERepository::package_set(const SetName & s) const
-{
- if (s.data() == "system")
- {
- _imp->need_profiles();
- return _imp->profile_ptr->system_packages();
- }
-
- return _imp->sets_ptr->package_set(s);
-}
-
-std::tr1::shared_ptr<const SetNameSet>
-ERepository::sets_list() const
-{
- return _imp->sets_ptr->sets_list();
-}
-
bool
ERepository::sync(const std::tr1::shared_ptr<OutputManager> & output_manager) const
{
@@ -1758,3 +1739,52 @@ ERepository::eapi_for_file(const FSEntry & f) const
return i->second;
}
+namespace
+{
+ std::tr1::shared_ptr<const SetSpecTree> get_system_set(const std::tr1::shared_ptr<const SetSpecTree> s)
+ {
+ return s;
+ }
+
+ std::tr1::shared_ptr<const SetSpecTree> get_set(
+ const std::tr1::shared_ptr<const ERepositorySets> & s,
+ const SetName & n)
+ {
+ return s->package_set(n);
+ }
+}
+
+void
+ERepository::populate_sets() const
+{
+ const std::tr1::shared_ptr<const SetNameSet> sets(_imp->sets_ptr->sets_list());
+ for (SetNameSet::ConstIterator s(sets->begin()), s_end(sets->end()) ;
+ s != s_end ; ++s)
+ {
+ if (stringify(*s) == "system")
+ {
+ _imp->need_profiles();
+ _imp->params.environment()->add_set(
+ *s,
+ SetName(stringify(*s) + "::" + stringify(name())),
+ std::tr1::bind(&get_system_set, _imp->profile_ptr->system_packages()),
+ true);
+ }
+ else
+ {
+ _imp->params.environment()->add_set(
+ *s,
+ SetName(stringify(*s) + "::" + stringify(name())),
+ std::tr1::bind(&get_set, _imp->sets_ptr, *s),
+ true);
+
+ if (stringify(*s) != "security" && stringify(*s) != "insecurity")
+ _imp->params.environment()->add_set(
+ SetName(stringify(*s) + "*"),
+ SetName(stringify(*s) + "::" + stringify(name()) + "*"),
+ std::tr1::bind(&get_set, _imp->sets_ptr, SetName(stringify(*s) + "*")),
+ true);
+ }
+ }
+}
+
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index 5977a2b..4a5981f 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -52,7 +52,6 @@ namespace paludis
class PALUDIS_VISIBLE ERepository :
public Repository,
public RepositorySyncableInterface,
- public RepositorySetsInterface,
public RepositoryEnvironmentVariableInterface,
public RepositoryMirrorsInterface,
public RepositoryVirtualsInterface,
@@ -127,12 +126,6 @@ namespace paludis
/* RepositoryManifestInterface */
virtual void make_manifest(const QualifiedPackageName & qpn);
- /* RepositorySetsInterface */
-
- virtual const std::tr1::shared_ptr<const SetSpecTree> package_set(const SetName & id) const;
-
- virtual std::tr1::shared_ptr<const SetNameSet> sets_list() const;
-
/* RepositorySyncableInterface */
virtual bool sync(const std::tr1::shared_ptr<OutputManager> &) const;
@@ -238,6 +231,13 @@ namespace paludis
const std::tr1::shared_ptr<const UseDesc> use_desc() const PALUDIS_ATTRIBUTE((warn_unused_result));
const std::string eapi_for_file(const FSEntry &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
}
diff --git a/paludis/repositories/e/e_repository_sets_TEST.cc b/paludis/repositories/e/e_repository_sets_TEST.cc
index a5cc45b..d138eb8 100644
--- a/paludis/repositories/e/e_repository_sets_TEST.cc
+++ b/paludis/repositories/e/e_repository_sets_TEST.cc
@@ -62,13 +62,12 @@ namespace test_cases
keys->insert("profiles", "e_repository_sets_TEST_dir/repo1/profiles/profile");
std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
- std::tr1::shared_ptr<const SetNameSet> sets_list(repo->sets_interface()->sets_list());
- TEST_CHECK_EQUAL(sets_list->size(), 4U);
- TEST_CHECK(sets_list->end() != sets_list->find(SetName("system")));
- TEST_CHECK(sets_list->end() != sets_list->find(SetName("security")));
- TEST_CHECK(sets_list->end() != sets_list->find(SetName("insecurity")));
- TEST_CHECK(sets_list->end() != sets_list->find(SetName("set1")));
+ std::tr1::shared_ptr<const SetNameSet> sets_list(env.set_names());
+ TEST_CHECK_EQUAL(join(sets_list->begin(), sets_list->end(), " "), "everything everything::default insecurity "
+ "insecurity::test-repo-1 security security::test-repo-1 set1 set1* set1::test-repo-1 set1::test-repo-1* "
+ "system system::test-repo-1 world world::default");
}
} test_e_repository_sets_sets_list;
@@ -90,8 +89,10 @@ namespace test_cases
new FakeInstalledRepository(&env, RepositoryName("installed")));
installed->add_version("cat-two", "bar", "1.5");
env.package_database()->add_repository(0, installed);
+ env.package_database()->add_repository(1, repo);
- std::tr1::shared_ptr<const SetSpecTree> set1(repo->sets_interface()->package_set(SetName("set1")));
+ std::tr1::shared_ptr<const SetSpecTree> set1(env.set(SetName("set1::test-repo-1")));
+ TEST_CHECK(set1);
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pretty(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
set1->root()->accept(pretty);
@@ -121,7 +122,7 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(1, repo);
- std::tr1::shared_ptr<const SetSpecTree> insecurity(repo->sets_interface()->package_set(SetName("insecurity")));
+ std::tr1::shared_ptr<const SetSpecTree> insecurity(env.set(SetName("insecurity::test-repo-1")));
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pretty(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
insecurity->root()->accept(pretty);
@@ -161,7 +162,7 @@ namespace test_cases
installed->add_version("cat-four", "xyzzy", "2.0.1")->set_slot(SlotName("2"));
env.package_database()->add_repository(0, installed);
- std::tr1::shared_ptr<const SetSpecTree> security(repo->sets_interface()->package_set(SetName("security")));
+ std::tr1::shared_ptr<const SetSpecTree> security(env.set(SetName("security::test-repo-1")));
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pretty(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
security->root()->accept(pretty);
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 6c5489c..34a18c7 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -112,7 +112,6 @@ ExndbamRepository::ExndbamRepository(const RepositoryName & n, const ExndbamRepo
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>(this),
value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
)),
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 1d4eaed..ee0a1bd 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -167,7 +167,6 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
value_for<n::provides_interface>(this),
value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
- value_for<n::sets_interface>(this),
value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
)),