aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories')
-rw-r--r--paludis/repositories/accounts/accounts_repository.cc69
-rw-r--r--paludis/repositories/accounts/accounts_repository.hh7
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc72
-rw-r--r--paludis/repositories/cran/cran_installed_repository.hh20
-rw-r--r--paludis/repositories/cran/cran_repository.cc31
-rw-r--r--paludis/repositories/cran/cran_repository.hh14
-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
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc1
-rw-r--r--paludis/repositories/fake/fake_repository.cc4
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc31
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh21
-rw-r--r--paludis/repositories/gems/gems_repository.cc6
-rw-r--r--paludis/repositories/gems/gems_repository.hh9
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc38
-rw-r--r--paludis/repositories/gems/installed_gems_repository.hh9
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.cc6
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.hh9
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc82
-rw-r--r--paludis/repositories/unpackaged/installed_repository.hh18
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.cc6
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.hh9
-rw-r--r--paludis/repositories/unwritten/unwritten_repository.cc6
-rw-r--r--paludis/repositories/unwritten/unwritten_repository.hh7
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc6
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.hh5
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc6
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.hh9
33 files changed, 379 insertions, 322 deletions
diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc
index e501d5a..ee4e955 100644
--- a/paludis/repositories/accounts/accounts_repository.cc
+++ b/paludis/repositories/accounts/accounts_repository.cc
@@ -29,11 +29,15 @@
#include <paludis/util/active_object_ptr.hh>
#include <paludis/util/deferred_construction_ptr.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/log.hh>
#include <paludis/dep_tag.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/package_id.hh>
#include <paludis/environment.hh>
+#include <paludis/generator.hh>
+#include <paludis/selection.hh>
+#include <paludis/filtered_generator.hh>
using namespace paludis;
using namespace paludis::accounts_repository;
@@ -114,7 +118,6 @@ AccountsRepository::AccountsRepository(const AccountsRepositoryParams & p) :
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))
)),
@@ -138,7 +141,6 @@ AccountsRepository::AccountsRepository(const InstalledAccountsRepositoryParams &
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))
)),
@@ -422,51 +424,46 @@ AccountsRepository::merge(const MergeParams & m)
_imp->handler_if_installed->merge(m);
}
-const std::tr1::shared_ptr<const SetSpecTree>
-AccountsRepository::package_set(const SetName & s) const
+namespace
{
- using namespace std::tr1::placeholders;
-
- Context context("When fetching package set '" + stringify(s) + "' from '" +
- stringify(name()) + "':");
-
- if ("everything" == s.data() && _imp->params_if_installed)
+ std::tr1::shared_ptr<SetSpecTree> get_everything_set(
+ const Environment * const env,
+ const AccountsRepository * 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<GeneralSetDepTag> tag(new GeneralSetDepTag(s, stringify(name())));
- std::tr1::shared_ptr<const CategoryNamePartSet> cats(category_names());
- for (CategoryNamePartSet::ConstIterator c(cats->begin()), c_end(cats->end()) ;
- c != c_end ; ++c)
- {
- std::tr1::shared_ptr<const QualifiedPackageNameSet> pkgs(package_names(*c));
- 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(QualifiedPackageName(*e))));
- spec->set_tag(tag);
- result->root()->append(spec);
- }
- }
+ 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;
}
- else
- return make_null_shared_ptr();
}
-std::tr1::shared_ptr<const SetNameSet>
-AccountsRepository::sets_list() const
+void
+AccountsRepository::populate_sets() const
{
- Context context("While generating the list of sets:");
-
- std::tr1::shared_ptr<SetNameSet> result(new SetNameSet);
- if (_imp->params_if_installed)
- result->insert(SetName("everything"));
- return result;
+ if (_imp->params_if_not_installed)
+ {
+ /* no sets */
+ }
+ else
+ {
+ /* everything */
+ _imp->params_if_installed->environment()->add_set(
+ SetName("everything"),
+ SetName("everything::" + stringify(name())),
+ std::tr1::bind(get_everything_set, _imp->params_if_installed->environment(), this),
+ true);
+ }
}
-
template class PrivateImplementationPattern<AccountsRepository>;
diff --git a/paludis/repositories/accounts/accounts_repository.hh b/paludis/repositories/accounts/accounts_repository.hh
index a25153c..c9d2d22 100644
--- a/paludis/repositories/accounts/accounts_repository.hh
+++ b/paludis/repositories/accounts/accounts_repository.hh
@@ -56,7 +56,6 @@ namespace paludis
private PrivateImplementationPattern<AccountsRepository>,
public Repository,
public RepositoryDestinationInterface,
- public RepositorySetsInterface,
public std::tr1::enable_shared_from_this<AccountsRepository>
{
private:
@@ -154,12 +153,10 @@ namespace paludis
///\}
- ///\name Set queries
+ ///\name Set methods
///\{
- virtual const std::tr1::shared_ptr<const SetSpecTree> package_set(const SetName & s) const;
- virtual std::tr1::shared_ptr<const SetNameSet> sets_list() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual void populate_sets() const;
///\}
};
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 397e490..bf0384c 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -27,6 +27,10 @@
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/generator.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/selection.hh>
#include <paludis/repositories/cran/cran_package_id.hh>
#include <paludis/repositories/cran/cran_dep_parser.hh>
#include <paludis/repositories/cran/cran_installed_repository.hh>
@@ -167,7 +171,6 @@ CRANInstalledRepository::CRANInstalledRepository(const CRANInstalledRepositoryPa
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))
)),
@@ -444,41 +447,6 @@ CRANInstalledRepository::do_uninstall(const QualifiedPackageName & q, const Vers
}
#endif
-const std::tr1::shared_ptr<const SetSpecTree>
-CRANInstalledRepository::package_set(const SetName & s) const
-{
- 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)));
-
- need_ids();
-
- for (IDMap::const_iterator p(_imp->ids.begin()), p_end(_imp->ids.end()) ;
- p != p_end ; ++p)
- {
- std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(cranrepository::parse_cran_package_dep_spec(stringify(p->first.package()))));
- result->root()->append(spec);
- }
-
- return result;
- }
- else
- return make_null_shared_ptr();
-}
-
-std::tr1::shared_ptr<const SetNameSet>
-CRANInstalledRepository::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;
-}
-
void
CRANInstalledRepository::invalidate()
{
@@ -601,4 +569,36 @@ CRANInstalledRepository::installed_root_key() const
return _imp->installed_root_key;
}
+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
+CRANInstalledRepository::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/cran/cran_installed_repository.hh b/paludis/repositories/cran/cran_installed_repository.hh
index 80b3627..bba0019 100644
--- a/paludis/repositories/cran/cran_installed_repository.hh
+++ b/paludis/repositories/cran/cran_installed_repository.hh
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2006 Danny van Dyk
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -64,7 +64,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE CRANInstalledRepository :
public Repository,
- public RepositorySetsInterface,
public RepositoryDestinationInterface,
public PrivateImplementationPattern<CRANInstalledRepository>
{
@@ -108,11 +107,6 @@ namespace paludis
virtual void invalidate();
virtual void invalidate_masks();
- /* RepositorySetsInterface */
-
- virtual std::tr1::shared_ptr<const SetNameSet> sets_list() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* RepositoryDestinationInterface */
virtual bool is_suitable_destination_for(const PackageID &) const
@@ -147,16 +141,18 @@ namespace paludis
virtual bool some_ids_might_support_action(const SupportsActionTestBase &) const;
- /* RepositorySetsInterface */
-
- virtual const std::tr1::shared_ptr<const SetSpecTree> package_set(const SetName & id) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* Keys */
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
/**
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index 4d6713b..3bdde14 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -116,7 +116,6 @@ CRANRepository::CRANRepository(const CRANRepositoryParams & p) :
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>(this),
value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
)),
@@ -342,31 +341,6 @@ CRANRepository::do_install(const std::tr1::shared_ptr<const PackageID> & id_unca
}
#endif
-const std::tr1::shared_ptr<const SetSpecTree>
-CRANRepository::package_set(const SetName & s) const
-{
- if ("base" == s.data())
- {
- /**
- * \todo Implement system as all package which are installed
- * by dev-lang/R by default.
- */
- return make_shared_ptr(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
- }
- else
- return make_null_shared_ptr();
-}
-
-std::tr1::shared_ptr<const SetNameSet>
-CRANRepository::sets_list() const
-{
- Context context("While generating the list of sets:");
-
- std::tr1::shared_ptr<SetNameSet> result(new SetNameSet);
- result->insert(SetName("base"));
- return result;
-}
-
bool
CRANRepository::sync(const std::tr1::shared_ptr<OutputManager> & output_manager) const
{
@@ -571,3 +545,8 @@ CRANRepository::installed_root_key() const
return std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >();
}
+void
+CRANRepository::populate_sets() const
+{
+}
+
diff --git a/paludis/repositories/cran/cran_repository.hh b/paludis/repositories/cran/cran_repository.hh
index 9baef2a..bbd5578 100644
--- a/paludis/repositories/cran/cran_repository.hh
+++ b/paludis/repositories/cran/cran_repository.hh
@@ -76,7 +76,6 @@ namespace paludis
class PALUDIS_VISIBLE CRANRepository :
public Repository,
public RepositorySyncableInterface,
- public RepositorySetsInterface,
private PrivateImplementationPattern<CRANRepository>,
public std::tr1::enable_shared_from_this<CRANRepository>
{
@@ -128,12 +127,6 @@ namespace paludis
/* RepositorySyncableInterface */
- virtual const std::tr1::shared_ptr<const SetSpecTree> package_set(const SetName &) const;
-
- virtual std::tr1::shared_ptr<const SetNameSet> sets_list() const;
-
- /* RepositorySyncableInterface */
-
virtual bool sync(const std::tr1::shared_ptr<OutputManager> & output_deviant) const;
/* Repository */
@@ -162,6 +155,13 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
/**
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))
)),
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 5a7f23e..814b729 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -65,7 +65,6 @@ FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, co
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))
)),
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 9bca810..765fb28 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -68,7 +68,6 @@ FakeRepository::FakeRepository(const Environment * const env, const RepositoryNa
value_for<n::mirrors_interface>(this),
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>((*DistributionData::get_instance()->distribution_from_string(
env->distribution())).support_old_style_virtuals() ? this : 0)
@@ -90,7 +89,6 @@ FakeRepository::FakeRepository(const FakeRepositoryParams & params) :
value_for<n::mirrors_interface>(this),
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>((*DistributionData::get_instance()->distribution_from_string(
params.environment()->distribution())).support_old_style_virtuals() ? this : 0)
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index 8f0515b..51ce369 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -48,7 +48,6 @@ namespace paludis
std::tr1::shared_ptr<CategoryNamePartSet> category_names;
std::map<CategoryNamePart, std::tr1::shared_ptr<PackageNamePartSet> > package_names;
std::map<QualifiedPackageName, std::tr1::shared_ptr<PackageIDSequence> > ids;
- std::map<SetName, std::tr1::shared_ptr<const SetSpecTree> > sets;
const Environment * const env;
@@ -164,31 +163,6 @@ FakeRepositoryBase::invalidate_masks()
(*it2)->invalidate_masks();
}
-void
-FakeRepositoryBase::add_package_set(const SetName & n, const std::tr1::shared_ptr<const SetSpecTree> & s)
-{
- _imp->sets.insert(std::make_pair(n, s));
-}
-
-const std::tr1::shared_ptr<const SetSpecTree>
-FakeRepositoryBase::package_set(const SetName & id) const
-{
- std::map<SetName, std::tr1::shared_ptr<const SetSpecTree> >::const_iterator i(_imp->sets.find(id));
- if (_imp->sets.end() == i)
- return std::tr1::shared_ptr<const SetSpecTree>();
- else
- return i->second;
-}
-
-std::tr1::shared_ptr<const SetNameSet>
-FakeRepositoryBase::sets_list() const
-{
- std::tr1::shared_ptr<SetNameSet> result(new SetNameSet);
- std::transform(_imp->sets.begin(), _imp->sets.end(), result->inserter(),
- std::tr1::mem_fn(&std::pair<const SetName, std::tr1::shared_ptr<const SetSpecTree> >::first));
- return result;
-}
-
const Environment *
FakeRepositoryBase::environment() const
{
@@ -200,3 +174,8 @@ FakeRepositoryBase::need_keys_added() const
{
}
+void
+FakeRepositoryBase::populate_sets() const
+{
+}
+
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index 136530a..b2548b5 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -44,7 +44,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE FakeRepositoryBase :
public Repository,
- public RepositorySetsInterface,
private PrivateImplementationPattern<FakeRepositoryBase>,
public std::tr1::enable_shared_from_this<FakeRepositoryBase>
{
@@ -90,11 +89,6 @@ namespace paludis
std::tr1::shared_ptr<FakePackageID> add_version(const std::string & c, const std::string & p,
const std::string & v);
- /**
- * Add a package set.
- */
- void add_package_set(const SetName &, const std::tr1::shared_ptr<const SetSpecTree> &);
-
virtual void invalidate();
virtual void invalidate_masks();
@@ -104,14 +98,6 @@ namespace paludis
*/
const Environment * environment() const;
- /* 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));
-
/* Repository */
virtual std::tr1::shared_ptr<const PackageIDSequence> package_ids(
@@ -130,6 +116,13 @@ namespace paludis
virtual bool has_category_named(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
}
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index d021eb9..13530b5 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -100,7 +100,6 @@ GemsRepository::GemsRepository(const gems::RepositoryParams & params) :
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))
)),
@@ -406,3 +405,8 @@ GemsRepository::repository_factory_dependencies(
return make_shared_ptr(new RepositoryNameSet);
}
+void
+GemsRepository::populate_sets() const
+{
+}
+
diff --git a/paludis/repositories/gems/gems_repository.hh b/paludis/repositories/gems/gems_repository.hh
index e380e78..1d5ac0d 100644
--- a/paludis/repositories/gems/gems_repository.hh
+++ b/paludis/repositories/gems/gems_repository.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -106,6 +106,13 @@ namespace paludis
const std::tr1::function<std::string (const std::string &)> &);
///\}
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
}
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);
+}
+
diff --git a/paludis/repositories/gems/installed_gems_repository.hh b/paludis/repositories/gems/installed_gems_repository.hh
index 2b7323e..22a9fc0 100644
--- a/paludis/repositories/gems/installed_gems_repository.hh
+++ b/paludis/repositories/gems/installed_gems_repository.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -121,6 +121,13 @@ namespace paludis
const std::tr1::function<std::string (const std::string &)> &);
///\}
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
}
diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc
index ed26457..2ed4b43 100644
--- a/paludis/repositories/unavailable/unavailable_repository.cc
+++ b/paludis/repositories/unavailable/unavailable_repository.cc
@@ -94,7 +94,6 @@ UnavailableRepository::UnavailableRepository(const UnavailableRepositoryParams &
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>(this),
value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
)),
@@ -345,5 +344,10 @@ UnavailableRepository::repository_factory_dependencies(
return make_shared_ptr(new RepositoryNameSet);
}
+void
+UnavailableRepository::populate_sets() const
+{
+}
+
template class PrivateImplementationPattern<unavailable_repository::UnavailableRepository>;
diff --git a/paludis/repositories/unavailable/unavailable_repository.hh b/paludis/repositories/unavailable/unavailable_repository.hh
index 68a15fb..657093b 100644
--- a/paludis/repositories/unavailable/unavailable_repository.hh
+++ b/paludis/repositories/unavailable/unavailable_repository.hh
@@ -110,7 +110,14 @@ namespace paludis
const std::tr1::function<std::string (const std::string &)> &);
///\}
- };
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
+ };
}
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index dc154ab..c8431e3 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -42,6 +42,10 @@
#include <paludis/metadata_key.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/generator.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/selection.hh>
#include <sstream>
#include <sys/time.h>
@@ -95,7 +99,6 @@ InstalledUnpackagedRepository::InstalledUnpackagedRepository(
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))
)),
@@ -417,50 +420,6 @@ InstalledUnpackagedRepository::deindex(const QualifiedPackageName & q) const
_imp->ndbam.deindex(q);
}
-const std::tr1::shared_ptr<const SetSpecTree>
-InstalledUnpackagedRepository::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(s, stringify(name())));
-
- std::tr1::shared_ptr<const CategoryNamePartSet> cats(category_names());
- for (CategoryNamePartSet::ConstIterator c(cats->begin()), c_end(cats->end()) ;
- c != c_end ; ++c)
- {
- std::tr1::shared_ptr<const QualifiedPackageNameSet> pkgs(package_names(*c));
- 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(QualifiedPackageName(*e))));
- spec->set_tag(tag);
- result->root()->append(spec);
- }
- }
-
- return result;
- }
- else
- return make_null_shared_ptr();
-}
-
-std::tr1::shared_ptr<const SetNameSet>
-InstalledUnpackagedRepository::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;
-}
-
void
InstalledUnpackagedRepository::need_keys_added() const
{
@@ -523,3 +482,36 @@ InstalledUnpackagedRepository::repository_factory_dependencies(
return make_shared_ptr(new RepositoryNameSet);
}
+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
+InstalledUnpackagedRepository::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/unpackaged/installed_repository.hh b/paludis/repositories/unpackaged/installed_repository.hh
index 11f7dc2..1189e8b 100644
--- a/paludis/repositories/unpackaged/installed_repository.hh
+++ b/paludis/repositories/unpackaged/installed_repository.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -47,8 +47,7 @@ namespace paludis
class PALUDIS_VISIBLE InstalledUnpackagedRepository :
private PrivateImplementationPattern<InstalledUnpackagedRepository>,
public Repository,
- public RepositoryDestinationInterface,
- public RepositorySetsInterface
+ public RepositoryDestinationInterface
{
private:
PrivateImplementationPattern<InstalledUnpackagedRepository>::ImpPtr & _imp;
@@ -80,9 +79,6 @@ namespace paludis
void deindex(const QualifiedPackageName &) const;
- virtual std::tr1::shared_ptr<const SetNameSet> sets_list() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual std::tr1::shared_ptr<const PackageIDSequence> package_ids(
const QualifiedPackageName &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -106,9 +102,6 @@ namespace paludis
virtual bool some_ids_might_support_action(const SupportsActionTestBase &) const;
- virtual const std::tr1::shared_ptr<const SetSpecTree> package_set(const SetName & id) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* Keys */
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
@@ -131,6 +124,13 @@ namespace paludis
const std::tr1::function<std::string (const std::string &)> &);
///\}
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.cc b/paludis/repositories/unpackaged/unpackaged_repository.cc
index e3ca4c4..05022ca 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository.cc
@@ -104,7 +104,6 @@ UnpackagedRepository::UnpackagedRepository(const RepositoryName & n,
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))
)),
@@ -278,3 +277,8 @@ UnpackagedRepository::repository_factory_dependencies(
return make_shared_ptr(new RepositoryNameSet);
}
+void
+UnpackagedRepository::populate_sets() const
+{
+}
+
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.hh b/paludis/repositories/unpackaged/unpackaged_repository.hh
index 826cadc..2b60131 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.hh
+++ b/paludis/repositories/unpackaged/unpackaged_repository.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -123,6 +123,13 @@ namespace paludis
const std::tr1::function<std::string (const std::string &)> &);
///\}
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
}
diff --git a/paludis/repositories/unwritten/unwritten_repository.cc b/paludis/repositories/unwritten/unwritten_repository.cc
index 4eed1d9..7c7f032 100644
--- a/paludis/repositories/unwritten/unwritten_repository.cc
+++ b/paludis/repositories/unwritten/unwritten_repository.cc
@@ -94,7 +94,6 @@ UnwrittenRepository::UnwrittenRepository(const UnwrittenRepositoryParams & p) :
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>(this),
value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
)),
@@ -345,6 +344,11 @@ UnwrittenRepository::repository_factory_dependencies(
return make_shared_ptr(new RepositoryNameSet);
}
+void
+UnwrittenRepository::populate_sets() const
+{
+}
+
template class PrivateImplementationPattern<unwritten_repository::UnwrittenRepository>;
diff --git a/paludis/repositories/unwritten/unwritten_repository.hh b/paludis/repositories/unwritten/unwritten_repository.hh
index f61a687..bcb9a38 100644
--- a/paludis/repositories/unwritten/unwritten_repository.hh
+++ b/paludis/repositories/unwritten/unwritten_repository.hh
@@ -109,6 +109,13 @@ namespace paludis
const std::tr1::function<std::string (const std::string &)> &);
///\}
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
}
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 60820bf..98bf8bd 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -119,7 +119,6 @@ InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * con
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))
)),
@@ -389,3 +388,8 @@ InstalledVirtualsRepository::merge(const MergeParams &)
throw InternalError(PALUDIS_HERE, "can't merge to installed virtuals");
}
+void
+InstalledVirtualsRepository::populate_sets() const
+{
+}
+
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.hh b/paludis/repositories/virtuals/installed_virtuals_repository.hh
index af9e9e0..5a72619 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.hh
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.hh
@@ -126,6 +126,11 @@ namespace paludis
virtual void merge(const MergeParams &) PALUDIS_ATTRIBUTE((noreturn));
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
///\}
};
}
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index 9bbb64d..f88c59c 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -130,7 +130,6 @@ VirtualsRepository::VirtualsRepository(const Environment * const env) :
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))
)),
@@ -459,3 +458,8 @@ VirtualsRepository::repository_factory_dependencies(
return make_shared_ptr(new RepositoryNameSet);
}
+void
+VirtualsRepository::populate_sets() const
+{
+}
+
diff --git a/paludis/repositories/virtuals/virtuals_repository.hh b/paludis/repositories/virtuals/virtuals_repository.hh
index ce7e26e..cf33555 100644
--- a/paludis/repositories/virtuals/virtuals_repository.hh
+++ b/paludis/repositories/virtuals/virtuals_repository.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -114,6 +114,13 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
};
}