aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/unpackaged
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/unpackaged')
-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
4 files changed, 59 insertions, 56 deletions
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index dc154ab5a..c8431e300 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 11f7dc2f8..1189e8bcd 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 e3ca4c43b..05022caae 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 826cadc76..2b6013180 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;
+
+ ///\}
};
}