aboutsummaryrefslogtreecommitdiff
path: root/paludis/environments
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-26 18:58:38 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-26 19:00:38 +0000
commit5c2a332b70243cb583a29bb74f712bfca2c1fb76 (patch)
tree0a01f8e624caa2c6639181df45fa80bc20adba84 /paludis/environments
parent79d9f02fb355d81c472f3d94b8b85d5a7639210c (diff)
downloadpaludis-5c2a332b70243cb583a29bb74f712bfca2c1fb76.tar.gz
paludis-5c2a332b70243cb583a29bb74f712bfca2c1fb76.tar.xz
Use Environment rather than PackageDatabase
Diffstat (limited to 'paludis/environments')
-rw-r--r--paludis/environments/no_config/no_config_environment.cc40
-rw-r--r--paludis/environments/no_config/no_config_environment.hh6
-rw-r--r--paludis/environments/no_config/no_config_environment_TEST.cc2
-rw-r--r--paludis/environments/paludis/mirrors_conf.cc11
-rw-r--r--paludis/environments/paludis/output_conf.cc4
-rw-r--r--paludis/environments/paludis/paludis_config.cc2
-rw-r--r--paludis/environments/paludis/paludis_environment.cc22
-rw-r--r--paludis/environments/paludis/paludis_environment.hh7
-rw-r--r--paludis/environments/paludis/paludis_environment_TEST.cc24
-rw-r--r--paludis/environments/paludis/use_conf.cc3
-rw-r--r--paludis/environments/portage/portage_environment.cc35
-rw-r--r--paludis/environments/portage/portage_environment.hh6
-rw-r--r--paludis/environments/portage/portage_environment_TEST.cc1
-rw-r--r--paludis/environments/test/test_environment.cc25
-rw-r--r--paludis/environments/test/test_environment.hh6
15 files changed, 62 insertions, 132 deletions
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index 000d609ea..8ec8153b9 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/environments/no_config/no_config_environment.hh>
+
#include <paludis/util/tokeniser.hh>
#include <paludis/util/log.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -37,13 +38,16 @@
#include <paludis/util/fs_path.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_iterator.hh>
+#include <paludis/util/join.hh>
+
#include <paludis/standard_output_manager.hh>
#include <paludis/distribution.hh>
-#include <paludis/package_database.hh>
#include <paludis/hook.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/repository_factory.hh>
#include <paludis/choice.hh>
+#include <paludis/repository.hh>
+
#include <unordered_map>
#include <functional>
#include <algorithm>
@@ -73,14 +77,12 @@ namespace paludis
std::shared_ptr<Repository> master_repo;
std::list<std::shared_ptr<Repository> > extra_repos;
- std::shared_ptr<PackageDatabase> package_database;
-
std::shared_ptr<LiteralMetadataValueKey<std::string> > format_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > repository_dir_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > preferred_root_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > system_root_key;
- Imp(NoConfigEnvironment * const env, const no_config_environment::Params & params);
+ Imp(const no_config_environment::Params & params);
void initialise(NoConfigEnvironment * const env);
};
@@ -149,14 +151,12 @@ namespace
}
}
-Imp<NoConfigEnvironment>::Imp(
- NoConfigEnvironment * const env, const no_config_environment::Params & p) :
+Imp<NoConfigEnvironment>::Imp(const no_config_environment::Params & p) :
params(p),
top_level_dir(p.repository_dir()),
write_cache(p.write_cache()),
accept_unstable(p.accept_unstable()),
is_vdb(is_vdb_repository(p.repository_dir(), p.repository_type())),
- package_database(std::make_shared<PackageDatabase>(env)),
format_key(std::make_shared<LiteralMetadataValueKey<std::string>>("format", "Format", mkt_significant, "no_config")),
repository_dir_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("repository_dir", "Repository dir",
mkt_normal, p.repository_dir())),
@@ -291,15 +291,15 @@ Imp<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
if (repo->name() == main_repository_name)
{
main_repo = repo;
- package_database->add_repository(3, repo);
+ env->add_repository(3, repo);
}
else if (stringify(repo->name()) == params.master_repository_name())
{
master_repo = repo;
- package_database->add_repository(2, repo);
+ env->add_repository(2, repo);
}
else
- package_database->add_repository(1, repo);
+ env->add_repository(1, repo);
}
}
catch (const NoGraphTopologicalOrderExistsError & x)
@@ -319,7 +319,7 @@ Imp<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "virtuals");
if ((*DistributionData::get_instance()->distribution_from_string(env->distribution())).support_old_style_virtuals())
- package_database->add_repository(-2, RepositoryFactory::get_instance()->create(env,
+ env->add_repository(-2, RepositoryFactory::get_instance()->create(env,
std::bind(from_keys, v_keys, std::placeholders::_1)));
#endif
}
@@ -336,7 +336,7 @@ Imp<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
keys->insert("provides_cache", "/var/empty");
keys->insert("location", stringify(top_level_dir.realpath()));
- package_database->add_repository(1, RepositoryFactory::get_instance()->create(env,
+ env->add_repository(1, RepositoryFactory::get_instance()->create(env,
std::bind(from_keys, keys, std::placeholders::_1)));
std::shared_ptr<Map<std::string, std::string> > iv_keys(std::make_shared<Map<std::string, std::string>>());
@@ -345,14 +345,14 @@ Imp<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
#ifdef ENABLE_VIRTUALS_REPOSITORY
if ((*DistributionData::get_instance()->distribution_from_string(env->distribution())).support_old_style_virtuals())
- package_database->add_repository(-2, RepositoryFactory::get_instance()->create(env,
+ env->add_repository(-2, RepositoryFactory::get_instance()->create(env,
std::bind(from_keys, iv_keys, std::placeholders::_1)));
#endif
}
}
NoConfigEnvironment::NoConfigEnvironment(const no_config_environment::Params & params) :
- _imp(this, params)
+ _imp(params)
{
_imp->initialise(this);
@@ -408,18 +408,6 @@ NoConfigEnvironment::master_repository() const
return _imp->master_repo;
}
-std::shared_ptr<PackageDatabase>
-NoConfigEnvironment::package_database()
-{
- return _imp->package_database;
-}
-
-std::shared_ptr<const PackageDatabase>
-NoConfigEnvironment::package_database() const
-{
- return _imp->package_database;
-}
-
bool
NoConfigEnvironment::accept_keywords(
const std::shared_ptr<const KeywordNameSet> & keywords,
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index 868eb37a2..60be54777 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -162,12 +162,6 @@ namespace paludis
const PackageDepSpec & spec) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::shared_ptr<PackageDatabase> package_database()
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::shared_ptr<const PackageDatabase> package_database() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual bool accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/environments/no_config/no_config_environment_TEST.cc b/paludis/environments/no_config/no_config_environment_TEST.cc
index 0da71bafa..c4403df15 100644
--- a/paludis/environments/no_config/no_config_environment_TEST.cc
+++ b/paludis/environments/no_config/no_config_environment_TEST.cc
@@ -40,7 +40,5 @@ TEST(NoConfigEnvironment, Construction)
n::repository_type() = no_config_environment::ncer_auto,
n::write_cache() = FSPath("/var/empty")
));
-
- EXPECT_TRUE(bool(e.package_database()));
}
diff --git a/paludis/environments/paludis/mirrors_conf.cc b/paludis/environments/paludis/mirrors_conf.cc
index 0ff5a2480..2f36bd20a 100644
--- a/paludis/environments/paludis/mirrors_conf.cc
+++ b/paludis/environments/paludis/mirrors_conf.cc
@@ -17,11 +17,13 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "mirrors_conf.hh"
-#include <paludis/environment.hh>
-#include <paludis/name.hh>
+#include <paludis/environments/paludis/mirrors_conf.hh>
#include <paludis/environments/paludis/paludis_environment.hh>
#include <paludis/environments/paludis/bashable_conf.hh>
+
+#include <paludis/environment.hh>
+#include <paludis/name.hh>
+
#include <paludis/util/log.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/tokeniser.hh>
@@ -30,6 +32,9 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/options.hh>
+
#include <functional>
#include <unordered_map>
#include <algorithm>
diff --git a/paludis/environments/paludis/output_conf.cc b/paludis/environments/paludis/output_conf.cc
index 3b9d50a16..2f3ebfaf3 100644
--- a/paludis/environments/paludis/output_conf.cc
+++ b/paludis/environments/paludis/output_conf.cc
@@ -22,6 +22,7 @@
#include <paludis/environments/paludis/paludis_config.hh>
#include <paludis/environments/paludis/paludis_environment.hh>
#include <paludis/environments/paludis/extra_distribution_data.hh>
+
#include <paludis/util/log.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/tokeniser.hh>
@@ -37,6 +38,7 @@
#include <paludis/util/map.hh>
#include <paludis/util/simple_parser.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+
#include <paludis/user_dep_spec.hh>
#include <paludis/create_output_manager_info.hh>
#include <paludis/package_id.hh>
@@ -45,6 +47,8 @@
#include <paludis/output_manager_factory.hh>
#include <paludis/metadata_key.hh>
#include <paludis/distribution.hh>
+#include <paludis/version_spec.hh>
+
#include <list>
#include <vector>
#include <map>
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index 1f9bc882b..03b5f7b33 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -52,6 +52,8 @@
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_error.hh>
#include <paludis/util/env_var_names.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/join.hh>
#include <paludis/distribution.hh>
#include <paludis/repository_factory.hh>
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index bfe9478f2..de4f65dab 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -59,6 +59,7 @@
#include <paludis/util/fs_iterator.hh>
#include <paludis/util/fs_error.hh>
#include <paludis/util/env_var_names.hh>
+#include <paludis/util/join.hh>
#include <functional>
#include <algorithm>
@@ -80,8 +81,6 @@ namespace paludis
std::shared_ptr<PaludisConfig> config;
- std::shared_ptr<PackageDatabase> package_database;
-
mutable Mutex sets_mutex;
mutable std::map<SetName, std::shared_ptr<const SetSpecTree> > sets;
@@ -91,10 +90,9 @@ namespace paludis
std::shared_ptr<LiteralMetadataValueKey<FSPath> > preferred_root_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > system_root_key;
- Imp(PaludisEnvironment * const e, std::shared_ptr<PaludisConfig> c) :
+ Imp(std::shared_ptr<PaludisConfig> c) :
done_hooks(false),
config(c),
- package_database(std::make_shared<PackageDatabase>(e)),
format_key(std::make_shared<LiteralMetadataValueKey<std::string>>("format", "Format", mkt_significant, "paludis")),
config_location_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("conf_dir", "Config dir", mkt_normal,
FSPath(config->config_dir()))),
@@ -148,13 +146,13 @@ namespace paludis
}
PaludisEnvironment::PaludisEnvironment(const std::string & s) :
- _imp(this, std::shared_ptr<PaludisConfig>(std::make_shared<PaludisConfig>(this, s)))
+ _imp(std::shared_ptr<PaludisConfig>(std::make_shared<PaludisConfig>(this, s)))
{
Context context("When loading paludis environment:");
for (PaludisConfig::RepositoryConstIterator r(_imp->config->begin_repositories()),
r_end(_imp->config->end_repositories()) ; r != r_end ; ++r)
- _imp->package_database->add_repository(
+ add_repository(
RepositoryFactory::get_instance()->importance(this, *r),
RepositoryFactory::get_instance()->create(this, *r));
@@ -323,18 +321,6 @@ PaludisEnvironment::config_dir() const
return _imp->config->config_dir();
}
-std::shared_ptr<PackageDatabase>
-PaludisEnvironment::package_database()
-{
- return _imp->package_database;
-}
-
-std::shared_ptr<const PackageDatabase>
-PaludisEnvironment::package_database() const
-{
- return _imp->package_database;
-}
-
std::string
PaludisEnvironment::distribution() const
{
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index 29f93081c..553ff238a 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -20,7 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEFAULT_ENVIRONMENT_HH
#define PALUDIS_GUARD_PALUDIS_DEFAULT_ENVIRONMENT_HH 1
-#include <paludis/package_database.hh>
#include <paludis/environment_implementation.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
@@ -100,12 +99,6 @@ namespace paludis
const std::shared_ptr<OutputManager> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::shared_ptr<PackageDatabase> package_database()
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::shared_ptr<const PackageDatabase> package_database() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual std::string distribution() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/environments/paludis/paludis_environment_TEST.cc b/paludis/environments/paludis/paludis_environment_TEST.cc
index 87b136bc8..ef5d28ab2 100644
--- a/paludis/environments/paludis/paludis_environment_TEST.cc
+++ b/paludis/environments/paludis/paludis_environment_TEST.cc
@@ -25,6 +25,8 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/options.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
#include <paludis/package_id.hh>
#include <paludis/user_dep_spec.hh>
@@ -163,16 +165,16 @@ TEST(PaludisEnvironment, Repositories)
std::shared_ptr<Environment> env(std::make_shared<PaludisEnvironment>(""));
- EXPECT_TRUE(bool(env->package_database()->fetch_repository(RepositoryName("first"))));
- EXPECT_TRUE(bool(env->package_database()->fetch_repository(RepositoryName("second"))));
- EXPECT_TRUE(bool(env->package_database()->fetch_repository(RepositoryName("third"))));
- EXPECT_TRUE(bool(env->package_database()->fetch_repository(RepositoryName("fourth"))));
- EXPECT_TRUE(bool(env->package_database()->fetch_repository(RepositoryName("fifth"))));
-
- EXPECT_TRUE(env->package_database()->more_important_than(RepositoryName("first"), RepositoryName("second")));
- EXPECT_TRUE(env->package_database()->more_important_than(RepositoryName("second"), RepositoryName("third")));
- EXPECT_TRUE(env->package_database()->more_important_than(RepositoryName("fourth"), RepositoryName("third")));
- EXPECT_TRUE(env->package_database()->more_important_than(RepositoryName("fourth"), RepositoryName("fifth")));
- EXPECT_TRUE(env->package_database()->more_important_than(RepositoryName("second"), RepositoryName("fifth")));
+ EXPECT_TRUE(bool(env->fetch_repository(RepositoryName("first"))));
+ EXPECT_TRUE(bool(env->fetch_repository(RepositoryName("second"))));
+ EXPECT_TRUE(bool(env->fetch_repository(RepositoryName("third"))));
+ EXPECT_TRUE(bool(env->fetch_repository(RepositoryName("fourth"))));
+ EXPECT_TRUE(bool(env->fetch_repository(RepositoryName("fifth"))));
+
+ EXPECT_TRUE(env->more_important_than(RepositoryName("first"), RepositoryName("second")));
+ EXPECT_TRUE(env->more_important_than(RepositoryName("second"), RepositoryName("third")));
+ EXPECT_TRUE(env->more_important_than(RepositoryName("fourth"), RepositoryName("third")));
+ EXPECT_TRUE(env->more_important_than(RepositoryName("fourth"), RepositoryName("fifth")));
+ EXPECT_TRUE(env->more_important_than(RepositoryName("second"), RepositoryName("fifth")));
}
diff --git a/paludis/environments/paludis/use_conf.cc b/paludis/environments/paludis/use_conf.cc
index 4a7009e25..46dfcb665 100644
--- a/paludis/environments/paludis/use_conf.cc
+++ b/paludis/environments/paludis/use_conf.cc
@@ -20,9 +20,12 @@
#include <paludis/environments/paludis/use_conf.hh>
#include <paludis/environments/paludis/paludis_environment.hh>
#include <paludis/environments/paludis/bashable_conf.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/tribool.hh>
+#include <paludis/util/stringify.hh>
+
#include <paludis/paludislike_options_conf.hh>
#include <paludis/choice.hh>
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 3cd2c53c3..414ad4ce5 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -17,7 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "portage_environment.hh"
+#include <paludis/environments/portage/portage_environment.hh>
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
@@ -42,13 +42,13 @@
#include <paludis/util/fs_error.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/env_var_names.hh>
+#include <paludis/util/join.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/hooker.hh>
#include <paludis/hook.hh>
#include <paludis/mask.hh>
#include <paludis/match_package.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/set_file.hh>
@@ -109,8 +109,6 @@ namespace paludis
int overlay_importance;
- std::shared_ptr<PackageDatabase> package_database;
-
const FSPath world_file;
mutable Mutex world_mutex;
@@ -120,12 +118,11 @@ namespace paludis
std::shared_ptr<LiteralMetadataValueKey<FSPath> > preferred_root_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > system_root_key;
- Imp(Environment * const e, const std::string & s) :
+ Imp(const std::string & s) :
conf_dir(FSPath(s.empty() ? "/" : s) / SYSCONFDIR),
ignore_all_breaks_portage(false),
done_hooks(false),
overlay_importance(10),
- package_database(std::make_shared<PackageDatabase>(e)),
world_file(s + "/var/lib/portage/world"),
format_key(std::make_shared<LiteralMetadataValueKey<std::string>>("format", "Format", mkt_significant, "portage")),
config_location_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("conf_dir", "Config dir", mkt_normal,
@@ -230,7 +227,7 @@ namespace
}
PortageEnvironment::PortageEnvironment(const std::string & s) :
- _imp(this, s)
+ _imp(s)
{
using namespace std::placeholders;
@@ -470,8 +467,7 @@ PortageEnvironment::_add_virtuals_repository()
#ifdef ENABLE_VIRTUALS_REPOSITORY
std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
keys->insert("format", "virtuals");
- package_database()->add_repository(-2,
- RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1)));
+ add_repository(-2, RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1)));
#endif
}
@@ -482,8 +478,7 @@ PortageEnvironment::_add_installed_virtuals_repository()
std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
keys->insert("root", stringify(preferred_root_key()->value()));
keys->insert("format", "installed_virtuals");
- package_database()->add_repository(-1,
- RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1)));
+ add_repository(-1, RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1)));
#endif
}
@@ -514,8 +509,7 @@ PortageEnvironment::_add_ebuild_repository(const FSPath & portdir, const std::st
builddir.append("/portage");
keys->insert("builddir", builddir);
- package_database()->add_repository(importance,
- RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1)));
+ add_repository(importance, RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1)));
}
void
@@ -540,8 +534,7 @@ PortageEnvironment::_add_vdb_repository()
if (! builddir.empty())
builddir.append("/portage");
keys->insert("builddir", builddir);
- package_database()->add_repository(1,
- RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1)));
+ add_repository(1, RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1)));
}
PortageEnvironment::~PortageEnvironment()
@@ -740,18 +733,6 @@ PortageEnvironment::bashrc_files() const
return result;
}
-std::shared_ptr<PackageDatabase>
-PortageEnvironment::package_database()
-{
- return _imp->package_database;
-}
-
-std::shared_ptr<const PackageDatabase>
-PortageEnvironment::package_database() const
-{
- return _imp->package_database;
-}
-
std::shared_ptr<const MirrorsSequence>
PortageEnvironment::mirrors(const std::string & m) const
{
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index c8ddfd28e..e7193e0d4 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -129,12 +129,6 @@ namespace paludis
const std::shared_ptr<OutputManager> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::shared_ptr<PackageDatabase> package_database()
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::shared_ptr<const PackageDatabase> package_database() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual bool accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/environments/portage/portage_environment_TEST.cc b/paludis/environments/portage/portage_environment_TEST.cc
index 97bd214ef..1f637f2fa 100644
--- a/paludis/environments/portage/portage_environment_TEST.cc
+++ b/paludis/environments/portage/portage_environment_TEST.cc
@@ -28,7 +28,6 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
#include <paludis/dep_spec.hh>
#include <paludis/name.hh>
#include <paludis/user_dep_spec.hh>
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index f437c9361..aacb55293 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -32,12 +32,13 @@
#include <paludis/util/env_var_names.hh>
#include <paludis/standard_output_manager.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/hook.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/choice.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/repository.hh>
+
#include <functional>
#include <unordered_map>
@@ -53,15 +54,13 @@ namespace paludis
template<>
struct Imp<TestEnvironment>
{
- std::shared_ptr<PackageDatabase> package_database;
std::unordered_map<std::string, Tribool> override_want_choice_enabled;
FSPath root;
Sets sets;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > preferred_root_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > system_root_key;
- Imp(Environment * const e, const FSPath & r) :
- package_database(std::make_shared<PackageDatabase>(e)),
+ Imp(const FSPath & r) :
root(r),
preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("root", "Root", mkt_normal, root)),
system_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("system_root", "System Root", mkt_normal, FSPath("/")))
@@ -71,14 +70,14 @@ namespace paludis
}
TestEnvironment::TestEnvironment() :
- _imp(this, FSPath("/"))
+ _imp(FSPath("/"))
{
add_metadata_key(_imp->preferred_root_key);
add_metadata_key(_imp->system_root_key);
}
TestEnvironment::TestEnvironment(const FSPath & r) :
- _imp(this, r)
+ _imp(r)
{
add_metadata_key(_imp->preferred_root_key);
add_metadata_key(_imp->system_root_key);
@@ -100,25 +99,13 @@ TestEnvironment::accept_license(const std::string &, const std::shared_ptr<const
return true;
}
-std::shared_ptr<PackageDatabase>
-TestEnvironment::package_database()
-{
- return _imp->package_database;
-}
-
-std::shared_ptr<const PackageDatabase>
-TestEnvironment::package_database() const
-{
- return _imp->package_database;
-}
-
const std::shared_ptr<const PackageID>
TestEnvironment::fetch_package_id(const QualifiedPackageName & q,
const VersionSpec & v, const RepositoryName & r) const
{
using namespace std::placeholders;
- std::shared_ptr<const PackageIDSequence> ids(package_database()->fetch_repository(r)->package_ids(q, { }));
+ std::shared_ptr<const PackageIDSequence> ids(fetch_repository(r)->package_ids(q, { }));
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
if (v == (*i)->version())
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index 1d49812f5..d8abeac1f 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -60,12 +60,6 @@ namespace paludis
///\}
- virtual std::shared_ptr<PackageDatabase> package_database()
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::shared_ptr<const PackageDatabase> package_database() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/**
* Convenience way of getting a package id.
*/