aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-02 21:00:39 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-02 21:00:39 +0100
commitf5bb0e4827bbc8d9bbab98c55fd3c9ad0093569b (patch)
tree976cd23dbf68b5861d6876b667822772467d1a1e
parent0703b518aa8cee3a383de45bca5083315807245e (diff)
downloadpaludis-f5bb0e4827bbc8d9bbab98c55fd3c9ad0093569b.tar.gz
paludis-f5bb0e4827bbc8d9bbab98c55fd3c9ad0093569b.tar.xz
Pretend installed virtuals is a destination repo
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc29
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.hh18
2 files changed, 44 insertions, 3 deletions
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index bfd3ae8..60820bf 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -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
@@ -110,7 +110,7 @@ namespace
InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * const env,
const FSEntry & r) :
Repository(env, RepositoryName(make_name(r)), make_named_values<RepositoryCapabilities>(
- value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(this)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
value_for<n::hook_interface>(this),
@@ -363,4 +363,29 @@ InstalledVirtualsRepository::repository_factory_dependencies(
return make_shared_ptr(new RepositoryNameSet);
}
+bool
+InstalledVirtualsRepository::is_suitable_destination_for(const PackageID & e) const
+{
+ std::string f(e.repository()->format_key() ? e.repository()->format_key()->value() : "");
+ return f == "virtuals";
+
+}
+
+bool
+InstalledVirtualsRepository::is_default_destination() const
+{
+ return false;
+}
+
+bool
+InstalledVirtualsRepository::want_pre_post_phases() const
+{
+ return false;
+}
+
+void
+InstalledVirtualsRepository::merge(const MergeParams &)
+{
+ throw InternalError(PALUDIS_HERE, "can't merge to installed virtuals");
+}
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.hh b/paludis/repositories/virtuals/installed_virtuals_repository.hh
index b9f7ef9..af9e9e0 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.hh
+++ b/paludis/repositories/virtuals/installed_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
@@ -35,6 +35,7 @@ namespace paludis
class PALUDIS_VISIBLE InstalledVirtualsRepository :
public Repository,
public RepositoryHookInterface,
+ public RepositoryDestinationInterface,
public std::tr1::enable_shared_from_this<InstalledVirtualsRepository>,
private PrivateImplementationPattern<InstalledVirtualsRepository>
{
@@ -111,6 +112,21 @@ 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;
+
+ /* RepositoryDestinationInterface */
+
+ virtual bool is_suitable_destination_for(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool is_default_destination() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool want_pre_post_phases() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void merge(const MergeParams &) PALUDIS_ATTRIBUTE((noreturn));
+
+ ///\}
};
}