aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-13 05:57:15 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-13 05:57:15 +0000
commit11059e77637e3724329e68441f26b68657479d1a (patch)
treed98af70a69cce4c4f799a012ffae20870b27de20
parente0176aa160cf3565b2d2ce935dcda7f5153587bd (diff)
downloadpaludis-11059e77637e3724329e68441f26b68657479d1a.tar.gz
paludis-11059e77637e3724329e68441f26b68657479d1a.tar.xz
Support the 'everything' and 'ununused' packages in InstalledUnpackagedRepository.
-rw-r--r--paludis/repositories/unpackaged/installed_unpackaged_repository.cc50
-rw-r--r--paludis/repositories/unpackaged/installed_unpackaged_repository.hh9
2 files changed, 57 insertions, 2 deletions
diff --git a/paludis/repositories/unpackaged/installed_unpackaged_repository.cc b/paludis/repositories/unpackaged/installed_unpackaged_repository.cc
index a38d3e9..e4167da 100644
--- a/paludis/repositories/unpackaged/installed_unpackaged_repository.cc
+++ b/paludis/repositories/unpackaged/installed_unpackaged_repository.cc
@@ -24,12 +24,15 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/iterator.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/set.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/system.hh>
#include <paludis/action.hh>
#include <paludis/environment.hh>
+#include <paludis/dep_tag.hh>
#include <paludis/metadata_key.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <fstream>
@@ -70,7 +73,7 @@ InstalledUnpackagedRepository::InstalledUnpackagedRepository(
PrivateImplementationPattern<InstalledUnpackagedRepository>(new Implementation<InstalledUnpackagedRepository>(p)),
Repository(n, RepositoryCapabilities::create()
.installed_interface(this)
- .sets_interface(0)
+ .sets_interface(this)
.syncable_interface(0)
.use_interface(0)
.world_interface(0)
@@ -324,3 +327,48 @@ InstalledUnpackagedRepository::deindex(const QualifiedPackageName & q) const
_imp->ndbam.deindex(q);
}
+tr1::shared_ptr<SetSpecTree::ConstItem>
+InstalledUnpackagedRepository::do_package_set(const SetName & s) const
+{
+ using namespace tr1::placeholders;
+
+ Context context("When fetching package set '" + stringify(s) + "' from '" +
+ stringify(name()) + "':");
+
+ if ("everything" == s.data() || "ununused" == s.data())
+ {
+ tr1::shared_ptr<ConstTreeSequence<SetSpecTree, AllDepSpec> > result(new ConstTreeSequence<SetSpecTree, AllDepSpec>(
+ make_shared_ptr(new AllDepSpec)));
+ tr1::shared_ptr<GeneralSetDepTag> tag(new GeneralSetDepTag(s, stringify(name())));
+
+ tr1::shared_ptr<const CategoryNamePartSet> cats(category_names());
+ for (CategoryNamePartSet::ConstIterator c(cats->begin()), c_end(cats->end()) ;
+ c != c_end ; ++c)
+ {
+ tr1::shared_ptr<const QualifiedPackageNameSet> pkgs(package_names(*c));
+ for (QualifiedPackageNameSet::ConstIterator e(pkgs->begin()), e_end(pkgs->end()) ;
+ e != e_end ; ++e)
+ {
+ tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(make_shared_ptr(new QualifiedPackageName(*e))));
+ spec->set_tag(tag);
+ result->add(make_shared_ptr(new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ }
+ }
+
+ return result;
+ }
+ else
+ return tr1::shared_ptr<SetSpecTree::ConstItem>();
+}
+
+tr1::shared_ptr<const SetNameSet>
+InstalledUnpackagedRepository::sets_list() const
+{
+ Context context("While generating the list of sets:");
+
+ tr1::shared_ptr<SetNameSet> result(new SetNameSet);
+ result->insert(SetName("everything"));
+ result->insert(SetName("ununused"));
+ return result;
+}
+
diff --git a/paludis/repositories/unpackaged/installed_unpackaged_repository.hh b/paludis/repositories/unpackaged/installed_unpackaged_repository.hh
index 2f1014f..f3916af 100644
--- a/paludis/repositories/unpackaged/installed_unpackaged_repository.hh
+++ b/paludis/repositories/unpackaged/installed_unpackaged_repository.hh
@@ -35,7 +35,8 @@ namespace paludis
private PrivateImplementationPattern<InstalledUnpackagedRepository>,
public Repository,
public RepositoryDestinationInterface,
- public RepositoryInstalledInterface
+ public RepositoryInstalledInterface,
+ public RepositorySetsInterface
{
protected:
virtual tr1::shared_ptr<const PackageIDSequence> do_package_ids(
@@ -61,6 +62,9 @@ namespace paludis
virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const;
+ virtual tr1::shared_ptr<SetSpecTree::ConstItem> do_package_set(const SetName & id) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
public:
InstalledUnpackagedRepository(
const RepositoryName &,
@@ -86,6 +90,9 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
void deindex(const QualifiedPackageName &) const;
+
+ virtual tr1::shared_ptr<const SetNameSet> sets_list() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}