aboutsummaryrefslogtreecommitdiff
path: root/paludis/environments/paludis
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/paludis
parent79d9f02fb355d81c472f3d94b8b85d5a7639210c (diff)
downloadpaludis-5c2a332b70243cb583a29bb74f712bfca2c1fb76.tar.gz
paludis-5c2a332b70243cb583a29bb74f712bfca2c1fb76.tar.xz
Use Environment rather than PackageDatabase
Diffstat (limited to 'paludis/environments/paludis')
-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
7 files changed, 34 insertions, 39 deletions
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>