aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-12 14:54:14 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-12 16:28:19 +0100
commit0f3eb4b7da157630049ad93334338c4ba796304c (patch)
tree8ca4326bbc6d54fa6839a35402c56d0844c94757
parentdc24637ad9ea08b179bf76969533b29e95467eb4 (diff)
downloadpaludis-0f3eb4b7da157630049ad93334338c4ba796304c.tar.gz
paludis-0f3eb4b7da157630049ad93334338c4ba796304c.tar.xz
Replace EnvironmentMaker with EnvironmentFactory.
-rw-r--r--doc/api/cplusplus/examples/example_action.cc2
-rw-r--r--doc/api/cplusplus/examples/example_contents.cc2
-rw-r--r--doc/api/cplusplus/examples/example_dep_label.cc2
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec.cc2
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec_flattener.cc2
-rw-r--r--doc/api/cplusplus/examples/example_dep_tag.cc2
-rw-r--r--doc/api/cplusplus/examples/example_dep_tree.cc2
-rw-r--r--doc/api/cplusplus/examples/example_environment.cc6
-rw-r--r--doc/api/cplusplus/examples/example_formatter.cc2
-rw-r--r--doc/api/cplusplus/examples/example_mask.cc2
-rw-r--r--doc/api/cplusplus/examples/example_match_package.cc2
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc2
-rw-r--r--doc/api/cplusplus/examples/example_package_database.cc2
-rw-r--r--doc/api/cplusplus/examples/example_package_id.cc2
-rw-r--r--doc/api/cplusplus/examples/example_repository.cc2
-rw-r--r--doc/api/cplusplus/examples/example_selection.cc2
-rw-r--r--doc/api/cplusplus/examples/example_stringify_formatter.cc2
-rw-r--r--doc/api/ruby/example_action.rb2
-rw-r--r--doc/api/ruby/example_contents.rb2
-rw-r--r--doc/api/ruby/example_dep_tree.rb2
-rw-r--r--doc/api/ruby/example_environment.rb6
-rw-r--r--doc/api/ruby/example_mask.rb2
-rw-r--r--doc/api/ruby/example_match_package.rb2
-rw-r--r--doc/api/ruby/example_package_database.rb2
-rw-r--r--doc/api/ruby/example_package_id.rb2
-rw-r--r--doc/api/ruby/example_repository.rb2
-rw-r--r--doc/api/ruby/example_selection.rb2
-rw-r--r--paludis/environment_factory-fwd.hh29
-rw-r--r--paludis/environment_factory.cc (renamed from paludis/environment_maker.cc)182
-rw-r--r--paludis/environment_factory.hh97
-rw-r--r--paludis/environment_maker.hh178
-rw-r--r--paludis/environments/adapted/registration.cc11
-rw-r--r--paludis/environments/no_config/registration.cc17
-rw-r--r--paludis/environments/paludis/paludis_config.hh5
-rw-r--r--paludis/environments/paludis/registration.cc16
-rw-r--r--paludis/environments/portage/registration.cc14
-rw-r--r--paludis/environments/test/registration.cc11
-rw-r--r--paludis/files.m42
-rwxr-xr-xpython/dep_list_TEST.py4
-rw-r--r--python/environment.cc23
-rwxr-xr-xpython/environment_TEST.py10
-rwxr-xr-xpython/mask_TEST.py4
-rwxr-xr-xpython/package_database_TEST.py2
-rwxr-xr-xpython/repository_TEST.py6
-rw-r--r--ruby/action_TEST.rb2
-rw-r--r--ruby/dep_list_TEST.rb2
-rw-r--r--ruby/dep_spec_TEST.rb8
-rw-r--r--ruby/dep_tag_TEST.rb2
-rw-r--r--ruby/environment.cc20
-rw-r--r--ruby/environment_TEST.rb22
-rw-r--r--ruby/generator_TEST.rb2
-rw-r--r--ruby/package_database_TEST.rb6
-rw-r--r--ruby/paludis_ruby_TEST.rb6
-rw-r--r--ruby/repository_TEST.rb2
-rw-r--r--src/clients/contrarius/contrarius.cc4
-rw-r--r--src/clients/gtkpaludis/gtkpaludis.cc4
-rw-r--r--src/clients/importare/importare.cc4
-rw-r--r--src/clients/inquisitio/inquisitio.cc5
-rw-r--r--src/clients/paludis/paludis.cc4
-rw-r--r--src/clients/reconcilio/reconcilio.cc7
60 files changed, 339 insertions, 434 deletions
diff --git a/doc/api/cplusplus/examples/example_action.cc b/doc/api/cplusplus/examples/example_action.cc
index 92ffd31..2f12f2d 100644
--- a/doc/api/cplusplus/examples/example_action.cc
+++ b/doc/api/cplusplus/examples/example_action.cc
@@ -33,7 +33,7 @@ int main(int argc, char * argv[])
"example_action", "EXAMPLE_ACTION_OPTIONS", "EXAMPLE_ACTION_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for 'sys-apps/paludis'. */
diff --git a/doc/api/cplusplus/examples/example_contents.cc b/doc/api/cplusplus/examples/example_contents.cc
index 3997103..4287943 100644
--- a/doc/api/cplusplus/examples/example_contents.cc
+++ b/doc/api/cplusplus/examples/example_contents.cc
@@ -75,7 +75,7 @@ int main(int argc, char * argv[])
"example_contents", "EXAMPLE_CONTENTS_OPTIONS", "EXAMPLE_CONTENTS_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for installed 'sys-apps/paludis'. */
diff --git a/doc/api/cplusplus/examples/example_dep_label.cc b/doc/api/cplusplus/examples/example_dep_label.cc
index 3c26f1a..5823f99 100644
--- a/doc/api/cplusplus/examples/example_dep_label.cc
+++ b/doc/api/cplusplus/examples/example_dep_label.cc
@@ -155,7 +155,7 @@ int main(int argc, char * argv[])
"example_dep_label", "EXAMPLE_DEP_LABEL_OPTIONS", "EXAMPLE_DEP_LABEL_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for all installed packages. */
diff --git a/doc/api/cplusplus/examples/example_dep_spec.cc b/doc/api/cplusplus/examples/example_dep_spec.cc
index 1819b7e..393f43a 100644
--- a/doc/api/cplusplus/examples/example_dep_spec.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec.cc
@@ -41,7 +41,7 @@ int main(int argc, char * argv[])
"example_dep_spec", "EXAMPLE_DEP_SPEC_OPTIONS", "EXAMPLE_DEP_SPEC_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* For each command line parameter... */
diff --git a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
index 5bd5925..d46accc 100644
--- a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
@@ -38,7 +38,7 @@ int main(int argc, char * argv[])
"example_dep_spec_flattener", "EXAMPLE_DEP_SPEC_FLATTENER_OPTIONS", "EXAMPLE_DEP_SPEC_FLATTENER_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for all installed packages. */
diff --git a/doc/api/cplusplus/examples/example_dep_tag.cc b/doc/api/cplusplus/examples/example_dep_tag.cc
index 9ced77a..3d351c0 100644
--- a/doc/api/cplusplus/examples/example_dep_tag.cc
+++ b/doc/api/cplusplus/examples/example_dep_tag.cc
@@ -132,7 +132,7 @@ int main(int argc, char * argv[])
"example_dep_tag", "EXAMPLE_DEP_TAG_OPTIONS", "EXAMPLE_DEP_TAG_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
SeenCategories seen_categories;
diff --git a/doc/api/cplusplus/examples/example_dep_tree.cc b/doc/api/cplusplus/examples/example_dep_tree.cc
index 5b2d74d..7224d25 100644
--- a/doc/api/cplusplus/examples/example_dep_tree.cc
+++ b/doc/api/cplusplus/examples/example_dep_tree.cc
@@ -190,7 +190,7 @@ int main(int argc, char * argv[])
"example_dep_tree", "EXAMPLE_DEP_TREE_OPTIONS", "EXAMPLE_DEP_TREE_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for all installed packages. */
diff --git a/doc/api/cplusplus/examples/example_environment.cc b/doc/api/cplusplus/examples/example_environment.cc
index 7ace844..966c536 100644
--- a/doc/api/cplusplus/examples/example_environment.cc
+++ b/doc/api/cplusplus/examples/example_environment.cc
@@ -9,7 +9,7 @@
/** \example example_environment.cc
*
- * This example demonstrates how to use EnvironmentMaker and the resultant
+ * This example demonstrates how to use EnvironmentFactory and the resultant
* Environment.
*/
@@ -35,7 +35,7 @@ int main(int argc, char * argv[])
CommandLine::get_instance()->run(argc, argv,
"example_environment", "EXAMPLE_ENVIRONMENT_OPTIONS", "EXAMPLE_ENVIRONMENT_CMDLINE");
- /* We use EnvironmentMaker to construct an environment from the user's
+ /* We use EnvironmentFactory to construct an environment from the user's
* --environment commandline choice. With an empty string, this uses the
* distribution-defined default environment. With a non-empty string, it
* is split into two parts upon the first colon (if there is no colon,
@@ -43,7 +43,7 @@ int main(int argc, char * argv[])
* the environment class to use (e.g. 'paludis', 'portage') and the
* second part is passed as parameters to be handled by that
* environment's constructor. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* A lot of the Environment members aren't very useful to clients. The
diff --git a/doc/api/cplusplus/examples/example_formatter.cc b/doc/api/cplusplus/examples/example_formatter.cc
index 164d2b0..263aa25 100644
--- a/doc/api/cplusplus/examples/example_formatter.cc
+++ b/doc/api/cplusplus/examples/example_formatter.cc
@@ -155,7 +155,7 @@ int main(int argc, char * argv[])
"example_formatter", "EXAMPLE_FORMATTER_OPTIONS", "EXAMPLE_FORMATTER_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for installable 'sys-apps/paludis'. */
diff --git a/doc/api/cplusplus/examples/example_mask.cc b/doc/api/cplusplus/examples/example_mask.cc
index 45e0318..87625e3 100644
--- a/doc/api/cplusplus/examples/example_mask.cc
+++ b/doc/api/cplusplus/examples/example_mask.cc
@@ -80,7 +80,7 @@ int main(int argc, char * argv[])
"example_mask", "EXAMPLE_MASK_OPTIONS", "EXAMPLE_MASK_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for 'sys-apps/paludis'. */
diff --git a/doc/api/cplusplus/examples/example_match_package.cc b/doc/api/cplusplus/examples/example_match_package.cc
index 7cd7b06..e82f4e4 100644
--- a/doc/api/cplusplus/examples/example_match_package.cc
+++ b/doc/api/cplusplus/examples/example_match_package.cc
@@ -36,7 +36,7 @@ int main(int argc, char * argv[])
"example_match_package", "EXAMPLE_MATCH_PACKAGE_OPTIONS", "EXAMPLE_MATCH_PACKAGE_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch all installed packages. */
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index 1cf28cf..d68d4d7 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -255,7 +255,7 @@ int main(int argc, char * argv[])
"example_metadata_key", "EXAMPLE_METADATA_KEY_OPTIONS", "EXAMPLE_METADATA_KEY_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for 'sys-apps/paludis'. */
diff --git a/doc/api/cplusplus/examples/example_package_database.cc b/doc/api/cplusplus/examples/example_package_database.cc
index d8cd411..03acc04 100644
--- a/doc/api/cplusplus/examples/example_package_database.cc
+++ b/doc/api/cplusplus/examples/example_package_database.cc
@@ -37,7 +37,7 @@ int main(int argc, char * argv[])
"example_package_database", "EXAMPLE_PACKAGE_DATABASE_OPTIONS", "EXAMPLE_PACKAGE_DATABASE_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Mostly PackageDatabase is used by Environment. But some methods are useful: */
diff --git a/doc/api/cplusplus/examples/example_package_id.cc b/doc/api/cplusplus/examples/example_package_id.cc
index 45df420..78016c4 100644
--- a/doc/api/cplusplus/examples/example_package_id.cc
+++ b/doc/api/cplusplus/examples/example_package_id.cc
@@ -42,7 +42,7 @@ int main(int argc, char * argv[])
"example_package_id", "EXAMPLE_PACKAGE_ID_OPTIONS", "EXAMPLE_PACKAGE_ID_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for 'sys-apps/paludis'. */
diff --git a/doc/api/cplusplus/examples/example_repository.cc b/doc/api/cplusplus/examples/example_repository.cc
index 4114218..fc3ea27 100644
--- a/doc/api/cplusplus/examples/example_repository.cc
+++ b/doc/api/cplusplus/examples/example_repository.cc
@@ -35,7 +35,7 @@ int main(int argc, char * argv[])
"example_environment", "EXAMPLE_ENVIRONMENT_OPTIONS", "EXAMPLE_ENVIRONMENT_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* For each repository... */
diff --git a/doc/api/cplusplus/examples/example_selection.cc b/doc/api/cplusplus/examples/example_selection.cc
index bf133ee..b048f8e 100644
--- a/doc/api/cplusplus/examples/example_selection.cc
+++ b/doc/api/cplusplus/examples/example_selection.cc
@@ -55,7 +55,7 @@ int main(int argc, char * argv[])
"example_selection", "EXAMPLE_SELECTION_OPTIONS", "EXAMPLE_SELECTION_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Make some selections, and display what they give. The selection
diff --git a/doc/api/cplusplus/examples/example_stringify_formatter.cc b/doc/api/cplusplus/examples/example_stringify_formatter.cc
index 8c92d00..f6d6332 100644
--- a/doc/api/cplusplus/examples/example_stringify_formatter.cc
+++ b/doc/api/cplusplus/examples/example_stringify_formatter.cc
@@ -34,7 +34,7 @@ int main(int argc, char * argv[])
"example_stringify_formatter", "EXAMPLE_STRINGIFY_FORMATTER_OPTIONS", "EXAMPLE_STRINGIFY_FORMATTER_CMDLINE");
/* We start with an Environment, respecting the user's '--environment' choice. */
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument()));
/* Fetch package IDs for installable 'sys-apps/paludis'. */
diff --git a/doc/api/ruby/example_action.rb b/doc/api/ruby/example_action.rb
index bd3695a..27ed221 100644
--- a/doc/api/ruby/example_action.rb
+++ b/doc/api/ruby/example_action.rb
@@ -14,7 +14,7 @@ include Paludis
exit_status = 0
# We start with an Environment, respecting the user's '--environment' choice.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# Fetch package IDs for 'sys-apps/paludis'
ids = env[Selection::AllVersionsSorted.new(Generator::Matches.new(
diff --git a/doc/api/ruby/example_contents.rb b/doc/api/ruby/example_contents.rb
index c6a4b9b..60f3cb5 100644
--- a/doc/api/ruby/example_contents.rb
+++ b/doc/api/ruby/example_contents.rb
@@ -14,7 +14,7 @@ include Paludis
exit_status = 0
# We start with an Environment, respecting the user's '--environment' choice.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# Fetch package IDs for installed 'sys-apps/paludis'
ids = env[Selection::AllVersionsSorted.new(
diff --git a/doc/api/ruby/example_dep_tree.rb b/doc/api/ruby/example_dep_tree.rb
index bddbdcc..db8c298 100644
--- a/doc/api/ruby/example_dep_tree.rb
+++ b/doc/api/ruby/example_dep_tree.rb
@@ -112,7 +112,7 @@ def collect_extensions env, id, spec, results, recursing_sets = {}
end
# We start with an Environment, respecting the user's '--environment' choice.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# Fetch package IDs for all installed packages.
ids = env[Selection::AllVersionsSorted.new(
diff --git a/doc/api/ruby/example_environment.rb b/doc/api/ruby/example_environment.rb
index 80b5b0f..7ec6d25 100644
--- a/doc/api/ruby/example_environment.rb
+++ b/doc/api/ruby/example_environment.rb
@@ -2,7 +2,7 @@
# vim: set sw=4 sts=4 et tw=80 :
=begin description
-This example demonstrates how to use EnvironmentMaker and the resultant
+This example demonstrates how to use EnvironmentFactory and the resultant
Environment.
=end
@@ -13,7 +13,7 @@ include Paludis
exit_status = 0
-# We use EnvironmentMaker to construct an environment from the user's
+# We use EnvironmentFactory to construct an environment from the user's
# --environment commandline choice. With an empty string, this uses the
# distribution-defined default environment. With a non-empty string, it
# is split into two parts upon the first colon (if there is no colon,
@@ -21,7 +21,7 @@ exit_status = 0
# the environment class to use (e.g. 'paludis', 'portage') and the
# second part is passed as parameters to be handled by that
# environment's constructor.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# A lot of the Environment members aren't very useful to clients. The mask
# related methods are used by PackageID, and shouldn't usually be called
diff --git a/doc/api/ruby/example_mask.rb b/doc/api/ruby/example_mask.rb
index 19c0a6b..e035258 100644
--- a/doc/api/ruby/example_mask.rb
+++ b/doc/api/ruby/example_mask.rb
@@ -14,7 +14,7 @@ include Paludis
exit_status = 0
# We start with an Environment, respecting the user's '--environment' choice.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# Fetch package IDs for 'sys-apps/paludis'
ids = env[Selection::AllVersionsSorted.new(
diff --git a/doc/api/ruby/example_match_package.rb b/doc/api/ruby/example_match_package.rb
index 61788d1..7ee0cd6 100644
--- a/doc/api/ruby/example_match_package.rb
+++ b/doc/api/ruby/example_match_package.rb
@@ -14,7 +14,7 @@ include Paludis
exit_status = 0
# We start with an Environment, respecting the user's '--environment' choice.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# Fetch all installed packages
ids = env[Selection::AllVersionsSorted.new(
diff --git a/doc/api/ruby/example_package_database.rb b/doc/api/ruby/example_package_database.rb
index 5201d4d..d5b3028 100644
--- a/doc/api/ruby/example_package_database.rb
+++ b/doc/api/ruby/example_package_database.rb
@@ -14,7 +14,7 @@ include Paludis
exit_status = 0
# We start with an Environment, respecting the user's '--environment' choice.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# Mostly PackageDatabase is used by Environment. But other methods are useful:
if env.package_database.has_repository_named?('gentoo')
diff --git a/doc/api/ruby/example_package_id.rb b/doc/api/ruby/example_package_id.rb
index da841eb..01dd10c 100644
--- a/doc/api/ruby/example_package_id.rb
+++ b/doc/api/ruby/example_package_id.rb
@@ -16,7 +16,7 @@ include Paludis
exit_status = 0
# We start with an Environment, respecting the user's '--environment' choice.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# Fetch package IDs for installed 'sys-apps/paludis'
ids = env[Selection::AllVersionsSorted.new(
diff --git a/doc/api/ruby/example_repository.rb b/doc/api/ruby/example_repository.rb
index a0c7374..5d9fba4 100644
--- a/doc/api/ruby/example_repository.rb
+++ b/doc/api/ruby/example_repository.rb
@@ -13,7 +13,7 @@ include Paludis
exit_status = 0
# We start with an Environment, respecting the user's '--environment' choice.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# For each repository
env.package_database.repositories do |repo|
diff --git a/doc/api/ruby/example_selection.rb b/doc/api/ruby/example_selection.rb
index e794519..725b26f 100644
--- a/doc/api/ruby/example_selection.rb
+++ b/doc/api/ruby/example_selection.rb
@@ -28,7 +28,7 @@ end
exit_status = 0
# We start with an Environment, respecting the user's '--environment' choice.
-env = EnvironmentMaker.instance.make_from_spec(ExampleCommandLine.instance.environment)
+env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# Make some selections, and display what they give. The selection
# object used determines the number and ordering of results. In the
diff --git a/paludis/environment_factory-fwd.hh b/paludis/environment_factory-fwd.hh
new file mode 100644
index 0000000..9379d7a
--- /dev/null
+++ b/paludis/environment_factory-fwd.hh
@@ -0,0 +1,29 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_ENVIRONMENT_FACTORY_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_FACTORY_FWD_HH 1
+
+namespace paludis
+{
+ class EnvironmentFactory;
+ class FallBackToAnotherFormatError;
+}
+
+#endif
diff --git a/paludis/environment_maker.cc b/paludis/environment_factory.cc
index 335152e..77c2b14 100644
--- a/paludis/environment_maker.cc
+++ b/paludis/environment_factory.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2008 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
@@ -17,125 +17,54 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "environment_maker.hh"
+#include <paludis/environment_factory.hh>
+#include <paludis/util/instantiation_policy-impl.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/member_iterator-impl.hh>
+#include <paludis/util/join.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/is_file_with_extension.hh>
-#include <paludis/util/system.hh>
-#include <paludis/util/virtual_constructor-impl.hh>
-#include <paludis/util/instantiation_policy-impl.hh>
-#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/distribution.hh>
#include <paludis/about.hh>
-#include <list>
-#include <set>
+#include <tr1/unordered_map>
#include <dlfcn.h>
#include <stdint.h>
+#include <list>
#include "config.h"
using namespace paludis;
-template class VirtualConstructor<std::string,
- std::tr1::shared_ptr<Environment> (*) (const std::string &),
- virtual_constructor_not_found::ThrowException<NoSuchEnvironmentTypeError> >;
-
-template class InstantiationPolicy<EnvironmentMaker, instantiation_method::SingletonTag>;
-
-NoSuchEnvironmentTypeError::NoSuchEnvironmentTypeError(const std::string & format) throw ():
- ConfigurationError("No available maker for environment type '" + format + "'")
-{
-}
-
-PaludisEnvironmentSoDirNotADirectoryError::PaludisEnvironmentSoDirNotADirectoryError() throw () :
- Exception("PALUDIS_ENVIRONMENT_SO_DIR not a directory")
-{
-}
-
-PaludisEnvironmentSoDirCannotDlopenError::PaludisEnvironmentSoDirCannotDlopenError(
- const std::string & file, const std::string & e) throw () :
- Exception("Cannot dlopen an environment .so file"),
- _file(file),
- _dlerr(e)
-{
-}
-
-PaludisEnvironmentSoDirCannotDlopenError::~PaludisEnvironmentSoDirCannotDlopenError() throw ()
-{
-}
-
-const char *
-PaludisEnvironmentSoDirCannotDlopenError::what() const throw ()
-{
- if (_what.empty())
- _what = std::string(Exception::what()) +
- ": Cannot dlopen environment .so file '" + _file + "': '" + _dlerr + "'";
- return _what.c_str();
-}
+typedef std::tr1::unordered_map<std::string, EnvironmentFactory::CreateFunction> Keys;
namespace paludis
{
- template<>
- struct Implementation<EnvironmentMaker>
+ template <>
+ struct Implementation<EnvironmentFactory>
{
+ Keys keys;
std::list<void *> dl_opened;
};
}
-void
-EnvironmentMaker::load_dir(const FSEntry & so_dir)
-{
- for (DirIterator d(so_dir), d_end ; d != d_end ; ++d)
- {
- if (d->is_directory())
- load_dir(*d);
-
- if (! is_file_with_extension(*d, ".so." + stringify(100 * PALUDIS_VERSION_MAJOR + PALUDIS_VERSION_MINOR),
- IsFileWithOptions()))
- continue;
-
- /* don't use RTLD_LOCAL, g++ is over happy about template instantiations, and it
- * can lead to multiple singleton instances. */
- void * dl(dlopen(stringify(*d).c_str(), RTLD_GLOBAL | RTLD_NOW));
-
- if (dl)
- {
- _imp->dl_opened.push_back(dl);
-
- void * reg(dlsym(dl, "register_environments"));
- if (reg)
- {
- reinterpret_cast<void (*)(EnvironmentMaker *)>(
- reinterpret_cast<uintptr_t>(reg))(this);
- }
- else
- throw PaludisEnvironmentSoDirCannotDlopenError(stringify(*d),
- "no register_environments function defined");
- }
- else
- throw PaludisEnvironmentSoDirCannotDlopenError(stringify(*d), dlerror());
- }
-
- if ((so_dir / ".libs").is_directory())
- load_dir(so_dir / ".libs");
-}
-
-EnvironmentMaker::EnvironmentMaker() :
- PrivateImplementationPattern<EnvironmentMaker>(new Implementation<EnvironmentMaker>)
+EnvironmentFactory::EnvironmentFactory() :
+ PrivateImplementationPattern<EnvironmentFactory>(new Implementation<EnvironmentFactory>)
{
FSEntry so_dir(getenv_with_default("PALUDIS_ENVIRONMENT_SO_DIR", LIBDIR "/paludis/environments"));
-
if (! so_dir.is_directory())
- throw PaludisEnvironmentSoDirNotADirectoryError();
-
- load_dir(so_dir);
+ throw InternalError(PALUDIS_HERE, "PALUDIS_ENVIRONMENT_SO_DIR '" + stringify(so_dir) + "' not a directory");
+ _load_dir(so_dir);
}
-EnvironmentMaker::~EnvironmentMaker()
+EnvironmentFactory::~EnvironmentFactory()
{
}
-std::tr1::shared_ptr<Environment>
-EnvironmentMaker::make_from_spec(const std::string & s) const
+const std::tr1::shared_ptr<Environment>
+EnvironmentFactory::create(const std::string & s) const
{
Context context("When making environment from specification '" + s + "':");
@@ -156,18 +85,21 @@ EnvironmentMaker::make_from_spec(const std::string & s) const
try
{
- return (*find_maker(key))(suffix);
+ Keys::const_iterator i(_imp->keys.find(key));
+ if (_imp->keys.end() == i)
+ throw ConfigurationError("Format '" + key + "' not supported when creating an environment (known formats are { "
+ + join(first_iterator(_imp->keys.begin()), first_iterator(_imp->keys.end()), ", ") + "})");
+ return i->second(suffix);
}
- catch (const FallBackToAnotherMakerError &)
+ catch (const FallBackToAnotherFormatError &)
{
std::string f((*DistributionData::get_instance()->distribution_from_string(
getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION))).fallback_environment());
if (s.empty() && ! f.empty())
{
- std::set<std::string> keys;
- copy_keys(std::inserter(keys, keys.begin()));
- if (keys.end() != keys.find(f))
- return make_from_spec(f);
+ Keys::const_iterator i(_imp->keys.find(f));
+ if (_imp->keys.end() == i)
+ return i->second(suffix);
else
throw;
}
@@ -176,16 +108,56 @@ EnvironmentMaker::make_from_spec(const std::string & s) const
}
}
-FallBackToAnotherMakerError::FallBackToAnotherMakerError()
+void
+EnvironmentFactory::_load_dir(const FSEntry & so_dir)
{
-}
+ for (DirIterator d(so_dir), d_end ; d != d_end ; ++d)
+ {
+ if (d->is_directory())
+ _load_dir(*d);
-extern "C"
-{
- void PALUDIS_VISIBLE register_environments(EnvironmentMaker * maker);
+ if (! is_file_with_extension(*d, ".so." + stringify(100 * PALUDIS_VERSION_MAJOR + PALUDIS_VERSION_MINOR),
+ IsFileWithOptions()))
+ continue;
+
+ /* don't use RTLD_LOCAL, g++ is over happy about template instantiations, and it
+ * can lead to multiple singleton instances. */
+ void * dl(dlopen(stringify(*d).c_str(), RTLD_GLOBAL | RTLD_NOW));
+
+ if (dl)
+ {
+ _imp->dl_opened.push_back(dl);
+
+ void * reg(dlsym(dl, "paludis_initialise_environment_so"));
+ if (reg)
+ {
+ reinterpret_cast<void (*)(EnvironmentFactory * const)>(reinterpret_cast<uintptr_t>(reg))(this);
+ }
+ else
+ throw InternalError(PALUDIS_HERE, "No paludis_initialise_environment_so function defined in '" + stringify(*d) + "'");
+ }
+ else
+ throw InternalError(PALUDIS_HERE, "Couldn't dlopen '" + stringify(*d) + "': " + stringify(dlerror()));
+ }
+
+ if ((so_dir / ".libs").is_directory())
+ _load_dir(so_dir / ".libs");
}
-void register_environments(EnvironmentMaker *)
+void
+EnvironmentFactory::add_environment_format(
+ const std::tr1::shared_ptr<const Set<std::string> > & formats,
+ const CreateFunction & create_function
+ )
{
+ for (Set<std::string>::ConstIterator f(formats->begin()), f_end(formats->end()) ;
+ f != f_end ; ++f)
+ {
+ if (! _imp->keys.insert(std::make_pair(*f, create_function)).second)
+ throw ConfigurationError("Handler for environment format '" + stringify(*f) + "' already exists");
+ }
}
+template class InstantiationPolicy<EnvironmentFactory, instantiation_method::SingletonTag>;
+template class PrivateImplementationPattern<EnvironmentFactory>;
+
diff --git a/paludis/environment_factory.hh b/paludis/environment_factory.hh
new file mode 100644
index 0000000..b5821bf
--- /dev/null
+++ b/paludis/environment_factory.hh
@@ -0,0 +1,97 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_ENVIRONMENT_FACTORY_HH
+#define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_FACTORY_HH 1
+
+#include <paludis/environment_factory-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/set-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <tr1/memory>
+#include <tr1/functional>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE FallBackToAnotherFormatError
+ {
+ };
+
+ /**
+ * Factory for Environment creation.
+ *
+ * \ingroup g_environment
+ * \since 0.30
+ */
+ class PALUDIS_VISIBLE EnvironmentFactory :
+ private PrivateImplementationPattern<EnvironmentFactory>,
+ public InstantiationPolicy<EnvironmentFactory, instantiation_method::SingletonTag>
+ {
+ friend class InstantiationPolicy<EnvironmentFactory, instantiation_method::SingletonTag>;
+
+ private:
+ EnvironmentFactory();
+ ~EnvironmentFactory();
+
+ void _load_dir(const FSEntry &);
+
+ public:
+ typedef std::tr1::function<const std::tr1::shared_ptr<Environment>(const std::string &)> CreateFunction;
+
+ /**
+ * Create an Environment subclass from the specified spec.
+ *
+ * \param spec The environment spec, which is in the form
+ * env:suffix, where env is the string representing an
+ * Environment's kind (e.g. "paludis", "portage") and
+ * suffix is the information to pass to the constructing
+ * function (for paludis, a config suffix, and for portage,
+ * a location). If env is not specified, it defaults to
+ * trying paludis then portage. If suffix is not specified,
+ * it defaults to an empty string. If no colon is present,
+ * the supplied string is taken as env (this includes an
+ * empty string).
+ */
+ const std::tr1::shared_ptr<Environment> create(const std::string & spec) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * Add a repository format.
+ *
+ * \param formats must have at least one value, and no value may be
+ * specified more than once across all invocations.
+ *
+ * \param create_function is used to implement EnvironmentFactory::create.
+ */
+ void add_environment_format(
+ const std::tr1::shared_ptr<const Set<std::string> > & formats,
+ const CreateFunction & create_function
+ );
+ };
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<EnvironmentFactory>;
+ extern template class InstantiationPolicy<EnvironmentFactory, instantiation_method::SingletonTag>;
+#endif
+}
+
+#endif
diff --git a/paludis/environment_maker.hh b/paludis/environment_maker.hh
deleted file mode 100644
index 2dc9b88..0000000
--- a/paludis/environment_maker.hh
+++ /dev/null
@@ -1,178 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2008 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
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_ENVIRONMENT_MAKER_HH
-#define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_MAKER_HH 1
-
-#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/virtual_constructor.hh>
-#include <paludis/environment.hh>
-
-
-/** \file
- * Declarations for the EnvironmentMaker class.
- *
- * \ingroup g_environment
- *
- * \section Examples
- *
- * - \ref example_environment.cc "example_environment.cc"
- */
-
-namespace paludis
-{
- class FSEntry;
-
- /**
- * Thrown if an environment of the specified type does not exist.
- *
- * \ingroup g_exceptions
- * \ingroup g_environment
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE NoSuchEnvironmentTypeError : public ConfigurationError
- {
- public:
- ///\name Basic operations
- ///\{
-
- NoSuchEnvironmentTypeError(const std::string & format) throw ();
-
- ///\}
- };
-
- /**
- * Thrown if PALUDIS_ENVIRONMENT_SO_DIR is not a directory.
- *
- * \ingroup g_exceptions
- * \ingroup g_environment
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE PaludisEnvironmentSoDirNotADirectoryError :
- public Exception
- {
- public:
- ///\name Basic operations
- ///\{
-
- PaludisEnvironmentSoDirNotADirectoryError() throw ();
-
- ///\}
- };
-
- /**
- * Thrown if an environment .so cannot be used.
- *
- * \ingroup g_exceptions
- * \ingroup g_environment
- */
- class PALUDIS_VISIBLE PaludisEnvironmentSoDirCannotDlopenError :
- public Exception
- {
- private:
- std::string _file, _dlerr;
- mutable std::string _what;
-
- public:
- ///\name Basic operations
- ///\{
-
- PaludisEnvironmentSoDirCannotDlopenError(const std::string & file,
- const std::string & e) throw ();
-
- ~PaludisEnvironmentSoDirCannotDlopenError() throw ();
-
- ///\}
-
- const char * what() const throw ();
- };
-
- /**
- * If an EnvironmentMaker default call fails with an exception of this type,
- * it is ok to fall back and try another maker.
- *
- * \ingroup g_environment
- * \ingroup g_exceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE FallBackToAnotherMakerError
- {
- protected:
- ///\name Basic operations
- ///\{
-
- FallBackToAnotherMakerError();
-
- ///\}
- };
-
- /**
- * Virtual constructor for environments.
- *
- * \ingroup g_environment
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE EnvironmentMaker :
- public VirtualConstructor<std::string,
- std::tr1::shared_ptr<Environment> (*) (const std::string &),
- virtual_constructor_not_found::ThrowException<NoSuchEnvironmentTypeError> >,
- public InstantiationPolicy<EnvironmentMaker, instantiation_method::SingletonTag>,
- private PrivateImplementationPattern<EnvironmentMaker>
- {
- friend class InstantiationPolicy<EnvironmentMaker, instantiation_method::SingletonTag>;
-
- private:
- EnvironmentMaker();
-
- void load_dir(const FSEntry &);
-
- public:
- ///\name Basic operations
- ///\{
-
- ~EnvironmentMaker();
-
- ///\}
-
- /**
- * Create an Environment subclass from the specified spec.
- *
- * \param spec The environment spec, which is in the form
- * env:suffix, where env is the string representing an
- * Environment's kind (e.g. "paludis", "portage") and
- * suffix is the information to pass to the constructing
- * function (for paludis, a config suffix, and for portage,
- * a location). If env is not specified, it defaults to
- * trying paludis then portage. If suffix is not specified,
- * it defaults to an empty string. If no colon is present,
- * the supplied string is taken as env (this includes an
- * empty string).
- *
- * \throw NoSuchEnvironmentTypeError if an invalid environment type
- * is specified.
- *
- * \see Environment
- * \ingroup g_environment
- */
- std::tr1::shared_ptr<Environment> make_from_spec(const std::string & spec) const;
- };
-}
-
-#endif
diff --git a/paludis/environments/adapted/registration.cc b/paludis/environments/adapted/registration.cc
index f6bf5f2..de91c5e 100644
--- a/paludis/environments/adapted/registration.cc
+++ b/paludis/environments/adapted/registration.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 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
@@ -17,16 +17,13 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
using namespace paludis;
-extern "C"
-{
- void PALUDIS_VISIBLE register_environments(EnvironmentMaker * maker);
-}
+extern "C" void paludis_initialise_environment_so(EnvironmentFactory * const) PALUDIS_VISIBLE;
-void register_environments(EnvironmentMaker *)
+void paludis_initialise_environment_so(EnvironmentFactory * const)
{
}
diff --git a/paludis/environments/no_config/registration.cc b/paludis/environments/no_config/registration.cc
index 0601d22..091ba68 100644
--- a/paludis/environments/no_config/registration.cc
+++ b/paludis/environments/no_config/registration.cc
@@ -17,9 +17,10 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/environment_maker.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/util/map.hh>
+#include <paludis/util/set.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/make_shared_ptr.hh>
@@ -27,11 +28,6 @@
using namespace paludis;
-extern "C"
-{
- void PALUDIS_VISIBLE register_environments(EnvironmentMaker * maker);
-}
-
namespace
{
std::tr1::shared_ptr<Environment>
@@ -94,8 +90,13 @@ namespace
}
}
-void register_environments(EnvironmentMaker * maker)
+extern "C" void paludis_initialise_environment_so(EnvironmentFactory * const) PALUDIS_VISIBLE;
+
+void paludis_initialise_environment_so(EnvironmentFactory * const factory)
{
- maker->register_maker("no-config", &make_no_config_environment);
+ std::tr1::shared_ptr<Set<std::string> > no_config_formats(new Set<std::string>);
+ no_config_formats->insert("no_config");
+ no_config_formats->insert("no-config");
+ factory->add_environment_format(no_config_formats, &make_no_config_environment);
}
diff --git a/paludis/environments/paludis/paludis_config.hh b/paludis/environments/paludis/paludis_config.hh
index 6b8b76e..6e9f8df 100644
--- a/paludis/environments/paludis/paludis_config.hh
+++ b/paludis/environments/paludis/paludis_config.hh
@@ -22,6 +22,7 @@
#include <paludis/dep_spec.hh>
#include <paludis/name.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/sr.hh>
@@ -29,7 +30,7 @@
#include <paludis/util/map-fwd.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
#include <paludis/util/named_value.hh>
-#include <paludis/environment_maker.hh>
+#include <paludis/util/fs_entry-fwd.hh>
#include <string>
@@ -92,7 +93,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE PaludisConfigNoDirectoryError :
public PaludisConfigError,
- public FallBackToAnotherMakerError
+ public FallBackToAnotherFormatError
{
public:
///\name Basic operations
diff --git a/paludis/environments/paludis/registration.cc b/paludis/environments/paludis/registration.cc
index 8b8dd3e..e8efc02 100644
--- a/paludis/environments/paludis/registration.cc
+++ b/paludis/environments/paludis/registration.cc
@@ -17,8 +17,9 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/environment_maker.hh>
#include <paludis/environments/paludis/paludis_environment.hh>
+#include <paludis/environment_factory.hh>
+#include <paludis/util/set.hh>
using namespace paludis;
@@ -31,15 +32,12 @@ namespace
}
}
-extern "C"
-{
- void PALUDIS_VISIBLE register_environments(EnvironmentMaker * maker);
-}
+extern "C" void paludis_initialise_environment_so(EnvironmentFactory * const) PALUDIS_VISIBLE;
-void register_environments(EnvironmentMaker * maker)
+void paludis_initialise_environment_so(EnvironmentFactory * const factory)
{
- maker->register_maker("paludis", &make_paludis_environment);
+ std::tr1::shared_ptr<Set<std::string> > paludis_formats(new Set<std::string>);
+ paludis_formats->insert("paludis");
+ factory->add_environment_format(paludis_formats, &make_paludis_environment);
}
-
-
diff --git a/paludis/environments/portage/registration.cc b/paludis/environments/portage/registration.cc
index bdc6ada..69b3a36 100644
--- a/paludis/environments/portage/registration.cc
+++ b/paludis/environments/portage/registration.cc
@@ -17,8 +17,9 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/environments/portage/portage_environment.hh>
+#include <paludis/util/set.hh>
using namespace paludis;
@@ -31,13 +32,12 @@ namespace
}
}
-extern "C"
-{
- void PALUDIS_VISIBLE register_environments(EnvironmentMaker * maker);
-}
+extern "C" void paludis_initialise_environment_so(EnvironmentFactory * const) PALUDIS_VISIBLE;
-void register_environments(EnvironmentMaker * maker)
+void paludis_initialise_environment_so(EnvironmentFactory * const factory)
{
- maker->register_maker("portage", &make_portage_environment);
+ std::tr1::shared_ptr<Set<std::string> > portage_formats(new Set<std::string>);
+ portage_formats->insert("portage");
+ factory->add_environment_format(portage_formats, &make_portage_environment);
}
diff --git a/paludis/environments/test/registration.cc b/paludis/environments/test/registration.cc
index cc99da3..1b4a4c3 100644
--- a/paludis/environments/test/registration.cc
+++ b/paludis/environments/test/registration.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 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
@@ -17,17 +17,14 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/environments/test/test_environment.hh>
using namespace paludis;
-extern "C"
-{
- void PALUDIS_VISIBLE register_environments(EnvironmentMaker * maker);
-}
+extern "C" void paludis_initialise_environment_so(EnvironmentFactory * const) PALUDIS_VISIBLE;
-void register_environments(EnvironmentMaker *)
+void paludis_initialise_environment_so(EnvironmentFactory * const)
{
}
diff --git a/paludis/files.m4 b/paludis/files.m4
index 6a0487d..c349656 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -28,8 +28,8 @@ add(`elike_package_dep_spec', `hh', `cc', `fwd', `se')
add(`elike_slot_requirement', `hh', `cc', `fwd')
add(`elike_use_requirement', `hh', `cc', `fwd', `se', `test')
add(`environment', `hh', `fwd', `cc')
+add(`environment_factory', `hh', `fwd', `cc')
add(`environment_implementation', `hh', `cc')
-add(`environment_maker', `hh', `cc')
add(`filter', `hh', `cc', `fwd', `test')
add(`filter_handler', `hh', `cc', `fwd')
add(`filtered_generator', `hh', `cc', `fwd', `test')
diff --git a/python/dep_list_TEST.py b/python/dep_list_TEST.py
index cc781fa..4ef554a 100755
--- a/python/dep_list_TEST.py
+++ b/python/dep_list_TEST.py
@@ -119,7 +119,7 @@ class TestCase_01_DepListOptions(unittest.TestCase):
class TestCase_02_DepList(unittest.TestCase):
def setUp(self):
global env, dl, dd, pds, cds
- env = EnvironmentMaker.instance.make_from_spec("")
+ env = EnvironmentFactory.instance.create("")
dl = DepList(env, DepListOptions())
dd = env.default_destinations
pds = parse_user_package_dep_spec("foo/bar", env, [])
@@ -166,7 +166,7 @@ class TestCase_02_DepList(unittest.TestCase):
class TestCase_03_DepListEntry(unittest.TestCase):
def setUp(self):
global env, dl, dd, pds, cds
- env = EnvironmentMaker.instance.make_from_spec("")
+ env = EnvironmentFactory.instance.create("")
dl = DepList(env, DepListOptions())
dd = env.default_destinations
diff --git a/python/environment.cc b/python/environment.cc
index 863bf0a..31fca4f 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -22,7 +22,7 @@
#include <python/iterable.hh>
#include <paludis/environment.hh>
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/environments/adapted/adapted_environment.hh>
#include <paludis/environments/paludis/paludis_environment.hh>
#include <paludis/environments/paludis/paludis_config.hh>
@@ -455,15 +455,6 @@ void expose_environment()
/**
* Exceptions
*/
- ExceptionRegister::get_instance()->add_exception<NoSuchEnvironmentTypeError>
- ("NoSuchEnvironmentTypeError", "ConfigurationError",
- "Thrown if an environment of the specified type does not exist.");
- ExceptionRegister::get_instance()->add_exception<PaludisEnvironmentSoDirNotADirectoryError>
- ("PaludisEnvironmentSoDirNotADirectoryError", "BaseException",
- "Thrown if PALUDIS_ENVIRONMENT_SO_DIR is not a directory.");
- ExceptionRegister::get_instance()->add_exception<PaludisEnvironmentSoDirCannotDlopenError>
- ("PaludisEnvironmentSoDirCannotDlopenError", "BaseException",
- "Thrown if a repository .so cannot be used.");
ExceptionRegister::get_instance()->add_exception<paludis_environment::PaludisConfigError>
("PaludisConfigError", "ConfigurationError",
"Thrown if a configuration error is encountered by PaludisConfig.");
@@ -482,21 +473,21 @@ void expose_environment()
);
/**
- * EnvironmentMaker
+ * EnvironmentFactory
*/
- bp::class_<EnvironmentMaker, boost::noncopyable>
+ bp::class_<EnvironmentFactory, boost::noncopyable>
(
- "EnvironmentMaker",
+ "EnvironmentFactory",
"Virtual constructor for environments.",
bp::no_init
)
- .add_static_property("instance", bp::make_function(&EnvironmentMaker::get_instance,
+ .add_static_property("instance", bp::make_function(&EnvironmentFactory::get_instance,
bp::return_value_policy<bp::reference_existing_object>()),
"Singleton instance."
)
- .def("make_from_spec", &EnvironmentMaker::make_from_spec,
- "make_from_spec(spec_string) -> Environment\n"
+ .def("create", &EnvironmentFactory::create,
+ "create(spec_string) -> Environment\n"
"Make Environment from specification."
)
;
diff --git a/python/environment_TEST.py b/python/environment_TEST.py
index a1f5d08..e710254 100755
--- a/python/environment_TEST.py
+++ b/python/environment_TEST.py
@@ -34,7 +34,7 @@ Log.instance.log_level = LogLevel.WARNING
class TestCase_01_Environments(unittest.TestCase):
def setUp(self):
- self.e = EnvironmentMaker.instance.make_from_spec("")
+ self.e = EnvironmentFactory.instance.create("")
self.nce = NoConfigEnvironment(repo)
def test_01_create(self):
@@ -97,10 +97,10 @@ class TestCase_01_Environments(unittest.TestCase):
class TestCase_02_AdaptedEnvironment(unittest.TestCase):
def test_01_create(self):
- env = AdaptedEnvironment(EnvironmentMaker.instance.make_from_spec(""))
+ env = AdaptedEnvironment(EnvironmentFactory.instance.create(""))
def test_02_adapt_use(self):
- env = AdaptedEnvironment(EnvironmentMaker.instance.make_from_spec(""))
+ env = AdaptedEnvironment(EnvironmentFactory.instance.create(""))
pid = iter(env[Selection.RequireExactlyOne(Generator.Matches(
parse_user_package_dep_spec("=foo/bar-1.0", env, UserPackageDepSpecOptions())))]).next()
pds = parse_user_package_dep_spec("foo/bar", env, [])
@@ -119,7 +119,7 @@ class TestCase_02_AdaptedEnvironment(unittest.TestCase):
self.assert_(env.query_use("sometimes_enabled", pid))
def test_03_clear_adaptions(self):
- env = AdaptedEnvironment(EnvironmentMaker.instance.make_from_spec(""))
+ env = AdaptedEnvironment(EnvironmentFactory.instance.create(""))
pid = iter(env[Selection.RequireExactlyOne(Generator.Matches(
parse_user_package_dep_spec("=foo/bar-1.0", env, [])))]).next()
pds = parse_user_package_dep_spec("foo/bar", env, [])
@@ -199,7 +199,7 @@ class TestCase_04_Environment_subclassingd(unittest.TestCase):
return AllDepSpec()
def default_destinations(self):
- e = EnvironmentMaker.instance.make_from_spec("")
+ e = EnvironmentFactory.instance.create("")
return [x for x in e.package_database.repositories]
def distribution(self):
diff --git a/python/mask_TEST.py b/python/mask_TEST.py
index ae228f7..0544fd0 100755
--- a/python/mask_TEST.py
+++ b/python/mask_TEST.py
@@ -31,7 +31,7 @@ Log.instance.log_level = LogLevel.WARNING
class TestCase_01_Masks(unittest.TestCase):
def setUp(self):
- self.e = EnvironmentMaker.instance.make_from_spec("")
+ self.e = EnvironmentFactory.instance.create("")
def test_01_user_mask(self):
q = Selection.RequireExactlyOne(Generator.Matches(
@@ -163,7 +163,7 @@ class TestCase_02_Masks_subclassing(unittest.TestCase):
return "test"
def associated_package(self):
- e = EnvironmentMaker.instance.make_from_spec("")
+ e = EnvironmentFactory.instance.create("")
q = Selection.RequireExactlyOne(Generator.Matches(
parse_user_package_dep_spec("=masked/user-1.0", e, [])))
pid = iter(e[q]).next()
diff --git a/python/package_database_TEST.py b/python/package_database_TEST.py
index b3dfa12..c811070 100755
--- a/python/package_database_TEST.py
+++ b/python/package_database_TEST.py
@@ -29,7 +29,7 @@ Log.instance.log_level = LogLevel.WARNING
class TestCase_PackageDatabase(unittest.TestCase):
def get_db(self):
- self.env = EnvironmentMaker.instance.make_from_spec("")
+ self.env = EnvironmentFactory.instance.create("")
self.db = self.env.package_database
def test_01_create_error(self):
diff --git a/python/repository_TEST.py b/python/repository_TEST.py
index aab5d54..4ae1ec8 100755
--- a/python/repository_TEST.py
+++ b/python/repository_TEST.py
@@ -35,7 +35,7 @@ Log.instance.log_level = LogLevel.WARNING
class TestCase_01_Repository(unittest.TestCase):
def setUp(self):
global e, nce, db, repo, irepo
- e = EnvironmentMaker.instance.make_from_spec("")
+ e = EnvironmentFactory.instance.create("")
nce = NoConfigEnvironment(repo_path)
db = e.package_database
repo = db.fetch_repository("testrepo")
@@ -96,7 +96,7 @@ class TestCase_01_Repository(unittest.TestCase):
class TestCase_02_RepositoryInterfaces(unittest.TestCase):
def setUp(self):
global e, nce, db, repo, irepo
- e = EnvironmentMaker.instance.make_from_spec("")
+ e = EnvironmentFactory.instance.create("")
nce = NoConfigEnvironment(repo_path)
db = e.package_database
repo = db.fetch_repository("testrepo")
@@ -208,7 +208,7 @@ class TestCase_02_RepositoryInterfaces(unittest.TestCase):
class TestCase_03_FakeRepository(unittest.TestCase):
def setUp(self):
global e, f
- e = EnvironmentMaker.instance.make_from_spec("")
+ e = EnvironmentFactory.instance.create("")
f = FakeRepository(e, "fake")
def test_01_init(self):
diff --git a/ruby/action_TEST.rb b/ruby/action_TEST.rb
index c51b353..842cd14 100644
--- a/ruby/action_TEST.rb
+++ b/ruby/action_TEST.rb
@@ -25,7 +25,7 @@ require 'Paludis'
module Paludis
module InstallActionModule
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def hash_args
diff --git a/ruby/dep_list_TEST.rb b/ruby/dep_list_TEST.rb
index 4b93eae..96003ff 100644
--- a/ruby/dep_list_TEST.rb
+++ b/ruby/dep_list_TEST.rb
@@ -110,7 +110,7 @@ module Paludis
end
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def dl
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index 177645c..4fa4df5 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -43,7 +43,7 @@ module Paludis
class TestCase_PackageDepSpec < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def pda
@@ -198,7 +198,7 @@ module Paludis
class TestCase_BlockDepSpec < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def test_create
@@ -223,7 +223,7 @@ module Paludis
class TestCase_Composites < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def test_composites
@@ -265,7 +265,7 @@ module Paludis
class TestCase_URILabels < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def spec_key
diff --git a/ruby/dep_tag_TEST.rb b/ruby/dep_tag_TEST.rb
index 170f48c..6fbb43c 100644
--- a/ruby/dep_tag_TEST.rb
+++ b/ruby/dep_tag_TEST.rb
@@ -33,7 +33,7 @@ module Paludis
class TestCase_DependencyDepTag < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def get_dt
diff --git a/ruby/environment.cc b/ruby/environment.cc
index 96fc8c1..255f660 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -22,7 +22,7 @@
#include <paludis/environments/paludis/paludis_environment.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
#include <paludis/environments/adapted/adapted_environment.hh>
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
@@ -39,7 +39,7 @@ namespace
static VALUE c_paludis_environment;
static VALUE c_no_config_environment;
static VALUE c_adapted_environment;
- static VALUE c_environment_maker;
+ static VALUE c_environment_factory;
std::tr1::shared_ptr<AdaptedEnvironment>
value_to_adapted_environment(VALUE v)
@@ -524,7 +524,7 @@ namespace
/*
* call-seq:
- * make_from_spec(spec) -> Environment
+ * create(spec) -> Environment
*
* Create an environment from the given spec.
* A spec consisits of <b>class:suffix</b> both of which may be omitted. <b>class</b> is the environment class,
@@ -532,11 +532,11 @@ namespace
*
*/
VALUE
- environment_maker_make_from_spec(VALUE, VALUE spec)
+ environment_factory_create(VALUE, VALUE spec)
{
try
{
- std::tr1::shared_ptr<Environment> * e = new std::tr1::shared_ptr<Environment>(EnvironmentMaker::get_instance()->make_from_spec(
+ std::tr1::shared_ptr<Environment> * e = new std::tr1::shared_ptr<Environment>(EnvironmentFactory::get_instance()->create(
StringValuePtr(spec)));
VALUE tdata(Data_Wrap_Struct(c_environment, 0, &Common<std::tr1::shared_ptr<Environment> >::free, e));
@@ -611,15 +611,15 @@ namespace
rb_define_method(c_adapted_environment, "clear_adaptions", RUBY_FUNC_CAST(&adapted_environment_clear_adaptions), 0);
/*
- * Document-class: Paludis::EnvironmentMaker
+ * Document-class: Paludis::EnvironmentFactory
*
* A class that holds methods to create environments.
*
- * To access the default environment use make_from_spec()
+ * To access the default environment use create("")
*/
- c_environment_maker = rb_define_class_under(paludis_module(), "EnvironmentMaker", rb_cObject);
- rb_funcall(rb_const_get(rb_cObject, rb_intern("Singleton")), rb_intern("included"), 1, c_environment_maker);
- rb_define_method(c_environment_maker, "make_from_spec", RUBY_FUNC_CAST(&environment_maker_make_from_spec), 1);
+ c_environment_factory = rb_define_class_under(paludis_module(), "EnvironmentFactory", rb_cObject);
+ rb_funcall(rb_const_get(rb_cObject, rb_intern("Singleton")), rb_intern("included"), 1, c_environment_factory);
+ rb_define_method(c_environment_factory, "create", RUBY_FUNC_CAST(&environment_factory_create), 1);
}
}
diff --git a/ruby/environment_TEST.rb b/ruby/environment_TEST.rb
index 09a76eb..262aa50 100644
--- a/ruby/environment_TEST.rb
+++ b/ruby/environment_TEST.rb
@@ -75,7 +75,7 @@ module Paludis
class TestCase_EnvironmentUse < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def test_query_use
@@ -99,7 +99,7 @@ module Paludis
class TestCase_EnvironmentAcceptLicense < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def pid
@@ -126,7 +126,7 @@ module Paludis
class TestCase_EnvironmentAcceptKeywords < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def pid
@@ -176,7 +176,7 @@ module Paludis
class TestCase_AdaptedEnvironment < Test::Unit::TestCase
def env
- @env or @env = AdaptedEnvironment.new(EnvironmentMaker.instance.make_from_spec(""))
+ @env or @env = AdaptedEnvironment.new(EnvironmentFactory.instance.create(""))
end
def test_create
@@ -194,7 +194,7 @@ module Paludis
class TestCase_AdaptedEnvironmentAdaptUse < Test::Unit::TestCase
def env
- @env or @env = AdaptedEnvironment.new(EnvironmentMaker.instance.make_from_spec(""))
+ @env or @env = AdaptedEnvironment.new(EnvironmentFactory.instance.create(""))
end
def test_adapt_use
@@ -225,7 +225,7 @@ module Paludis
class TestCase_AdaptedEnvironmentClearAdaptions < Test::Unit::TestCase
def env
- @env or @env = AdaptedEnvironment.new(EnvironmentMaker.instance.make_from_spec(""))
+ @env or @env = AdaptedEnvironment.new(EnvironmentFactory.instance.create(""))
end
def test_clear_adaptions
@@ -244,7 +244,7 @@ module Paludis
class TestCase_EnvironmentPackageDatabase < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def db
@@ -274,7 +274,7 @@ module Paludis
class TestCase_EnvironmentPackageSet < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def test_package_set
@@ -390,7 +390,7 @@ module Paludis
class TestCase_EnvironmentMirrors < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def test_respond_and_return
@@ -417,7 +417,7 @@ module Paludis
class TestCase_EnvironmentQuery < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def db
@@ -506,7 +506,7 @@ module Paludis
class TestCase_EnvironmentMetadataKeys < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def ncenv
diff --git a/ruby/generator_TEST.rb b/ruby/generator_TEST.rb
index c82984d..7756c90 100644
--- a/ruby/generator_TEST.rb
+++ b/ruby/generator_TEST.rb
@@ -46,7 +46,7 @@ module Paludis
class TestCase_GeneratorMatches < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def test_create
diff --git a/ruby/package_database_TEST.rb b/ruby/package_database_TEST.rb
index 4935b3e..b927ce2 100644
--- a/ruby/package_database_TEST.rb
+++ b/ruby/package_database_TEST.rb
@@ -37,7 +37,7 @@ module Paludis
class TestCase_PackageDatabaseFavouriteRepository < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def test_package_database_favourite_repository
@@ -47,7 +47,7 @@ module Paludis
class TestCase_PackageDatabaseFetchUniqueQualifiedPackageName < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def db
@@ -89,7 +89,7 @@ module Paludis
class TestCase_PackageDatabaseRepositories < Test::Unit::TestCase
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def db
diff --git a/ruby/paludis_ruby_TEST.rb b/ruby/paludis_ruby_TEST.rb
index f46d785..3d3a7ae 100644
--- a/ruby/paludis_ruby_TEST.rb
+++ b/ruby/paludis_ruby_TEST.rb
@@ -38,7 +38,7 @@ module Paludis
class TestCase_Match < Test::Unit::TestCase
def test_match_package
- env = EnvironmentMaker.instance.make_from_spec("")
+ env = EnvironmentFactory.instance.create("")
spec_good = Paludis::parse_user_package_dep_spec('>=foo/bar-1', env, [])
spec_bad = Paludis::parse_user_package_dep_spec('>=foo/bar-2', env, [])
pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
@@ -50,7 +50,7 @@ module Paludis
end
def test_match_package_in_set
- env = EnvironmentMaker.instance.make_from_spec("")
+ env = EnvironmentFactory.instance.create("")
world = env.set('world')
pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
@@ -59,7 +59,7 @@ module Paludis
end
def test_type_errors
- env = EnvironmentMaker.instance.make_from_spec("")
+ env = EnvironmentFactory.instance.create("")
spec = Paludis::parse_user_package_dep_spec('>=foo/bar-1', env, [])
pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb
index 9433a5b..89e50f9 100644
--- a/ruby/repository_TEST.rb
+++ b/ruby/repository_TEST.rb
@@ -46,7 +46,7 @@ module Paludis
end
def env
- @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ @env or @env = EnvironmentFactory.instance.create("")
end
def no_config_testrepo
diff --git a/src/clients/contrarius/contrarius.cc b/src/clients/contrarius/contrarius.cc
index 6274c75..c3553c0 100644
--- a/src/clients/contrarius/contrarius.cc
+++ b/src/clients/contrarius/contrarius.cc
@@ -19,8 +19,8 @@
#include <paludis/args/args.hh>
#include <paludis/paludis.hh>
-#include <paludis/environment_maker.hh>
#include <paludis/environments/adapted/adapted_environment.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/util/util.hh>
#include <paludis/util/system.hh>
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
stage = "cxx";
std::tr1::shared_ptr<AdaptedEnvironment> env(
- new AdaptedEnvironment(EnvironmentMaker::get_instance()->make_from_spec(
+ new AdaptedEnvironment(EnvironmentFactory::get_instance()->create(
CommandLine::get_instance()->a_environment.argument())));
StageOptions stage_opts(CommandLine::get_instance()->a_pretend.specified(),
diff --git a/src/clients/gtkpaludis/gtkpaludis.cc b/src/clients/gtkpaludis/gtkpaludis.cc
index 18459f1..3c3f704 100644
--- a/src/clients/gtkpaludis/gtkpaludis.cc
+++ b/src/clients/gtkpaludis/gtkpaludis.cc
@@ -1,6 +1,6 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/util/log.hh>
#include <libgtkpaludis/main_window.hh>
#include <gtkmm.h>
@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
paludis::Log::get_instance()->set_log_level(paludis::ll_qa);
paludis::Log::get_instance()->set_program_name(argv[0]);
std::tr1::shared_ptr<paludis::Environment> env(
- paludis::EnvironmentMaker::get_instance()->make_from_spec(""));
+ paludis::EnvironmentFactory::get_instance()->create(""));
MainWindow main_window(env.get());
Gtk::Main::run(main_window);
diff --git a/src/clients/importare/importare.cc b/src/clients/importare/importare.cc
index d023f54..ab7ba4b 100644
--- a/src/clients/importare/importare.cc
+++ b/src/clients/importare/importare.cc
@@ -23,7 +23,7 @@
#include <paludis/args/do_help.hh>
#include <src/output/colour.hh>
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/util/system.hh>
#include <paludis/util/log.hh>
#include <paludis/util/map.hh>
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
paludis_command.append(CommandLine::get_instance()->install_args.paludis_command_fragment());
paludis_command.append(CommandLine::get_instance()->dl_args.paludis_command_fragment());
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(env_spec));
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(env_spec));
env->set_paludis_command(paludis_command);
std::vector<std::string> params(
diff --git a/src/clients/inquisitio/inquisitio.cc b/src/clients/inquisitio/inquisitio.cc
index 790b359..6cec436 100644
--- a/src/clients/inquisitio/inquisitio.cc
+++ b/src/clients/inquisitio/inquisitio.cc
@@ -27,7 +27,8 @@
#include <paludis/about.hh>
#include <paludis/util/system.hh>
#include <paludis/util/join.hh>
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
+#include <paludis/environment.hh>
#include <src/output/colour.hh>
#include <paludis/args/do_help.hh>
@@ -109,7 +110,7 @@ main(int argc, char *argv[])
if (CommandLine::get_instance()->a_no_color.specified())
paludis_command.append(" --" + CommandLine::get_instance()->a_no_color.long_name());
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(env_spec));
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(env_spec));
env->set_paludis_command(paludis_command);
if (CommandLine::get_instance()->begin_parameters() == CommandLine::get_instance()->end_parameters())
diff --git a/src/clients/paludis/paludis.cc b/src/clients/paludis/paludis.cc
index cd76849..cd452f1 100644
--- a/src/clients/paludis/paludis.cc
+++ b/src/clients/paludis/paludis.cc
@@ -36,7 +36,7 @@
#include <src/output/colour.hh>
#include <paludis/paludis.hh>
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/util/system.hh>
#include <paludis/util/util.hh>
#include <paludis/util/log.hh>
@@ -252,7 +252,7 @@ main(int argc, char *argv[])
paludis_command.append(CommandLine::get_instance()->install_args.paludis_command_fragment());
paludis_command.append(CommandLine::get_instance()->dl_args.paludis_command_fragment());
- std::tr1::shared_ptr<Environment> env(EnvironmentMaker::get_instance()->make_from_spec(env_spec));
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(env_spec));
env->set_paludis_command(paludis_command);
try
diff --git a/src/clients/reconcilio/reconcilio.cc b/src/clients/reconcilio/reconcilio.cc
index 422460d..c54e454 100644
--- a/src/clients/reconcilio/reconcilio.cc
+++ b/src/clients/reconcilio/reconcilio.cc
@@ -26,7 +26,7 @@
#include <paludis/util/log.hh>
#include <paludis/about.hh>
-#include <paludis/environment_maker.hh>
+#include <paludis/environment_factory.hh>
#include <paludis/args/do_help.hh>
#include <src/output/colour.hh>
@@ -96,9 +96,8 @@ main(int argc, char *argv[])
paludis_command.append(CommandLine::get_instance()->install_args.paludis_command_fragment());
paludis_command.append(CommandLine::get_instance()->dl_args.paludis_command_fragment());
- std::tr1::shared_ptr<Environment> env(
- EnvironmentMaker::get_instance()->make_from_spec(
- CommandLine::get_instance()->a_environment.argument()));
+ std::tr1::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(
+ CommandLine::get_instance()->a_environment.argument()));
env->set_paludis_command(paludis_command);
return do_fix_linkage(env);