aboutsummaryrefslogtreecommitdiff
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
parent79d9f02fb355d81c472f3d94b8b85d5a7639210c (diff)
downloadpaludis-5c2a332b70243cb583a29bb74f712bfca2c1fb76.tar.gz
paludis-5c2a332b70243cb583a29bb74f712bfca2c1fb76.tar.xz
Use Environment rather than PackageDatabase
-rw-r--r--.gitignore1
-rw-r--r--doc/api/cplusplus/examples/Makefile.am7
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc3
-rw-r--r--doc/api/cplusplus/examples/example_package_database.cc100
-rw-r--r--doc/api/cplusplus/examples/example_repository.cc3
-rw-r--r--doc/api/cplusplus/groups.doxygen12
-rw-r--r--doc/api/cplusplus/main_page.doxygen1
-rw-r--r--doc/api/index.html.part7
-rw-r--r--doc/api/ruby/Makefile.am1
-rw-r--r--doc/api/ruby/example_package_database.rb39
-rw-r--r--doc/api/ruby/example_repository.rb4
-rw-r--r--paludis/broken_linkage_finder.cc2
-rw-r--r--paludis/elike_use_requirement_TEST.cc29
-rw-r--r--paludis/environment.cc102
-rw-r--r--paludis/environment.hh156
-rw-r--r--paludis/environment_implementation.cc26
-rw-r--r--paludis/environment_implementation.hh2
-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
-rw-r--r--paludis/filter.cc12
-rw-r--r--paludis/filter_TEST.cc8
-rw-r--r--paludis/formatted_pretty_printer.cc8
-rw-r--r--paludis/fuzzy_finder.cc17
-rw-r--r--paludis/fuzzy_finder.hh6
-rw-r--r--paludis/fuzzy_finder_TEST.cc16
-rw-r--r--paludis/generator.cc48
-rw-r--r--paludis/generator_TEST.cc8
-rw-r--r--paludis/generator_handler.cc17
-rw-r--r--paludis/hooker.cc10
-rw-r--r--paludis/match_package.cc17
-rw-r--r--paludis/ndbam_merger.cc3
-rw-r--r--paludis/ndbam_unmerger.cc13
-rw-r--r--paludis/package_database.cc107
-rw-r--r--paludis/package_database.hh178
-rw-r--r--paludis/package_database_TEST.cc85
-rw-r--r--paludis/package_id.cc15
-rw-r--r--paludis/package_id.hh8
-rw-r--r--paludis/repositories/accounts/accounts_id.cc3
-rw-r--r--paludis/repositories/accounts/accounts_repository.cc3
-rw-r--r--paludis/repositories/accounts/accounts_repository_TEST.cc3
-rw-r--r--paludis/repositories/accounts/accounts_repository_store.cc4
-rw-r--r--paludis/repositories/e/aa_visitor_TEST.cc3
-rw-r--r--paludis/repositories/e/dep_parser.cc1
-rw-r--r--paludis/repositories/e/dep_parser_TEST.cc35
-rw-r--r--paludis/repositories/e/depend_rdepend_TEST.cc9
-rw-r--r--paludis/repositories/e/do_fetch_action.cc6
-rw-r--r--paludis/repositories/e/do_info_action.cc6
-rw-r--r--paludis/repositories/e/do_install_action.cc3
-rw-r--r--paludis/repositories/e/do_pretend_action.cc6
-rw-r--r--paludis/repositories/e/do_pretend_fetch_action.cc5
-rw-r--r--paludis/repositories/e/e_installed_repository.cc13
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc7
-rw-r--r--paludis/repositories/e/e_repository.cc7
-rw-r--r--paludis/repositories/e/e_repository.hh1
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc26
-rw-r--r--paludis/repositories/e/e_repository_TEST_0.cc8
-rw-r--r--paludis/repositories/e/e_repository_TEST_1.cc4
-rw-r--r--paludis/repositories/e/e_repository_TEST_2.cc4
-rw-r--r--paludis/repositories/e/e_repository_TEST_3.cc4
-rw-r--r--paludis/repositories/e/e_repository_TEST_4.cc18
-rw-r--r--paludis/repositories/e/e_repository_TEST_ever.cc8
-rw-r--r--paludis/repositories/e/e_repository_TEST_exheres_0.cc8
-rw-r--r--paludis/repositories/e/e_repository_TEST_exlibs.cc4
-rw-r--r--paludis/repositories/e/e_repository_TEST_pbin.cc6
-rw-r--r--paludis/repositories/e/e_repository_TEST_phases.cc8
-rw-r--r--paludis/repositories/e/e_repository_TEST_replacing.cc4
-rw-r--r--paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc4
-rw-r--r--paludis/repositories/e/e_repository_params.hh3
-rw-r--r--paludis/repositories/e/e_repository_sets_TEST.cc13
-rw-r--r--paludis/repositories/e/ebuild.cc2
-rw-r--r--paludis/repositories/e/ebuild.hh12
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc17
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc87
-rw-r--r--paludis/repositories/e/ebuild_id.cc21
-rw-r--r--paludis/repositories/e/exheres_layout.cc1
-rw-r--r--paludis/repositories/e/exndbam_repository.cc4
-rw-r--r--paludis/repositories/e/exndbam_repository_TEST.cc4
-rw-r--r--paludis/repositories/e/fetch_visitor.cc3
-rw-r--r--paludis/repositories/e/fetch_visitor_TEST.cc3
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.cc1
-rw-r--r--paludis/repositories/e/fix_locked_dependencies_TEST.cc5
-rw-r--r--paludis/repositories/e/parse_dependency_label.cc7
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc10
-rw-r--r--paludis/repositories/e/source_uri_finder_TEST.cc7
-rw-r--r--paludis/repositories/e/traditional_layout.cc1
-rw-r--r--paludis/repositories/e/vdb_merger.cc4
-rw-r--r--paludis/repositories/e/vdb_repository.cc6
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc17
-rw-r--r--paludis/repositories/e/vdb_repository_TEST_cache.cc13
-rw-r--r--paludis/repositories/e/vdb_repository_TEST_eapis.cc9
-rw-r--r--paludis/repositories/e/vdb_unmerger.cc17
-rw-r--r--paludis/repositories/e/vdb_unmerger_TEST.cc3
-rw-r--r--paludis/repositories/fake/fake_package_id.cc21
-rw-r--r--paludis/repositories/gemcutter/gemcutter_repository_store.cc1
-rw-r--r--paludis/repositories/repository/repository_repository.cc3
-rw-r--r--paludis/repositories/repository/repository_repository_store.cc4
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_TEST.cc7
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_store.cc3
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc11
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc5
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc32
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc5
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc17
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_TEST.cc5
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_store.cc1
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc9
-rw-r--r--paludis/repositories/virtuals/package_id.cc17
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc7
-rw-r--r--paludis/repositories/virtuals/virtuals_repository_TEST.cc22
-rw-r--r--paludis/repository.hh4
-rw-r--r--paludis/repository_name_cache_TEST.cc15
-rw-r--r--paludis/resolver/decider.cc1
-rw-r--r--paludis/resolver/destination_utils.cc8
-rw-r--r--paludis/resolver/find_replacing_helper.cc4
-rw-r--r--paludis/resolver/find_repository_for_helper.cc4
-rw-r--r--paludis/resolver/make_destination_filtered_generator_helper.cc2
-rw-r--r--paludis/resolver/resolver_TEST_any.cc1
-rw-r--r--paludis/resolver/resolver_TEST_blockers.cc1
-rw-r--r--paludis/resolver/resolver_TEST_continue_on_failure.cc2
-rw-r--r--paludis/resolver/resolver_TEST_cycles.cc3
-rw-r--r--paludis/resolver/resolver_TEST_errors.cc3
-rw-r--r--paludis/resolver/resolver_TEST_fetches.cc2
-rw-r--r--paludis/resolver/resolver_TEST_purges.cc1
-rw-r--r--paludis/resolver/resolver_TEST_serialisation.cc3
-rw-r--r--paludis/resolver/resolver_TEST_simple.cc4
-rw-r--r--paludis/resolver/resolver_TEST_suggestions.cc3
-rw-r--r--paludis/resolver/resolver_TEST_uninstalls.cc1
-rw-r--r--paludis/resolver/resolver_TEST_virtuals.cc3
-rw-r--r--paludis/resolver/resolver_test.cc12
-rw-r--r--paludis/selection.cc8
-rw-r--r--paludis/selection_TEST.cc12
-rw-r--r--paludis/set_file.cc1
-rw-r--r--paludis/user_dep_spec.cc10
-rw-r--r--paludis/user_dep_spec_TEST.cc11
-rw-r--r--python/Makefile.am3
-rw-r--r--python/additional_tests.cc5
-rw-r--r--python/choices_TEST.py6
-rw-r--r--python/environment.cc112
-rwxr-xr-xpython/environment_TEST.py25
-rwxr-xr-xpython/metadata_key_TEST.py6
-rw-r--r--python/package_database.cc99
-rwxr-xr-xpython/package_database_TEST.py62
-rwxr-xr-xpython/package_database_TEST_cleanup.sh8
-rwxr-xr-xpython/package_database_TEST_setup.sh89
-rwxr-xr-xpython/package_id_TEST.py8
-rw-r--r--python/paludis_python.hh1
-rw-r--r--python/paludis_python_so.cc1
-rw-r--r--python/repository.cc4
-rwxr-xr-xpython/repository_TEST.py14
-rw-r--r--ruby/Makefile.am3
-rw-r--r--ruby/choice_TEST.rb4
-rwxr-xr-xruby/demos/find_unmanaged_files.rb1
-rwxr-xr-xruby/demos/latest_stable.rb2
-rwxr-xr-xruby/demos/playman.rb2
-rwxr-xr-xruby/demos/version_spec_distributions.rb2
-rw-r--r--ruby/dep_spec.cc2
-rw-r--r--ruby/environment.cc190
-rw-r--r--ruby/environment_TEST.rb125
-rw-r--r--ruby/package_database.cc233
-rw-r--r--ruby/package_database_TEST.rb138
-rwxr-xr-xruby/package_database_TEST_cleanup.sh13
-rwxr-xr-xruby/package_database_TEST_setup.sh90
-rw-r--r--ruby/package_id_TEST.rb6
-rw-r--r--ruby/paludis_ruby.cc17
-rw-r--r--ruby/paludis_ruby.hh1
-rw-r--r--ruby/repository.cc2
-rw-r--r--ruby/repository_TEST.rb4
-rw-r--r--src/clients/accerso/accerso.cc5
-rw-r--r--src/clients/appareo/appareo.cc4
-rw-r--r--src/clients/cave/cmd_config.cc1
-rw-r--r--src/clients/cave/cmd_digest.cc6
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc4
-rw-r--r--src/clients/cave/cmd_find_candidates.cc10
-rw-r--r--src/clients/cave/cmd_fix_cache.cc17
-rw-r--r--src/clients/cave/cmd_generate_metadata.cc2
-rw-r--r--src/clients/cave/cmd_has_version.cc1
-rw-r--r--src/clients/cave/cmd_import.cc5
-rw-r--r--src/clients/cave/cmd_info.cc8
-rw-r--r--src/clients/cave/cmd_manage_search_index.cc2
-rw-r--r--src/clients/cave/cmd_match.cc1
-rw-r--r--src/clients/cave/cmd_mirror.cc2
-rw-r--r--src/clients/cave/cmd_perform.cc6
-rw-r--r--src/clients/cave/cmd_print_best_version.cc1
-rw-r--r--src/clients/cave/cmd_print_categories.cc5
-rw-r--r--src/clients/cave/cmd_print_dependent_ids.cc2
-rw-r--r--src/clients/cave/cmd_print_id_environment_variable.cc3
-rw-r--r--src/clients/cave/cmd_print_ids.cc2
-rw-r--r--src/clients/cave/cmd_print_packages.cc4
-rw-r--r--src/clients/cave/cmd_print_repositories.cc5
-rw-r--r--src/clients/cave/cmd_print_repository_metadata.cc4
-rw-r--r--src/clients/cave/cmd_print_set.cc2
-rw-r--r--src/clients/cave/cmd_print_sets.cc1
-rw-r--r--src/clients/cave/cmd_print_sync_protocols.cc1
-rw-r--r--src/clients/cave/cmd_print_unused_distfiles.cc8
-rw-r--r--src/clients/cave/cmd_report.cc3
-rw-r--r--src/clients/cave/cmd_search.cc2
-rw-r--r--src/clients/cave/cmd_show.cc12
-rw-r--r--src/clients/cave/cmd_sync.cc17
-rw-r--r--src/clients/cave/cmd_sync_protocol_options.cc2
-rw-r--r--src/clients/cave/cmd_update_world.cc4
-rw-r--r--src/clients/cave/cmd_verify.cc3
-rw-r--r--src/clients/cave/executables_common.cc1
-rw-r--r--src/clients/cave/owner_common.cc4
-rw-r--r--src/clients/cave/parse_spec_with_nice_error.cc2
-rw-r--r--src/clients/cave/resolve_cmdline.cc3
-rw-r--r--src/clients/cave/resolve_common.cc3
-rw-r--r--src/clients/cave/size_common.cc1
-rw-r--r--src/clients/instruo/instruo.cc4
221 files changed, 1375 insertions, 2121 deletions
diff --git a/.gitignore b/.gitignore
index 5cb5ec4..4bccc6c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,7 +59,6 @@ paludis-*.*.*.tar.bz2
/doc/api/cplusplus/examples/example_match_package
/doc/api/cplusplus/examples/example_metadata_key
/doc/api/cplusplus/examples/example_name
-/doc/api/cplusplus/examples/example_package_database
/doc/api/cplusplus/examples/example_package_id
/doc/api/cplusplus/examples/example_repository
/doc/api/cplusplus/examples/example_selection
diff --git a/doc/api/cplusplus/examples/Makefile.am b/doc/api/cplusplus/examples/Makefile.am
index 05bd89c..fae161c 100644
--- a/doc/api/cplusplus/examples/Makefile.am
+++ b/doc/api/cplusplus/examples/Makefile.am
@@ -22,7 +22,6 @@ noinst_PROGRAMS = \
example_mask \
example_repository \
example_match_package \
- example_package_database \
example_selection \
example_version_operator \
example_version_spec \
@@ -115,12 +114,6 @@ example_selection_LDADD = \
$(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la
-example_package_database_SOURCES = example_package_database.cc
-example_package_database_LDADD = \
- libpaludisexamples.a \
- $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la
-
example_version_operator_SOURCES = example_version_operator.cc
example_version_operator_LDADD = \
libpaludisexamples.a \
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index 1d95145..17821ba 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -275,8 +275,7 @@ int main(int argc, char * argv[])
}
/* And for each repository: */
- for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()),
- r_end(env->package_database()->end_repositories()) ;
+ for (auto r(env->begin_repositories()), r_end(env->end_repositories()) ;
r != r_end ; ++r)
{
cout << (*r)->name() << ":" << endl;
diff --git a/doc/api/cplusplus/examples/example_package_database.cc b/doc/api/cplusplus/examples/example_package_database.cc
deleted file mode 100644
index ddbc38e..0000000
--- a/doc/api/cplusplus/examples/example_package_database.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/** \file
- *
- * Example \ref example_package_database.cc "example_package_database.cc" .
- *
- * \ingroup g_package_database
- */
-
-/** \example example_package_database.cc
- *
- * This example demonstrates how to use PackageDatabase.
- */
-
-#include <paludis/paludis.hh>
-#include "example_command_line.hh"
-#include <iostream>
-#include <iomanip>
-#include <algorithm>
-#include <cstdlib>
-#include <set>
-#include <map>
-
-using namespace paludis;
-using namespace examples;
-
-using std::cout;
-using std::endl;
-using std::setw;
-using std::left;
-
-int main(int argc, char * argv[])
-{
- try
- {
- CommandLine::get_instance()->run(argc, argv,
- "example_package_database", "EXAMPLE_PACKAGE_DATABASE_OPTIONS", "EXAMPLE_PACKAGE_DATABASE_CMDLINE");
-
- /* We start with an Environment, respecting the user's '--environment' choice. */
- std::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: */
- if (env->package_database()->has_repository_named(RepositoryName("gentoo")))
- {
- std::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(RepositoryName("gentoo")));
- cout << "Repository 'gentoo' exists, and has format '" <<
- (repo->format_key() ? repo->format_key()->value() : "") << "'" << endl;
- }
-
- /* Users often expect to be able to refer to a package by its name part
- * only (e.g. 'foo' rather than 'app-misc/foo'). This has to be
- * disambiguated as follows: */
- try
- {
- QualifiedPackageName name(env->package_database()->fetch_unique_qualified_package_name(
- PackageNamePart("git")));
- cout << "The only package named 'git' is '" << name << "'" << endl;
- }
- catch (const NoSuchPackageError & e)
- {
- cout << "There is no package named 'git'" << endl;
- }
- catch (const AmbiguousPackageNameError & e)
- {
- cout << "There are several packages named 'git':" << endl;
- for (AmbiguousPackageNameError::OptionsConstIterator o(e.begin_options()), o_end(e.end_options()) ;
- o != o_end ; ++o)
- cout << " " << *o << endl;
- }
- }
- catch (const Exception & e)
- {
- /* Paludis exceptions can provide a handy human-readable backtrace and
- * an explanation message. Where possible, these should be displayed. */
- cout << endl;
- cout << "Unhandled exception:" << endl
- << " * " << e.backtrace("\n * ")
- << e.message() << " (" << e.what() << ")" << endl;
- return EXIT_FAILURE;
- }
- catch (const std::exception & e)
- {
- cout << endl;
- cout << "Unhandled exception:" << endl
- << " * " << e.what() << endl;
- return EXIT_FAILURE;
- }
- catch (...)
- {
- cout << endl;
- cout << "Unhandled exception:" << endl
- << " * Unknown exception type. Ouch..." << endl;
- return EXIT_FAILURE;
- }
-
- return EXIT_SUCCESS;
-}
-
-
diff --git a/doc/api/cplusplus/examples/example_repository.cc b/doc/api/cplusplus/examples/example_repository.cc
index 8ae820f..78db205 100644
--- a/doc/api/cplusplus/examples/example_repository.cc
+++ b/doc/api/cplusplus/examples/example_repository.cc
@@ -39,8 +39,7 @@ int main(int argc, char * argv[])
CommandLine::get_instance()->a_environment.argument()));
/* For each repository... */
- for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()),
- r_end(env->package_database()->end_repositories()) ;
+ for (auto r(env->begin_repositories()), r_end(env->end_repositories()) ;
r != r_end ; ++r)
{
/* A repository is identified by its name. */
diff --git a/doc/api/cplusplus/groups.doxygen b/doc/api/cplusplus/groups.doxygen
index 8cc58c6..99262c9 100644
--- a/doc/api/cplusplus/groups.doxygen
+++ b/doc/api/cplusplus/groups.doxygen
@@ -177,18 +177,6 @@ using namespace paludis;
* - \ref example_repository.cc "example_repository.cc"
*/
-/** \defgroup g_package_database Package Database
- *
- * \ingroup g_paludis
- *
- * A PackageDatabase, which is owned by an Environment, contains a number of
- * Repository instances.
- *
- * \section Examples
- *
- * - \ref example_package_database.cc "example_package_database.cc"
- */
-
/** \defgroup g_names Names and Versions
*
* \ingroup g_paludis
diff --git a/doc/api/cplusplus/main_page.doxygen b/doc/api/cplusplus/main_page.doxygen
index 3e79a6e..e1461ce 100644
--- a/doc/api/cplusplus/main_page.doxygen
+++ b/doc/api/cplusplus/main_page.doxygen
@@ -14,7 +14,6 @@ Some classes you may find useful:
- paludis::Environment, which is usually created using paludis::EnvironmentFactory
- paludis::PackageID, which you can get from your paludis::Environment by using a paludis::Selection
-- paludis::PackageDatabase
- paludis::Repository and the associated interface classes
*/
diff --git a/doc/api/index.html.part b/doc/api/index.html.part
index 8a8eaf6..07dd5dc 100644
--- a/doc/api/index.html.part
+++ b/doc/api/index.html.part
@@ -135,13 +135,6 @@ how concepts map on to different language bindings.</p>
<td>How to use name classes</td>
</tr>
<tr>
- <td>example_package_database</td>
- <td><a href="cplusplus/examples.html">C++</a></td>
- <td><a href="ruby/example_package_database.html">Ruby</a></td>
- <td></td>
- <td>How to use PackageDatabase</td>
- </tr>
- <tr>
<td>example_package_id</td>
<td><a href="cplusplus/examples.html">C++</a></td>
<td><a href="ruby/example_package_id.html">Ruby</a></td>
diff --git a/doc/api/ruby/Makefile.am b/doc/api/ruby/Makefile.am
index 178ec52..b536ed6 100644
--- a/doc/api/ruby/Makefile.am
+++ b/doc/api/ruby/Makefile.am
@@ -24,7 +24,6 @@ examples = \
example_contents.rb \
example_dep_tree.rb \
example_environment.rb \
- example_package_database.rb \
example_package_id.rb \
example_mask.rb \
example_match_package.rb \
diff --git a/doc/api/ruby/example_package_database.rb b/doc/api/ruby/example_package_database.rb
deleted file mode 100644
index 6c7a17e..0000000
--- a/doc/api/ruby/example_package_database.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env ruby
-# vim: set sw=4 sts=4 et tw=100 :
-
-=begin description
-This example demonstrates how to use Mask. It displays all the
-mask keys for a particular PackageID.
-=end
-
-require 'Paludis'
-require 'example_command_line'
-
-include Paludis
-
-exit_status = 0
-
-# We start with an Environment, respecting the user's '--environment' choice.
-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')
- repo = env.package_database.fetch_repository('gentoo')
- puts "Repository 'gentoo' exists, and has format '" +
- (repo.format_key ? repo.format_key.value : '') + "'"
-end
-
-begin
- name = env.package_database.fetch_unique_qualified_package_name('git')
- puts "The only package named 'git' is '#{name}'"
-rescue NoSuchPackageError
- puts "There is no package named 'git'"
-rescue AmbiguousPackageNameError
- puts "There are several packages named 'git':"
- $!.options.each do |o|
- puts " #{o}"
- end
-end
-
-exit exit_status
-
diff --git a/doc/api/ruby/example_repository.rb b/doc/api/ruby/example_repository.rb
index 5d9fba4..8d09b3f 100644
--- a/doc/api/ruby/example_repository.rb
+++ b/doc/api/ruby/example_repository.rb
@@ -16,7 +16,7 @@ exit_status = 0
env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment)
# For each repository
-env.package_database.repositories do |repo|
+env.repositories do |repo|
# A repository is identified by its name.
puts repo.name + ':'
@@ -33,7 +33,7 @@ env.package_database.repositories do |repo|
# Repositories support various methods for querying categories,
# packages, IDs and so on. These methods are used by
- # PackageDatabase::query, but are also sometimes of direct use to
+ # Environment::[], but are also sometimes of direct use to
# clients.
puts " Number of categories: ".ljust(31) + repo.category_names.length.to_s
puts " IDs for sys-apps/paludis: ".ljust(31) + repo.package_ids('sys-apps/paludis').join(' ')
diff --git a/paludis/broken_linkage_finder.cc b/paludis/broken_linkage_finder.cc
index 7079a1b..ba828c4 100644
--- a/paludis/broken_linkage_finder.cc
+++ b/paludis/broken_linkage_finder.cc
@@ -36,11 +36,11 @@
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_iterator.hh>
#include <paludis/util/fs_error.hh>
+#include <paludis/util/join.hh>
#include <paludis/contents.hh>
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/elike_use_requirement_TEST.cc b/paludis/elike_use_requirement_TEST.cc
index 31f9b17..f0872dd 100644
--- a/paludis/elike_use_requirement_TEST.cc
+++ b/paludis/elike_use_requirement_TEST.cc
@@ -20,7 +20,6 @@
#include <paludis/dep_spec.hh>
#include <paludis/elike_use_requirement.hh>
-#include <paludis/package_database.hh>
#include <paludis/choice.hh>
#include <paludis/additional_package_dep_spec_requirement.hh>
@@ -65,7 +64,7 @@ TEST(ELikeUseRequirements, Simple)
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "enabled disabled");
@@ -101,7 +100,7 @@ TEST(ELikeUseRequirements, Portage)
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "enabled disabled");
@@ -137,7 +136,7 @@ TEST(ELikeUseRequirements, Multiple)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "enabled disabled");
@@ -179,7 +178,7 @@ TEST(ELikeUseRequirements, Complex)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
set_conditionals(id, "pkgname");
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
@@ -277,7 +276,7 @@ TEST(ELikeUseRequirements, ComplexPortage)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
set_conditionals(id, "pkgname");
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
@@ -347,7 +346,7 @@ TEST(ELikeUseRequirements, Both)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
set_conditionals(id, "pkgname");
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
@@ -473,7 +472,7 @@ TEST(ELikeUseRequirements, Malformed)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
set_conditionals(id, "pkgname");
@@ -498,7 +497,7 @@ TEST(ELikeUseRequirements, MalformedPortage)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
set_conditionals(id, "pkgname");
@@ -527,7 +526,7 @@ TEST(ELikeUseRequirements, MalformedBoth)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
set_conditionals(id, "pkgname");
@@ -551,7 +550,7 @@ TEST(ELikeUseRequirements, ComplexNonStrict)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
set_conditionals(id, "pkgname");
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
@@ -677,7 +676,7 @@ TEST(ELikeUseRequirements, PortageNonStrict)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
set_conditionals(id, "pkgname");
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
@@ -803,7 +802,7 @@ TEST(ELikeUseRequirements, Defaults)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "enabled disabled");
@@ -839,7 +838,7 @@ TEST(ELikeUseRequirements, PrefixStar)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "foo:enabled foo:disabled");
@@ -861,7 +860,7 @@ TEST(ELikeUseRequirements, QuestionDefaults)
n::environment() = &env,
n::name() = RepositoryName("fake")
)));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> id1(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id1, "foo:enabled foo:disabled");
diff --git a/paludis/environment.cc b/paludis/environment.cc
index fa194c9..c3443c2 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -18,6 +18,15 @@
*/
#include <paludis/environment.hh>
+#include <paludis/filter.hh>
+
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/sequence-impl.hh>
+
+#include <list>
+#include <algorithm>
using namespace paludis;
@@ -25,3 +34,94 @@ Environment::~Environment()
{
}
+const Filter &
+Environment::all_filter()
+{
+ static const Filter result((filter::All()));
+ return result;
+}
+
+namespace paludis
+{
+ template <>
+ struct WrappedForwardIteratorTraits<AmbiguousPackageNameError::OptionsConstIteratorTag>
+ {
+ typedef std::list<std::string>::const_iterator UnderlyingIterator;
+ };
+}
+
+DuplicateRepositoryError::DuplicateRepositoryError(const std::string & name) throw () :
+ Exception("A repository named '" + name + "' already exists")
+{
+}
+
+NoSuchPackageError::NoSuchPackageError(const std::string & our_name) throw () :
+ Exception("Could not find '" + our_name + "'"),
+ _name(our_name)
+{
+}
+
+NoSuchRepositoryError::NoSuchRepositoryError(const RepositoryName & n) throw () :
+ Exception("Could not find repository '" + stringify(n) + "'"),
+ _name(n)
+{
+}
+
+NoSuchRepositoryError::~NoSuchRepositoryError() throw ()
+{
+}
+
+RepositoryName
+NoSuchRepositoryError::name() const
+{
+ return _name;
+}
+
+struct AmbiguousPackageNameError::NameData
+{
+ std::string name;
+ std::list<std::string> names;
+};
+
+AmbiguousPackageNameError::AmbiguousPackageNameError(const std::string & our_name,
+ const std::shared_ptr<const Sequence<std::string> > & names) throw () :
+ Exception("Ambiguous package name '" + our_name + "' (candidates are " + join(names->begin(), names->end(), ", ") + ")"),
+ _name_data(new NameData)
+{
+ _name_data->name = our_name;
+ std::copy(names->begin(), names->end(), std::back_inserter(_name_data->names));
+}
+
+AmbiguousPackageNameError::AmbiguousPackageNameError(const AmbiguousPackageNameError & other) :
+ Exception(other),
+ _name_data(new NameData)
+{
+ _name_data->name = other._name_data->name;
+ _name_data->names = other._name_data->names;
+}
+
+AmbiguousPackageNameError::~AmbiguousPackageNameError() throw ()
+{
+ delete _name_data;
+}
+
+AmbiguousPackageNameError::OptionsConstIterator
+AmbiguousPackageNameError::begin_options() const
+{
+ return OptionsConstIterator(_name_data->names.begin());
+}
+
+AmbiguousPackageNameError::OptionsConstIterator
+AmbiguousPackageNameError::end_options() const
+{
+ return OptionsConstIterator(_name_data->names.end());
+}
+
+const std::string &
+AmbiguousPackageNameError::name() const
+{
+ return _name_data->name;
+}
+
+template class WrappedForwardIterator<AmbiguousPackageNameError::OptionsConstIteratorTag, const std::string>;
+
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 953f961..16b1292 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -21,11 +21,8 @@
#define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_HH 1
#include <paludis/environment-fwd.hh>
-#include <paludis/util/options-fwd.hh>
-#include <paludis/util/tribool-fwd.hh>
-#include <paludis/util/visitor.hh>
+
#include <paludis/output_manager-fwd.hh>
-#include <paludis/util/pimp.hh>
#include <paludis/name-fwd.hh>
#include <paludis/hook-fwd.hh>
#include <paludis/repository-fwd.hh>
@@ -33,7 +30,6 @@
#include <paludis/spec_tree-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/mask-fwd.hh>
-#include <paludis/package_database-fwd.hh>
#include <paludis/selection-fwd.hh>
#include <paludis/selection_cache-fwd.hh>
#include <paludis/metadata_key_holder.hh>
@@ -42,6 +38,12 @@
#include <paludis/notifier_callback-fwd.hh>
#include <paludis/filter-fwd.hh>
+#include <paludis/util/options-fwd.hh>
+#include <paludis/util/tribool-fwd.hh>
+#include <paludis/util/visitor.hh>
+#include <paludis/util/pimp.hh>
+#include <paludis/util/sequence-fwd.hh>
+
/** \file
* Declarations for the Environment class.
*
@@ -55,12 +57,134 @@
namespace paludis
{
/**
+ * Thrown if a query results in more than one matching package.
+ *
+ * \ingroup g_exceptions
+ * \ingroup g_environment
+ */
+ class PALUDIS_VISIBLE AmbiguousPackageNameError :
+ public Exception
+ {
+ private:
+ struct NameData;
+ NameData * const _name_data;
+
+ std::string _name;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ AmbiguousPackageNameError(const std::string & name, const std::shared_ptr<const Sequence<std::string> > &) throw ();
+
+ AmbiguousPackageNameError(const AmbiguousPackageNameError &);
+
+ virtual ~AmbiguousPackageNameError() throw ();
+
+ ///\}
+
+ /**
+ * The name of the package.
+ */
+ const std::string & name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\name Iterate over possible matches
+ ///\{
+
+ struct OptionsConstIteratorTag;
+ typedef WrappedForwardIterator<OptionsConstIteratorTag, const std::string> OptionsConstIterator;
+
+ OptionsConstIterator begin_options() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ OptionsConstIterator end_options() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\}
+ };
+
+ /**
+ * Thrown if a Repository with the same name as an existing member is added
+ * to an Environment.
+ *
+ * \ingroup g_exceptions
+ * \ingroup g_environment
+ */
+ class PALUDIS_VISIBLE DuplicateRepositoryError :
+ public Exception
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ DuplicateRepositoryError(const std::string & name) throw ();
+ };
+
+ /**
+ * Thrown if there is no Package with the given name.
+ *
+ * \ingroup g_exceptions
+ * \ingroup g_environment
+ */
+ class PALUDIS_VISIBLE NoSuchPackageError :
+ public Exception
+ {
+ private:
+ std::string _name;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ NoSuchPackageError(const std::string & name) throw ();
+
+ virtual ~NoSuchPackageError() throw ()
+ {
+ }
+
+ ///\}
+
+ /**
+ * Name of the package.
+ */
+ const std::string & name() const
+ {
+ return _name;
+ }
+ };
+
+ /**
+ * Thrown if there is no Repository in a RepositoryDatabase with the given
+ * name.
+ *
+ * \ingroup g_exceptions
+ * \ingroup g_environment
+ */
+ class PALUDIS_VISIBLE NoSuchRepositoryError :
+ public Exception
+ {
+ private:
+ const RepositoryName _name;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ NoSuchRepositoryError(const RepositoryName &) throw ();
+
+ ~NoSuchRepositoryError() throw ();
+
+ ///\}
+
+ /**
+ * The name of our repository.
+ */
+ RepositoryName name() const;
+ };
+
+ /**
* Represents a working environment, which contains an available packages
* database and provides various methods for querying package visibility
* and options.
*
- * Contains a PackageDatabase, which in turn contains a number of Repository
- * instances.
+ * Holds a number of Repository instances.
*
* Environment itself is purely an interface class. Actual Environment
* implementations usually descend from EnvironmentImplementation, which
@@ -69,15 +193,15 @@ namespace paludis
* application.
*
* \ingroup g_environment
- * \see PackageDatabase
* \see EnvironmentFactory
* \see EnvironmentImplementation
+ * \see Repository
* \nosubgrouping
*/
class PALUDIS_VISIBLE Environment :
public MetadataKeyHolder
{
- private:
+ protected:
static const Filter & all_filter() PALUDIS_ATTRIBUTE((warn_unused_result));
public:
@@ -251,15 +375,6 @@ namespace paludis
///\}
- ///\name Database-related functions
- ///\{
-
- virtual std::shared_ptr<PackageDatabase> package_database()
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- virtual std::shared_ptr<const PackageDatabase> package_database() const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
/**
* Select some packages.
*/
@@ -289,7 +404,7 @@ namespace paludis
/**
* Create a repository from a particular file.
*
- * Does not add the repository to the PackageDatabase.
+ * Does not add the repository to the Environment.
*
* This allows RepositoryRepository to add a repo config file, then
* sync that repo. If you aren't RepositoryRepository you shouldn't
@@ -622,7 +737,8 @@ namespace paludis
extern template class Pimp<CreateOutputManagerForRepositorySyncInfo>;
extern template class Pimp<CreateOutputManagerForPackageIDActionInfo>;
-
+ extern template class WrappedForwardIterator<Environment::RepositoryConstIteratorTag, const std::shared_ptr<Repository> >;
+ extern template class WrappedForwardIterator<AmbiguousPackageNameError::OptionsConstIteratorTag, const std::string>;
}
#endif
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index 13975fd..d7f7f33 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -25,6 +25,7 @@
#include <paludis/distribution.hh>
#include <paludis/selection.hh>
#include <paludis/selection_cache.hh>
+#include <paludis/package_database.hh>
#include <paludis/util/log.hh>
#include <paludis/util/save.hh>
@@ -118,6 +119,7 @@ namespace paludis
template <>
struct Imp<EnvironmentImplementation>
{
+ std::shared_ptr<PackageDatabase> package_database;
std::map<unsigned, NotifierCallbackFunction> notifier_callbacks;
std::list<std::shared_ptr<const SelectionCache> > selection_caches;
@@ -126,7 +128,8 @@ namespace paludis
mutable std::shared_ptr<SetNameSet> set_names;
mutable SetsStore sets;
- Imp() :
+ Imp(const std::shared_ptr<PackageDatabase> & d) :
+ package_database(d),
loaded_sets(false)
{
}
@@ -134,7 +137,7 @@ namespace paludis
}
EnvironmentImplementation::EnvironmentImplementation() :
- _imp()
+ _imp(std::shared_ptr<PackageDatabase>(new PackageDatabase(this)))
{
}
@@ -292,8 +295,7 @@ EnvironmentImplementation::_need_sets() const
if (_imp->loaded_sets)
return;
- for (PackageDatabase::RepositoryConstIterator r(package_database()->begin_repositories()),
- r_end(package_database()->end_repositories()) ;
+ for (auto r(begin_repositories()), r_end(end_repositories()) ;
r != r_end ; ++r)
(*r)->populate_sets();
@@ -367,50 +369,50 @@ EnvironmentImplementation::set_always_exists(const SetName & s) const
void
EnvironmentImplementation::add_repository(int importance, const std::shared_ptr<Repository> & repository)
{
- package_database()->add_repository(importance, repository);
+ _imp->package_database->add_repository(importance, repository);
}
const std::shared_ptr<const Repository>
EnvironmentImplementation::fetch_repository(const RepositoryName & name) const
{
- return package_database()->fetch_repository(name);
+ return _imp->package_database->fetch_repository(name);
}
const std::shared_ptr<Repository>
EnvironmentImplementation::fetch_repository(const RepositoryName & name)
{
- return package_database()->fetch_repository(name);
+ return _imp->package_database->fetch_repository(name);
}
bool
EnvironmentImplementation::has_repository_named(const RepositoryName & name) const
{
- return package_database()->has_repository_named(name);
+ return _imp->package_database->has_repository_named(name);
}
QualifiedPackageName
EnvironmentImplementation::fetch_unique_qualified_package_name(const PackageNamePart & name,
const Filter & filter, const bool disambiguate) const
{
- return package_database()->fetch_unique_qualified_package_name(name, filter, disambiguate);
+ return _imp->package_database->fetch_unique_qualified_package_name(name, filter, disambiguate);
}
bool
EnvironmentImplementation::more_important_than(const RepositoryName & a, const RepositoryName & b) const
{
- return package_database()->more_important_than(a, b);
+ return _imp->package_database->more_important_than(a, b);
}
EnvironmentImplementation::RepositoryConstIterator
EnvironmentImplementation::begin_repositories() const
{
- return package_database()->begin_repositories();
+ return _imp->package_database->begin_repositories();
}
EnvironmentImplementation::RepositoryConstIterator
EnvironmentImplementation::end_repositories() const
{
- return package_database()->end_repositories();
+ return _imp->package_database->end_repositories();
}
DuplicateSetError::DuplicateSetError(const SetName & s) throw () :
diff --git a/paludis/environment_implementation.hh b/paludis/environment_implementation.hh
index 6a4fba7..fd79e5d 100644
--- a/paludis/environment_implementation.hh
+++ b/paludis/environment_implementation.hh
@@ -123,7 +123,7 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual QualifiedPackageName fetch_unique_qualified_package_name(
- const PackageNamePart &, const Filter &, const bool disambiguate) const
+ const PackageNamePart &, const Filter & = all_filter(), const bool disambiguate = true) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool more_important_than(const RepositoryName &, const RepositoryName &) const
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index 000d609..8ec8153 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 868eb37..60be547 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 0da71ba..c4403df 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 0ff5a24..2f36bd2 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 3b9d50a..2f3ebfa 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 1f9bc88..03b5f7b 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 bfe9478..de4f65d 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 29f9308..553ff23 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 87b136b..ef5d28a 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 4a7009e..46dfcb6 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 3cd2c53..414ad4c 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 c8ddfd2..e7193e0 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 97bd214..1f637f2 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 f437c93..aacb552 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 1d49812..d8abeac 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.
*/
diff --git a/paludis/filter.cc b/paludis/filter.cc
index 62bbebe..f6faff1 100644
--- a/paludis/filter.cc
+++ b/paludis/filter.cc
@@ -23,15 +23,17 @@
#include <paludis/action.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
#include <paludis/match_package.hh>
+#include <paludis/repository.hh>
+#include <paludis/action_names.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/wrapped_output_iterator.hh>
-#include <paludis/action_names.hh>
+#include <paludis/util/stringify.hh>
using namespace paludis;
@@ -141,7 +143,7 @@ namespace
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
r != r_end ; ++r)
{
- if (env->package_database()->fetch_repository(*r)->some_ids_might_support_action(SupportsActionTest<A_>()))
+ if (env->fetch_repository(*r)->some_ids_might_support_action(SupportsActionTest<A_>()))
result->insert(*r);
}
@@ -187,7 +189,7 @@ namespace
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
r != r_end ; ++r)
{
- if (env->package_database()->fetch_repository(*r)->some_ids_might_not_be_masked())
+ if (env->fetch_repository(*r)->some_ids_might_not_be_masked())
result->insert(*r);
}
@@ -240,7 +242,7 @@ namespace
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
r != r_end ; ++r)
{
- const std::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(*r));
+ const std::shared_ptr<const Repository> repo(env->fetch_repository(*r));
if (repo->installed_root_key() && (equal == (root == repo->installed_root_key()->value())))
result->insert(*r);
}
diff --git a/paludis/filter_TEST.cc b/paludis/filter_TEST.cc
index 6069bc3..f4f0942 100644
--- a/paludis/filter_TEST.cc
+++ b/paludis/filter_TEST.cc
@@ -21,7 +21,6 @@
#include <paludis/generator.hh>
#include <paludis/selection.hh>
#include <paludis/filtered_generator.hh>
-#include <paludis/package_database.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
@@ -32,6 +31,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/join.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <test/test_concepts.hh>
@@ -71,9 +71,9 @@ namespace test_cases
n::supports_uninstall() = true
)))
{
- env.package_database()->add_repository(1, repo1);
- env.package_database()->add_repository(10, repo2);
- env.package_database()->add_repository(0, inst_repo1);
+ env.add_repository(1, repo1);
+ env.add_repository(10, repo2);
+ env.add_repository(0, inst_repo1);
repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1", { }));
repo1->add_version(CategoryNamePart("cat") + PackageNamePart("b"), VersionSpec("2", { }));
diff --git a/paludis/formatted_pretty_printer.cc b/paludis/formatted_pretty_printer.cc
index a8a511e..7612b3c 100644
--- a/paludis/formatted_pretty_printer.cc
+++ b/paludis/formatted_pretty_printer.cc
@@ -18,15 +18,17 @@
*/
#include <paludis/formatted_pretty_printer.hh>
-#include <paludis/util/pimp-impl.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
#include <paludis/package_id.hh>
+#include <paludis/repository.hh>
+
+#include <paludis/util/pimp-impl.hh>
+#include <paludis/util/stringify.hh>
using namespace paludis;
@@ -172,7 +174,7 @@ FormattedPrettyPrinter::prettify(const std::shared_ptr<const PackageID> & v) con
{
if (_imp->env)
{
- auto repo(_imp->env->package_database()->fetch_repository(v->repository_name()));
+ auto repo(_imp->env->fetch_repository(v->repository_name()));
if (repo->installed_root_key())
return format_installed(stringify(*v));
else if (! v->masked())
diff --git a/paludis/fuzzy_finder.cc b/paludis/fuzzy_finder.cc
index 1793532..3846609 100644
--- a/paludis/fuzzy_finder.cc
+++ b/paludis/fuzzy_finder.cc
@@ -18,11 +18,6 @@
*/
#include <paludis/fuzzy_finder.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/wrapped_forward_iterator-impl.hh>
-#include <paludis/util/damerau_levenshtein.hh>
-#include <paludis/util/options.hh>
-#include <paludis/package_database.hh>
#include <paludis/environment.hh>
#include <paludis/repository.hh>
#include <paludis/package_id.hh>
@@ -33,8 +28,15 @@
#include <paludis/filter_handler.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
+
+#include <paludis/util/pimp-impl.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/damerau_levenshtein.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/util/set-impl.hh>
#include <paludis/util/sequence-impl.hh>
+
#include <list>
#include <algorithm>
#include <set>
@@ -202,15 +204,14 @@ FuzzyRepositoriesFinder::FuzzyRepositoriesFinder(const Environment & e, const st
if (0 != name.compare(0, 2, std::string("x-")))
{
RepositoryName xname(std::string("x-" + name));
- if (e.package_database()->has_repository_named(xname))
+ if (e.has_repository_named(xname))
{
_imp->candidates.push_back(xname);
return;
}
}
- for (PackageDatabase::RepositoryConstIterator r(e.package_database()->begin_repositories()),
- r_end(e.package_database()->end_repositories()) ; r != r_end ; ++r)
+ for (auto r(e.begin_repositories()), r_end(e.end_repositories()) ; r != r_end ; ++r)
if (distance_calculator.distance_with(tolower_0_cost(stringify((*r)->name()))) <= threshold)
_imp->candidates.push_back((*r)->name());
}
diff --git a/paludis/fuzzy_finder.hh b/paludis/fuzzy_finder.hh
index ae3686e..90d1047 100644
--- a/paludis/fuzzy_finder.hh
+++ b/paludis/fuzzy_finder.hh
@@ -30,7 +30,7 @@
/** \file
* Declarations for paludis::FuzzyCandidatesFinder and paludis::FuzzyRepositoriesFinder
*
- * \ingroup g_package_database
+ * \ingroup g_environment
*/
namespace paludis
@@ -38,7 +38,7 @@ namespace paludis
/**
* Object to find package names to a given name
*
- * \ingroup g_package_database
+ * \ingroup g_environment
*/
class PALUDIS_VISIBLE FuzzyCandidatesFinder
{
@@ -70,7 +70,7 @@ namespace paludis
/**
* Object to find repositories similar to a given name
*
- * \ingroup g_package_database
+ * \ingroup g_environment
*/
class PALUDIS_VISIBLE FuzzyRepositoriesFinder
{
diff --git a/paludis/fuzzy_finder_TEST.cc b/paludis/fuzzy_finder_TEST.cc
index c282091..eff7bf0 100644
--- a/paludis/fuzzy_finder_TEST.cc
+++ b/paludis/fuzzy_finder_TEST.cc
@@ -25,7 +25,6 @@
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/make_named_values.hh>
-#include <paludis/package_database.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -50,13 +49,13 @@ namespace test_cases
r1->add_version("other-cat", "foo", "1");
r1->add_version("some-cat", "bar", "1");
r1->add_version("some-cat", "one-two-three", "1");
- e.package_database()->add_repository(1, r1);
+ e.add_repository(1, r1);
const std::shared_ptr<FakeRepository> r2(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &e,
n::name() = RepositoryName("r2")
)));
- e.package_database()->add_repository(2, r2);
+ e.add_repository(2, r2);
FuzzyCandidatesFinder f1(e, std::string("some-cat/one-two-thee"), filter::All());
TEST_CHECK_EQUAL(std::distance(f1.begin(), f1.end()), 1);
@@ -86,21 +85,20 @@ namespace test_cases
void run()
{
TestEnvironment e;
- PackageDatabase & p(*e.package_database());
- p.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
+ e.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &e,
n::name() = RepositoryName("my-main-repository")))));
- p.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
+ e.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &e,
n::name() = RepositoryName("x-new-repository")))));
- p.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
+ e.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &e,
n::name() = RepositoryName("bar-overlay")))));
- p.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
+ e.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &e,
n::name() = RepositoryName("baz-overlay")))));
- p.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
+ e.add_repository(1, std::shared_ptr<FakeRepository>(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &e,
n::name() = RepositoryName("sunrise")))));
diff --git a/paludis/generator.cc b/paludis/generator.cc
index ffa0d5a..e38ebed 100644
--- a/paludis/generator.cc
+++ b/paludis/generator.cc
@@ -24,17 +24,20 @@
#include <paludis/action_names.hh>
#include <paludis/action.hh>
#include <paludis/match_package.hh>
+#include <paludis/package_dep_spec_properties.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/repository.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/make_named_values.hh>
-#include <paludis/package_dep_spec_properties.hh>
-#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
-#include <paludis/package_id.hh>
-#include <paludis/metadata_key.hh>
+#include <paludis/util/stringify.hh>
+
#include <algorithm>
#include <functional>
@@ -142,7 +145,7 @@ namespace
{
using namespace std::placeholders;
std::shared_ptr<RepositoryNameSet> result(std::make_shared<RepositoryNameSet>());
- if (env->package_database()->has_repository_named(name))
+ if (env->has_repository_named(name))
result->insert(name);
return result;
}
@@ -177,8 +180,7 @@ namespace
for (QualifiedPackageNameSet::ConstIterator q(qpns->begin()), q_end(qpns->end()) ;
q != q_end ; ++q)
{
- std::shared_ptr<const PackageIDSequence> id(
- env->package_database()->fetch_repository(*r)->package_ids(*q, x));
+ std::shared_ptr<const PackageIDSequence> id(env->fetch_repository(*r)->package_ids(*q, x));
for (PackageIDSequence::ConstIterator i(id->begin()), i_end(id->end()) ;
i != i_end ; ++i)
if ((*i)->from_repositories_key() && ((*i)->from_repositories_key()->value()->end() !=
@@ -216,7 +218,7 @@ namespace
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
r != r_end ; ++r)
- if (env->package_database()->fetch_repository(*r)->has_category_named(name, x))
+ if (env->fetch_repository(*r)->has_category_named(name, x))
{
result->insert(name);
break;
@@ -251,7 +253,7 @@ namespace
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
r != r_end ; ++r)
- if (env->package_database()->fetch_repository(*r)->has_category_named(name.category(), x))
+ if (env->fetch_repository(*r)->has_category_named(name.category(), x))
{
result->insert(name.category());
break;
@@ -271,7 +273,7 @@ namespace
r != r_end ; ++r)
for (CategoryNamePartSet::ConstIterator c(cats->begin()), c_end(cats->end()) ;
c != c_end ; ++c)
- if (env->package_database()->fetch_repository(*r)->has_package_named(name, x))
+ if (env->fetch_repository(*r)->has_package_named(name, x))
result->insert(name);
return result;
@@ -321,11 +323,11 @@ namespace
if (spec.in_repository_ptr())
{
- if (env->package_database()->has_repository_named(*spec.in_repository_ptr()))
+ if (env->has_repository_named(*spec.in_repository_ptr()))
{
if (spec.installed_at_path_ptr())
{
- std::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(
+ std::shared_ptr<const Repository> repo(env->fetch_repository(
*spec.in_repository_ptr()));
if (! repo->installed_root_key())
return result;
@@ -340,8 +342,8 @@ namespace
{
if (spec.installed_at_path_ptr())
{
- for (PackageDatabase::RepositoryConstIterator i(env->package_database()->begin_repositories()),
- i_end(env->package_database()->end_repositories()) ; i != i_end ; ++i)
+ for (auto i(env->begin_repositories()),
+ i_end(env->end_repositories()) ; i != i_end ; ++i)
{
if (! (*i)->installed_root_key())
continue;
@@ -369,7 +371,7 @@ namespace
std::shared_ptr<CategoryNamePartSet> result(std::make_shared<CategoryNamePartSet>());
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
r != r_end ; ++r)
- if (env->package_database()->fetch_repository(*r)->has_category_named(*spec.category_name_part_ptr(), x))
+ if (env->fetch_repository(*r)->has_category_named(*spec.category_name_part_ptr(), x))
{
result->insert(*spec.category_name_part_ptr());
break;
@@ -384,7 +386,7 @@ namespace
r != r_end ; ++r)
{
std::shared_ptr<const CategoryNamePartSet> cats(
- env->package_database()->fetch_repository(*r)
+ env->fetch_repository(*r)
->category_names_containing_package(*spec.package_name_part_ptr(), x));
std::copy(cats->begin(), cats->end(), result->inserter());
}
@@ -396,7 +398,7 @@ namespace
std::shared_ptr<CategoryNamePartSet> result(std::make_shared<CategoryNamePartSet>());
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
r != r_end ; ++r)
- if (env->package_database()->fetch_repository(*r)->has_category_named(spec.package_ptr()->category(), x))
+ if (env->fetch_repository(*r)->has_category_named(spec.package_ptr()->category(), x))
{
result->insert(spec.package_ptr()->category());
break;
@@ -421,7 +423,7 @@ namespace
r != r_end ; ++r)
for (CategoryNamePartSet::ConstIterator c(cats->begin()), c_end(cats->end()) ;
c != c_end ; ++c)
- if (env->package_database()->fetch_repository(*r)->has_package_named(*c + *spec.package_name_part_ptr(), x))
+ if (env->fetch_repository(*r)->has_package_named(*c + *spec.package_name_part_ptr(), x))
result->insert(*c + *spec.package_name_part_ptr());
return result;
@@ -431,7 +433,7 @@ namespace
std::shared_ptr<QualifiedPackageNameSet> result(std::make_shared<QualifiedPackageNameSet>());
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
r != r_end ; ++r)
- if (env->package_database()->fetch_repository(*r)->has_package_named(*spec.package_ptr(), x))
+ if (env->fetch_repository(*r)->has_package_named(*spec.package_ptr(), x))
{
result->insert(*spec.package_ptr());
break;
@@ -458,7 +460,7 @@ namespace
q != q_end ; ++q)
{
std::shared_ptr<const PackageIDSequence> id(
- env->package_database()->fetch_repository(*r)->package_ids(*q, x));
+ env->fetch_repository(*r)->package_ids(*q, x));
for (PackageIDSequence::ConstIterator i(id->begin()), i_end(id->end()) ;
i != i_end ; ++i)
if (match_package(*env, spec, *i, from_id, options))
@@ -680,8 +682,8 @@ namespace
const RepositoryContentMayExcludes &) const
{
std::shared_ptr<RepositoryNameSet> result(std::make_shared<RepositoryNameSet>());
- for (PackageDatabase::RepositoryConstIterator i(env->package_database()->begin_repositories()),
- i_end(env->package_database()->end_repositories()) ; i != i_end ; ++i)
+ for (auto i(env->begin_repositories()),
+ i_end(env->end_repositories()) ; i != i_end ; ++i)
if ((*i)->some_ids_might_support_action(SupportsActionTest<A_>()))
result->insert((*i)->name());
diff --git a/paludis/generator_TEST.cc b/paludis/generator_TEST.cc
index deff8e8..092124f 100644
--- a/paludis/generator_TEST.cc
+++ b/paludis/generator_TEST.cc
@@ -21,7 +21,6 @@
#include <paludis/generator.hh>
#include <paludis/selection.hh>
#include <paludis/filtered_generator.hh>
-#include <paludis/package_database.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
@@ -32,6 +31,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/join.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <test/test_concepts.hh>
@@ -69,9 +69,9 @@ namespace test_cases
n::supports_uninstall() = true
)))
{
- env.package_database()->add_repository(1, repo1);
- env.package_database()->add_repository(10, repo2);
- env.package_database()->add_repository(0, inst_repo1);
+ env.add_repository(1, repo1);
+ env.add_repository(10, repo2);
+ env.add_repository(0, inst_repo1);
repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1", { }));
repo1->add_version(CategoryNamePart("cat") + PackageNamePart("b"), VersionSpec("2", { }));
diff --git a/paludis/generator_handler.cc b/paludis/generator_handler.cc
index ec474a7..8ce53c9 100644
--- a/paludis/generator_handler.cc
+++ b/paludis/generator_handler.cc
@@ -18,13 +18,15 @@
*/
#include <paludis/generator_handler.hh>
+#include <paludis/name.hh>
+#include <paludis/environment.hh>
+#include <paludis/repository.hh>
+
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/name.hh>
-#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
+
#include <functional>
#include <algorithm>
@@ -41,7 +43,7 @@ AllGeneratorHandlerBase::repositories(
{
using namespace std::placeholders;
std::shared_ptr<RepositoryNameSet> result(std::make_shared<RepositoryNameSet>());
- std::transform(env->package_database()->begin_repositories(), env->package_database()->end_repositories(),
+ std::transform(env->begin_repositories(), env->end_repositories(),
result->inserter(), std::bind(&Repository::name, _1));
return result;
}
@@ -57,7 +59,7 @@ AllGeneratorHandlerBase::categories(
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
r != r_end ; ++r)
{
- std::shared_ptr<const CategoryNamePartSet> cats(env->package_database()->fetch_repository(*r)->category_names(may_exclude));
+ std::shared_ptr<const CategoryNamePartSet> cats(env->fetch_repository(*r)->category_names(may_exclude));
std::copy(cats->begin(), cats->end(), result->inserter());
}
@@ -80,7 +82,7 @@ AllGeneratorHandlerBase::packages(
c != c_end ; ++c)
{
std::shared_ptr<const QualifiedPackageNameSet> pkgs(
- env->package_database()->fetch_repository(*r)->package_names(*c, may_exclude));
+ env->fetch_repository(*r)->package_names(*c, may_exclude));
std::copy(pkgs->begin(), pkgs->end(), result->inserter());
}
}
@@ -103,8 +105,7 @@ AllGeneratorHandlerBase::ids(
for (QualifiedPackageNameSet::ConstIterator q(qpns->begin()), q_end(qpns->end()) ;
q != q_end ; ++q)
{
- std::shared_ptr<const PackageIDSequence> i(
- env->package_database()->fetch_repository(*r)->package_ids(*q, may_exclude));
+ std::shared_ptr<const PackageIDSequence> i(env->fetch_repository(*r)->package_ids(*q, may_exclude));
std::copy(i->begin(), i->end(), result->inserter());
}
}
diff --git a/paludis/hooker.cc b/paludis/hooker.cc
index 3aa1dc2..81e1845 100644
--- a/paludis/hooker.cc
+++ b/paludis/hooker.cc
@@ -21,10 +21,10 @@
#include <paludis/hooker.hh>
#include <paludis/environment.hh>
#include <paludis/hook.hh>
-#include <paludis/package_database.hh>
#include <paludis/about.hh>
#include <paludis/output_manager.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/repository.hh>
#include <paludis/util/log.hh>
#include <paludis/util/is_file_with_extension.hh>
@@ -746,15 +746,15 @@ Hooker::perform_hook(
switch (hook.output_dest)
{
case hod_stdout:
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ for (auto r(_imp->env->begin_repositories()),
+ r_end(_imp->env->end_repositories()) ; r != r_end ; ++r)
result.max_exit_status() = std::max(result.max_exit_status(),
((*r)->perform_hook(hook, optional_output_manager)).max_exit_status());
continue;
case hod_grab:
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ for (auto r(_imp->env->begin_repositories()),
+ r_end(_imp->env->end_repositories()) ; r != r_end ; ++r)
{
HookResult tmp((*r)->perform_hook(hook, optional_output_manager));
if (tmp.max_exit_status() > result.max_exit_status())
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index c80b29c..5b0fa7d 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -22,20 +22,20 @@
#include <paludis/dep_spec_flattener.hh>
#include <paludis/environment.hh>
#include <paludis/version_requirements.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/slot_requirement.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/options.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/sequence.hh>
#include <paludis/action.hh>
#include <paludis/repository.hh>
#include <paludis/additional_package_dep_spec_requirement.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/sequence.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <functional>
#include <algorithm>
@@ -141,7 +141,7 @@ paludis::match_package_with_maybe_changes(
if (spec.installed_at_path_ptr())
{
- auto repo(env.package_database()->fetch_repository(id->repository_name()));
+ auto repo(env.fetch_repository(id->repository_name()));
if (! repo->installed_root_key())
return false;
if (repo->installed_root_key()->value() != *spec.installed_at_path_ptr())
@@ -156,7 +156,7 @@ paludis::match_package_with_maybe_changes(
if (id->masked())
return false;
- const std::shared_ptr<const Repository> dest(env.package_database()->fetch_repository(
+ const std::shared_ptr<const Repository> dest(env.fetch_repository(
spec.installable_to_repository_ptr()->repository()));
if (! dest->destination_interface())
return false;
@@ -173,8 +173,7 @@ paludis::match_package_with_maybe_changes(
return false;
bool ok(false);
- for (PackageDatabase::RepositoryConstIterator d(env.package_database()->begin_repositories()),
- d_end(env.package_database()->end_repositories()) ;
+ for (auto d(env.begin_repositories()), d_end(env.end_repositories()) ;
d != d_end ; ++d)
{
if (! (*d)->destination_interface())
diff --git a/paludis/ndbam_merger.cc b/paludis/ndbam_merger.cc
index edd81de..e94ae83 100644
--- a/paludis/ndbam_merger.cc
+++ b/paludis/ndbam_merger.cc
@@ -34,14 +34,15 @@
#include <paludis/util/fs_stat.hh>
#include <paludis/util/env_var_names.hh>
#include <paludis/util/md5.hh>
+#include <paludis/util/join.hh>
#include <paludis/output_manager.hh>
#include <paludis/hook.hh>
#include <paludis/package_id.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/ndbam_merger.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/version_spec.hh>
#include <iomanip>
#include <list>
diff --git a/paludis/ndbam_unmerger.cc b/paludis/ndbam_unmerger.cc
index 71aefb3..72ded34 100644
--- a/paludis/ndbam_unmerger.cc
+++ b/paludis/ndbam_unmerger.cc
@@ -20,13 +20,15 @@
#include <paludis/ndbam_unmerger.hh>
#include <paludis/ndbam.hh>
-
-#include <paludis/util/destringify.hh>
-#include <paludis/util/md5.hh>
+#include <paludis/contents.hh>
#include <paludis/environment.hh>
#include <paludis/hook.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
+#include <paludis/output_manager.hh>
+#include <paludis/metadata_key.hh>
+
+#include <paludis/util/destringify.hh>
+#include <paludis/util/md5.hh>
#include <paludis/util/join.hh>
#include <paludis/util/log.hh>
#include <paludis/util/pimp-impl.hh>
@@ -41,8 +43,7 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_iterator.hh>
-#include <paludis/output_manager.hh>
-#include <paludis/metadata_key.hh>
+
#include <functional>
#include <list>
#include <map>
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 9fe051d..f0ba5f0 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -54,104 +54,12 @@ using namespace paludis;
namespace paludis
{
template <>
- struct WrappedForwardIteratorTraits<AmbiguousPackageNameError::OptionsConstIteratorTag>
- {
- typedef std::list<std::string>::const_iterator UnderlyingIterator;
- };
-
- template <>
struct WrappedForwardIteratorTraits<PackageDatabase::RepositoryConstIteratorTag>
{
typedef std::list<std::shared_ptr<Repository> >::const_iterator UnderlyingIterator;
};
}
-PackageDatabaseError::PackageDatabaseError(const std::string & our_message) throw () :
- Exception(our_message)
-{
-}
-
-PackageDatabaseLookupError::PackageDatabaseLookupError(const std::string & our_message) throw () :
- PackageDatabaseError(our_message)
-{
-}
-
-DuplicateRepositoryError::DuplicateRepositoryError(const std::string & name) throw () :
- PackageDatabaseError("A repository named '" + name + "' already exists")
-{
-}
-
-NoSuchPackageError::NoSuchPackageError(const std::string & our_name) throw () :
- PackageDatabaseLookupError("Could not find '" + our_name + "'"),
- _name(our_name)
-{
-}
-
-NoSuchRepositoryError::NoSuchRepositoryError(const RepositoryName & n) throw () :
- PackageDatabaseLookupError("Could not find repository '" + stringify(n) + "'"),
- _name(n)
-{
-}
-
-NoSuchRepositoryError::~NoSuchRepositoryError() throw ()
-{
-}
-
-RepositoryName
-NoSuchRepositoryError::name() const
-{
- return _name;
-}
-
-struct AmbiguousPackageNameError::NameData
-{
- std::string name;
- std::list<std::string> names;
-};
-
-template <typename I_>
-AmbiguousPackageNameError::AmbiguousPackageNameError(const std::string & our_name,
- I_ begin, const I_ end) throw () :
- PackageDatabaseLookupError("Ambiguous package name '" + our_name + "' (candidates are " +
- join(begin, end, ", ") + ")"),
- _name_data(new NameData)
-{
- _name_data->name = our_name;
- std::transform(begin, end, std::back_inserter(_name_data->names),
- &stringify<typename std::iterator_traits<I_>::value_type>);
-}
-
-AmbiguousPackageNameError::AmbiguousPackageNameError(const AmbiguousPackageNameError & other) :
- PackageDatabaseLookupError(other),
- _name_data(new NameData)
-{
- _name_data->name = other._name_data->name;
- _name_data->names = other._name_data->names;
-}
-
-AmbiguousPackageNameError::~AmbiguousPackageNameError() throw ()
-{
- delete _name_data;
-}
-
-AmbiguousPackageNameError::OptionsConstIterator
-AmbiguousPackageNameError::begin_options() const
-{
- return OptionsConstIterator(_name_data->names.begin());
-}
-
-AmbiguousPackageNameError::OptionsConstIterator
-AmbiguousPackageNameError::end_options() const
-{
- return OptionsConstIterator(_name_data->names.end());
-}
-
-const std::string &
-AmbiguousPackageNameError::name() const
-{
- return _name_data->name;
-}
-
namespace paludis
{
template<>
@@ -342,13 +250,19 @@ PackageDatabase::fetch_unique_qualified_package_name(const PackageNamePart & p,
if (! qpns.empty() && next(qpns.begin()) == qpns.end())
break;
- throw AmbiguousPackageNameError(stringify(p), first_iterator(result->begin()),
- first_iterator(result->end()));
+ auto candidates(std::make_shared<Sequence<std::string> >());
+ std::transform(first_iterator(result->begin()), first_iterator(result->end()), candidates->back_inserter(),
+ &stringify<QualifiedPackageName>);
+ throw AmbiguousPackageNameError(stringify(p), candidates);
} while (false);
if (! disambiguate)
- throw AmbiguousPackageNameError(stringify(p), first_iterator(result->begin()),
- first_iterator(result->end()));
+ {
+ auto candidates(std::make_shared<Sequence<std::string> >());
+ std::transform(first_iterator(result->begin()), first_iterator(result->end()), candidates->back_inserter(),
+ &stringify<QualifiedPackageName>);
+ throw AmbiguousPackageNameError(stringify(p), candidates);
+ }
Log::get_instance()->message("package_database.ambiguous_name", ll_warning, lc_context)
<< "Package name '" << p << "' is ambiguous, assuming you meant '" << *qpns.begin()
@@ -434,6 +348,5 @@ PackageDatabase::all_filter()
return result;
}
-template class WrappedForwardIterator<AmbiguousPackageNameError::OptionsConstIteratorTag, const std::string>;
template class WrappedForwardIterator<PackageDatabase::RepositoryConstIteratorTag, const std::shared_ptr<Repository> >;
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index f1fc47b..589b8e6 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -26,13 +26,15 @@
#include <paludis/repository.hh>
#include <paludis/selection-fwd.hh>
#include <paludis/filter-fwd.hh>
+#include <paludis/version_spec.hh>
+#include <paludis/contents.hh>
+#include <paludis/environment.hh>
+
#include <paludis/util/exception.hh>
#include <paludis/util/join.hh>
#include <paludis/util/pimp.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/version_spec.hh>
-#include <paludis/contents.hh>
#include <iosfwd>
@@ -49,169 +51,6 @@
namespace paludis
{
/**
- * A PackageDatabaseError is an error that occurs when performing some
- * operation upon a PackageDatabase.
- *
- * \ingroup g_exceptions
- * \ingroup g_package_database
- */
- class PALUDIS_VISIBLE PackageDatabaseError :
- public Exception
- {
- protected:
- /**
- * Constructor.
- */
- PackageDatabaseError(const std::string & message) throw ();
- };
-
- /**
- * A PackageDatabaseLookupError descendent is thrown if an error occurs
- * when looking for something in a PackageDatabase.
- *
- * \ingroup g_exceptions
- * \ingroup g_package_database
- */
- class PALUDIS_VISIBLE PackageDatabaseLookupError :
- public PackageDatabaseError
- {
- protected:
- /**
- * Constructor.
- */
- PackageDatabaseLookupError(const std::string & message) throw ();
- };
-
- /**
- * Thrown if a PackageDatabase query results in more than one matching
- * Package.
- *
- * \ingroup g_exceptions
- * \ingroup g_package_database
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE AmbiguousPackageNameError :
- public PackageDatabaseLookupError
- {
- private:
- struct NameData;
- NameData * const _name_data;
-
- std::string _name;
-
- public:
- ///\name Basic operations
- ///\{
-
- template <typename I_>
- AmbiguousPackageNameError(const std::string & name,
- I_ begin, const I_ end) throw ();
-
- AmbiguousPackageNameError(const AmbiguousPackageNameError &);
-
- virtual ~AmbiguousPackageNameError() throw ();
-
- ///\}
-
- /**
- * The name of the package.
- */
- const std::string & name() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- ///\name Iterate over possible matches
- ///\{
-
- struct OptionsConstIteratorTag;
- typedef WrappedForwardIterator<OptionsConstIteratorTag,
- const std::string> OptionsConstIterator;
-
- OptionsConstIterator begin_options() const PALUDIS_ATTRIBUTE((warn_unused_result));
- OptionsConstIterator end_options() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- ///\}
- };
-
- /**
- * Thrown if a Repository with the same name as an existing member is added
- * to a PackageDatabase.
- *
- * \ingroup g_exceptions
- * \ingroup g_package_database
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DuplicateRepositoryError :
- public PackageDatabaseError
- {
- public:
- /**
- * Constructor.
- */
- DuplicateRepositoryError(const std::string & name) throw ();
- };
-
- /**
- * Thrown if there is no Package in a PackageDatabase with the given
- * name.
- *
- * \ingroup g_exceptions
- * \ingroup g_package_database
- */
- class PALUDIS_VISIBLE NoSuchPackageError :
- public PackageDatabaseLookupError
- {
- private:
- std::string _name;
-
- public:
- ///\name Basic operations
- ///\{
-
- NoSuchPackageError(const std::string & name) throw ();
-
- virtual ~NoSuchPackageError() throw ()
- {
- }
-
- ///\}
-
- /**
- * Name of the package.
- */
- const std::string & name() const
- {
- return _name;
- }
- };
-
- /**
- * Thrown if there is no Repository in a RepositoryDatabase with the given
- * name.
- *
- * \ingroup g_exceptions
- * \ingroup g_package_database
- */
- class PALUDIS_VISIBLE NoSuchRepositoryError : public PackageDatabaseLookupError
- {
- private:
- const RepositoryName _name;
-
- public:
- ///\name Basic operations
- ///\{
-
- NoSuchRepositoryError(const RepositoryName &) throw ();
-
- ~NoSuchRepositoryError() throw ();
-
- ///\}
-
- /**
- * The name of our repository.
- */
- RepositoryName name() const;
- };
-
- /**
* A PackageDatabase, which is owned by an Environment, contains a number of
* Repository instances and supports various querying methods.
*
@@ -219,19 +58,23 @@ namespace paludis
*/
class PALUDIS_VISIBLE PackageDatabase
{
+ friend class EnvironmentImplementation;
+ friend class WrappedForwardIteratorTraits<Environment::RepositoryConstIteratorTag>;
+
private:
Pimp<PackageDatabase> _imp;
static const Filter & all_filter() PALUDIS_ATTRIBUTE((warn_unused_result));
public:
+ ~PackageDatabase();
+
+ protected:
///\name Basic operations
///\{
explicit PackageDatabase(const Environment * const);
- ~PackageDatabase();
-
PackageDatabase(const PackageDatabase &) = delete;
PackageDatabase & operator= (const PackageDatabase &) = delete;
@@ -299,7 +142,6 @@ namespace paludis
};
extern template class WrappedForwardIterator<PackageDatabase::RepositoryConstIteratorTag, const std::shared_ptr<Repository> >;
- extern template class WrappedForwardIterator<AmbiguousPackageNameError::OptionsConstIteratorTag, const std::string>;
}
#endif
diff --git a/paludis/package_database_TEST.cc b/paludis/package_database_TEST.cc
index b56aa44..effe522 100644
--- a/paludis/package_database_TEST.cc
+++ b/paludis/package_database_TEST.cc
@@ -39,7 +39,6 @@ using namespace paludis;
TEST(PackageDatabase, Repositories)
{
TestEnvironment e;
- PackageDatabase & p(*e.package_database());
const std::shared_ptr<FakeRepository> r1(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &e,
@@ -50,34 +49,34 @@ TEST(PackageDatabase, Repositories)
n::name() = RepositoryName("repo2")
)));
- EXPECT_THROW(p.fetch_repository(RepositoryName("repo1")), NoSuchRepositoryError);
- EXPECT_THROW(p.fetch_repository(RepositoryName("repo2")), NoSuchRepositoryError);
+ EXPECT_THROW(e.fetch_repository(RepositoryName("repo1")), NoSuchRepositoryError);
+ EXPECT_THROW(e.fetch_repository(RepositoryName("repo2")), NoSuchRepositoryError);
- p.add_repository(10, r1);
- ASSERT_TRUE(bool(p.fetch_repository(RepositoryName("repo1"))));
- EXPECT_EQ(RepositoryName("repo1"), p.fetch_repository(RepositoryName("repo1"))->name());
- EXPECT_THROW(p.fetch_repository(RepositoryName("repo2")), NoSuchRepositoryError);
+ e.add_repository(10, r1);
+ ASSERT_TRUE(bool(e.fetch_repository(RepositoryName("repo1"))));
+ EXPECT_EQ(RepositoryName("repo1"), e.fetch_repository(RepositoryName("repo1"))->name());
+ EXPECT_THROW(e.fetch_repository(RepositoryName("repo2")), NoSuchRepositoryError);
- EXPECT_THROW(p.add_repository(10, r1), DuplicateRepositoryError);
+ EXPECT_THROW(e.add_repository(10, r1), DuplicateRepositoryError);
- p.add_repository(11, r2);
- ASSERT_TRUE(bool(p.fetch_repository(RepositoryName("repo1"))));
- EXPECT_EQ(RepositoryName("repo1"), p.fetch_repository(RepositoryName("repo1"))->name());
- ASSERT_TRUE(bool(p.fetch_repository(RepositoryName("repo2"))));
- EXPECT_EQ(RepositoryName("repo2"), p.fetch_repository(RepositoryName("repo2"))->name());
+ e.add_repository(11, r2);
+ ASSERT_TRUE(bool(e.fetch_repository(RepositoryName("repo1"))));
+ EXPECT_EQ(RepositoryName("repo1"), e.fetch_repository(RepositoryName("repo1"))->name());
+ ASSERT_TRUE(bool(e.fetch_repository(RepositoryName("repo2"))));
+ EXPECT_EQ(RepositoryName("repo2"), e.fetch_repository(RepositoryName("repo2"))->name());
- EXPECT_THROW(p.add_repository(10, r1), DuplicateRepositoryError);
- EXPECT_THROW(p.add_repository(5, r2), DuplicateRepositoryError);
+ EXPECT_THROW(e.add_repository(10, r1), DuplicateRepositoryError);
+ EXPECT_THROW(e.add_repository(5, r2), DuplicateRepositoryError);
- ASSERT_TRUE(bool(p.fetch_repository(RepositoryName("repo1"))));
- EXPECT_EQ(RepositoryName("repo1"), p.fetch_repository(RepositoryName("repo1"))->name());
- ASSERT_TRUE(bool(p.fetch_repository(RepositoryName("repo2"))));
- EXPECT_EQ(RepositoryName("repo2"), p.fetch_repository(RepositoryName("repo2"))->name());
+ ASSERT_TRUE(bool(e.fetch_repository(RepositoryName("repo1"))));
+ EXPECT_EQ(RepositoryName("repo1"), e.fetch_repository(RepositoryName("repo1"))->name());
+ ASSERT_TRUE(bool(e.fetch_repository(RepositoryName("repo2"))));
+ EXPECT_EQ(RepositoryName("repo2"), e.fetch_repository(RepositoryName("repo2"))->name());
- EXPECT_TRUE(! p.more_important_than(RepositoryName("repo1"), RepositoryName("repo2")));
- EXPECT_TRUE(p.more_important_than(RepositoryName("repo2"), RepositoryName("repo1")));
- EXPECT_TRUE(! p.more_important_than(RepositoryName("repo2"), RepositoryName("repo2")));
- EXPECT_TRUE(! p.more_important_than(RepositoryName("repo1"), RepositoryName("repo1")));
+ EXPECT_TRUE(! e.more_important_than(RepositoryName("repo1"), RepositoryName("repo2")));
+ EXPECT_TRUE(e.more_important_than(RepositoryName("repo2"), RepositoryName("repo1")));
+ EXPECT_TRUE(! e.more_important_than(RepositoryName("repo2"), RepositoryName("repo2")));
+ EXPECT_TRUE(! e.more_important_than(RepositoryName("repo1"), RepositoryName("repo1")));
}
namespace
@@ -106,7 +105,6 @@ namespace
TEST(PackageDatabase, Disambiguation)
{
TestEnvironment e;
- PackageDatabase & p(*e.package_database());
std::shared_ptr<FakeRepository> r1(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &e,
@@ -115,14 +113,14 @@ TEST(PackageDatabase, Disambiguation)
r1->add_version(CategoryNamePart("cat-one") + PackageNamePart("pkg-two"), VersionSpec("0", { }));
r1->add_version(CategoryNamePart("cat-two") + PackageNamePart("pkg-two"), VersionSpec("0", { }));
r1->add_version(CategoryNamePart("cat-two") + PackageNamePart("pkg-three"), VersionSpec("0", { }));
- p.add_repository(10, r1);
+ e.add_repository(10, r1);
std::shared_ptr<FakeRepository> r2(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &e,
n::name() = RepositoryName("repo2"))));
r2->add_version(CategoryNamePart("cat-three") + PackageNamePart("pkg-three"), VersionSpec("0", { }));
r2->add_version(CategoryNamePart("cat-three") + PackageNamePart("pkg-four"), VersionSpec("0", { }));
- p.add_repository(10, r2);
+ e.add_repository(10, r2);
std::shared_ptr<FakeRepository> r3(std::make_shared<CoolFakeRepository>(&e, RepositoryName("repo3")));
r3->add_version(CategoryNamePart("bad-cat1") + PackageNamePart("pkg-important"), VersionSpec("0", { }));
@@ -144,7 +142,7 @@ TEST(PackageDatabase, Disambiguation)
r3->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-fail4"), VersionSpec("0", { }));
r3->add_version(CategoryNamePart("avail-cat") + PackageNamePart("pkg-foo"), VersionSpec("0", { }));
- p.add_repository(10, r3);
+ e.add_repository(10, r3);
std::shared_ptr<FakeInstalledRepository> r4(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -157,28 +155,27 @@ TEST(PackageDatabase, Disambiguation)
r4->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-fail4"), VersionSpec("0", { }));
r4->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-fail4"), VersionSpec("0", { }));
r4->add_version(CategoryNamePart("inst-cat") + PackageNamePart("pkg-foo"), VersionSpec("0", { }));
- p.add_repository(10, r4);
+ e.add_repository(10, r4);
- EXPECT_EQ("cat-one/pkg-one", stringify(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-one"))));
- EXPECT_EQ("cat-three/pkg-four", stringify(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-four"))));
- EXPECT_EQ("good-cat1/pkg-important", stringify(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-important"))));
- EXPECT_EQ("good-cat1/pkg-installed", stringify(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-installed"))));
+ EXPECT_EQ("cat-one/pkg-one", stringify(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-one"))));
+ EXPECT_EQ("cat-three/pkg-four", stringify(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-four"))));
+ EXPECT_EQ("good-cat1/pkg-important", stringify(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-important"))));
+ EXPECT_EQ("good-cat1/pkg-installed", stringify(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-installed"))));
- EXPECT_THROW(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-two")), AmbiguousPackageNameError);
- EXPECT_THROW(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-three")), AmbiguousPackageNameError);
+ EXPECT_THROW(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-two")), AmbiguousPackageNameError);
+ EXPECT_THROW(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-three")), AmbiguousPackageNameError);
- EXPECT_THROW(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-fail1")), AmbiguousPackageNameError);
- EXPECT_THROW(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-fail2")), AmbiguousPackageNameError);
- EXPECT_THROW(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-fail3")), AmbiguousPackageNameError);
- EXPECT_THROW(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-fail4")), AmbiguousPackageNameError);
+ EXPECT_THROW(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-fail1")), AmbiguousPackageNameError);
+ EXPECT_THROW(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-fail2")), AmbiguousPackageNameError);
+ EXPECT_THROW(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-fail3")), AmbiguousPackageNameError);
+ EXPECT_THROW(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-fail4")), AmbiguousPackageNameError);
- EXPECT_THROW(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-five")), NoSuchPackageError);
+ EXPECT_THROW(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-five")), NoSuchPackageError);
- EXPECT_THROW(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-one"),
+ EXPECT_THROW(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-one"),
filter::SupportsAction<ConfigAction>()), NoSuchPackageError);
- EXPECT_EQ("inst-cat/pkg-foo", stringify(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-foo"))));
- EXPECT_EQ("avail-cat/pkg-foo", stringify(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-foo"), filter::SupportsAction<InstallAction>())));
- EXPECT_THROW(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-foo"), filter::All(), false), AmbiguousPackageNameError);
-
+ EXPECT_EQ("inst-cat/pkg-foo", stringify(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-foo"))));
+ EXPECT_EQ("avail-cat/pkg-foo", stringify(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-foo"), filter::SupportsAction<InstallAction>())));
+ EXPECT_THROW(e.fetch_unique_qualified_package_name(PackageNamePart("pkg-foo"), filter::All(), false), AmbiguousPackageNameError);
}
diff --git a/paludis/package_id.cc b/paludis/package_id.cc
index 1eafa8c..82663e2 100644
--- a/paludis/package_id.cc
+++ b/paludis/package_id.cc
@@ -19,6 +19,11 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/name.hh>
+#include <paludis/version_spec.hh>
+#include <paludis/repository.hh>
+#include <paludis/environment.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/sequence-impl.hh>
@@ -29,10 +34,7 @@
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/wrapped_output_iterator-impl.hh>
#include <paludis/util/hashes.hh>
-#include <paludis/name.hh>
-#include <paludis/version_spec.hh>
-#include <paludis/repository.hh>
-#include <paludis/package_database.hh>
+
#include <functional>
#include <unordered_map>
#include <list>
@@ -170,12 +172,11 @@ namespace paludis
};
}
-PackageIDComparator::PackageIDComparator(const PackageDatabase * const db) :
+PackageIDComparator::PackageIDComparator(const Environment * const e) :
_imp()
{
unsigned c(0);
- for (PackageDatabase::RepositoryConstIterator r(db->begin_repositories()),
- r_end(db->end_repositories()) ; r != r_end ; ++r)
+ for (auto r(e->begin_repositories()), r_end(e->end_repositories()) ; r != r_end ; ++r)
_imp->m.insert(std::make_pair((*r)->name(), ++c));
}
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 37976d4..1231f51 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -57,8 +57,6 @@
namespace paludis
{
- class PackageDatabase;
-
/**
* A PackageID represents a unique package version in a particular
* Repository.
@@ -458,8 +456,8 @@ namespace paludis
/**
* A comparison functor that provides a less-than comparison on PackageID
* instances according to, in order, their name, their version, their
- * repository's importance according to the supplied PackageDatabase,
- * and PackageID::arbitrary_less_than_comparison.
+ * repository's importance according to the supplied Environment,
+ * and Environment::arbitrary_less_than_comparison.
*
* \ingroup g_package_id
* \since 0.26
@@ -481,7 +479,7 @@ namespace paludis
///\name Basic operations
///\{
- PackageIDComparator(const PackageDatabase * const);
+ PackageIDComparator(const Environment * const);
PackageIDComparator(const PackageIDComparator &);
~PackageIDComparator();
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index 6755da6..e8a13e8 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -38,7 +38,6 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/environment.hh>
#include <paludis/repository.hh>
-#include <paludis/package_database.hh>
#include <paludis/action.hh>
#include <paludis/user_dep_spec.hh>
#include <algorithm>
@@ -561,7 +560,7 @@ AccountsID::perform_action(Action & action) const
i != i_end ; ++i)
{
Context local_context("When cleaning '" + stringify(**i) + "':");
- auto repo(_imp->env->package_database()->fetch_repository((*i)->repository_name()));
+ auto repo(_imp->env->fetch_repository((*i)->repository_name()));
if (repo->format_key() && repo->format_key()->value() == "installed-accounts"
&& (*i)->name() == name())
continue;
diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc
index 5400bac..55e8560 100644
--- a/paludis/repositories/accounts/accounts_repository.cc
+++ b/paludis/repositories/accounts/accounts_repository.cc
@@ -39,7 +39,6 @@
#include <paludis/filtered_generator.hh>
#include <paludis/hook.hh>
#include <paludis/common_sets.hh>
-#include <paludis/package_database.hh>
using namespace paludis;
using namespace paludis::accounts_repository;
@@ -397,7 +396,7 @@ bool
AccountsRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const
{
auto env(_imp->params_if_installed ? _imp->params_if_installed->environment() : _imp->params_if_not_installed->environment());
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
std::string f(repo->format_key() ? repo->format_key()->value() : "");
return _imp->handler_if_installed && f == "accounts";
}
diff --git a/paludis/repositories/accounts/accounts_repository_TEST.cc b/paludis/repositories/accounts/accounts_repository_TEST.cc
index b96035b..49aa1e8 100644
--- a/paludis/repositories/accounts/accounts_repository_TEST.cc
+++ b/paludis/repositories/accounts/accounts_repository_TEST.cc
@@ -32,7 +32,6 @@
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
#include <memory>
@@ -49,6 +48,6 @@ TEST(AccountsRepository, Creation)
n::environment() = &env,
n::name() = RepositoryName("accounts")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
EXPECT_EQ("accounts", stringify(repo->name()));
}
diff --git a/paludis/repositories/accounts/accounts_repository_store.cc b/paludis/repositories/accounts/accounts_repository_store.cc
index fb782e3..879c224 100644
--- a/paludis/repositories/accounts/accounts_repository_store.cc
+++ b/paludis/repositories/accounts/accounts_repository_store.cc
@@ -35,7 +35,6 @@
#include <paludis/util/strip.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/name.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
#include <paludis/environment.hh>
#include <paludis/literal_metadata_key.hh>
@@ -101,8 +100,7 @@ AccountsRepositoryStore::_load(const RepositoryName & repository_name)
{
Context context("When loading data for AccountsRepository:");
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ;
+ for (auto r(_imp->env->begin_repositories()), r_end(_imp->env->end_repositories()) ;
r != r_end ; ++r)
{
Context r_context("When loading data for repository '" + stringify((*r)->name()) + ":");
diff --git a/paludis/repositories/e/aa_visitor_TEST.cc b/paludis/repositories/e/aa_visitor_TEST.cc
index 4d47e41..9c29e19 100644
--- a/paludis/repositories/e/aa_visitor_TEST.cc
+++ b/paludis/repositories/e/aa_visitor_TEST.cc
@@ -25,7 +25,6 @@
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/package_database.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
@@ -45,7 +44,7 @@ namespace test_cases
std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
AAVisitor p1;
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index 7825cc3..bab3e7c 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -46,7 +46,6 @@
#include <paludis/choice.hh>
#include <paludis/dep_spec_annotations.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/package_database.hh>
#include <paludis/always_enabled_dependency_label.hh>
#include <paludis/elike_blocker.hh>
#include <map>
diff --git a/paludis/repositories/e/dep_parser_TEST.cc b/paludis/repositories/e/dep_parser_TEST.cc
index b8f53cc..9cd51f3 100644
--- a/paludis/repositories/e/dep_parser_TEST.cc
+++ b/paludis/repositories/e/dep_parser_TEST.cc
@@ -23,7 +23,6 @@
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/package_database.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <paludis/util/make_named_values.hh>
#include <sstream>
@@ -56,7 +55,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
UnformattedPrettyPrinter ff;
@@ -82,7 +81,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
UnformattedPrettyPrinter ff;
@@ -108,7 +107,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
UnformattedPrettyPrinter ff;
@@ -135,7 +134,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d1(ff, { });
@@ -171,7 +170,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -193,7 +192,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -215,7 +214,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -249,7 +248,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -275,7 +274,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -300,7 +299,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -321,7 +320,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { ppo_multiline_allowed });
@@ -353,7 +352,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -386,7 +385,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -441,7 +440,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -465,7 +464,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
SpecTreePrettyPrinter d(ff, { });
@@ -488,7 +487,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
UnformattedPrettyPrinter ff;
@@ -516,7 +515,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
UnformattedPrettyPrinter ff;
diff --git a/paludis/repositories/e/depend_rdepend_TEST.cc b/paludis/repositories/e/depend_rdepend_TEST.cc
index f1bf6ee..e0125de 100644
--- a/paludis/repositories/e/depend_rdepend_TEST.cc
+++ b/paludis/repositories/e/depend_rdepend_TEST.cc
@@ -26,7 +26,6 @@
#include <paludis/util/sequence.hh>
#include <paludis/repository_factory.hh>
#include <paludis/repository.hh>
-#include <paludis/package_database.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/action.hh>
#include <paludis/selection.hh>
@@ -120,7 +119,7 @@ namespace
keys->insert("root", stringify(root));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "vdb");
@@ -130,17 +129,17 @@ namespace
v_keys->insert("root", stringify(root));
std::shared_ptr<Repository> v_repo(VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, v_repo);
+ env.add_repository(1, v_repo);
#ifdef ENABLE_VIRTUALS_REPOSITORY
std::shared_ptr<Map<std::string, std::string> > iv_keys(std::make_shared<Map<std::string, std::string>>());
iv_keys->insert("root", "/");
iv_keys->insert("format", "installed_virtuals");
- env.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)));
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "virtuals");
- env.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
diff --git a/paludis/repositories/e/do_fetch_action.cc b/paludis/repositories/e/do_fetch_action.cc
index 46ac118..d79ec56 100644
--- a/paludis/repositories/e/do_fetch_action.cc
+++ b/paludis/repositories/e/do_fetch_action.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 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
@@ -28,10 +28,14 @@
#include <paludis/repositories/e/make_use.hh>
#include <paludis/repositories/e/can_skip_phase.hh>
#include <paludis/repositories/e/ebuild.hh>
+
#include <paludis/util/strip.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_output_iterator.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
+
#include <paludis/dep_spec_flattener.hh>
#include <paludis/metadata_key.hh>
#include <paludis/environment.hh>
diff --git a/paludis/repositories/e/do_info_action.cc b/paludis/repositories/e/do_info_action.cc
index 54d4f70..2d89dfe 100644
--- a/paludis/repositories/e/do_info_action.cc
+++ b/paludis/repositories/e/do_info_action.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 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
@@ -23,8 +23,12 @@
#include <paludis/repositories/e/check_userpriv.hh>
#include <paludis/repositories/e/make_use.hh>
#include <paludis/repositories/e/ebuild.hh>
+
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
+
#include <paludis/dep_spec_flattener.hh>
#include <paludis/action.hh>
#include <paludis/metadata_key.hh>
diff --git a/paludis/repositories/e/do_install_action.cc b/paludis/repositories/e/do_install_action.cc
index d123490..bcd550a 100644
--- a/paludis/repositories/e/do_install_action.cc
+++ b/paludis/repositories/e/do_install_action.cc
@@ -28,12 +28,15 @@
#include <paludis/repositories/e/can_skip_phase.hh>
#include <paludis/repositories/e/e_stripper.hh>
#include <paludis/repositories/e/ebuild.hh>
+
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/log.hh>
+#include <paludis/util/join.hh>
+
#include <paludis/action.hh>
#include <paludis/dep_spec_flattener.hh>
#include <paludis/metadata_key.hh>
diff --git a/paludis/repositories/e/do_pretend_action.cc b/paludis/repositories/e/do_pretend_action.cc
index d55fc8f..a282dc3 100644
--- a/paludis/repositories/e/do_pretend_action.cc
+++ b/paludis/repositories/e/do_pretend_action.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 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
@@ -26,8 +26,12 @@
#include <paludis/repositories/e/required_use_verifier.hh>
#include <paludis/repositories/e/ebuild.hh>
#include <paludis/repositories/e/can_skip_phase.hh>
+
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
+
#include <paludis/dep_spec_flattener.hh>
#include <paludis/metadata_key.hh>
#include <paludis/environment.hh>
diff --git a/paludis/repositories/e/do_pretend_fetch_action.cc b/paludis/repositories/e/do_pretend_fetch_action.cc
index af9a0f0..e455b03 100644
--- a/paludis/repositories/e/do_pretend_fetch_action.cc
+++ b/paludis/repositories/e/do_pretend_fetch_action.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 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
@@ -19,6 +19,9 @@
#include <paludis/repositories/e/do_pretend_fetch_action.hh>
#include <paludis/repositories/e/pretend_fetch_visitor.hh>
+
+#include <paludis/util/stringify.hh>
+
#include <paludis/action.hh>
#include <paludis/metadata_key.hh>
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 2c670d1..4c07d8a 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -24,6 +24,7 @@
#include <paludis/repositories/e/eapi_phase.hh>
#include <paludis/repositories/e/ebuild.hh>
#include <paludis/repositories/e/e_repository.hh>
+
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/mutex.hh>
@@ -39,6 +40,8 @@
#include <paludis/util/safe_ifstream.hh>
#include <paludis/util/process.hh>
#include <paludis/util/fs_stat.hh>
+#include <paludis/util/join.hh>
+
#include <paludis/action.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
@@ -139,7 +142,7 @@ EInstalledRepository::some_ids_might_not_be_masked() const
bool
EInstalledRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const
{
- auto repo(_imp->params.environment()->package_database()->fetch_repository(id->repository_name()));
+ auto repo(_imp->params.environment()->fetch_repository(id->repository_name()));
std::string f(repo->format_key() ? repo->format_key()->value() : "");
return f == "e" || f == "ebuild" || f == "exheres" || f == "portage";
}
@@ -311,10 +314,10 @@ EInstalledRepository::perform_info(
o != o_end ; ++o)
{
RepositoryName rn(*o);
- if (_imp->params.environment()->package_database()->has_repository_named(rn))
+ if (_imp->params.environment()->has_repository_named(rn))
{
const std::shared_ptr<const Repository> r(
- _imp->params.environment()->package_database()->fetch_repository(rn));
+ _imp->params.environment()->fetch_repository(rn));
Repository::MetadataConstIterator m(r->find_metadata("info_vars"));
if (r->end_metadata() != m)
{
@@ -333,9 +336,7 @@ EInstalledRepository::perform_info(
/* try to find an info_vars file from any repo */
if (! i)
{
- for (PackageDatabase::RepositoryConstIterator
- r(_imp->params.environment()->package_database()->begin_repositories()),
- r_end(_imp->params.environment()->package_database()->end_repositories()) ;
+ for (auto r(_imp->params.environment()->begin_repositories()), r_end(_imp->params.environment()->end_repositories()) ;
r != r_end ; ++r)
{
Repository::MetadataConstIterator m((*r)->find_metadata("info_vars"));
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index ec8cf99..da4b28c 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -50,7 +50,6 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/elike_choices.hh>
-#include <paludis/package_database.hh>
#include <paludis/always_enabled_dependency_label.hh>
#include <iterator>
@@ -972,19 +971,19 @@ namespace
void visit(const UninstallAction & a)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
std::static_pointer_cast<const EInstalledRepository>(repo)->perform_uninstall(id, a);
}
void visit(const ConfigAction & a)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
std::static_pointer_cast<const EInstalledRepository>(repo)->perform_config(id, a);
}
void visit(const InfoAction & a)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
std::static_pointer_cast<const EInstalledRepository>(repo)->perform_info(id, a);
}
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index df5b023..31748aa 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -73,6 +73,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/iterator_funcs.hh>
+#include <paludis/util/join.hh>
#include <paludis/util/log.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
@@ -926,7 +927,7 @@ ERepository::params() const
bool
ERepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const
{
- auto repo(_imp->params.environment()->package_database()->fetch_repository(id->repository_name()));
+ auto repo(_imp->params.environment()->fetch_repository(id->repository_name()));
std::string f(repo->format_key() ? repo->format_key()->value() : "");
if (f == "e")
return static_cast<const ERepositoryID &>(*id).eapi()->supported()->can_be_pbin();
@@ -1214,7 +1215,7 @@ ERepository::repository_factory_create(
RepositoryName master_repository_name(f("master_repository"));
std::shared_ptr<Repository> master_repository_uncasted(
- env->package_database()->fetch_repository(master_repository_name));
+ env->fetch_repository(master_repository_name));
std::string format("unknown");
if (master_repository_uncasted->format_key())
@@ -1248,7 +1249,7 @@ ERepository::repository_factory_create(
try
{
std::shared_ptr<Repository> master_repository_uncasted(
- env->package_database()->fetch_repository(master_repository_name));
+ env->fetch_repository(master_repository_name));
std::string format("unknown");
if (master_repository_uncasted->format_key())
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index 3fc9c5e..0a78c69 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -21,7 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_E_REPOSITORY_HH 1
#include <paludis/repository.hh>
-#include <paludis/package_database.hh>
#include <paludis/mask-fwd.hh>
#include <paludis/util/pimp.hh>
#include <paludis/repositories/e/e_repository_params.hh>
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 39ad42a..709fcdf 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -379,7 +379,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
for (int pass = 1 ; pass <= 2 ; ++pass)
{
@@ -424,7 +424,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
for (int pass = 1 ; pass <= 2 ; ++pass)
{
@@ -477,7 +477,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
for (int pass = 1 ; pass <= 3 ; ++pass)
{
@@ -557,7 +557,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
for (int pass = 1 ; pass <= 2 ; ++pass)
{
@@ -600,7 +600,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<ERepository> repo(std::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1))));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
for (int pass = 1 ; pass <= 2 ; ++pass)
{
@@ -680,7 +680,7 @@ namespace test_cases
keys18->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo18(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys18, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo18);
+ env.add_repository(1, repo18);
std::shared_ptr<Map<std::string, std::string> > keys19(std::make_shared<Map<std::string, std::string>>());
keys19->insert("format", "e");
@@ -690,7 +690,7 @@ namespace test_cases
keys19->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo19(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys19, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo19);
+ env.add_repository(1, repo19);
TEST_CHECK((*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=category/package-1::test-repo-18",
@@ -735,7 +735,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
for (int pass = 1 ; pass <= 2 ; ++pass)
{
@@ -769,7 +769,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<ERepository> repo(std::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1))));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
bool has_one(false), has_two(false);
int count(0);
@@ -810,7 +810,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<ERepository> repo(std::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1))));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
bool has_one(false), has_two(false), has_three(false);
int count(0);
@@ -857,7 +857,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<ERepository> repo(std::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1))));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
repo->make_manifest(QualifiedPackageName("category/package"));
std::multiset<std::string> made_manifest, reference_manifest;
@@ -907,7 +907,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
FetchAction action(make_named_values<FetchActionOptions>(
n::errors() = std::make_shared<Sequence<FetchActionFailure>>(),
@@ -1014,7 +1014,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dir" / "build"));
std::shared_ptr<ERepository> repo(std::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1))));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
FetchAction action(make_named_values<FetchActionOptions>(
n::errors() = std::make_shared<Sequence<FetchActionFailure>>(),
diff --git a/paludis/repositories/e/e_repository_TEST_0.cc b/paludis/repositories/e/e_repository_TEST_0.cc
index 99eb4a7..b942f67 100644
--- a/paludis/repositories/e/e_repository_TEST_0.cc
+++ b/paludis/repositories/e/e_repository_TEST_0.cc
@@ -122,7 +122,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_0_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -133,17 +133,17 @@ namespace test_cases
)));
installed_repo->add_version("cat", "pretend-installed", "0")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
#ifdef ENABLE_VIRTUALS_REPOSITORY
std::shared_ptr<Map<std::string, std::string> > iv_keys(std::make_shared<Map<std::string, std::string>>());
iv_keys->insert("root", "/");
iv_keys->insert("format", "installed_virtuals");
- env.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)));
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "virtuals");
- env.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
diff --git a/paludis/repositories/e/e_repository_TEST_1.cc b/paludis/repositories/e/e_repository_TEST_1.cc
index b25028c..7e6f853 100644
--- a/paludis/repositories/e/e_repository_TEST_1.cc
+++ b/paludis/repositories/e/e_repository_TEST_1.cc
@@ -115,7 +115,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_1_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -124,7 +124,7 @@ namespace test_cases
n::suitable_destination() = true,
n::supports_uninstall() = true
)));
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
InstallAction action(make_named_values<InstallActionOptions>(
n::destination() = installed_repo,
diff --git a/paludis/repositories/e/e_repository_TEST_2.cc b/paludis/repositories/e/e_repository_TEST_2.cc
index 54db720..16d5fdb 100644
--- a/paludis/repositories/e/e_repository_TEST_2.cc
+++ b/paludis/repositories/e/e_repository_TEST_2.cc
@@ -115,7 +115,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_2_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -124,7 +124,7 @@ namespace test_cases
n::suitable_destination() = true,
n::supports_uninstall() = true
)));
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
InstallAction action(make_named_values<InstallActionOptions>(
n::destination() = installed_repo,
diff --git a/paludis/repositories/e/e_repository_TEST_3.cc b/paludis/repositories/e/e_repository_TEST_3.cc
index 45d186c..79c0e02 100644
--- a/paludis/repositories/e/e_repository_TEST_3.cc
+++ b/paludis/repositories/e/e_repository_TEST_3.cc
@@ -115,7 +115,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_3_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -124,7 +124,7 @@ namespace test_cases
n::suitable_destination() = true,
n::supports_uninstall() = true
)));
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
InstallAction action(make_named_values<InstallActionOptions>(
n::destination() = installed_repo,
diff --git a/paludis/repositories/e/e_repository_TEST_4.cc b/paludis/repositories/e/e_repository_TEST_4.cc
index 3492f65..141cd3a 100644
--- a/paludis/repositories/e/e_repository_TEST_4.cc
+++ b/paludis/repositories/e/e_repository_TEST_4.cc
@@ -116,7 +116,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -125,7 +125,7 @@ namespace test_cases
n::suitable_destination() = true,
n::supports_uninstall() = true
)));
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
InstallAction action(make_named_values<InstallActionOptions>(
n::destination() = installed_repo,
@@ -277,7 +277,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "vdb");
@@ -287,7 +287,7 @@ namespace test_cases
v_keys->insert("root", stringify(root));
std::shared_ptr<Repository> v_repo(VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, v_repo);
+ env.add_repository(1, v_repo);
{
InstallAction action(make_named_values<InstallActionOptions>(
@@ -343,7 +343,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<Map<std::string, std::string> > b_keys(std::make_shared<Map<std::string, std::string>>());
b_keys->insert("format", "e");
@@ -363,7 +363,7 @@ namespace test_cases
b_keys->insert("root", stringify(root));
std::shared_ptr<Repository> b_repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, b_keys, std::placeholders::_1)));
- env.package_database()->add_repository(2, b_repo);
+ env.add_repository(2, b_repo);
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "vdb");
@@ -373,7 +373,7 @@ namespace test_cases
v_keys->insert("root", stringify(root));
std::shared_ptr<Repository> v_repo(VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, v_repo);
+ env.add_repository(1, v_repo);
{
InstallAction action(make_named_values<InstallActionOptions>(
@@ -448,7 +448,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -457,7 +457,7 @@ namespace test_cases
n::suitable_destination() = true,
n::supports_uninstall() = true
)));
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
{
PretendAction pretend_action(make_named_values<PretendActionOptions>(
diff --git a/paludis/repositories/e/e_repository_TEST_ever.cc b/paludis/repositories/e/e_repository_TEST_ever.cc
index 5aa7813..f1fd198 100644
--- a/paludis/repositories/e/e_repository_TEST_ever.cc
+++ b/paludis/repositories/e/e_repository_TEST_ever.cc
@@ -123,7 +123,7 @@ namespace
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_ever_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -134,17 +134,17 @@ namespace
)));
installed_repo->add_version("cat", "pretend-installed", "0")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
#ifdef ENABLE_VIRTUALS_REPOSITORY
std::shared_ptr<Map<std::string, std::string> > iv_keys(std::make_shared<Map<std::string, std::string>>());
iv_keys->insert("root", "/");
iv_keys->insert("format", "installed_virtuals");
- env.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)));
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "virtuals");
- env.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
diff --git a/paludis/repositories/e/e_repository_TEST_exheres_0.cc b/paludis/repositories/e/e_repository_TEST_exheres_0.cc
index 3eea8c5..31cb7f1 100644
--- a/paludis/repositories/e/e_repository_TEST_exheres_0.cc
+++ b/paludis/repositories/e/e_repository_TEST_exheres_0.cc
@@ -120,7 +120,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_exheres_0_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -131,17 +131,17 @@ namespace test_cases
)));
installed_repo->add_version("cat", "pretend-installed", "0")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
#ifdef ENABLE_VIRTUALS_REPOSITORY
std::shared_ptr<Map<std::string, std::string> > iv_keys(std::make_shared<Map<std::string, std::string>>());
iv_keys->insert("root", "/");
iv_keys->insert("format", "installed_virtuals");
- env.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)));
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "virtuals");
- env.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
diff --git a/paludis/repositories/e/e_repository_TEST_exlibs.cc b/paludis/repositories/e/e_repository_TEST_exlibs.cc
index 505f220..3d5af11 100644
--- a/paludis/repositories/e/e_repository_TEST_exlibs.cc
+++ b/paludis/repositories/e/e_repository_TEST_exlibs.cc
@@ -131,7 +131,7 @@ namespace
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_exlibs_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -140,7 +140,7 @@ namespace
n::suitable_destination() = true,
n::supports_uninstall() = true
)));
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
InstallAction action(make_named_values<InstallActionOptions>(
n::destination() = installed_repo,
diff --git a/paludis/repositories/e/e_repository_TEST_pbin.cc b/paludis/repositories/e/e_repository_TEST_pbin.cc
index c27bca9..27a46b6 100644
--- a/paludis/repositories/e/e_repository_TEST_pbin.cc
+++ b/paludis/repositories/e/e_repository_TEST_pbin.cc
@@ -125,7 +125,7 @@ namespace test_cases
keys->insert("root", stringify(root));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<Map<std::string, std::string> > b_keys(std::make_shared<Map<std::string, std::string>>());
b_keys->insert("format", "e");
@@ -145,7 +145,7 @@ namespace test_cases
b_keys->insert("root", stringify(root));
std::shared_ptr<Repository> b_repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, b_keys, std::placeholders::_1)));
- env.package_database()->add_repository(2, b_repo);
+ env.add_repository(2, b_repo);
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "vdb");
@@ -155,7 +155,7 @@ namespace test_cases
v_keys->insert("root", stringify(root));
std::shared_ptr<Repository> v_repo(VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, v_repo);
+ env.add_repository(1, v_repo);
{
InstallAction bin_action(make_named_values<InstallActionOptions>(
diff --git a/paludis/repositories/e/e_repository_TEST_phases.cc b/paludis/repositories/e/e_repository_TEST_phases.cc
index 29728e8..b20afd3 100644
--- a/paludis/repositories/e/e_repository_TEST_phases.cc
+++ b/paludis/repositories/e/e_repository_TEST_phases.cc
@@ -131,7 +131,7 @@ namespace
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_phases_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -142,17 +142,17 @@ namespace
)));
installed_repo->add_version("cat", "pretend-installed", "0")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
#ifdef ENABLE_VIRTUALS_REPOSITORY
std::shared_ptr<Map<std::string, std::string> > iv_keys(std::make_shared<Map<std::string, std::string>>());
iv_keys->insert("root", "/");
iv_keys->insert("format", "installed_virtuals");
- env.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)));
std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
v_keys->insert("format", "virtuals");
- env.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
diff --git a/paludis/repositories/e/e_repository_TEST_replacing.cc b/paludis/repositories/e/e_repository_TEST_replacing.cc
index 93b8def..17c2363 100644
--- a/paludis/repositories/e/e_repository_TEST_replacing.cc
+++ b/paludis/repositories/e/e_repository_TEST_replacing.cc
@@ -127,7 +127,7 @@ namespace
keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_replacing_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -139,7 +139,7 @@ namespace
installed_repo->add_version("cat", replacing_pkg_name, "1")->set_slot(SlotName("1"));
installed_repo->add_version("cat", replacing_pkg_name, "2")->set_slot(SlotName("2"));
installed_repo->add_version("cat", replacing_pkg_name, "3")->set_slot(SlotName("3"));
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
const std::shared_ptr<const PackageIDSequence> rlist(env[selection::AllVersionsSorted(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec(replacing, &env, { })),
diff --git a/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc b/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc
index 19861d1..366a752 100644
--- a/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc
+++ b/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc
@@ -117,7 +117,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath(stringify(FSPath::cwd() / "e_repository_TEST_symlink_rewriting_dir" / "root")).realpath()));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "vdb");
@@ -128,7 +128,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath(stringify(FSPath::cwd() / "e_repository_TEST_symlink_rewriting_dir" / "root")).realpath()));
std::shared_ptr<Repository> installed_repo(VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, installed_repo);
+ env.add_repository(1, installed_repo);
InstallAction action(make_named_values<InstallActionOptions>(
n::destination() = installed_repo,
diff --git a/paludis/repositories/e/e_repository_params.hh b/paludis/repositories/e/e_repository_params.hh
index a5dc7de..7c3c368 100644
--- a/paludis/repositories/e/e_repository_params.hh
+++ b/paludis/repositories/e/e_repository_params.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -34,7 +34,6 @@
namespace paludis
{
class Environment;
- class PackageDatabase;
class ERepository;
typedef Sequence<std::shared_ptr<const ERepository> > ERepositorySequence;
diff --git a/paludis/repositories/e/e_repository_sets_TEST.cc b/paludis/repositories/e/e_repository_sets_TEST.cc
index ca7aaba..a32a2a1 100644
--- a/paludis/repositories/e/e_repository_sets_TEST.cc
+++ b/paludis/repositories/e/e_repository_sets_TEST.cc
@@ -26,6 +26,7 @@
#include <paludis/util/map.hh>
#include <paludis/util/set.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/join.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -63,7 +64,7 @@ namespace test_cases
keys->insert("profiles", "e_repository_sets_TEST_dir/repo1/profiles/profile");
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const SetNameSet> sets_list(env.set_names());
TEST_CHECK_EQUAL(join(sets_list->begin(), sets_list->end(), " "), "everything insecurity "
@@ -99,8 +100,8 @@ namespace test_cases
n::supports_uninstall() = true
)));
installed->add_version("cat-two", "bar", "1.5");
- env.package_database()->add_repository(0, installed);
- env.package_database()->add_repository(1, repo);
+ env.add_repository(0, installed);
+ env.add_repository(1, repo);
std::shared_ptr<const SetSpecTree> set1(env.set(SetName("set1::test-repo-1")));
TEST_CHECK(bool(set1));
@@ -131,7 +132,7 @@ namespace test_cases
keys->insert("profiles", "e_repository_sets_TEST_dir/repo1/profiles/profile");
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const SetSpecTree> insecurity(env.set(SetName("insecurity::test-repo-1")));
UnformattedPrettyPrinter ff;
@@ -162,7 +163,7 @@ namespace test_cases
keys->insert("profiles", "e_repository_sets_TEST_dir/repo1/profiles/profile");
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<FakeInstalledRepository> installed(std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
n::environment() = &env,
@@ -175,7 +176,7 @@ namespace test_cases
installed->add_version("cat-three", "baz", "1.0");
installed->add_version("cat-four", "xyzzy", "1.1.0")->set_slot(SlotName("1"));
installed->add_version("cat-four", "xyzzy", "2.0.1")->set_slot(SlotName("2"));
- env.package_database()->add_repository(0, installed);
+ env.add_repository(0, installed);
std::shared_ptr<const SetSpecTree> security(env.set(SetName("security::test-repo-1")));
UnformattedPrettyPrinter ff;
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 11b7bc6..377b6fb 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -511,7 +511,7 @@ EbuildMetadataCommand::load(const std::shared_ptr<const EbuildID> & id)
id->set_eapi(s);
else
{
- auto repo(params.environment()->package_database()->fetch_repository(id->repository_name()));
+ auto repo(params.environment()->fetch_repository(id->repository_name()));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
id->set_eapi(e_repo->params().eapi_when_unspecified());
}
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index 538399b..57259c3 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -23,10 +23,18 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/map-fwd.hh>
#include <paludis/util/process-fwd.hh>
-#include <paludis/package_database.hh>
+#include <paludis/util/named_value.hh>
+#include <paludis/util/fs_path.hh>
+
#include <paludis/action-fwd.hh>
#include <paludis/fs_merger-fwd.hh>
+#include <paludis/output_manager-fwd.hh>
+#include <paludis/repository-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/merger.hh>
+
#include <string>
+#include <memory>
/** \file
* Declarations for the EbuildCommand classes.
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index 538ad6e..b3bfa68 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -18,7 +18,11 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "ebuild_flat_metadata_cache.hh"
+#include <paludis/repositories/e/ebuild_flat_metadata_cache.hh>
+#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
+
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/join.hh>
@@ -30,13 +34,12 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_error.hh>
-#include <paludis/repositories/e/dep_parser.hh>
-#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/util/pimp-impl.hh>
+
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/unformatted_pretty_printer.hh>
+#include <paludis/repository.hh>
+
#include <set>
#include <map>
#include <list>
@@ -131,7 +134,7 @@ namespace
{
std::set<std::string> tokens;
tokenise_whitespace(lines[m.inherited()->flat_list_index()], std::inserter(tokens, tokens.begin()));
- auto repo(_imp->env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(_imp->env->fetch_repository(id->repository_name()));
FSPath eclassdir((repo->location_key()->value() / "eclass").realpath_if_exists());
for (std::set<std::string>::const_iterator it(tokens.begin()),
it_end(tokens.end()); it_end != it; ++it)
@@ -399,7 +402,7 @@ EbuildFlatMetadataCache::load(const std::shared_ptr<const EbuildID> & id, const
{
std::vector<std::string> eclasses;
tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(keys["_eclasses_"], "\t", "", std::back_inserter(eclasses));
- auto repo(_imp->env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(_imp->env->fetch_repository(id->repository_name()));
FSPath eclassdir((repo->location_key()->value() / "eclass").realpath_if_exists());
for (std::vector<std::string>::const_iterator it(eclasses.begin()),
it_end(eclasses.end()); it_end != it; ++it)
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
index ba6763f..f05eeba 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
@@ -35,6 +35,7 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/join.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <iterator>
@@ -73,7 +74,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-1",
@@ -100,7 +101,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-stale-1",
@@ -128,7 +129,7 @@ namespace test_cases
keys->insert("eapi_when_unknown", "1");
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-guessed-eapi-1",
@@ -155,7 +156,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-eclass-1",
@@ -185,7 +186,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-eclass-stale-1",
@@ -212,7 +213,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-eclass-wrong-1",
@@ -239,7 +240,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-eclass-gone-1",
@@ -266,7 +267,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-detection-1",
@@ -293,7 +294,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-1",
@@ -321,7 +322,7 @@ namespace test_cases
keys->insert("eapi_when_unknown", "1");
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-guessed-eapi-1",
@@ -348,7 +349,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-guessed-eapi-extension-1",
@@ -375,7 +376,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-no-guessed-eapi-1",
@@ -402,7 +403,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-empty-1",
@@ -430,7 +431,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-stale-1",
@@ -457,7 +458,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-no-mtime-1",
@@ -484,7 +485,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-no-mtime-stale-1",
@@ -511,7 +512,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-bad-mtime-1",
@@ -538,7 +539,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-no-eapi-1",
@@ -565,7 +566,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-duplicate-key-1",
@@ -592,7 +593,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclass-1",
@@ -622,7 +623,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclass-stale-1",
@@ -649,7 +650,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclass-wrong-1",
@@ -675,7 +676,7 @@ namespace test_cases
keys->insert("eclassdirs", "ebuild_flat_metadata_cache_TEST_dir/repo/eclass ebuild_flat_metadata_cache_TEST_dir/extra_eclasses");
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclass-gone-1",
@@ -702,7 +703,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-1",
@@ -732,7 +733,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-nonstandard-1",
@@ -762,7 +763,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-stale-1",
@@ -789,7 +790,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-wrong-1",
@@ -816,7 +817,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-gone-1",
@@ -843,7 +844,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclasses-truncated-1",
@@ -877,7 +878,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclasses-bad-mtime-1",
@@ -904,7 +905,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclasses-spaces-1",
@@ -932,7 +933,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-1",
@@ -963,7 +964,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-percat-1",
@@ -994,7 +995,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-stale-1",
@@ -1022,7 +1023,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-wrong-1",
@@ -1050,7 +1051,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-gone-1",
@@ -1078,7 +1079,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlibs-truncated-1",
@@ -1113,7 +1114,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlibs-bad-mtime-1",
@@ -1141,7 +1142,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlibs-spaces-1",
@@ -1175,7 +1176,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/write-1",
@@ -1210,7 +1211,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/write-eapi1-1",
@@ -1247,7 +1248,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/write-eclasses-1",
@@ -1283,7 +1284,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/write-exlibs-1",
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 775edec..6e776da 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -67,6 +67,7 @@
#include <paludis/util/singleton-impl.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/fs_stat.hh>
+#include <paludis/util/join.hh>
#include <set>
#include <iterator>
@@ -207,7 +208,7 @@ namespace
{
if (! g.empty())
return g;
- auto repo(env->package_database()->fetch_repository(repo_name));
+ auto repo(env->fetch_repository(repo_name));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
return e_repo->params().eapi_when_unknown();
}
@@ -242,7 +243,7 @@ EbuildID::need_keys_added() const
add_metadata_key(_imp->fs_location);
- auto repo(_imp->environment->package_database()->fetch_repository(repository_name()));
+ auto repo(_imp->environment->fetch_repository(repository_name()));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
FSPath cache_file(e_repo->params().cache());
cache_file /= stringify(name().category());
@@ -526,7 +527,7 @@ EbuildID::need_masks_added() const
return;
}
- auto repo(_imp->environment->package_database()->fetch_repository(_imp->repository_name));
+ auto repo(_imp->environment->fetch_repository(_imp->repository_name));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
if (keywords_key())
@@ -1230,7 +1231,7 @@ namespace
void visit(InstallAction & a)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
do_install_action(
env,
@@ -1241,7 +1242,7 @@ namespace
void visit(FetchAction & a)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
do_fetch_action(
env,
@@ -1252,7 +1253,7 @@ namespace
void visit(PretendFetchAction & a)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
do_pretend_fetch_action(
env,
@@ -1263,7 +1264,7 @@ namespace
void visit(PretendAction & action)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
if (! do_pretend_action(
env,
@@ -1275,7 +1276,7 @@ namespace
void visit(InfoAction & action)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
do_info_action(
env,
@@ -1428,7 +1429,7 @@ EbuildID::make_choice_value(
if (! eapi()->supported())
throw InternalError(PALUDIS_HERE, "Unsupported EAPI");
- auto repo(_imp->environment->package_database()->fetch_repository(repository_name()));
+ auto repo(_imp->environment->fetch_repository(repository_name()));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
std::string name_with_prefix_s;
@@ -1625,7 +1626,7 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const
void
EbuildID::purge_invalid_cache() const
{
- auto repo(_imp->environment->package_database()->fetch_repository(repository_name()));
+ auto repo(_imp->environment->fetch_repository(repository_name()));
auto e_repo(std::static_pointer_cast<const ERepository>(repo));
FSPath write_cache_file(e_repo->params().write_cache());
diff --git a/paludis/repositories/e/exheres_layout.cc b/paludis/repositories/e/exheres_layout.cc
index 5179914..1fd3e09 100644
--- a/paludis/repositories/e/exheres_layout.cc
+++ b/paludis/repositories/e/exheres_layout.cc
@@ -46,7 +46,6 @@
#include <paludis/choice.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
#include <unordered_map>
#include <functional>
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 9177c0e..57b62e9 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -24,6 +24,7 @@
#include <paludis/repositories/e/eapi_phase.hh>
#include <paludis/repositories/e/extra_distribution_data.hh>
#include <paludis/repositories/e/can_skip_phase.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/log.hh>
#include <paludis/util/sequence.hh>
@@ -37,6 +38,8 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_iterator.hh>
+#include <paludis/util/join.hh>
+
#include <paludis/output_manager.hh>
#include <paludis/distribution.hh>
#include <paludis/environment.hh>
@@ -47,6 +50,7 @@
#include <paludis/package_id.hh>
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
+
#include <functional>
using namespace paludis;
diff --git a/paludis/repositories/e/exndbam_repository_TEST.cc b/paludis/repositories/e/exndbam_repository_TEST.cc
index 21e6836..a965346 100644
--- a/paludis/repositories/e/exndbam_repository_TEST.cc
+++ b/paludis/repositories/e/exndbam_repository_TEST.cc
@@ -140,7 +140,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("exndbam_repository_TEST_dir/root").realpath()));
std::shared_ptr<Repository> repo1(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo1);
+ env.add_repository(1, repo1);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "exndbam");
@@ -149,7 +149,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("exndbam_repository_TEST_dir/root").realpath()));
std::shared_ptr<Repository> exndbam_repo(ExndbamRepository::ExndbamRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(0, exndbam_repo);
+ env.add_repository(0, exndbam_repo);
TEST_CHECK(exndbam_repo->package_ids(QualifiedPackageName("cat/pkg"), { })->empty());
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
index 387c413..9296084 100644
--- a/paludis/repositories/e/fetch_visitor.cc
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -30,7 +30,6 @@
#include <paludis/repository.hh>
#include <paludis/about.hh>
#include <paludis/output_manager.hh>
-#include <paludis/package_database.hh>
#include <paludis/util/system.hh>
#include <paludis/util/process.hh>
@@ -163,7 +162,7 @@ FetchVisitor::visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::T
if (! *_imp->labels.begin())
throw ActionFailedError("No fetch action label available");
- auto repo(_imp->env->package_database()->fetch_repository(_imp->id->repository_name()));
+ auto repo(_imp->env->fetch_repository(_imp->id->repository_name()));
SourceURIFinder source_uri_finder(_imp->env, repo.get(),
node.spec()->original_url(), node.spec()->filename(), _imp->mirrors_name, _imp->get_mirrors_fn);
(*_imp->labels.begin())->accept(source_uri_finder);
diff --git a/paludis/repositories/e/fetch_visitor_TEST.cc b/paludis/repositories/e/fetch_visitor_TEST.cc
index 16d4790..0619199 100644
--- a/paludis/repositories/e/fetch_visitor_TEST.cc
+++ b/paludis/repositories/e/fetch_visitor_TEST.cc
@@ -29,7 +29,6 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/util/safe_ifstream.hh>
-#include <paludis/package_database.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
@@ -70,7 +69,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
TEST_CHECK(FSPath("fetch_visitor_TEST_dir/in/input1").stat().exists());
diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc
index e312277..bb61360 100644
--- a/paludis/repositories/e/fix_locked_dependencies.cc
+++ b/paludis/repositories/e/fix_locked_dependencies.cc
@@ -27,7 +27,6 @@
#include <paludis/util/accept_visitor.hh>
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/elike_slot_requirement.hh>
#include <paludis/selection.hh>
diff --git a/paludis/repositories/e/fix_locked_dependencies_TEST.cc b/paludis/repositories/e/fix_locked_dependencies_TEST.cc
index 4c1ed3e..74f8a1a 100644
--- a/paludis/repositories/e/fix_locked_dependencies_TEST.cc
+++ b/paludis/repositories/e/fix_locked_dependencies_TEST.cc
@@ -26,7 +26,6 @@
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/make_named_values.hh>
-#include <paludis/package_database.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -48,7 +47,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
@@ -58,7 +57,7 @@ namespace test_cases
n::suitable_destination() = true,
n::supports_uninstall() = true
)));
- env.package_database()->add_repository(2, installed_repo);
+ env.add_repository(2, installed_repo);
installed_repo->add_version("cat", "installed", "1")->set_slot(SlotName("monkey"));
std::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"));
diff --git a/paludis/repositories/e/parse_dependency_label.cc b/paludis/repositories/e/parse_dependency_label.cc
index 9c55b96..0cb1857 100644
--- a/paludis/repositories/e/parse_dependency_label.cc
+++ b/paludis/repositories/e/parse_dependency_label.cc
@@ -20,17 +20,20 @@
#include <paludis/repositories/e/parse_dependency_label.hh>
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/eapi.hh>
+
#include <paludis/util/log.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/singleton-impl.hh>
+
#include <paludis/dep_label.hh>
#include <paludis/choice.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/always_enabled_dependency_label.hh>
+#include <paludis/repository.hh>
+
#include <map>
#include <set>
@@ -45,7 +48,7 @@ namespace
const std::string label,
const ChoiceNameWithPrefix n)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (repo->installed_root_key())
return false;
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index a8e86d6..c8754ec 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -24,6 +24,7 @@
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/repositories/e/e_repository_id.hh>
+
#include <paludis/util/log.hh>
#include <paludis/util/join.hh>
#include <paludis/util/exception.hh>
@@ -37,10 +38,10 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/save.hh>
+
#include <paludis/output_manager.hh>
#include <paludis/package_id.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
@@ -49,6 +50,9 @@
#include <paludis/choice.hh>
#include <paludis/dep_spec_annotations.hh>
#include <paludis/unformatted_pretty_printer.hh>
+#include <paludis/version_spec.hh>
+#include <paludis/repository.hh>
+
#include <vector>
#include <limits>
#include <sstream>
@@ -432,9 +436,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
}
else
{
- if (! environment->package_database()->has_repository_named(RepositoryName("installed")))
+ if (! environment->has_repository_named(RepositoryName("installed")))
return "Eno installed repository available";
- std::shared_ptr<const Repository> repo(environment->package_database()->fetch_repository(RepositoryName("installed")));
+ std::shared_ptr<const Repository> repo(environment->fetch_repository(RepositoryName("installed")));
Repository::MetadataConstIterator key(repo->find_metadata("location"));
if (repo->end_metadata() == key)
return "Einstalled repository has no location key";
diff --git a/paludis/repositories/e/source_uri_finder_TEST.cc b/paludis/repositories/e/source_uri_finder_TEST.cc
index 9332681..693a875 100644
--- a/paludis/repositories/e/source_uri_finder_TEST.cc
+++ b/paludis/repositories/e/source_uri_finder_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010, 2011 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
@@ -23,7 +23,6 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/sequence.hh>
-#include <paludis/package_database.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
@@ -58,7 +57,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
SourceURIFinder f(&env, repo.get(), "http://example.com/path/input", "output", "monkey",
get_mirrors_fn);
@@ -88,7 +87,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
SourceURIFinder f(&env, repo.get(), "mirror://example/path/input", "output", "repo", get_mirrors_fn);
URIMirrorsThenListedLabel label("mirrors-then-listed");
diff --git a/paludis/repositories/e/traditional_layout.cc b/paludis/repositories/e/traditional_layout.cc
index 95f90f9..6917db0 100644
--- a/paludis/repositories/e/traditional_layout.cc
+++ b/paludis/repositories/e/traditional_layout.cc
@@ -44,7 +44,6 @@
#include <paludis/util/deferred_construction_ptr.hh>
#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
#include <paludis/choice.hh>
#include <paludis/literal_metadata_key.hh>
diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc
index 0bba3f8..b67d3b0 100644
--- a/paludis/repositories/e/vdb_merger.cc
+++ b/paludis/repositories/e/vdb_merger.cc
@@ -36,14 +36,14 @@
#include <paludis/util/safe_ofstream.hh>
#include <paludis/util/safe_ifstream.hh>
#include <paludis/util/env_var_names.hh>
+#include <paludis/util/md5.hh>
#include <paludis/output_manager.hh>
#include <paludis/hook.hh>
#include <paludis/package_id.hh>
-#include <paludis/util/md5.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/version_spec.hh>
#include <iomanip>
#include <list>
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index efc673f..bef1833 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -40,7 +40,6 @@
#include <paludis/hook.hh>
#include <paludis/match_package.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/repositories/e/ebuild.hh>
#include <paludis/repository_name_cache.hh>
@@ -78,6 +77,7 @@
#include <paludis/util/destringify.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_iterator.hh>
+#include <paludis/util/join.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/create_iterator-impl.hh>
@@ -1360,8 +1360,8 @@ VDBRepository::perform_updates()
std::cout << std::endl << "Checking for updates (package moves etc):" << std::endl;
std::map<FSPath, std::time_t, FSPathComparator> update_timestamps;
- for (PackageDatabase::RepositoryConstIterator r(_imp->params.environment()->package_database()->begin_repositories()),
- r_end(_imp->params.environment()->package_database()->end_repositories()) ;
+ for (auto r(_imp->params.environment()->begin_repositories()),
+ r_end(_imp->params.environment()->end_repositories()) ;
r != r_end ; ++r)
{
Context context_2("When performing updates from '" + stringify((*r)->name()) + "':");
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index 5d08251..4580f73 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -21,7 +21,6 @@
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/environments/test/test_environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/options.hh>
@@ -30,6 +29,7 @@
#include <paludis/util/safe_ifstream.hh>
#include <paludis/util/fs_iterator.hh>
#include <paludis/util/fs_stat.hh>
+#include <paludis/util/join.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
@@ -40,6 +40,7 @@
#include <paludis/action.hh>
#include <paludis/choice.hh>
#include <paludis/unformatted_pretty_printer.hh>
+#include <paludis/contents.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
@@ -146,7 +147,7 @@ namespace test_cases
keys->insert("builddir", stringify(FSPath::cwd() / "vdb_repository_TEST_dir" / "build"));
std::shared_ptr<Repository> repo(VDBRepository::VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> e1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
@@ -216,7 +217,7 @@ namespace test_cases
keys->insert("world", stringify(FSPath::cwd() / "vdb_repository_TEST_dir" / "world-no-match-no-eol"));
std::shared_ptr<Repository> repo(VDBRepository::VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<const PackageID> e1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
@@ -285,7 +286,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_dir/root").realpath()));
std::shared_ptr<Repository> repo1(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo1);
+ env.add_repository(1, repo1);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "e");
@@ -301,7 +302,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_dir/root").realpath()));
std::shared_ptr<Repository> repo2(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(2, repo2);
+ env.add_repository(2, repo2);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "vdb");
@@ -312,7 +313,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_dir/root").realpath()));
std::shared_ptr<Repository> vdb_repo(VDBRepository::VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(0, vdb_repo);
+ env.add_repository(0, vdb_repo);
InstallAction install_action(make_named_values<InstallActionOptions>(
n::destination() = vdb_repo,
@@ -415,7 +416,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_dir/root").realpath()));
std::shared_ptr<Repository> repo1(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo1);
+ env.add_repository(1, repo1);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "vdb");
@@ -426,7 +427,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_dir/root").realpath()));
std::shared_ptr<Repository> vdb_repo(VDBRepository::VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(0, vdb_repo);
+ env.add_repository(0, vdb_repo);
TEST_CHECK(vdb_repo->package_ids(QualifiedPackageName("cat/pkg"), { })->empty());
diff --git a/paludis/repositories/e/vdb_repository_TEST_cache.cc b/paludis/repositories/e/vdb_repository_TEST_cache.cc
index 89cab61..21dff28 100644
--- a/paludis/repositories/e/vdb_repository_TEST_cache.cc
+++ b/paludis/repositories/e/vdb_repository_TEST_cache.cc
@@ -21,7 +21,6 @@
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/environments/test/test_environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/options.hh>
@@ -149,7 +148,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_cache_dir/root").realpath()));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "vdb");
@@ -160,7 +159,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_cache_dir/root").realpath()));
std::shared_ptr<Repository> vdb_repo(VDBRepository::VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(0, vdb_repo);
+ env.add_repository(0, vdb_repo);
UninstallAction uninstall_action(make_named_values<UninstallActionOptions>(
n::config_protect() = "",
@@ -393,7 +392,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_cache_dir/root").realpath()));
std::shared_ptr<Repository> vdb_repo(VDBRepository::VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(0, vdb_repo);
+ env.add_repository(0, vdb_repo);
TEST_CHECK(! provides_cache.stat().exists());
@@ -514,7 +513,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_cache_dir/root").realpath()));
std::shared_ptr<Repository> repo1(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo1);
+ env.add_repository(1, repo1);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "e");
@@ -530,7 +529,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_cache_dir/root").realpath()));
std::shared_ptr<Repository> repo2(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(2, repo2);
+ env.add_repository(2, repo2);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "vdb");
@@ -541,7 +540,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_cache_dir/root").realpath()));
std::shared_ptr<Repository> vdb_repo(VDBRepository::VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(0, vdb_repo);
+ env.add_repository(0, vdb_repo);
UninstallAction uninstall_action(make_named_values<UninstallActionOptions>(
n::config_protect() = "",
diff --git a/paludis/repositories/e/vdb_repository_TEST_eapis.cc b/paludis/repositories/e/vdb_repository_TEST_eapis.cc
index 9ae9724..9a42781 100644
--- a/paludis/repositories/e/vdb_repository_TEST_eapis.cc
+++ b/paludis/repositories/e/vdb_repository_TEST_eapis.cc
@@ -21,7 +21,6 @@
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/environments/test/test_environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/options.hh>
@@ -127,7 +126,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_eapis_dir/root").realpath()));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "vdb");
@@ -138,7 +137,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_eapis_dir/root").realpath()));
std::shared_ptr<Repository> vdb_repo(VDBRepository::VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(0, vdb_repo);
+ env.add_repository(0, vdb_repo);
InstallAction install_action(make_named_values<InstallActionOptions>(
n::destination() = vdb_repo,
@@ -256,7 +255,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_eapis_dir/root").realpath()));
std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "vdb");
@@ -267,7 +266,7 @@ namespace test_cases
keys->insert("root", stringify(FSPath("vdb_repository_TEST_eapis_dir/root").realpath()));
std::shared_ptr<Repository> vdb_repo(VDBRepository::VDBRepository::repository_factory_create(&env,
std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(0, vdb_repo);
+ env.add_repository(0, vdb_repo);
InstallAction install_action(make_named_values<InstallActionOptions>(
n::destination() = vdb_repo,
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index 631d1f2..e9ed59c 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -18,16 +18,12 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "vdb_unmerger.hh"
-#include "vdb_contents_tokeniser.hh"
+#include <paludis/repositories/e/vdb_unmerger.hh>
+#include <paludis/repositories/e/vdb_contents_tokeniser.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/md5.hh>
-#include <paludis/environment.hh>
-#include <paludis/hook.hh>
-#include <paludis/package_database.hh>
-#include <paludis/package_id.hh>
-#include <paludis/metadata_key.hh>
+#include <paludis/util/safe_ifstream.hh>
#include <paludis/util/join.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/log.hh>
@@ -41,8 +37,13 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_iterator.hh>
+
+#include <paludis/environment.hh>
+#include <paludis/hook.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/contents.hh>
#include <paludis/output_manager.hh>
-#include <paludis/util/safe_ifstream.hh>
#include <list>
#include <map>
diff --git a/paludis/repositories/e/vdb_unmerger_TEST.cc b/paludis/repositories/e/vdb_unmerger_TEST.cc
index b6c3318..9b53472 100644
--- a/paludis/repositories/e/vdb_unmerger_TEST.cc
+++ b/paludis/repositories/e/vdb_unmerger_TEST.cc
@@ -29,7 +29,6 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/package_database.hh>
#include <paludis/generator.hh>
#include <paludis/selection.hh>
#include <paludis/filtered_generator.hh>
@@ -120,7 +119,7 @@ namespace
keys->insert("location", stringify(FSPath::cwd() / "vdb_unmerger_TEST_dir" / "repo"));
keys->insert("builddir", stringify(FSPath::cwd() / "vdb_unmerger_TEST_dir" / "build"));
repo = VDBRepository::repository_factory_create(&env, std::bind(from_keys, keys, std::placeholders::_1));
- env.package_database()->add_repository(0, repo);
+ env.add_repository(0, repo);
unmerger = std::make_shared<VDBUnmergerNoDisplay>(make_named_values<VDBUnmergerOptions>(
n::config_protect() = "/protected_file /protected_dir",
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index ed1691a..9789db4 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -20,6 +20,7 @@
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/repositories/fake/fake_repository_base.hh>
#include <paludis/repositories/fake/dep_parser.hh>
+
#include <paludis/name.hh>
#include <paludis/action.hh>
#include <paludis/environment.hh>
@@ -28,10 +29,10 @@
#include <paludis/dep_spec.hh>
#include <paludis/choice.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/package_database.hh>
#include <paludis/always_enabled_dependency_label.hh>
#include <paludis/pretty_printer.hh>
#include <paludis/call_pretty_printer.hh>
+
#include <paludis/util/stringify.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/pimp-impl.hh>
@@ -48,6 +49,8 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/singleton-impl.hh>
+#include <paludis/util/join.hh>
+
#include <map>
#include <list>
#include <sstream>
@@ -982,7 +985,7 @@ FakePackageID::extra_hash_value() const
bool
FakePackageID::supports_action(const SupportsActionTestBase & b) const
{
- auto repo(_imp->env->package_database()->fetch_repository(repository_name()));
+ auto repo(_imp->env->fetch_repository(repository_name()));
return repo->some_ids_might_support_action(b);
}
@@ -1103,7 +1106,7 @@ namespace
void visit(const InstallAction & a)
{
SupportsActionTest<InstallAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -1111,7 +1114,7 @@ namespace
void visit(const UninstallAction & a)
{
SupportsActionTest<UninstallAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -1119,7 +1122,7 @@ namespace
void visit(const FetchAction & a)
{
SupportsActionTest<FetchAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -1127,7 +1130,7 @@ namespace
void visit(const ConfigAction & a)
{
SupportsActionTest<ConfigAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -1135,7 +1138,7 @@ namespace
void visit(const InfoAction & a)
{
SupportsActionTest<InfoAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -1143,7 +1146,7 @@ namespace
void visit(const PretendAction & a)
{
SupportsActionTest<PretendAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -1151,7 +1154,7 @@ namespace
void visit(const PretendFetchAction & a)
{
SupportsActionTest<PretendFetchAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
diff --git a/paludis/repositories/gemcutter/gemcutter_repository_store.cc b/paludis/repositories/gemcutter/gemcutter_repository_store.cc
index 61852fd..61a2a65 100644
--- a/paludis/repositories/gemcutter/gemcutter_repository_store.cc
+++ b/paludis/repositories/gemcutter/gemcutter_repository_store.cc
@@ -34,7 +34,6 @@
#include <paludis/version_spec.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <functional>
#include <unordered_map>
#include <algorithm>
diff --git a/paludis/repositories/repository/repository_repository.cc b/paludis/repositories/repository/repository_repository.cc
index dd842bb..00a5e83 100644
--- a/paludis/repositories/repository/repository_repository.cc
+++ b/paludis/repositories/repository/repository_repository.cc
@@ -38,7 +38,6 @@
#include <paludis/package_id.hh>
#include <paludis/output_manager.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <list>
using namespace paludis;
@@ -336,7 +335,7 @@ RepositoryRepository::sync_host_key() const
bool
RepositoryRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const
{
- auto repo(_imp->params.environment()->package_database()->fetch_repository(id->repository_name()));
+ auto repo(_imp->params.environment()->fetch_repository(id->repository_name()));
std::string f(repo->format_key() ? repo->format_key()->value() : "");
return f == "unavailable";
}
diff --git a/paludis/repositories/repository/repository_repository_store.cc b/paludis/repositories/repository/repository_repository_store.cc
index dfc1c16..a2b59a1 100644
--- a/paludis/repositories/repository/repository_repository_store.cc
+++ b/paludis/repositories/repository/repository_repository_store.cc
@@ -32,7 +32,6 @@
#include <paludis/version_spec.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <functional>
#include <unordered_map>
#include <algorithm>
@@ -84,8 +83,7 @@ RepositoryRepositoryStore::~RepositoryRepositoryStore()
void
RepositoryRepositoryStore::_populate()
{
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ for (auto r(_imp->env->begin_repositories()), r_end(_imp->env->end_repositories()) ; r != r_end ; ++r)
_populate_one((*r)->name());
}
diff --git a/paludis/repositories/unavailable/unavailable_repository_TEST.cc b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
index 5b78e78..4e00c07 100644
--- a/paludis/repositories/unavailable/unavailable_repository_TEST.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
@@ -34,7 +34,6 @@
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
#include <memory>
@@ -54,7 +53,7 @@ TEST(UnavailableRepository, Creation)
n::sync() = std::make_shared<Map<std::string, std::string> >(),
n::sync_options() = std::make_shared<Map<std::string, std::string> >()
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
EXPECT_EQ("unavailable", stringify(repo->name()));
}
@@ -69,7 +68,7 @@ TEST(UnavailableRepository, Contents)
n::sync() = std::make_shared<Map<std::string, std::string> >(),
n::sync_options() = std::make_shared<Map<std::string, std::string> >()
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
EXPECT_EQ("unavailable", stringify(repo->name()));
std::shared_ptr<const PackageIDSequence> contents(
@@ -95,7 +94,7 @@ TEST(UnavailableRepository, Contents)
n::environment() = &env,
n::name() = RepositoryName("bar")
)));
- env.package_database()->add_repository(2, hide_bar);
+ env.add_repository(2, hide_bar);
repo->invalidate();
std::shared_ptr<const PackageIDSequence> contents_without_bar(
diff --git a/paludis/repositories/unavailable/unavailable_repository_store.cc b/paludis/repositories/unavailable/unavailable_repository_store.cc
index 85e9ffd..bd3df3c 100644
--- a/paludis/repositories/unavailable/unavailable_repository_store.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_store.cc
@@ -38,7 +38,6 @@
#include <paludis/version_spec.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <functional>
#include <unordered_map>
#include <algorithm>
@@ -108,7 +107,7 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
UnavailableRepositoryFile file(f);
- bool has_repo(env->package_database()->has_repository_named(RepositoryName(file.repo_name())));
+ bool has_repo(env->has_repository_named(RepositoryName(file.repo_name())));
if (! _imp->seen_repo_names.insert(file.repo_name()).second)
{
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 29d0edd..e59cc6f 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -19,8 +19,7 @@
#include <paludis/repositories/unpackaged/installed_id.hh>
#include <paludis/repositories/unpackaged/installed_repository.hh>
-#include <paludis/ndbam.hh>
-#include <paludis/ndbam_unmerger.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/system.hh>
#include <paludis/util/stringify.hh>
@@ -35,10 +34,13 @@
#include <paludis/util/singleton-impl.hh>
#include <paludis/util/fs_iterator.hh>
#include <paludis/util/fs_stat.hh>
+#include <paludis/util/join.hh>
+
+#include <paludis/ndbam.hh>
+#include <paludis/ndbam_unmerger.hh>
#include <paludis/output_manager.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
-#include <paludis/package_database.hh>
#include <paludis/contents.hh>
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
@@ -50,6 +52,7 @@
#include <paludis/always_enabled_dependency_label.hh>
#include <paludis/pretty_printer.hh>
#include <paludis/call_pretty_printer.hh>
+
#include <functional>
using namespace paludis;
@@ -825,7 +828,7 @@ InstalledUnpackagedID::uninstall(const bool replace,
{
Context context("When uninstalling '" + stringify(*this) + "':");
- auto repo(_imp->env->package_database()->fetch_repository(repository_name()));
+ auto repo(_imp->env->fetch_repository(repository_name()));
bool last((! replace) && (! if_for_install_id));
if (last)
{
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 14cc032..252c20c 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -47,7 +47,6 @@
#include <paludis/selection.hh>
#include <paludis/hook.hh>
#include <paludis/common_sets.hh>
-#include <paludis/package_database.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <sstream>
#include <sys/time.h>
@@ -273,7 +272,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
if (! is_suitable_destination_for(m.package_id()))
throw ActionFailedError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
- auto repo(_imp->params.environment()->package_database()->fetch_repository(m.package_id()->repository_name()));
+ auto repo(_imp->params.environment()->fetch_repository(m.package_id()->repository_name()));
FSPath install_under("/");
{
Repository::MetadataConstIterator k(repo->find_metadata("install_under"));
@@ -402,7 +401,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
bool
InstalledUnpackagedRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const
{
- auto repo(_imp->params.environment()->package_database()->fetch_repository(id->repository_name()));
+ auto repo(_imp->params.environment()->fetch_repository(id->repository_name()));
std::string f(repo->format_key() ? repo->format_key()->value() : "");
return f == "unpackaged";
}
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index 9dc5b0c..31e3c55 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -22,7 +22,6 @@
#include <paludis/environments/test/test_environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/action.hh>
#include <paludis/user_dep_spec.hh>
@@ -32,6 +31,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
#include <paludis/standard_output_manager.hh>
+#include <paludis/contents.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/join.hh>
@@ -108,7 +108,7 @@ TEST(InstalledRepository, Content)
n::location() = FSPath("installed_repository_TEST_dir/repo1"),
n::root() = FSPath("installed_repository_TEST_dir/root")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageIDSequence> ids(
env[selection::AllVersionsSorted(generator::All())]);
@@ -126,7 +126,7 @@ TEST(InstalledRepository, Metadata)
n::location() = FSPath("installed_repository_TEST_dir/repo1"),
n::root() = FSPath("installed_repository_TEST_dir/root")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(
generator::Matches(parse_user_package_dep_spec("cat-one/foo:0",
@@ -173,7 +173,7 @@ TEST(InstalledRepository, Masks)
n::location() = FSPath("installed_repository_TEST_dir/repo1"),
n::root() = FSPath("installed_repository_TEST_dir/root")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(
generator::Matches(parse_user_package_dep_spec("cat-one/foo:0",
@@ -198,7 +198,7 @@ TEST(InstalledRepository, Actions)
n::location() = FSPath("installed_repository_TEST_dir/repo1"),
n::root() = FSPath("installed_repository_TEST_dir/root")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
EXPECT_TRUE(! repo->some_ids_might_support_action(SupportsActionTest<InstallAction>()));
EXPECT_TRUE(! repo->some_ids_might_support_action(SupportsActionTest<ConfigAction>()));
@@ -228,7 +228,7 @@ TEST(InstalledRepository, UninstallLast)
n::location() = FSPath("installed_repository_TEST_dir/repo2"),
n::root() = FSPath("installed_repository_TEST_dir/root2")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageIDSequence> pre_ids(env[selection::AllVersionsSorted(generator::All())]);
EXPECT_EQ("cat-one/foo-1.2.3:fred::installed-unpackaged",
@@ -275,7 +275,7 @@ TEST(InstalledRepository, UninstallNotLast)
n::location() = FSPath("installed_repository_TEST_dir/repo3"),
n::root() = FSPath("installed_repository_TEST_dir/root3")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageIDSequence> pre_ids(env[selection::AllVersionsSorted(generator::All())]);
EXPECT_EQ("cat-one/foo-1.2.3:fred::installed-unpackaged cat-one/foo-3.2.1:barney::installed-unpackaged",
@@ -318,7 +318,7 @@ TEST(InstalledRepository, MultipleOps)
n::location() = FSPath("installed_repository_TEST_dir/repo4"),
n::root() = FSPath("installed_repository_TEST_dir/root4")
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageIDSequence> pre_ids(env[selection::AllVersionsSorted(generator::All())]);
EXPECT_EQ("", join(indirect_iterator(pre_ids->begin()), indirect_iterator(pre_ids->end()), " "));
@@ -335,7 +335,7 @@ TEST(InstalledRepository, MultipleOps)
n::location() = FSPath("installed_repository_TEST_dir/repo4"),
n::root() = FSPath("installed_repository_TEST_dir/root4")
)));
- env.package_database()->add_repository(0, repo);
+ env.add_repository(0, repo);
std::shared_ptr<Repository> source_repo(std::make_shared<UnpackagedRepository>(
RepositoryName("unpackaged"),
@@ -353,7 +353,7 @@ TEST(InstalledRepository, MultipleOps)
n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
- env.package_database()->add_repository(1, source_repo);
+ env.add_repository(1, source_repo);
{
const std::shared_ptr<const PackageIDSequence> pre_ids(env[selection::AllVersionsSorted(
@@ -393,7 +393,7 @@ TEST(InstalledRepository, MultipleOps)
n::location() = FSPath("installed_repository_TEST_dir/repo4"),
n::root() = FSPath("installed_repository_TEST_dir/root4")
)));
- env.package_database()->add_repository(0, repo);
+ env.add_repository(0, repo);
std::shared_ptr<Repository> source_repo(std::make_shared<UnpackagedRepository>(
RepositoryName("unpackaged"),
@@ -411,7 +411,7 @@ TEST(InstalledRepository, MultipleOps)
n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
- env.package_database()->add_repository(1, source_repo);
+ env.add_repository(1, source_repo);
{
const std::shared_ptr<const PackageIDSequence> pre_ids(env[selection::AllVersionsSorted(
@@ -453,7 +453,7 @@ TEST(InstalledRepository, MultipleOps)
n::location() = FSPath("installed_repository_TEST_dir/repo4"),
n::root() = FSPath("installed_repository_TEST_dir/root4")
)));
- env.package_database()->add_repository(0, repo);
+ env.add_repository(0, repo);
std::shared_ptr<Repository> source_repo(std::make_shared<UnpackagedRepository>(
RepositoryName("unpackaged"),
@@ -471,7 +471,7 @@ TEST(InstalledRepository, MultipleOps)
n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
- env.package_database()->add_repository(1, source_repo);
+ env.add_repository(1, source_repo);
{
const std::shared_ptr<const PackageIDSequence> pre_ids(env[selection::AllVersionsSorted(
@@ -513,7 +513,7 @@ TEST(InstalledRepository, MultipleOps)
n::location() = FSPath("installed_repository_TEST_dir/repo4"),
n::root() = FSPath("installed_repository_TEST_dir/root4")
)));
- env.package_database()->add_repository(0, repo);
+ env.add_repository(0, repo);
{
const std::shared_ptr<const PackageIDSequence> pre_ids(env[selection::AllVersionsSorted(
@@ -557,7 +557,7 @@ TEST(InstalledRepository, MultipleOps)
n::location() = FSPath("installed_repository_TEST_dir/repo4"),
n::root() = FSPath("installed_repository_TEST_dir/root4")
)));
- env.package_database()->add_repository(0, repo);
+ env.add_repository(0, repo);
{
const std::shared_ptr<const PackageIDSequence> pre_ids(env[selection::AllVersionsSorted(
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 3797821..1eb637f 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -20,6 +20,7 @@
#include <paludis/repositories/unpackaged/unpackaged_id.hh>
#include <paludis/repositories/unpackaged/unpackaged_key.hh>
#include <paludis/repositories/unpackaged/unpackaged_stripper.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/visitor_cast.hh>
@@ -30,10 +31,11 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/singleton-impl.hh>
+#include <paludis/util/timestamp.hh>
+
#include <paludis/output_manager.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
-#include <paludis/package_database.hh>
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
@@ -42,6 +44,7 @@
#include <paludis/elike_choices.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/always_enabled_dependency_label.hh>
+#include <paludis/repository.hh>
using namespace paludis;
using namespace paludis::unpackaged_repositories;
diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index 0d89315..86d09db 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -22,7 +22,6 @@
#include <paludis/environments/test/test_environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/action.hh>
#include <paludis/metadata_key.hh>
@@ -85,7 +84,7 @@ TEST(UnpackagedRepository, Members)
n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageIDSequence> ids(
env[selection::AllVersionsSorted(generator::All())]);
@@ -111,7 +110,7 @@ TEST(UnpackagedRepository, Metadata)
n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id(
*env[selection::RequireExactlyOne(generator::All())]->begin());
@@ -143,7 +142,7 @@ TEST(UnpackagedRepository, Masks)
n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
const std::shared_ptr<const PackageID> id(
*env[selection::RequireExactlyOne(generator::All())]->begin());
@@ -170,7 +169,7 @@ TEST(UnpackagedRepository, Actions)
n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
EXPECT_TRUE(repo->some_ids_might_support_action(SupportsActionTest<InstallAction>()));
EXPECT_TRUE(! repo->some_ids_might_support_action(SupportsActionTest<ConfigAction>()));
@@ -208,7 +207,7 @@ TEST(UnpackagedRepository, Install)
n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<Repository> installed_repo(std::make_shared<InstalledUnpackagedRepository>(
RepositoryName("installed-unpackaged"),
@@ -217,7 +216,7 @@ TEST(UnpackagedRepository, Install)
n::location() = FSPath("unpackaged_repository_TEST_dir/installed"),
n::root() = FSPath("unpackaged_repository_TEST_dir/root")
)));
- env.package_database()->add_repository(0, installed_repo);
+ env.add_repository(0, installed_repo);
EXPECT_TRUE(! FSPath("unpackaged_repository_TEST_dir/root/first").stat().is_regular_file());
@@ -256,7 +255,7 @@ TEST(UnpackagedRepository, InstallUnder)
n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
std::shared_ptr<Repository> installed_repo(std::make_shared<InstalledUnpackagedRepository>(
RepositoryName("installed-unpackaged"),
@@ -265,7 +264,7 @@ TEST(UnpackagedRepository, InstallUnder)
n::location() = FSPath("unpackaged_repository_TEST_dir/under_installed"),
n::root() = FSPath("unpackaged_repository_TEST_dir/under_root")
)));
- env.package_database()->add_repository(0, installed_repo);
+ env.add_repository(0, installed_repo);
EXPECT_TRUE(! FSPath("unpackaged_repository_TEST_dir/under_root/magic/pixie/first").stat().is_regular_file());
diff --git a/paludis/repositories/unwritten/unwritten_repository_TEST.cc b/paludis/repositories/unwritten/unwritten_repository_TEST.cc
index 0df4c71..019ed70 100644
--- a/paludis/repositories/unwritten/unwritten_repository_TEST.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_TEST.cc
@@ -34,7 +34,6 @@
#include <paludis/filter.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/package_database.hh>
#include <memory>
@@ -62,7 +61,7 @@ TEST(UnwrittenRepository, Creation)
n::sync() = std::make_shared<Map<std::string, std::string> >(),
n::sync_options() = std::make_shared<Map<std::string, std::string> >()
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
EXPECT_EQ("unwritten", stringify(repo->name()));
}
@@ -77,7 +76,7 @@ TEST(UnwrittenRepository, Contents)
n::sync() = std::make_shared<Map<std::string, std::string> >(),
n::sync_options() = std::make_shared<Map<std::string, std::string> >()
)));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
EXPECT_EQ("unwritten", stringify(repo->name()));
std::shared_ptr<const PackageIDSequence> contents(
diff --git a/paludis/repositories/unwritten/unwritten_repository_store.cc b/paludis/repositories/unwritten/unwritten_repository_store.cc
index 2626d7c..03ccd29 100644
--- a/paludis/repositories/unwritten/unwritten_repository_store.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_store.cc
@@ -37,7 +37,6 @@
#include <paludis/version_spec.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <functional>
#include <unordered_map>
#include <algorithm>
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 7d017a4..88ee2a5 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -22,9 +22,9 @@
#include <paludis/environment.hh>
#include <paludis/hook.hh>
-#include <paludis/package_database.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
@@ -35,6 +35,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <functional>
#include <unordered_map>
@@ -137,8 +138,8 @@ InstalledVirtualsRepository::need_ids() const
/* Populate our _imp->entries. We need to iterate over each repository in
* our env's package database, see if it has a provides interface, and if it
* does create an entry for each provided package. */
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ for (auto r(_imp->env->begin_repositories()),
+ r_end(_imp->env->end_repositories()) ; r != r_end ; ++r)
{
if (! (**r).provides_interface())
continue;
@@ -353,7 +354,7 @@ InstalledVirtualsRepository::repository_factory_dependencies(
bool
InstalledVirtualsRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const
{
- auto repo(_imp->env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(_imp->env->fetch_repository(id->repository_name()));
std::string f(repo->format_key() ? repo->format_key()->value() : "");
return f == "virtuals";
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index dcad0e4..a2231e5 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -36,7 +36,6 @@
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/mask.hh>
-#include <paludis/package_database.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/selection.hh>
@@ -387,7 +386,7 @@ namespace
void visit(const InstallAction & a)
{
SupportsActionTest<InstallAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -395,7 +394,7 @@ namespace
void visit(const UninstallAction & a)
{
SupportsActionTest<UninstallAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -403,7 +402,7 @@ namespace
void visit(const ConfigAction & a)
{
SupportsActionTest<ConfigAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -411,7 +410,7 @@ namespace
void visit(const FetchAction & a)
{
SupportsActionTest<FetchAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -419,7 +418,7 @@ namespace
void visit(const InfoAction & a)
{
SupportsActionTest<InfoAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -427,7 +426,7 @@ namespace
void visit(const PretendAction & a)
{
SupportsActionTest<PretendAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -435,7 +434,7 @@ namespace
void visit(const PretendFetchAction & a)
{
SupportsActionTest<PretendFetchAction> t;
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (! repo->some_ids_might_support_action(t))
throw ActionFailedError("Unsupported action: " + a.simple_name());
}
@@ -452,7 +451,7 @@ VirtualsPackageID::perform_action(Action & a) const
bool
VirtualsPackageID::supports_action(const SupportsActionTestBase & b) const
{
- auto repo(_imp->env->package_database()->fetch_repository(repository_name()));
+ auto repo(_imp->env->fetch_repository(repository_name()));
return repo->some_ids_might_support_action(b);
}
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index bb6026d..1aa80cc 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -22,7 +22,6 @@
#include <paludis/environment.hh>
#include <paludis/match_package.hh>
-#include <paludis/package_database.hh>
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/selection.hh>
@@ -151,8 +150,7 @@ VirtualsRepository::need_names() const
Log::get_instance()->message("virtuals.need_names", ll_debug, lc_context) << "VirtualsRepository need_names";
/* Determine our virtual name -> package mappings. */
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ for (auto r(_imp->env->begin_repositories()), r_end(_imp->env->end_repositories()) ; r != r_end ; ++r)
{
if (! (**r).provides_interface())
continue;
@@ -170,8 +168,7 @@ VirtualsRepository::need_names() const
std::vector<std::pair<QualifiedPackageName, std::shared_ptr<const PackageDepSpec> > > new_names;
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ for (auto r(_imp->env->begin_repositories()), r_end(_imp->env->end_repositories()) ; r != r_end ; ++r)
{
if (! (**r).virtuals_interface())
continue;
diff --git a/paludis/repositories/virtuals/virtuals_repository_TEST.cc b/paludis/repositories/virtuals/virtuals_repository_TEST.cc
index e38d4a4..529fb40 100644
--- a/paludis/repositories/virtuals/virtuals_repository_TEST.cc
+++ b/paludis/repositories/virtuals/virtuals_repository_TEST.cc
@@ -25,7 +25,6 @@
#include <paludis/environments/test/test_environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
@@ -37,6 +36,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/options.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/join.hh>
#include <gtest/gtest.h>
@@ -60,9 +60,9 @@ TEST(VirtualsRepository, Works)
ASSERT_TRUE(repo->virtuals_interface());
- env.package_database()->add_repository(2, virtuals);
- env.package_database()->add_repository(3, repo);
- env.package_database()->add_repository(4, installed);
+ env.add_repository(2, virtuals);
+ env.add_repository(3, repo);
+ env.add_repository(4, installed);
repo->add_version("cat", "pkg", "1")->provide_key()->set_from_string("virtual/pkg");
repo->add_version("cat", "pkg", "2")->provide_key()->set_from_string("virtual/pkg");
@@ -100,10 +100,10 @@ TEST(VirtualsRepository, Duplicates)
n::supports_uninstall() = true
)));
- env.package_database()->add_repository(2, virtuals);
- env.package_database()->add_repository(3, repo1);
- env.package_database()->add_repository(4, repo2);
- env.package_database()->add_repository(5, installed);
+ env.add_repository(2, virtuals);
+ env.add_repository(3, repo1);
+ env.add_repository(4, repo2);
+ env.add_repository(5, installed);
repo1->add_version("cat", "pkg", "1")->provide_key()->set_from_string("virtual/pkg");
repo1->add_version("cat", "pkg", "2")->provide_key()->set_from_string("virtual/pkg");
@@ -141,9 +141,9 @@ TEST(VirtualsRepository, Recursion)
n::name() = RepositoryName("repo2")
)));
- env.package_database()->add_repository(2, repo1);
- env.package_database()->add_repository(3, repo2);
- env.package_database()->add_repository(4, virtuals);
+ env.add_repository(2, repo1);
+ env.add_repository(3, repo2);
+ env.add_repository(4, virtuals);
repo1->add_version("virtual", "gkp", "1")->provide_key()->set_from_string("virtual/pkg");
repo1->add_virtual_package(QualifiedPackageName("virtual/pkg"), std::make_shared<PackageDepSpec>(
diff --git a/paludis/repository.hh b/paludis/repository.hh
index a0cbe93..c85f88f 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -247,8 +247,8 @@ namespace paludis
};
/**
- * A Repository provides a representation of a physical repository to a
- * PackageDatabase.
+ * A Repository provides a representation of a physical repository to an
+ * Environment.
*
* \ingroup g_repository
* \nosubgrouping
diff --git a/paludis/repository_name_cache_TEST.cc b/paludis/repository_name_cache_TEST.cc
index acda6a9..96d2511 100644
--- a/paludis/repository_name_cache_TEST.cc
+++ b/paludis/repository_name_cache_TEST.cc
@@ -18,7 +18,6 @@
*/
#include <paludis/repository_name_cache.hh>
-#include <paludis/package_database.hh>
#include <paludis/util/join.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -39,7 +38,7 @@ TEST(RepositoryNameCache, Empty)
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(10, repo);
+ env.add_repository(10, repo);
RepositoryNameCache cache(FSPath("/var/empty"), repo.get());
EXPECT_TRUE(! cache.usable());
@@ -52,7 +51,7 @@ TEST(RepositoryNameCache, NotGenerated)
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(10, repo);
+ env.add_repository(10, repo);
RepositoryNameCache cache(FSPath("repository_name_cache_TEST_dir/not_generated"), repo.get());
EXPECT_TRUE(cache.usable());
@@ -67,7 +66,7 @@ TEST(RepositoryNameCache, NotExisting)
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(10, repo);
+ env.add_repository(10, repo);
RepositoryNameCache cache(FSPath("repository_name_cache_TEST_dir/not_existing"), repo.get());
EXPECT_TRUE(cache.usable());
@@ -82,7 +81,7 @@ TEST(RepositoryNameCache, OldFormat)
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(10, repo);
+ env.add_repository(10, repo);
RepositoryNameCache cache(FSPath("repository_name_cache_TEST_dir/old_format"), repo.get());
EXPECT_TRUE(cache.usable());
@@ -97,7 +96,7 @@ TEST(RepositoryNameCache, BadRepo)
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(10, repo);
+ env.add_repository(10, repo);
RepositoryNameCache cache(FSPath("repository_name_cache_TEST_dir/bad_repo"), repo.get());
EXPECT_TRUE(cache.usable());
@@ -112,7 +111,7 @@ TEST(RepositoryNameCache, Good)
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(10, repo);
+ env.add_repository(10, repo);
RepositoryNameCache cache(FSPath("repository_name_cache_TEST_dir/good_repo"), repo.get());
EXPECT_TRUE(cache.usable());
@@ -135,7 +134,7 @@ TEST(RepositoryNameCache, Generate)
n::environment() = &env,
n::name() = RepositoryName("repo")
)));
- env.package_database()->add_repository(10, repo);
+ env.add_repository(10, repo);
RepositoryNameCache cache(FSPath("repository_name_cache_TEST_dir/generated"), repo.get());
repo->add_package(QualifiedPackageName("bar/foo"));
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 9ee4c43..735a1bb 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -57,7 +57,6 @@
#include <paludis/notifier_callback.hh>
#include <paludis/repository.hh>
#include <paludis/filtered_generator.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
#include <paludis/generator.hh>
#include <paludis/selection.hh>
diff --git a/paludis/resolver/destination_utils.cc b/paludis/resolver/destination_utils.cc
index 2d28114..85f78a8 100644
--- a/paludis/resolver/destination_utils.cc
+++ b/paludis/resolver/destination_utils.cc
@@ -18,6 +18,9 @@
*/
#include <paludis/resolver/destination_utils.hh>
+
+#include <paludis/util/stringify.hh>
+
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/filtered_generator.hh>
@@ -25,7 +28,7 @@
#include <paludis/generator_handler.hh>
#include <paludis/filter.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
+#include <paludis/repository.hh>
using namespace paludis;
using namespace paludis::resolver;
@@ -65,8 +68,7 @@ namespace
{
using namespace std::placeholders;
std::shared_ptr<RepositoryNameSet> result(std::make_shared<RepositoryNameSet>());
- for (auto r(env->package_database()->begin_repositories()),
- r_end(env->package_database()->end_repositories()) ;
+ for (auto r(env->begin_repositories()), r_end(env->end_repositories()) ;
r != r_end ; ++r)
if (! (*r)->installed_root_key())
if ((*r)->destination_interface())
diff --git a/paludis/resolver/find_replacing_helper.cc b/paludis/resolver/find_replacing_helper.cc
index 92a0c52..88e3155 100644
--- a/paludis/resolver/find_replacing_helper.cc
+++ b/paludis/resolver/find_replacing_helper.cc
@@ -28,7 +28,6 @@
#include <paludis/elike_slot_requirement.hh>
#include <paludis/metadata_key.hh>
#include <paludis/repository.hh>
-#include <paludis/package_database.hh>
#include <paludis/environment.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
@@ -80,8 +79,7 @@ FindReplacingHelper::operator() (
if (repo->installed_root_key())
{
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ;
+ for (auto r(_imp->env->begin_repositories()), r_end(_imp->env->end_repositories()) ;
r != r_end ; ++r)
if ((*r)->installed_root_key() &&
(*r)->installed_root_key()->value() == repo->installed_root_key()->value())
diff --git a/paludis/resolver/find_repository_for_helper.cc b/paludis/resolver/find_repository_for_helper.cc
index ecda6ba..1951b0e 100644
--- a/paludis/resolver/find_repository_for_helper.cc
+++ b/paludis/resolver/find_repository_for_helper.cc
@@ -32,7 +32,6 @@
#include <paludis/metadata_key.hh>
#include <paludis/package_dep_spec_collection.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
using namespace paludis;
@@ -74,8 +73,7 @@ FindRepositoryForHelper::operator() (
{
std::shared_ptr<const Repository> result;
- for (auto r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ;
+ for (auto r(_imp->env->begin_repositories()), r_end(_imp->env->end_repositories()) ;
r != r_end ; ++r)
{
switch (resolution->resolvent().destination_type())
diff --git a/paludis/resolver/make_destination_filtered_generator_helper.cc b/paludis/resolver/make_destination_filtered_generator_helper.cc
index 6dd1d52..b807723 100644
--- a/paludis/resolver/make_destination_filtered_generator_helper.cc
+++ b/paludis/resolver/make_destination_filtered_generator_helper.cc
@@ -29,11 +29,9 @@
#include <paludis/filter_handler.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/generator.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/metadata_key.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
using namespace paludis;
using namespace paludis::resolver;
diff --git a/paludis/resolver/resolver_TEST_any.cc b/paludis/resolver/resolver_TEST_any.cc
index c3829dd..794c7dd 100644
--- a/paludis/resolver/resolver_TEST_any.cc
+++ b/paludis/resolver/resolver_TEST_any.cc
@@ -37,7 +37,6 @@
#include <paludis/util/make_shared_copy.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_TEST_blockers.cc b/paludis/resolver/resolver_TEST_blockers.cc
index 5981d1a..fe15af7 100644
--- a/paludis/resolver/resolver_TEST_blockers.cc
+++ b/paludis/resolver/resolver_TEST_blockers.cc
@@ -36,7 +36,6 @@
#include <paludis/util/make_shared_copy.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_TEST_continue_on_failure.cc b/paludis/resolver/resolver_TEST_continue_on_failure.cc
index 265884b..f4b490b 100644
--- a/paludis/resolver/resolver_TEST_continue_on_failure.cc
+++ b/paludis/resolver/resolver_TEST_continue_on_failure.cc
@@ -40,9 +40,9 @@
#include <paludis/util/tribool.hh>
#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/join.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_TEST_cycles.cc b/paludis/resolver/resolver_TEST_cycles.cc
index 3aa2998..d12c201 100644
--- a/paludis/resolver/resolver_TEST_cycles.cc
+++ b/paludis/resolver/resolver_TEST_cycles.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -35,7 +35,6 @@
#include <paludis/util/make_shared_copy.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_TEST_errors.cc b/paludis/resolver/resolver_TEST_errors.cc
index 30effd7..43a50d1 100644
--- a/paludis/resolver/resolver_TEST_errors.cc
+++ b/paludis/resolver/resolver_TEST_errors.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -35,7 +35,6 @@
#include <paludis/util/make_shared_copy.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_TEST_fetches.cc b/paludis/resolver/resolver_TEST_fetches.cc
index 5693aa0..364015f 100644
--- a/paludis/resolver/resolver_TEST_fetches.cc
+++ b/paludis/resolver/resolver_TEST_fetches.cc
@@ -39,9 +39,9 @@
#include <paludis/util/tribool.hh>
#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/join.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_TEST_purges.cc b/paludis/resolver/resolver_TEST_purges.cc
index 0aad6f1..071495a 100644
--- a/paludis/resolver/resolver_TEST_purges.cc
+++ b/paludis/resolver/resolver_TEST_purges.cc
@@ -37,7 +37,6 @@
#include <paludis/util/return_literal_function.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_TEST_serialisation.cc b/paludis/resolver/resolver_TEST_serialisation.cc
index 28cda34..0962f6e 100644
--- a/paludis/resolver/resolver_TEST_serialisation.cc
+++ b/paludis/resolver/resolver_TEST_serialisation.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 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
@@ -36,7 +36,6 @@
#include <paludis/util/string_list_stream.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/serialise.hh>
#include <paludis/resolver/resolver_test.hh>
diff --git a/paludis/resolver/resolver_TEST_simple.cc b/paludis/resolver/resolver_TEST_simple.cc
index 740802e..1a09da7 100644
--- a/paludis/resolver/resolver_TEST_simple.cc
+++ b/paludis/resolver/resolver_TEST_simple.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -35,8 +35,6 @@
#include <paludis/util/make_shared_copy.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
-
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
diff --git a/paludis/resolver/resolver_TEST_suggestions.cc b/paludis/resolver/resolver_TEST_suggestions.cc
index c0b02ba..8fadb85 100644
--- a/paludis/resolver/resolver_TEST_suggestions.cc
+++ b/paludis/resolver/resolver_TEST_suggestions.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -35,7 +35,6 @@
#include <paludis/util/make_shared_copy.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_TEST_uninstalls.cc b/paludis/resolver/resolver_TEST_uninstalls.cc
index 76a2a8f..37da841 100644
--- a/paludis/resolver/resolver_TEST_uninstalls.cc
+++ b/paludis/resolver/resolver_TEST_uninstalls.cc
@@ -39,7 +39,6 @@
#include <paludis/util/return_literal_function.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_TEST_virtuals.cc b/paludis/resolver/resolver_TEST_virtuals.cc
index cda1512..18cf869 100644
--- a/paludis/resolver/resolver_TEST_virtuals.cc
+++ b/paludis/resolver/resolver_TEST_virtuals.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -35,7 +35,6 @@
#include <paludis/util/make_shared_copy.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index b4f410a..d0a9a56 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -38,9 +38,9 @@
#include <paludis/util/set-impl.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/join.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
@@ -138,7 +138,7 @@ ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s,
keys->insert("builddir", stringify(FSPath::cwd() / ("resolver_TEST_" + t + "_dir") / "build"));
repo = RepositoryFactory::get_instance()->create(&env,
std::bind(from_keys, keys, std::placeholders::_1));
- env.package_database()->add_repository(1, repo);
+ env.add_repository(1, repo);
keys = std::make_shared<Map<std::string, std::string>>();
keys->insert("format", "vdb");
@@ -148,7 +148,7 @@ ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s,
keys->insert("builddir", stringify(FSPath::cwd() / ("resolver_TEST_" + t + "_dir") / "build"));
inst_repo = RepositoryFactory::get_instance()->create(&env,
std::bind(from_keys, keys, std::placeholders::_1));
- env.package_database()->add_repository(1, inst_repo);
+ env.add_repository(1, inst_repo);
fake_inst_repo = std::make_shared<FakeInstalledRepository>(
make_named_values<FakeInstalledRepositoryParams>(
@@ -157,11 +157,11 @@ ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s,
n::suitable_destination() = true,
n::supports_uninstall() = true
));
- env.package_database()->add_repository(1, fake_inst_repo);
+ env.add_repository(1, fake_inst_repo);
#ifdef ENABLE_VIRTUALS_REPOSITORY
- env.package_database()->add_repository(0, RepositoryFactory::get_instance()->create(&env, virtuals_repo_keys));
- env.package_database()->add_repository(0, RepositoryFactory::get_instance()->create(&env, installed_virtuals_repo_keys));
+ env.add_repository(0, RepositoryFactory::get_instance()->create(&env, virtuals_repo_keys));
+ env.add_repository(0, RepositoryFactory::get_instance()->create(&env, installed_virtuals_repo_keys));
#endif
interest_in_spec_helper.set_follow_installed_dependencies(true);
diff --git a/paludis/selection.cc b/paludis/selection.cc
index a5e11a7..30f97fc 100644
--- a/paludis/selection.cc
+++ b/paludis/selection.cc
@@ -188,7 +188,7 @@ namespace
s->insert(*q);
std::shared_ptr<const PackageIDSet> i(_fg.filter().ids(env, _fg.generator().ids(env, r, s, may_excludes)));
if (! i->empty())
- result->push_back(*std::max_element(i->begin(), i->end(), PackageIDComparator(env->package_database().get())));
+ result->push_back(*std::max_element(i->begin(), i->end(), PackageIDComparator(env)));
}
return result;
@@ -230,7 +230,7 @@ namespace
std::shared_ptr<const PackageIDSet> i(_fg.filter().ids(env, _fg.generator().ids(env, r, p, may_excludes)));
std::copy(i->begin(), i->end(), result->back_inserter());
- result->sort(PackageIDComparator(env->package_database().get()));
+ result->sort(PackageIDComparator(env));
return result;
}
@@ -323,7 +323,7 @@ namespace
m->second->push_back(*i);
}
- PackageIDComparator comparator(env->package_database().get());
+ PackageIDComparator comparator(env);
for (SlotMap::iterator i(by_slot.begin()), i_end(by_slot.end()) ;
i != i_end ; ++i)
i->second->sort(comparator);
@@ -390,7 +390,7 @@ namespace
m->second->push_back(*i);
}
- PackageIDComparator comparator(env->package_database().get());
+ PackageIDComparator comparator(env);
for (SlotMap::iterator i(by_slot.begin()), i_end(by_slot.end()) ;
i != i_end ; ++i)
i->second->sort(comparator);
diff --git a/paludis/selection_TEST.cc b/paludis/selection_TEST.cc
index 4d5c820..f40801b 100644
--- a/paludis/selection_TEST.cc
+++ b/paludis/selection_TEST.cc
@@ -25,12 +25,12 @@
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/package_database.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/join.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <test/test_concepts.hh>
@@ -58,7 +58,7 @@ namespace test_cases
r1->add_version("r1c1", "r1c1p2", "2");
r1->add_version("rac1", "rac1pa", "1");
r1->add_version("rac1", "rac1pa", "2");
- env.package_database()->add_repository(11, r1);
+ env.add_repository(11, r1);
TEST_CHECK(true);
std::shared_ptr<FakeRepository> r2(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
@@ -66,7 +66,7 @@ namespace test_cases
n::name() = RepositoryName("repo2"))));
r2->add_version("rac1", "rac1pa", "1");
r2->add_version("rac1", "rac1pa", "3");
- env.package_database()->add_repository(10, r2);
+ env.add_repository(10, r2);
TEST_CHECK(true);
PackageDepSpec d1(parse_user_package_dep_spec("r1c1/r1c1p1", &env, { }));
@@ -125,7 +125,7 @@ namespace test_cases
r1->add_version("cat", "pkg", "2")->set_slot(SlotName("c"));
r1->add_version("cat", "pkg", "3")->set_slot(SlotName("c"));
r1->add_version("cat", "pkg", "4")->set_slot(SlotName("a"));
- env.package_database()->add_repository(10, r1);
+ env.add_repository(10, r1);
TEST_CHECK(true);
std::shared_ptr<FakeRepository> r2(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
@@ -133,7 +133,7 @@ namespace test_cases
n::name() = RepositoryName("repo2"))));
r2->add_version("cat", "pkg", "1")->set_slot(SlotName("a"));
r2->add_version("cat", "pkg", "3")->set_slot(SlotName("b"));
- env.package_database()->add_repository(5, r2);
+ env.add_repository(5, r2);
TEST_CHECK(true);
PackageDepSpec d(parse_user_package_dep_spec("cat/pkg", &env, { }));
@@ -158,7 +158,7 @@ namespace test_cases
n::environment() = &env,
n::name() = RepositoryName("repo3"))));
r3->add_version("cat", "other", "1")->set_slot(SlotName("a"));
- env.package_database()->add_repository(5, r3);
+ env.add_repository(5, r3);
TEST_CHECK(true);
PackageDepSpec c(parse_user_package_dep_spec("cat/*", &env, { updso_allow_wildcards }));
diff --git a/paludis/set_file.cc b/paludis/set_file.cc
index 5fb9892..e3c0f2b 100644
--- a/paludis/set_file.cc
+++ b/paludis/set_file.cc
@@ -33,7 +33,6 @@
#include <paludis/util/env_var_names.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 3ab3f75..ad3c310 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -24,12 +24,14 @@
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
#include <paludis/version_requirements.hh>
-#include <paludis/package_database.hh>
#include <paludis/filter.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/dep_label.hh>
#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/contents.hh>
+#include <paludis/repository.hh>
+
#include <paludis/util/options.hh>
#include <paludis/util/log.hh>
#include <paludis/util/make_named_values.hh>
@@ -42,6 +44,8 @@
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/join.hh>
+
#include <algorithm>
using namespace paludis;
@@ -77,7 +81,7 @@ namespace
{
if (options[updso_no_disambiguation])
throw PackageDepSpecError("Need an explicit category specified");
- result.package(env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(s),
+ result.package(env->fetch_unique_qualified_package_name(PackageNamePart(s),
filter::And(filter, filter::Matches(result, make_null_shared_ptr(), { }))));
}
}
@@ -794,7 +798,7 @@ UserKeyRequirement::requirement_met(
const MetadataKey * key(0);
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (0 == _imp->key.compare(0, 3, "::$"))
{
if (_imp->key == "::$format")
diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc
index edf0397..a5fbf9e 100644
--- a/paludis/user_dep_spec_TEST.cc
+++ b/paludis/user_dep_spec_TEST.cc
@@ -19,7 +19,6 @@
#include <paludis/dep_spec.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/package_database.hh>
#include <paludis/match_package.hh>
#include <paludis/version_requirements.hh>
@@ -31,6 +30,8 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -326,8 +327,8 @@ TEST_F(UserDepSpecTest, Disambiguation)
n::suitable_destination() = true,
n::supports_uninstall() = true
)));
- env.package_database()->add_repository(1, fake);
- env.package_database()->add_repository(2, fake_inst);
+ env.add_repository(1, fake);
+ env.add_repository(2, fake_inst);
fake->add_version("cat", "pkg1", "1");
fake->add_version("cat", "pkg2", "1");
fake->add_version("dog", "pkg2", "1");
@@ -377,7 +378,7 @@ TEST(UserPackageDepSpec, Sets)
std::shared_ptr<FakeRepository> fake(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
n::name() = RepositoryName("fake"))));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
fake->add_version("cat", "world", "1");
fake->add_version("cat", "moon", "1");
@@ -405,7 +406,7 @@ TEST_F(UserDepSpecTest, Keys)
std::shared_ptr<FakeRepository> fake(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
n::name() = RepositoryName("fake"))));
- env.package_database()->add_repository(1, fake);
+ env.add_repository(1, fake);
std::shared_ptr<FakePackageID> pkg1(fake->add_version("cat", "pkg1", "1"));
pkg1->keywords_key()->set_from_string("~a ~b");
diff --git a/python/Makefile.am b/python/Makefile.am
index 4164596..4a27595 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -38,7 +38,6 @@ IF_PYTHON_TESTS = \
mask_TEST.py \
metadata_key_TEST.py \
name_TEST.py \
- package_database_TEST.py \
package_id_TEST.py \
repository_TEST.py \
selection_TEST.py \
@@ -70,7 +69,6 @@ IF_PYTHON_SOURCES = \
name.cc \
nice_names-nn.hh nice_names-nn.cc \
log.cc \
- package_database.cc \
package_id.cc \
repository.cc \
selection.cc \
@@ -89,7 +87,6 @@ EXTRA_DIST = $(IF_PYTHON_TESTS) $(IF_PYTHON_SOURCES) \
mask_TEST_setup.sh mask_TEST_cleanup.sh \
metadata_key_TEST_setup.sh metadata_key_TEST_cleanup.sh \
nice_names.nn \
- package_database_TEST_setup.sh package_database_TEST_cleanup.sh \
package_id_TEST_setup.sh package_id_TEST_cleanup.sh \
repository_TEST_setup.sh repository_TEST_cleanup.sh \
paludis_output_wrapper.py
diff --git a/python/additional_tests.cc b/python/additional_tests.cc
index ee0b13e..68e08bf 100644
--- a/python/additional_tests.cc
+++ b/python/additional_tests.cc
@@ -28,7 +28,6 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/environment.hh>
#include <paludis/environments/test/test_environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/mask.hh>
@@ -50,7 +49,7 @@ namespace environment
n::environment() = &e,
n::name() = RepositoryName("fakerepo"))));
std::shared_ptr<PackageID> pid(repo->add_version("cat", "pkg", "1.0"));
- e.package_database()->add_repository(0, repo);
+ e.add_repository(0, repo);
bool PALUDIS_ATTRIBUTE((unused)) b2(e.accept_license("l", pid));
@@ -64,8 +63,6 @@ namespace environment
bool PALUDIS_ATTRIBUTE((unused)) b4(e.unmasked_by_user(pid, ""));
- e.package_database();
-
e.bashrc_files();
e.syncers_dirs();
diff --git a/python/choices_TEST.py b/python/choices_TEST.py
index b824d32..ad69d1f 100644
--- a/python/choices_TEST.py
+++ b/python/choices_TEST.py
@@ -32,7 +32,7 @@ Log.instance.log_level = LogLevel.WARNING
class TestCase_01_Choices(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
self.choices = self.pid.find_metadata("PALUDIS_CHOICES").value()
def test_01_choices(self):
@@ -58,7 +58,7 @@ class TestCase_01_Choices(unittest.TestCase):
class TestCase_02_Choice(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
self.choices = self.pid.find_metadata("PALUDIS_CHOICES").value()
self.use = None
self.linguas = None
@@ -107,7 +107,7 @@ class TestCase_02_Choice(unittest.TestCase):
class TestCase_03_ChoiceValue(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
self.choices = self.pid.find_metadata("PALUDIS_CHOICES").value()
self.use_testflag = self.choices.find_by_name_with_prefix("testflag")
self.linguas_en = self.choices.find_by_name_with_prefix("linguas_en")
diff --git a/python/environment.cc b/python/environment.cc
index 71dca0f..d208bb2 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -21,21 +21,26 @@
#include <python/exception.hh>
#include <python/iterable.hh>
-#include <paludis/environment.hh>
-#include <paludis/environment_factory.hh>
#include <paludis/environments/paludis/paludis_environment.hh>
#include <paludis/environments/paludis/paludis_config.hh>
+
#include <paludis/environments/no_config/no_config_environment.hh>
+
#include <paludis/environments/test/test_environment.hh>
+
#include <paludis/hook.hh>
#include <paludis/package_id.hh>
#include <paludis/selection.hh>
#include <paludis/spec_tree.hh>
+#include <paludis/filter.hh>
+#include <paludis/standard_output_manager.hh>
+#include <paludis/environment.hh>
+#include <paludis/environment_factory.hh>
+
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/standard_output_manager.hh>
using namespace paludis;
using namespace paludis::python;
@@ -45,12 +50,8 @@ class EnvironmentImplementationWrapper :
public EnvironmentImplementation,
public bp::wrapper<EnvironmentImplementation>
{
- private:
- std::shared_ptr<PackageDatabase> _db;
-
public:
- EnvironmentImplementationWrapper() :
- _db(std::make_shared<PackageDatabase>(this))
+ EnvironmentImplementationWrapper()
{
}
@@ -119,18 +120,6 @@ class EnvironmentImplementationWrapper :
throw PythonMethodNotImplemented("EnvironmentImplementation", "unmasked_by_user");
}
- virtual std::shared_ptr<PackageDatabase> package_database()
- PALUDIS_ATTRIBUTE((warn_unused_result))
- {
- return _db;
- }
-
- virtual std::shared_ptr<const PackageDatabase> package_database() const
- PALUDIS_ATTRIBUTE((warn_unused_result))
- {
- return _db;
- }
-
virtual std::shared_ptr<const FSPathSequence> bashrc_files() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -429,8 +418,16 @@ class EnvironmentImplementationWrapper :
{
throw PythonMethodNotImplemented("EnvironmentImplementation", "update_config_files_for_package_move");
}
+
+ virtual QualifiedPackageName fetch_unique_qualified_package_name(
+ const PackageNamePart &, const Filter & = all_filter(), const bool disambiguate = true) const
+ {
+ throw PythonMethodNotImplemented("EnvironmentImplementation", "fetch_unique_qualified_package_name");
+ }
};
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(fetch_unique_qualified_package_name_overloads, fetch_unique_qualified_package_name, 1, 3)
+
struct NoConfigEnvironmentWrapper :
NoConfigEnvironment
{
@@ -495,11 +492,11 @@ void expose_environment()
)
;
+ const std::shared_ptr<Repository> (Environment::* fetch_repository_ptr)(const RepositoryName &) = &Environment::fetch_repository;
+
/**
* Environment
*/
- std::shared_ptr<PackageDatabase> (Environment::* package_database)() =
- &Environment::package_database;
bp::class_<Environment, std::shared_ptr<Environment>, boost::noncopyable>
(
"Environment",
@@ -507,11 +504,6 @@ void expose_environment()
"and provides various methods for querying package visibility and options.",
bp::no_init
)
- .add_property("package_database", bp::make_function(package_database,
- bp::with_custodian_and_ward_postcall<0, 1>()),
- "[ro] PackageDatabase\n"
- "Our package database."
- )
.def("set", &Environment::set,
"set(SetName) -> DepSpec\n"
@@ -527,6 +519,30 @@ void expose_environment()
"[selection] -> list of PackageID\n"
"Return PackageID instances matching a given selection."
)
+
+ .def("fetch_repository", fetch_repository_ptr, bp::with_custodian_and_ward_postcall<0, 1>(),
+ "fetch_repository(RepositoryName) -> Repository\n"
+ "Fetch a named repository."
+ )
+
+ .def("fetch_unique_qualified_package_name", &Environment::fetch_unique_qualified_package_name,
+ fetch_unique_qualified_package_name_overloads(
+ "fetch_unique_qualified_package_name(PackageNamePart[, Filter[, bool]]) -> QualifiedPackageName\n"
+ "Disambiguate a package name. If a filter is specified, "
+ "limit the potential results to packages that match."
+ )
+ )
+
+ .def("more_important_than", &Environment::more_important_than,
+ "more_important_than(RepositoryName, RepositoryName) -> bool\n"
+ "Return true if the first repository is more important than the second."
+ )
+
+ .add_property("repositories",
+ bp::range(&Environment::begin_repositories, &Environment::end_repositories),
+ "[ro] Iterable of Repository\n"
+ "Our repositories"
+ )
;
/**
@@ -534,6 +550,7 @@ void expose_environment()
*/
typedef EnvironmentImplementation EnvImp;
typedef EnvironmentImplementationWrapper EnvImpW;
+
bp::class_<EnvironmentImplementationWrapper, std::shared_ptr<EnvironmentImplementationWrapper>,
bp::bases<Environment>, boost::noncopyable>
(
@@ -631,6 +648,31 @@ void expose_environment()
"[selection] -> list of PackageID\n"
"Return PackageID instances matching a given selection."
)
+
+ .def("fetch_repository", fetch_repository_ptr, bp::with_custodian_and_ward_postcall<0, 1>(),
+ "fetch_repository(RepositoryName) -> Repository\n"
+ "Fetch a named repository."
+ )
+
+ .def("fetch_unique_qualified_package_name", &EnvImpW::fetch_unique_qualified_package_name,
+ fetch_unique_qualified_package_name_overloads(
+ "fetch_unique_qualified_package_name(PackageNamePart[, Filter[, bool]]) -> QualifiedPackageName\n"
+ "Disambiguate a package name. If a filter is specified, "
+ "limit the potential results to packages that match."
+ )
+ )
+
+ .def("more_important_than", &EnvImpW::more_important_than,
+ "more_important_than(RepositoryName, RepositoryName) -> bool\n"
+ "Return true if the first repository is more important than the second."
+ )
+
+ .add_property("repositories",
+ bp::range(&EnvImpW::begin_repositories, &EnvImpW::end_repositories),
+ "[ro] Iterable of Repository\n"
+ "Our repositories"
+ )
+ ;
;
/**
@@ -688,5 +730,21 @@ void expose_environment()
"control all the options rather than reading them from configuration files.",
bp::init<>("__init__()")
);
+
+ ExceptionRegister::get_instance()->add_exception<DuplicateRepositoryError>
+ ("DuplicateRepositoryError", "BaseException",
+ "Thrown if a Repository with the same name as an existing member is added to an Environment.");
+
+ ExceptionRegister::get_instance()->add_exception<AmbiguousPackageNameError>
+ ("AmbiguousPackageNameError", "BaseException",
+ "Thrown if an Environment query results in more than one matching Package.");
+
+ ExceptionRegister::get_instance()->add_exception<NoSuchPackageError>
+ ("NoSuchPackageError", "BaseException",
+ "Thrown if there is no Package in an Environment with the given name.");
+
+ ExceptionRegister::get_instance()->add_exception<NoSuchRepositoryError>
+ ("NoSuchRepositoryError", "BaseException",
+ "Thrown if there is no Repository in a RepositoryDatabase with the given name.");
}
diff --git a/python/environment_TEST.py b/python/environment_TEST.py
index 0e580ed..a9e62d6 100755
--- a/python/environment_TEST.py
+++ b/python/environment_TEST.py
@@ -51,10 +51,6 @@ class TestCase_01_Environments(unittest.TestCase):
def test_03_subclass(self):
self.assert_(isinstance(NoConfigEnvironment(repo), Environment))
- def test_06_package_database(self):
- self.assert_(isinstance(self.e.package_database, PackageDatabase))
- self.assert_(isinstance(self.nce.package_database, PackageDatabase))
-
def test_07_sets(self):
self.assert_(isinstance(self.e.set("everything"), AllDepSpec))
self.assert_(isinstance(self.nce.set("everything"), AllDepSpec))
@@ -73,9 +69,28 @@ class TestCase_01_Environments(unittest.TestCase):
def test_12_config_dir(self):
self.assert_(isinstance(self.e.config_dir, str))
+ def test_23_fech_unique_qpn(self):
+ self.assertEqual(str(QualifiedPackageName("foo/bar")), str(self.e.fetch_unique_qualified_package_name("bar")))
+ self.assertEqual(str(QualifiedPackageName("foo/bar")), str(self.e.fetch_unique_qualified_package_name("bar",
+ Filter.SupportsInstallAction())))
+
+ def test_24_exceptions(self):
+ self.assertRaises(NoSuchPackageError, self.e.fetch_unique_qualified_package_name, "baz")
+ self.assertRaises(NoSuchPackageError, self.e.fetch_unique_qualified_package_name, "foobarbaz")
+ self.assertRaises(NoSuchPackageError, self.e.fetch_unique_qualified_package_name, "bar",
+ Filter.SupportsUninstallAction())
+
+ def test_26_repositories(self):
+ if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
+ self.assert_(self.e.more_important_than("testrepo", "virtuals"))
+ self.assert_(not self.e.more_important_than("virtuals", "testrepo"))
+ self.assertRaises(NoSuchRepositoryError, self.e.fetch_repository, "blah")
+
+ self.assertEqual(len(list(self.e.repositories)), 3)
+
class TestCase_03_TestEnvironment(unittest.TestCase):
def test_01_create(self):
- env = TestEnvironment()
+ e = TestEnvironment()
class TestCase_04_Environment_subclassingd(unittest.TestCase):
class SubEnv(EnvironmentImplementation):
diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py
index 9d6a74a..b428a30 100755
--- a/python/metadata_key_TEST.py
+++ b/python/metadata_key_TEST.py
@@ -34,8 +34,8 @@ class TestCase_01_MetadataKeys(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
self.ie = NoConfigEnvironment(irepo_path)
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
- self.ipid = iter(self.ie.package_database.fetch_repository("installed").package_ids("cat-one/pkg-one", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.ipid = iter(self.ie.fetch_repository("installed").package_ids("cat-one/pkg-one", [])).next()
def test_01_contents(self):
self.assertEquals(self.pid.find_metadata("CONTENTS"), None)
@@ -73,7 +73,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
def value(self):
e = NoConfigEnvironment(repo_path, "/var/empty")
- pid = iter(e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ pid = iter(e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
return pid
def raw_name(self):
diff --git a/python/package_database.cc b/python/package_database.cc
deleted file mode 100644
index f14b412..0000000
--- a/python/package_database.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Piotr Jaroszyński
- *
- * 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
- */
-
-#include <python/paludis_python.hh>
-#include <python/exception.hh>
-
-#include <paludis/dep_spec.hh>
-#include <paludis/environment.hh>
-#include <paludis/filter.hh>
-#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-
-using namespace paludis;
-using namespace paludis::python;
-namespace bp = boost::python;
-
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(
- fetch_unique_qualified_package_name_overloads, fetch_unique_qualified_package_name, 1, 2)
-
-void expose_package_database()
-{
- /**
- * Exceptions
- */
- ExceptionRegister::get_instance()->add_exception<PackageDatabaseError>
- ("PackageDatabaseError", "BaseException",
- "A PackageDatabaseError is an error that occurs when performing some operation upon a PackageDatabase.");
- ExceptionRegister::get_instance()->add_exception<DuplicateRepositoryError>
- ("DuplicateRepositoryError", "PackageDatabaseError",
- "Thrown if a Repository with the same name as an existing member is added to a PackageDatabase.");
- ExceptionRegister::get_instance()->add_exception<PackageDatabaseLookupError>
- ("PackageDatabaseLookupError", "PackageDatabaseError",
- "A PackageDatabaseLookupError descendent is thrown if an error occurs "
- "when looking for something in a PackageDatabase.");
- ExceptionRegister::get_instance()->add_exception<AmbiguousPackageNameError>
- ("AmbiguousPackageNameError", "PackageDatabaseLookupError",
- "Thrown if a PackageDatabase query results in more than one matching Package.");
- ExceptionRegister::get_instance()->add_exception<NoSuchPackageError>
- ("NoSuchPackageError", "PackageDatabaseLookupError",
- "Thrown if there is no Package in a PackageDatabase with the given name.");
- ExceptionRegister::get_instance()->add_exception<NoSuchRepositoryError>
- ("NoSuchRepositoryError", "PackageDatabaseLookupError",
- "Thrown if there is no Repository in a RepositoryDatabase with the given name.");
-
- /**
- * PackageDatabase
- */
- register_shared_ptrs_to_python<PackageDatabase>();
- std::shared_ptr<Repository>
- (PackageDatabase::* fetch_repository_ptr)(const RepositoryName &) = &PackageDatabase::fetch_repository;
- bp::class_<PackageDatabase, boost::noncopyable>
- (
- "PackageDatabase",
- "A PackageDatabase can be queried for Package instances.\n",
- bp::no_init
- )
-
- .def("fetch_repository", fetch_repository_ptr, bp::with_custodian_and_ward_postcall<0, 1>(),
- "fetch_repository(RepositoryName) -> Repository\n"
- "Fetch a named repository."
- )
-
- .def("fetch_unique_qualified_package_name", &PackageDatabase::fetch_unique_qualified_package_name,
- fetch_unique_qualified_package_name_overloads(
- "fetch_unique_qualified_package_name(PackageNamePart[, Filter]) -> QualifiedPackageName\n"
- "Disambiguate a package name. If a filter is specified, "
- "limit the potential results to packages that match."
- )
- )
-
- .def("more_important_than", &PackageDatabase::more_important_than,
- "more_important_than(RepositoryName, RepositoryName) -> bool\n"
- "Return true if the first repository is more important than the second."
- )
-
- .add_property("repositories",
- bp::range(&PackageDatabase::begin_repositories, &PackageDatabase::end_repositories),
- "[ro] Iterable of Repository\n"
- "Our repositories"
- )
- ;
-}
diff --git a/python/package_database_TEST.py b/python/package_database_TEST.py
deleted file mode 100755
index d5598f9..0000000
--- a/python/package_database_TEST.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-# vim: set fileencoding=utf-8 sw=4 sts=4 et :
-
-#
-# Copyright (c) 2007 Piotr Jaroszyński
-#
-# 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
-#
-
-import os
-
-os.environ["PALUDIS_HOME"] = os.path.join(os.getcwd(), "package_database_TEST_dir/home")
-
-from paludis import *
-import unittest
-
-Log.instance.log_level = LogLevel.WARNING
-
-class TestCase_PackageDatabase(unittest.TestCase):
- def get_db(self):
- self.env = EnvironmentFactory.instance.create("")
- self.db = self.env.package_database
-
- def test_01_create_error(self):
- self.assertRaises(Exception, PackageDatabase)
-
- def test_03_fech_unique_qpn(self):
- self.get_db()
- self.assertEqual(str(QualifiedPackageName("foo/bar")), str(self.db.fetch_unique_qualified_package_name("bar")))
- self.assertEqual(str(QualifiedPackageName("foo/bar")), str(self.db.fetch_unique_qualified_package_name("bar",
- Filter.SupportsInstallAction())))
-
- def test_04_exceptions(self):
- self.get_db()
- self.assertRaises(AmbiguousPackageNameError, self.db.fetch_unique_qualified_package_name, "baz")
- self.assertRaises(NoSuchPackageError, self.db.fetch_unique_qualified_package_name, "foobarbaz")
- self.assertRaises(NoSuchPackageError, self.db.fetch_unique_qualified_package_name, "bar",
- Filter.SupportsUninstallAction())
-
- def test_6_repositories(self):
- if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
- self.get_db()
- self.assert_(self.db.more_important_than("testrepo", "virtuals"))
- self.assert_(not self.db.more_important_than("virtuals", "testrepo"))
- self.assertRaises(NoSuchRepositoryError, self.db.fetch_repository, "blah")
-
- self.assertEqual(len(list(self.db.repositories)), 3)
-
-if __name__ == "__main__":
- unittest.main()
-
diff --git a/python/package_database_TEST_cleanup.sh b/python/package_database_TEST_cleanup.sh
deleted file mode 100755
index 761b885..0000000
--- a/python/package_database_TEST_cleanup.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d package_database_TEST_dir ] ; then
- rm -fr package_database_TEST_dir
-else
- true
-fi
diff --git a/python/package_database_TEST_setup.sh b/python/package_database_TEST_setup.sh
deleted file mode 100755
index 6603e54..0000000
--- a/python/package_database_TEST_setup.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir package_database_TEST_dir || exit 1
-cd package_database_TEST_dir || exit 1
-
-mkdir -p home/.paludis/repositories
-
-cat <<END > home/.paludis/repositories/testrepo.conf
-location = `pwd`/testrepo
-format = e
-names_cache = /var/empty
-cache = /var/empty
-profiles = \${location}/profiles/testprofile
-builddir = `pwd`
-END
-
-cat <<END > home/.paludis/keywords.conf
-*/* test
-~foo/bar-1 ~test
-END
-
-cat <<END > home/.paludis/use.conf
-*/* enabled
-~foo/bar-1 sometimes_enabled
-END
-
-cat <<END > home/.paludis/licenses.conf
-*/* *
-END
-
-cat <<END > home/.paludis/general.conf
-world = /dev/null
-END
-
-mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files,foo/baz/files,quux/baz/files} || exit 1
-cd testrepo || exit 1
-echo "testrepo" > profiles/repo_name || exit 1
-cat <<END > profiles/categories || exit 1
-foo
-quux
-END
-cat <<END > profiles/testprofile/make.defaults
-ARCH=test
-USERLAND=test
-KERNEL=test
-END
-
-cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > foo/bar/bar-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="~test"
-END
-
-cat <<"END" > foo/baz/baz-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > quux/baz/baz-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cd ..
diff --git a/python/package_id_TEST.py b/python/package_id_TEST.py
index 123387e..4982b5e 100755
--- a/python/package_id_TEST.py
+++ b/python/package_id_TEST.py
@@ -32,11 +32,11 @@ class TestCase_01_PackageID(unittest.TestCase):
def setUp(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
self.ie = NoConfigEnvironment(irepo_path)
- self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
+ self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next()
if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
- self.vpid = iter(self.e.package_database.fetch_repository("virtuals").package_ids("virtual/bar", [])).next()
- self.ipid = iter(self.ie.package_database.fetch_repository("installed").package_ids("cat-one/pkg-one", [])).next()
- self.mpid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("cat/masked", [])).next()
+ self.vpid = iter(self.e.fetch_repository("virtuals").package_ids("virtual/bar", [])).next()
+ self.ipid = iter(self.ie.fetch_repository("installed").package_ids("cat-one/pkg-one", [])).next()
+ self.mpid = iter(self.e.fetch_repository("testrepo").package_ids("cat/masked", [])).next()
def test_01_get(self):
pass
diff --git a/python/paludis_python.hh b/python/paludis_python.hh
index 496ecc6..aacf7be 100644
--- a/python/paludis_python.hh
+++ b/python/paludis_python.hh
@@ -188,7 +188,6 @@ void expose_mask() PALUDIS_VISIBLE;
void expose_match_package() PALUDIS_VISIBLE;
void expose_metadata_key() PALUDIS_VISIBLE;
void expose_name() PALUDIS_VISIBLE;
-void expose_package_database() PALUDIS_VISIBLE;
void expose_package_id() PALUDIS_VISIBLE;
void expose_repository() PALUDIS_VISIBLE;
void expose_selection() PALUDIS_VISIBLE;
diff --git a/python/paludis_python_so.cc b/python/paludis_python_so.cc
index 9380435..f8b4e3e 100644
--- a/python/paludis_python_so.cc
+++ b/python/paludis_python_so.cc
@@ -47,7 +47,6 @@ BOOST_PYTHON_MODULE(paludis)
expose_match_package();
expose_package_id();
expose_action();
- expose_package_database();
expose_repository();
expose_filtered_generator();
expose_generator();
diff --git a/python/repository.cc b/python/repository.cc
index 6cc4756..e1cc5e0 100644
--- a/python/repository.cc
+++ b/python/repository.cc
@@ -124,7 +124,7 @@ void expose_repository()
bp::class_<RepositoryWrapper, std::shared_ptr<Repository>, boost::noncopyable>
(
"Repository",
- "A Repository provides a representation of a physical repository to a PackageDatabase.",
+ "A Repository provides a representation of a physical repository to an Environment.",
bp::no_init
)
@@ -167,7 +167,7 @@ void expose_repository()
"some_ids_might_support_action(SupportsActionTestBase) -> bool\n"
"Might some of our IDs support a particular action?\n\n"
- "Used to optimise PackageDatabase::query. If a repository doesn't\n"
+ "Used to optimise Environment::[]. If a repository doesn't\n"
"support, say, InstallAction, a query can skip searching it\n"
"entirely when looking for installable packages."
)
diff --git a/python/repository_TEST.py b/python/repository_TEST.py
index 711efbe..7c9ebfc 100755
--- a/python/repository_TEST.py
+++ b/python/repository_TEST.py
@@ -34,12 +34,11 @@ Log.instance.log_level = LogLevel.WARNING
class TestCase_01_Repository(unittest.TestCase):
def setUp(self):
- global e, nce, db, repo, irepo
+ global e, nce, repo, irepo
e = EnvironmentFactory.instance.create("")
nce = NoConfigEnvironment(repo_path)
- db = e.package_database
- repo = db.fetch_repository("testrepo")
- irepo = db.fetch_repository("installed")
+ repo = e.fetch_repository("testrepo")
+ irepo = e.fetch_repository("installed")
def test_01_fetch(self):
self.assert_(isinstance(repo, Repository))
@@ -101,12 +100,11 @@ class TestCase_01_Repository(unittest.TestCase):
class TestCase_02_RepositoryInterfaces(unittest.TestCase):
def setUp(self):
- global e, nce, db, repo, irepo
+ global e, nce, repo, irepo
e = EnvironmentFactory.instance.create("")
nce = NoConfigEnvironment(repo_path)
- db = e.package_database
- repo = db.fetch_repository("testrepo")
- irepo = db.fetch_repository("installed")
+ repo = e.fetch_repository("testrepo")
+ irepo = e.fetch_repository("installed")
def test_06_environment_variable_interface(self):
evi = repo.environment_variable_interface
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 149d06a..ade8df5 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -28,7 +28,6 @@ IF_RUBY_TESTS = \
filtered_generator_TEST.rb \
generator_TEST.rb \
log_TEST.rb \
- package_database_TEST.rb \
package_id_TEST.rb \
paludis_ruby_TEST.rb \
qualified_package_name_TEST.rb \
@@ -51,7 +50,6 @@ IF_RUBY_SOURCES = \
metadata_key.cc \
name.cc \
nice_names-nn.hh nice_names-nn.cc \
- package_database.cc \
package_id.cc \
paludis_ruby.cc paludis_ruby.hh \
qualified_package_name.cc \
@@ -69,7 +67,6 @@ EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \
environment_TEST_setup.sh environment_TEST_cleanup.sh \
generator_TEST_setup.sh generator_TEST_cleanup.sh \
nice_names.nn \
- package_database_TEST_setup.sh package_database_TEST_cleanup.sh \
package_id_TEST_setup.sh package_id_TEST_cleanup.sh \
paludis_ruby_TEST_setup.sh paludis_ruby_TEST_cleanup.sh \
repository_TEST_setup.sh repository_TEST_cleanup.sh \
diff --git a/ruby/choice_TEST.rb b/ruby/choice_TEST.rb
index 1dd94d9..20f9ddf 100644
--- a/ruby/choice_TEST.rb
+++ b/ruby/choice_TEST.rb
@@ -2,7 +2,7 @@
# vim: set sw=4 sts=4 et tw=80 :
#
-# Copyright (c) 2008 Ciaran McCreesh
+# Copyright (c) 2008, 2011 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
@@ -33,7 +33,7 @@ module Paludis
end
def pid
- env.package_database.fetch_repository("testrepo").package_ids("foo/bar").first
+ env.fetch_repository("testrepo").package_ids("foo/bar").first
end
def choices
diff --git a/ruby/demos/find_unmanaged_files.rb b/ruby/demos/find_unmanaged_files.rb
index c15f5a7..d41f7c1 100755
--- a/ruby/demos/find_unmanaged_files.rb
+++ b/ruby/demos/find_unmanaged_files.rb
@@ -72,7 +72,6 @@ opts.each do | opt, arg |
end
env = Paludis::EnvironmentFactory.instance.create env_spec
-db = env.package_database
root = env.preferred_root_key.value[-1] == ?/ ? env.preferred_root_key.value.chop : env.preferred_root_key.value
directories = []
diff --git a/ruby/demos/latest_stable.rb b/ruby/demos/latest_stable.rb
index 0a86079..5ddc5ab 100755
--- a/ruby/demos/latest_stable.rb
+++ b/ruby/demos/latest_stable.rb
@@ -100,7 +100,7 @@ def check_one_package(env, search_keywords, repo, pkg)
end
end
-env.package_database.repositories.each do |repo|
+env.repositories.each do |repo|
next if repo.virtuals_interface.nil?
repo.category_names.each do |cat|
repo.package_names(cat).each do |pkg|
diff --git a/ruby/demos/playman.rb b/ruby/demos/playman.rb
index 3d55bc5..730274b 100755
--- a/ruby/demos/playman.rb
+++ b/ruby/demos/playman.rb
@@ -146,7 +146,7 @@ if ARGV.empty?
end
end
-repositories = $env.package_database.repositories
+repositories = $env.repositories
begin
req = Net::HTTP::Get.new($laymanglobal_url.request_uri)
diff --git a/ruby/demos/version_spec_distributions.rb b/ruby/demos/version_spec_distributions.rb
index bac3e19..582a63a 100755
--- a/ruby/demos/version_spec_distributions.rb
+++ b/ruby/demos/version_spec_distributions.rb
@@ -130,7 +130,7 @@ end
distribution = Distribution.new
env = Paludis::NoConfigEnvironment.new repository_dir, write_cache_dir, master_repository_dir
-env.package_database.repositories.each do | repo |
+env.repositories.each do | repo |
distribution.add_repository repo
end
if output_image
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 405d2d0..9f6790b 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -915,7 +915,7 @@ namespace
* GotASetNotAPackageDepSpec exception if the string is a set name and :no_disambiguation
* to disallow disambiguation (require an explicit category). The Filter, if
* provided, is used to restrict disambiguation as per
- * PackageDatabase#fetch_unique_qualified_package_name.
+ * Environment#fetch_unique_qualified_package_name.
*
*/
VALUE paludis_parse_user_dep_spec(int argc, VALUE * argv, VALUE)
diff --git a/ruby/environment.cc b/ruby/environment.cc
index 6f86ab0..ac9db11 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -67,25 +67,6 @@ namespace
/*
* call-seq:
- * package_database -> PackageDatabase
- *
- * Fetch our PackageDatabase.
- */
- VALUE
- environment_package_database(VALUE self)
- {
- try
- {
- return package_database_to_value(value_to_environment(self)->package_database());
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
* set(set_name) -> DepSpec
*
* Fetch a named package set as a DepSpec.
@@ -439,6 +420,164 @@ namespace
}
}
+ /*
+ * call-seq:
+ * fetch_unique_qualified_package_name(package_name) -> QualifiedPackageName
+ * fetch_unique_qualified_package_name(package_name, filter) -> QualifiedPackageName
+ *
+ * Disambiguate a package name. If a filter is specified, limit
+ * the potential results to packages that match.
+ */
+ VALUE
+ environment_fetch_unique_qualified_package_name(int argc, VALUE *argv, VALUE self)
+ {
+ try
+ {
+ if (1 == argc || 2 == argc)
+ {
+ std::shared_ptr<Environment> * self_ptr;
+ Data_Get_Struct(self, std::shared_ptr<Environment>, self_ptr);
+ return qualified_package_name_to_value((*self_ptr)->fetch_unique_qualified_package_name(
+ PackageNamePart(StringValuePtr(argv[0])), 2 == argc ? value_to_filter(argv[1]) : filter::All()));
+ }
+ else
+ rb_raise(rb_eArgError, "fetch_unique_qualified_package_name expects one or two arguments, but got %d",argc);
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * repositories -> Array
+ * repositories {|repository| block } -> Nil
+ *
+ * Returns all the repositories in the package database, either as an Array, or as
+ * the parameters to a block.
+ */
+ VALUE
+ environment_repositories(VALUE self)
+ {
+ try
+ {
+ std::shared_ptr<Environment> * self_ptr;
+ Data_Get_Struct(self, std::shared_ptr<Environment>, self_ptr);
+
+ if (rb_block_given_p())
+ {
+ for (Environment::RepositoryConstIterator r((*self_ptr)->begin_repositories()),
+ r_end((*self_ptr)->end_repositories()) ; r != r_end ; ++r)
+ rb_yield(repository_to_value(*r));
+ return Qnil;
+ }
+ VALUE result(rb_ary_new());
+ for (Environment::RepositoryConstIterator r((*self_ptr)->begin_repositories()),
+ r_end((*self_ptr)->end_repositories()) ; r != r_end ; ++r)
+ rb_ary_push(result, repository_to_value(*r));
+
+ return result;
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * fetch_repository(repository_name) -> Repository
+ *
+ * Fetch a named repository.
+ */
+ VALUE
+ environment_fetch_repository(VALUE self, VALUE name)
+ {
+ try
+ {
+ std::shared_ptr<Environment> * self_ptr;
+ Data_Get_Struct(self, std::shared_ptr<Environment>, self_ptr);
+
+ return repository_to_value((*self_ptr)->fetch_repository(RepositoryName(StringValuePtr(name))));
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * more_important_than(repository_name_a, repository_name_b) -> bool
+ *
+ * True if repository_name_a is more important than repository_name_b .
+ */
+ VALUE
+ environment_more_important_than(VALUE self, VALUE name1, VALUE name2)
+ {
+ try
+ {
+ std::shared_ptr<Environment> * self_ptr;
+ Data_Get_Struct(self, std::shared_ptr<Environment>, self_ptr);
+
+ return (*self_ptr)->more_important_than(RepositoryName(StringValuePtr(name1)),
+ RepositoryName(StringValuePtr(name2))) ? Qtrue : Qfalse;
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * has_repository_named?(repository_name) -> true or false
+ *
+ * Do we have a named repository?
+ */
+ VALUE
+ environment_has_repository_named(VALUE self, VALUE name)
+ {
+ try
+ {
+ std::shared_ptr<Environment> * self_ptr;
+ Data_Get_Struct(self, std::shared_ptr<Environment>, self_ptr);
+
+ return ((*self_ptr)->has_repository_named(RepositoryName(StringValuePtr(name)))) ? true : false;
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * add_repository(importance, repository) -> nil
+ *
+ * Add a repository.
+ */
+ VALUE
+ environment_add_repository(VALUE self, VALUE importance, VALUE repo_v)
+ {
+ try
+ {
+ std::shared_ptr<Environment> * self_ptr;
+ Data_Get_Struct(self, std::shared_ptr<Environment>, self_ptr);
+
+ std::shared_ptr<Repository> repo(value_to_repository(repo_v));
+
+ (*self_ptr)->add_repository(NUM2INT(importance), repo);
+ return Qnil;
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+
void do_register_environment()
{
rb_require("singleton");
@@ -451,7 +590,6 @@ namespace
*/
c_environment = rb_define_class_under(paludis_module(), "Environment", rb_cObject);
rb_funcall(c_environment, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_environment, "package_database", RUBY_FUNC_CAST(&environment_package_database), 0);
rb_define_method(c_environment, "set", RUBY_FUNC_CAST(&environment_set), 1);
rb_define_method(c_environment, "distribution", RUBY_FUNC_CAST(&environment_distribution), 0);
rb_define_method(c_environment, "accept_license", RUBY_FUNC_CAST(&environment_accept_license), 2);
@@ -464,6 +602,18 @@ namespace
RUBY_FUNC_CAST((&EnvironmentKey<MetadataValueKey<FSPath>, &Environment::config_location_key>::fetch)), 0);
rb_define_method(c_environment, "preferred_root_key",
RUBY_FUNC_CAST((&EnvironmentKey<MetadataValueKey<FSPath>, &Environment::preferred_root_key>::fetch)), 0);
+ rb_define_method(c_environment, "fetch_unique_qualified_package_name",
+ RUBY_FUNC_CAST(&environment_fetch_unique_qualified_package_name), -1);
+ rb_define_method(c_environment, "repositories",
+ RUBY_FUNC_CAST(&environment_repositories), 0);
+ rb_define_method(c_environment, "fetch_repository",
+ RUBY_FUNC_CAST(&environment_fetch_repository), 1);
+ rb_define_method(c_environment, "more_important_than",
+ RUBY_FUNC_CAST(&environment_more_important_than), 2);
+ rb_define_method(c_environment, "has_repository_named?",
+ RUBY_FUNC_CAST(&environment_has_repository_named), 1);
+ rb_define_method(c_environment, "add_repository",
+ RUBY_FUNC_CAST(&environment_add_repository), 2);
/*
* Document-class: Paludis::PaludisEnvironment
diff --git a/ruby/environment_TEST.rb b/ruby/environment_TEST.rb
index 536850d..fd348ec 100644
--- a/ruby/environment_TEST.rb
+++ b/ruby/environment_TEST.rb
@@ -129,36 +129,6 @@ module Paludis
end
end
- class TestCase_EnvironmentPackageDatabase < Test::Unit::TestCase
- def env
- @env or @env = EnvironmentFactory.instance.create("")
- end
-
- def db
- env.package_database
- end
-
- def test_package_database
- assert_kind_of PackageDatabase, db
- assert_equal "testrepo", db.fetch_repository("testrepo").name
- end
- end
-
- class TestCase_NoConfigEnvironmentPackageDatabase < Test::Unit::TestCase
- def env
- NoConfigEnvironment.new(Dir.getwd().to_s + "/environment_TEST_dir/testrepo")
- end
-
- def db
- env.package_database
- end
-
- def test_package_database
- assert_kind_of PackageDatabase, db
- assert_equal "testrepo", db.fetch_repository("testrepo").name
- end
- end
-
class TestCase_EnvironmentPackageSet < Test::Unit::TestCase
def env
@env or @env = EnvironmentFactory.instance.create("")
@@ -262,10 +232,6 @@ module Paludis
@env or @env = EnvironmentFactory.instance.create("")
end
- def db
- return env.package_database
- end
-
def pda
Paludis::parse_user_package_dep_spec('=foo/bar-1.0', env, [])
end
@@ -280,7 +246,7 @@ module Paludis
end
end
- def test_package_database_query
+ def test_environment_query
a = env[Selection::AllVersionsSorted.new(Generator::Matches.new(pda, nil, []))]
assert_kind_of Array, a
assert_equal 1, a.length
@@ -383,5 +349,94 @@ module Paludis
x = TestEnvironment.new()
end
end
+
+ class TestCase_EnvironmentFetchUniqueQualifiedPackageName < Test::Unit::TestCase
+ def env
+ @env or @env = EnvironmentFactory.instance.create("")
+ end
+
+ def test_environment_fetch_unique_qualified_package_name
+ assert_equal "foo/bar", env.fetch_unique_qualified_package_name("bar")
+ assert_equal "foo/bar", env.fetch_unique_qualified_package_name("bar", Filter::SupportsAction.new(InstallAction))
+ end
+
+ def test_error
+ assert_raise NoSuchPackageError do
+ env.fetch_unique_qualified_package_name('foobarbaz')
+ end
+ assert_raise NoSuchPackageError do
+ env.fetch_unique_qualified_package_name('bar', Filter::SupportsAction.new(ConfigAction))
+ end
+ end
+
+ def test_bad
+ assert_raise ArgumentError do
+ env.fetch_unique_qualified_package_name
+ end
+ assert_raise ArgumentError do
+ env.fetch_unique_qualified_package_name(1, 2, 3)
+ end
+ assert_raise TypeError do
+ env.fetch_unique_qualified_package_name([])
+ end
+ assert_raise TypeError do
+ env.fetch_unique_qualified_package_name('bar', 123)
+ end
+ end
+ end
+
+ class TestCase_EnvironmentRepositories < Test::Unit::TestCase
+ def env
+ @env or @env = EnvironmentFactory.instance.create("")
+ end
+
+ def test_repositories
+ if ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "yes" then
+ assert_equal 3, env.repositories.length
+ else
+ assert_equal 1, env.repositories.length
+ end
+
+ a = env.repositories.find_all do | repo |
+ repo.name == "testrepo"
+ end
+ assert_equal 1, a.length
+
+ a = env.repositories.find_all do | repo |
+ repo.name == "foorepo"
+ end
+ assert a.empty?
+
+ assert_equal nil, env.repositories {|repo| assert_kind_of Repository, repo}
+ end
+
+ def test_fetch_repository
+ assert_equal "testrepo", env.fetch_repository("testrepo").name
+
+ assert_raise Paludis::NoSuchRepositoryError do
+ env.fetch_repository("barrepo")
+ end
+ end
+
+ def test_more_important_than
+ if ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "yes" then
+ assert env.more_important_than('testrepo', 'virtuals')
+ assert ! env.more_important_than('virtuals', 'testrepo')
+ elsif ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "no" then
+ else
+ throw "oops"
+ end
+ end
+
+ def test_has_repository_named?
+ assert env.has_repository_named?('testrepo')
+ if ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "yes" then
+ assert env.has_repository_named?('virtuals')
+ else
+ assert ! env.has_repository_named?('virtuals')
+ end
+ assert ! env.has_repository_named?('foobarbaz')
+ end
+ end
end
diff --git a/ruby/package_database.cc b/ruby/package_database.cc
deleted file mode 100644
index 2b59680..0000000
--- a/ruby/package_database.cc
+++ /dev/null
@@ -1,233 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2011 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
- */
-
-#include <paludis_ruby.hh>
-#include <paludis/package_database.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/sequence.hh>
-#include <ruby.h>
-
-using namespace paludis;
-using namespace paludis::ruby;
-
-namespace
-{
- static VALUE c_package_database;
-
- /*
- * call-seq:
- * fetch_unique_qualified_package_name(package_name) -> QualifiedPackageName
- * fetch_unique_qualified_package_name(package_name, filter) -> QualifiedPackageName
- *
- * Disambiguate a package name. If a filter is specified, limit
- * the potential results to packages that match.
- */
- VALUE
- package_database_fetch_unique_qualified_package_name(int argc, VALUE *argv, VALUE self)
- {
- try
- {
- if (1 == argc || 2 == argc)
- {
- std::shared_ptr<PackageDatabase> * self_ptr;
- Data_Get_Struct(self, std::shared_ptr<PackageDatabase>, self_ptr);
- return qualified_package_name_to_value((*self_ptr)->fetch_unique_qualified_package_name(
- PackageNamePart(StringValuePtr(argv[0])), 2 == argc ? value_to_filter(argv[1]) : filter::All()));
- }
- else
- rb_raise(rb_eArgError, "fetch_unique_qualified_package_name expects one or two arguments, but got %d",argc);
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * repositories -> Array
- * repositories {|repository| block } -> Nil
- *
- * Returns all the repositories in the package database, either as an Array, or as
- * the parameters to a block.
- */
- VALUE
- package_database_repositories(VALUE self)
- {
- try
- {
- std::shared_ptr<PackageDatabase> * self_ptr;
- Data_Get_Struct(self, std::shared_ptr<PackageDatabase>, self_ptr);
-
- if (rb_block_given_p())
- {
- for (PackageDatabase::RepositoryConstIterator r((*self_ptr)->begin_repositories()),
- r_end((*self_ptr)->end_repositories()) ; r != r_end ; ++r)
- rb_yield(repository_to_value(*r));
- return Qnil;
- }
- VALUE result(rb_ary_new());
- for (PackageDatabase::RepositoryConstIterator r((*self_ptr)->begin_repositories()),
- r_end((*self_ptr)->end_repositories()) ; r != r_end ; ++r)
- rb_ary_push(result, repository_to_value(*r));
-
- return result;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * fetch_repository(repository_name) -> Repository
- *
- * Fetch a named repository.
- */
- VALUE
- package_database_fetch_repository(VALUE self, VALUE name)
- {
- try
- {
- std::shared_ptr<PackageDatabase> * self_ptr;
- Data_Get_Struct(self, std::shared_ptr<PackageDatabase>, self_ptr);
-
- return repository_to_value((*self_ptr)->fetch_repository(RepositoryName(StringValuePtr(name))));
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * more_important_than(repository_name_a, repository_name_b) -> bool
- *
- * True if repository_name_a is more important than repository_name_b .
- */
- VALUE
- package_database_more_important_than(VALUE self, VALUE name1, VALUE name2)
- {
- try
- {
- std::shared_ptr<PackageDatabase> * self_ptr;
- Data_Get_Struct(self, std::shared_ptr<PackageDatabase>, self_ptr);
-
- return (*self_ptr)->more_important_than(RepositoryName(StringValuePtr(name1)),
- RepositoryName(StringValuePtr(name2))) ? Qtrue : Qfalse;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * has_repository_named?(repository_name) -> true or false
- *
- * Do we have a named repository?
- */
- VALUE
- package_database_has_repository_named(VALUE self, VALUE name)
- {
- try
- {
- std::shared_ptr<PackageDatabase> * self_ptr;
- Data_Get_Struct(self, std::shared_ptr<PackageDatabase>, self_ptr);
-
- return ((*self_ptr)->has_repository_named(RepositoryName(StringValuePtr(name)))) ? true : false;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * add_repository(importance, repository) -> nil
- *
- * Add a repository.
- */
- VALUE
- package_database_add_repository(VALUE self, VALUE importance, VALUE repo_v)
- {
- try
- {
- std::shared_ptr<PackageDatabase> * self_ptr;
- Data_Get_Struct(self, std::shared_ptr<PackageDatabase>, self_ptr);
-
- std::shared_ptr<Repository> repo(value_to_repository(repo_v));
-
- (*self_ptr)->add_repository(NUM2INT(importance), repo);
- return Qnil;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- void do_register_package_database()
- {
- /*
- * Document-class: Paludis::PackageDatabase
- *
- * A PackageDatabase can be queried for Package instances.
- */
- c_package_database = rb_define_class_under(paludis_module(), "PackageDatabase", rb_cObject);
- rb_funcall(c_package_database, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_package_database, "fetch_unique_qualified_package_name",
- RUBY_FUNC_CAST(&package_database_fetch_unique_qualified_package_name), -1);
- rb_define_method(c_package_database, "repositories",
- RUBY_FUNC_CAST(&package_database_repositories), 0);
- rb_define_method(c_package_database, "fetch_repository",
- RUBY_FUNC_CAST(&package_database_fetch_repository), 1);
- rb_define_method(c_package_database, "more_important_than",
- RUBY_FUNC_CAST(&package_database_more_important_than), 2);
- rb_define_method(c_package_database, "has_repository_named?",
- RUBY_FUNC_CAST(&package_database_has_repository_named), 1);
- rb_define_method(c_package_database, "add_repository",
- RUBY_FUNC_CAST(&package_database_add_repository), 2);
- }
-}
-
-VALUE
-paludis::ruby::package_database_to_value(std::shared_ptr<PackageDatabase> m)
-{
- std::shared_ptr<PackageDatabase> * m_ptr(0);
- try
- {
- m_ptr = new std::shared_ptr<PackageDatabase>(m);
- return Data_Wrap_Struct(c_package_database, 0, &Common<std::shared_ptr<PackageDatabase> >::free, m_ptr);
- }
- catch (const std::exception & e)
- {
- delete m_ptr;
- exception_to_ruby_exception(e);
- }
-}
-
-RegisterRubyClass::Register paludis_ruby_register_package_database PALUDIS_ATTRIBUTE((used))
- (&do_register_package_database);
-
diff --git a/ruby/package_database_TEST.rb b/ruby/package_database_TEST.rb
deleted file mode 100644
index fe4087f..0000000
--- a/ruby/package_database_TEST.rb
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/usr/bin/env ruby
-# vim: set sw=4 sts=4 et tw=80 :
-
-#
-# Copyright (c) 2006, 2007, 2008, 2009, 2011 Ciaran McCreesh
-# Copyright (c) 2007 Richard Brown
-#
-# 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
-#
-
-ENV["PALUDIS_HOME"] = Dir.getwd().to_s + "/package_database_TEST_dir/home";
-
-require 'test/unit'
-require 'Paludis'
-
-Paludis::Log.instance.log_level = Paludis::LogLevel::Warning
-
-module Paludis
- class TestCase_PackageDatabase < Test::Unit::TestCase
- def test_no_create
- assert_raise NoMethodError do
- p = PackageDatabase.new
- end
- end
- end
-
- class TestCase_PackageDatabaseFetchUniqueQualifiedPackageName < Test::Unit::TestCase
- def env
- @env or @env = EnvironmentFactory.instance.create("")
- end
-
- def db
- return env.package_database
- end
-
- def test_package_database_fetch_unique_qualified_package_name
- assert_equal "foo/bar", db.fetch_unique_qualified_package_name("bar")
- assert_equal "foo/bar", db.fetch_unique_qualified_package_name("bar", Filter::SupportsAction.new(InstallAction))
- end
-
- def test_error
- assert_raise AmbiguousPackageNameError do
- db.fetch_unique_qualified_package_name('baz')
- end
- assert_raise NoSuchPackageError do
- db.fetch_unique_qualified_package_name('foobarbaz')
- end
- assert_raise NoSuchPackageError do
- db.fetch_unique_qualified_package_name('bar', Filter::SupportsAction.new(ConfigAction))
- end
- end
-
- def test_bad
- assert_raise ArgumentError do
- db.fetch_unique_qualified_package_name
- end
- assert_raise ArgumentError do
- db.fetch_unique_qualified_package_name(1, 2, 3)
- end
- assert_raise TypeError do
- db.fetch_unique_qualified_package_name([])
- end
- assert_raise TypeError do
- db.fetch_unique_qualified_package_name('bar', db)
- end
- end
- end
-
- class TestCase_PackageDatabaseRepositories < Test::Unit::TestCase
- def env
- @env or @env = EnvironmentFactory.instance.create("")
- end
-
- def db
- return env.package_database
- end
-
- def test_repositories
- if ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "yes" then
- assert_equal 3, db.repositories.length
- else
- assert_equal 1, db.repositories.length
- end
-
- a = db.repositories.find_all do | repo |
- repo.name == "testrepo"
- end
- assert_equal 1, a.length
-
- a = db.repositories.find_all do | repo |
- repo.name == "foorepo"
- end
- assert a.empty?
-
- assert_equal nil, db.repositories {|repo| assert_kind_of Repository, repo}
- end
-
- def test_fetch_repository
- assert_equal "testrepo", db.fetch_repository("testrepo").name
-
- assert_raise Paludis::NoSuchRepositoryError do
- db.fetch_repository("barrepo")
- end
- end
-
- def test_more_important_than
- if ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "yes" then
- assert db.more_important_than('testrepo', 'virtuals')
- assert ! db.more_important_than('virtuals', 'testrepo')
- elsif ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "no" then
- else
- throw "oops"
- end
- end
-
- def test_has_repository_named?
- assert db.has_repository_named?('testrepo')
- if ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "yes" then
- assert db.has_repository_named?('virtuals')
- else
- assert ! db.has_repository_named?('virtuals')
- end
- assert ! db.has_repository_named?('foobarbaz')
- end
- end
-end
-
diff --git a/ruby/package_database_TEST_cleanup.sh b/ruby/package_database_TEST_cleanup.sh
deleted file mode 100755
index c34eeb7..0000000
--- a/ruby/package_database_TEST_cleanup.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d package_database_TEST_dir ] ; then
- rm -fr package_database_TEST_dir
-else
- true
-fi
-
-
-
-
-
diff --git a/ruby/package_database_TEST_setup.sh b/ruby/package_database_TEST_setup.sh
deleted file mode 100755
index 8148063..0000000
--- a/ruby/package_database_TEST_setup.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir package_database_TEST_dir || exit 1
-cd package_database_TEST_dir || exit 1
-
-mkdir -p home/.paludis/repositories
-
-cat <<END > home/.paludis/repositories/testrepo.conf
-location = `pwd`/testrepo
-format = e
-names_cache = /var/empty
-cache = /var/empty
-profiles = \${location}/profiles/testprofile
-builddir = `pwd`
-END
-
-cat <<END > home/.paludis/keywords.conf
-*/* test
-~foo/bar-1 ~test
-END
-
-cat <<END > home/.paludis/use.conf
-*/* enabled
-~foo/bar-1 sometimes_enabled
-END
-
-cat <<END > home/.paludis/licenses.conf
-*/* *
-END
-
-cat <<END > home/.paludis/general.conf
-world = /dev/null
-END
-
-mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files,foo/baz/files,quux/baz/files} || exit 1
-cd testrepo || exit 1
-echo "testrepo" > profiles/repo_name || exit 1
-cat <<END > profiles/categories || exit 1
-foo
-quux
-END
-cat <<END > profiles/testprofile/make.defaults
-ARCH=test
-USERLAND=test
-KERNEL=test
-END
-
-cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > foo/bar/bar-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="~test"
-END
-
-cat <<"END" > foo/baz/baz-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > quux/baz/baz-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-cd ..
-
-
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index 1f0a181..e230843 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -40,15 +40,15 @@ module Paludis
end
def pid_testrepo
- env.package_database.fetch_repository("testrepo").package_ids("foo/bar").first
+ env.fetch_repository("testrepo").package_ids("foo/bar").first
end
def pid_bad
- env.package_database.fetch_repository("testrepo").package_ids("bad/pkg").first
+ env.fetch_repository("testrepo").package_ids("bad/pkg").first
end
def pid_installed
- env_vdb.package_database.fetch_repository("installed").package_ids("cat-one/pkg-one").first
+ env_vdb.fetch_repository("installed").package_ids("cat-one/pkg-one").first
end
end
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index 3c201b9..cf749d2 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -28,7 +28,6 @@
#include <paludis/about.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/action.hh>
-#include <paludis/package_database.hh>
#include <ruby.h>
#include <list>
#include <ctype.h>
@@ -56,8 +55,6 @@ namespace
static VALUE c_package_name_part_error;
static VALUE c_bad_version_spec_error;
static VALUE c_package_dep_spec_error;
- static VALUE c_package_database_error;
- static VALUE c_package_database_lookup_error;
static VALUE c_ambiguous_package_name_error;
static VALUE c_no_such_package_error;
static VALUE c_no_such_repository_error;
@@ -204,10 +201,6 @@ void paludis::ruby::exception_to_ruby_exception(const std::exception & ee)
rb_raise(c_no_such_package_error, dynamic_cast<const paludis::NoSuchPackageError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::NoSuchRepositoryError *>(&ee))
rb_raise(c_no_such_repository_error, dynamic_cast<const paludis::NoSuchRepositoryError *>(&ee)->message().c_str());
- else if (0 != dynamic_cast<const paludis::PackageDatabaseLookupError *>(&ee))
- rb_raise(c_package_database_lookup_error, dynamic_cast<const paludis::PackageDatabaseLookupError *>(&ee)->message().c_str());
- else if (0 != dynamic_cast<const paludis::PackageDatabaseError *>(&ee))
- rb_raise(c_package_database_error, dynamic_cast<const paludis::PackageDatabaseError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::ConfigFileError *>(&ee))
rb_raise(c_config_file_error, dynamic_cast<const paludis::ConfigFileError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::ConfigurationError *>(&ee))
@@ -315,10 +308,8 @@ void PALUDIS_VISIBLE paludis::ruby::init()
c_package_name_part_error = rb_define_class_under(c_paludis_module, "PackageNamePartError", c_name_error);
c_bad_version_spec_error = rb_define_class_under(c_paludis_module, "BadVersionSpecError", c_name_error);
c_package_dep_spec_error = rb_define_class_under(c_paludis_module, "PackageDepSpecError", rb_eRuntimeError);
- c_package_database_error = rb_define_class_under(c_paludis_module, "PackageDatabaseError", rb_eRuntimeError);
- c_package_database_lookup_error = rb_define_class_under(c_paludis_module, "PackageDatabaseLookupError", c_package_database_error);
- c_no_such_package_error = rb_define_class_under(c_paludis_module, "NoSuchPackageError", c_package_database_lookup_error);
- c_no_such_repository_error = rb_define_class_under(c_paludis_module, "NoSuchRepositoryError", c_package_database_lookup_error);
+ c_no_such_package_error = rb_define_class_under(c_paludis_module, "NoSuchPackageError", rb_eRuntimeError);
+ c_no_such_repository_error = rb_define_class_under(c_paludis_module, "NoSuchRepositoryError", rb_eRuntimeError);
c_configuration_error = rb_define_class_under(c_paludis_module, "ConfigurationError", rb_eRuntimeError);
c_config_file_error = rb_define_class_under(c_paludis_module, "ConfigFileError", c_configuration_error);
@@ -335,9 +326,9 @@ void PALUDIS_VISIBLE paludis::ruby::init()
/*
* Document-class: Paludis::AmbiguousPackageNameError
*
- * Thrown if a PackageDatabase query results in more than one matching Package.
+ * Thrown if an Environment query results in more than one matching Package.
*/
- c_ambiguous_package_name_error = rb_define_class_under(c_paludis_module, "AmbiguousPackageNameError", c_package_database_lookup_error);
+ c_ambiguous_package_name_error = rb_define_class_under(c_paludis_module, "AmbiguousPackageNameError", rb_eRuntimeError);
rb_define_method(c_ambiguous_package_name_error, "initialize", RUBY_FUNC_CAST(&ambiguous_package_name_error_init), -1);
rb_define_method(c_ambiguous_package_name_error, "options", RUBY_FUNC_CAST(&ambiguous_package_name_error_failures), 0);
diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh
index 7e2b616..aab1fb1 100644
--- a/ruby/paludis_ruby.hh
+++ b/ruby/paludis_ruby.hh
@@ -80,7 +80,6 @@ namespace paludis
/* constructors */
- VALUE package_database_to_value(std::shared_ptr<PackageDatabase>);
VALUE repository_to_value(std::shared_ptr<Repository>);
VALUE version_spec_to_value(const VersionSpec &);
VALUE package_id_to_value(std::shared_ptr<const PackageID>);
diff --git a/ruby/repository.cc b/ruby/repository.cc
index 15803aa..62eadfd 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -615,7 +615,7 @@ namespace
/*
* Document-class: Paludis::Repository
*
- * A Repository provides a representation of a physical repository to a PackageDatabase.
+ * A Repository provides a representation of a physical repository to an Environment.
*/
c_repository = rb_define_class_under(paludis_module(), "Repository", rb_cObject);
rb_funcall(c_repository, rb_intern("private_class_method"), 1, rb_str_new2("new"));
diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb
index 82aae26..117f311 100644
--- a/ruby/repository_TEST.rb
+++ b/ruby/repository_TEST.rb
@@ -38,11 +38,11 @@ module Paludis
module RepositoryTestCase
def installed_repo
- env.package_database.fetch_repository "installed"
+ env.fetch_repository "installed"
end
def repo
- env.package_database.fetch_repository "testrepo"
+ env.fetch_repository "testrepo"
end
def env
diff --git a/src/clients/accerso/accerso.cc b/src/clients/accerso/accerso.cc
index 5e615f2..7cd5d9c 100644
--- a/src/clients/accerso/accerso.cc
+++ b/src/clients/accerso/accerso.cc
@@ -38,8 +38,8 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
-#include <paludis/package_database.hh>
#include <paludis/output_manager_from_environment.hh>
+#include <paludis/repository.hh>
#include <cstdlib>
#include <functional>
#include <iostream>
@@ -135,8 +135,7 @@ main(int argc, char *argv[])
std::shared_ptr<const PackageIDSequence> ids(env[selection::AllVersionsSorted(
generator::InRepository(env.main_repository()->name()))]);
- std::multimap<std::shared_ptr<const PackageID>, std::string, PackageIDComparator> results(
- PackageIDComparator(env.package_database().get()));
+ std::multimap<std::shared_ptr<const PackageID>, std::string, PackageIDComparator> results{PackageIDComparator(&env)};
unsigned success(0), total(0);
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
diff --git a/src/clients/appareo/appareo.cc b/src/clients/appareo/appareo.cc
index 3a19f97..0506661 100644
--- a/src/clients/appareo/appareo.cc
+++ b/src/clients/appareo/appareo.cc
@@ -39,7 +39,7 @@
#include <paludis/filter.hh>
#include <paludis/util/set.hh>
#include <paludis/filtered_generator.hh>
-#include <paludis/package_database.hh>
+#include <paludis/repository.hh>
#include <algorithm>
#include <functional>
#include <iostream>
@@ -255,7 +255,7 @@ main(int argc, char *argv[])
n::write_cache() = CommandLine::get_instance()->a_write_cache_dir.argument()
));
- IDMap results(PackageIDComparator(env.package_database().get()));
+ IDMap results{PackageIDComparator(&env)};
unsigned success(0), total(0);
diff --git a/src/clients/cave/cmd_config.cc b/src/clients/cave/cmd_config.cc
index 057d823..0877de6 100644
--- a/src/clients/cave/cmd_config.cc
+++ b/src/clients/cave/cmd_config.cc
@@ -26,7 +26,6 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
diff --git a/src/clients/cave/cmd_digest.cc b/src/clients/cave/cmd_digest.cc
index 430bc51..3c8ea88 100644
--- a/src/clients/cave/cmd_digest.cc
+++ b/src/clients/cave/cmd_digest.cc
@@ -31,10 +31,10 @@
#include <paludis/util/map.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
@@ -118,7 +118,7 @@ DigestCommand::run(
RepositoryName repo(*next(cmdline.begin_parameters()));
Filter repo_filter(filter::Matches(make_package_dep_spec({ }).in_repository(repo), make_null_shared_ptr(), { }));
QualifiedPackageName pkg(std::string::npos == cmdline.begin_parameters()->find('/') ?
- env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(*cmdline.begin_parameters()), repo_filter) :
+ env->fetch_unique_qualified_package_name(PackageNamePart(*cmdline.begin_parameters()), repo_filter) :
QualifiedPackageName(*cmdline.begin_parameters()));
auto ids((*env)[selection::AllVersionsSorted(generator::Package(pkg) & generator::InRepository(repo))]);
@@ -153,7 +153,7 @@ DigestCommand::run(
cout << endl;
}
- auto r(env->package_database()->fetch_repository(repo));
+ auto r(env->fetch_repository(repo));
if (r->manifest_interface())
{
cout << "Making manifest..." << endl;
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index e1bdc14..b9b71c1 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -78,8 +78,8 @@
#include <paludis/selection.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
-#include <paludis/package_database.hh>
#include <paludis/elike_blocker.hh>
+#include <paludis/repository.hh>
#include <set>
#include <iterator>
@@ -943,7 +943,7 @@ namespace
case x1_post:
done_action(env, action_string, ensequence(install_item.origin_id_spec()), install_item.replacing_specs(), 0 == retcode);
- env->package_database()->fetch_repository(install_item.destination_repository_name())->invalidate();
+ env->fetch_repository(install_item.destination_repository_name())->invalidate();
break;
}
diff --git a/src/clients/cave/cmd_find_candidates.cc b/src/clients/cave/cmd_find_candidates.cc
index ee55cbd..21db9b8 100644
--- a/src/clients/cave/cmd_find_candidates.cc
+++ b/src/clients/cave/cmd_find_candidates.cc
@@ -25,7 +25,6 @@
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
@@ -44,6 +43,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <cstdlib>
#include <iostream>
@@ -212,8 +212,8 @@ FindCandidatesCommand::run_hosted(
step("Searching repositories");
RepositoryNames repository_names;
- for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()),
- r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ for (Environment::RepositoryConstIterator r(env->begin_repositories()),
+ r_end(env->end_repositories()) ; r != r_end ; ++r)
repository_names.insert((*r)->name());
step("Searching categories");
@@ -222,7 +222,7 @@ FindCandidatesCommand::run_hosted(
for (RepositoryNames::const_iterator r(repository_names.begin()), r_end(repository_names.end()) ;
r != r_end ; ++r)
{
- const std::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(*r));
+ const std::shared_ptr<const Repository> repo(env->fetch_repository(*r));
const std::shared_ptr<const CategoryNamePartSet> cats(repo->category_names({ }));
std::copy(cats->begin(), cats->end(), std::inserter(category_names, category_names.end()));
}
@@ -233,7 +233,7 @@ FindCandidatesCommand::run_hosted(
for (RepositoryNames::const_iterator r(repository_names.begin()), r_end(repository_names.end()) ;
r != r_end ; ++r)
{
- const std::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(*r));
+ const std::shared_ptr<const Repository> repo(env->fetch_repository(*r));
for (CategoryNames::const_iterator c(category_names.begin()), c_end(category_names.end()) ;
c != c_end ; ++c)
{
diff --git a/src/clients/cave/cmd_fix_cache.cc b/src/clients/cave/cmd_fix_cache.cc
index f536c90..16a7453 100644
--- a/src/clients/cave/cmd_fix_cache.cc
+++ b/src/clients/cave/cmd_fix_cache.cc
@@ -24,9 +24,10 @@
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
+
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/stringify.hh>
#include <iostream>
#include <set>
@@ -116,8 +117,8 @@ FixCacheCommand::run(
if (cmdline.a_installable.specified())
{
all = false;
- for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository>
- r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories());
+ for (IndirectIterator<Environment::RepositoryConstIterator, const Repository>
+ r(env->begin_repositories()), r_end(env->end_repositories());
r != r_end; ++r)
if (! r->installed_root_key())
repository_names.insert(r->name());
@@ -126,16 +127,16 @@ FixCacheCommand::run(
if (cmdline.a_installed.specified())
{
all = false;
- for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository>
- r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories());
+ for (IndirectIterator<Environment::RepositoryConstIterator, const Repository>
+ r(env->begin_repositories()), r_end(env->end_repositories());
r != r_end; ++r)
if (r->installed_root_key())
repository_names.insert(r->name());
}
if (all)
- for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository>
- r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories());
+ for (IndirectIterator<Environment::RepositoryConstIterator, const Repository>
+ r(env->begin_repositories()), r_end(env->end_repositories());
r != r_end; ++r)
repository_names.insert(r->name());
@@ -143,7 +144,7 @@ FixCacheCommand::run(
r != r_end; ++r)
{
cout << fuc(fs_fixing(), fv<'s'>(stringify(*r)));
- const std::shared_ptr<Repository> repo(env->package_database()->fetch_repository(*r));
+ const std::shared_ptr<Repository> repo(env->fetch_repository(*r));
repo->regenerate_cache();
}
diff --git a/src/clients/cave/cmd_generate_metadata.cc b/src/clients/cave/cmd_generate_metadata.cc
index fee73df..c38b657 100644
--- a/src/clients/cave/cmd_generate_metadata.cc
+++ b/src/clients/cave/cmd_generate_metadata.cc
@@ -23,7 +23,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -33,6 +32,7 @@
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/thread_pool.hh>
#include <paludis/util/mutex.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
diff --git a/src/clients/cave/cmd_has_version.cc b/src/clients/cave/cmd_has_version.cc
index 18cb856..7d58786 100644
--- a/src/clients/cave/cmd_has_version.cc
+++ b/src/clients/cave/cmd_has_version.cc
@@ -22,7 +22,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
diff --git a/src/clients/cave/cmd_import.cc b/src/clients/cave/cmd_import.cc
index 48a3d78..04bb0b4 100644
--- a/src/clients/cave/cmd_import.cc
+++ b/src/clients/cave/cmd_import.cc
@@ -37,7 +37,6 @@
#include <paludis/repository.hh>
#include <paludis/metadata_key.hh>
#include <paludis/repository_factory.hh>
-#include <paludis/package_database.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <iostream>
@@ -224,7 +223,7 @@ ImportCommand::run(
for (PackageIDSequence::ConstIterator i(old_ids->begin()), i_end(old_ids->end()) ;
i != i_end ; ++i)
{
- auto repo(env->package_database()->fetch_repository((*i)->repository_name()));
+ auto repo(env->fetch_repository((*i)->repository_name()));
if (! repo->format_key())
continue;
if (repo->format_key()->value() != "installed_unpackaged")
@@ -291,7 +290,7 @@ ImportCommand::run(
keys->insert("preserve_work", preserve_work);
std::shared_ptr<Repository> repo(RepositoryFactory::get_instance()->create(env.get(),
std::bind(from_keys, keys, std::placeholders::_1)));
- env->package_database()->add_repository(10, repo);
+ env->add_repository(10, repo);
std::shared_ptr<const PackageIDSequence> ids(repo->package_ids(package, { }));
if (1 != std::distance(ids->begin(), ids->end()))
throw InternalError(PALUDIS_HERE, "ids is '" + join(indirect_iterator(ids->begin()), indirect_iterator(
diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc
index a0b8d13..d04006c 100644
--- a/src/clients/cave/cmd_info.cc
+++ b/src/clients/cave/cmd_info.cc
@@ -29,7 +29,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/filter.hh>
@@ -44,12 +43,16 @@
#include <paludis/util/pretty_print.hh>
#include <paludis/util/timestamp.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
#include <paludis/action.hh>
#include <paludis/about_metadata.hh>
+#include <paludis/contents.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <set>
+#include <sstream>
#include "command_command_line.hh"
@@ -408,8 +411,7 @@ InfoCommand::run(
do_about(cmdline, env);
do_env(cmdline, env);
- for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()),
- r_end(env->package_database()->end_repositories()) ;
+ for (auto r(env->begin_repositories()), r_end(env->end_repositories()) ;
r != r_end ; ++r)
do_one_repository(cmdline, env, *r);
diff --git a/src/clients/cave/cmd_manage_search_index.cc b/src/clients/cave/cmd_manage_search_index.cc
index 52b76a7..23e7405 100644
--- a/src/clients/cave/cmd_manage_search_index.cc
+++ b/src/clients/cave/cmd_manage_search_index.cc
@@ -26,7 +26,6 @@
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
@@ -49,6 +48,7 @@
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/mutex.hh>
+#include <paludis/util/stringify.hh>
#include <cstdlib>
#include <iostream>
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index c41a31c..c6ad495 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -23,7 +23,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
diff --git a/src/clients/cave/cmd_mirror.cc b/src/clients/cave/cmd_mirror.cc
index 0dcd36f..f515609 100644
--- a/src/clients/cave/cmd_mirror.cc
+++ b/src/clients/cave/cmd_mirror.cc
@@ -32,10 +32,10 @@
#include <paludis/util/map.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
diff --git a/src/clients/cave/cmd_perform.cc b/src/clients/cave/cmd_perform.cc
index ca6d2c7..b9d4820 100644
--- a/src/clients/cave/cmd_perform.cc
+++ b/src/clients/cave/cmd_perform.cc
@@ -26,7 +26,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
@@ -44,6 +43,7 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
@@ -542,7 +542,7 @@ PerformCommand::run(
if (! cmdline.a_destination.specified())
throw args::DoHelp("--destination must be specified for an install");
- const std::shared_ptr<Repository> destination(env->package_database()->fetch_repository(
+ const std::shared_ptr<Repository> destination(env->fetch_repository(
RepositoryName(cmdline.a_destination.argument())));
OutputManagerFromIPCOrEnvironment output_manager_holder(env.get(), cmdline, id);
@@ -568,7 +568,7 @@ PerformCommand::run(
if (! cmdline.a_destination.specified())
throw args::DoHelp("--destination must be specified for a pretend");
- const std::shared_ptr<Repository> destination(env->package_database()->fetch_repository(
+ const std::shared_ptr<Repository> destination(env->fetch_repository(
RepositoryName(cmdline.a_destination.argument())));
OutputManagerFromIPCOrEnvironment output_manager_holder(env.get(), cmdline, id);
diff --git a/src/clients/cave/cmd_print_best_version.cc b/src/clients/cave/cmd_print_best_version.cc
index 6691611..1ef5eb0 100644
--- a/src/clients/cave/cmd_print_best_version.cc
+++ b/src/clients/cave/cmd_print_best_version.cc
@@ -22,7 +22,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
diff --git a/src/clients/cave/cmd_print_categories.cc b/src/clients/cave/cmd_print_categories.cc
index 112d372..312704d 100644
--- a/src/clients/cave/cmd_print_categories.cc
+++ b/src/clients/cave/cmd_print_categories.cc
@@ -22,10 +22,10 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/stringify.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
@@ -95,8 +95,7 @@ PrintCategoriesCommand::run(
throw args::DoHelp("print-categories takes no parameters");
std::set<CategoryNamePart> categories;
- for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()),
- r_end(env->package_database()->end_repositories()) ;
+ for (auto r(env->begin_repositories()), r_end(env->end_repositories()) ;
r != r_end ; ++r)
{
if (cmdline.a_repository.specified())
diff --git a/src/clients/cave/cmd_print_dependent_ids.cc b/src/clients/cave/cmd_print_dependent_ids.cc
index ca0da8c..7caae7a 100644
--- a/src/clients/cave/cmd_print_dependent_ids.cc
+++ b/src/clients/cave/cmd_print_dependent_ids.cc
@@ -25,7 +25,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -33,6 +32,7 @@
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/map.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/resolver/collect_depped_upon.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
diff --git a/src/clients/cave/cmd_print_id_environment_variable.cc b/src/clients/cave/cmd_print_id_environment_variable.cc
index e98d549..2e2d898 100644
--- a/src/clients/cave/cmd_print_id_environment_variable.cc
+++ b/src/clients/cave/cmd_print_id_environment_variable.cc
@@ -32,7 +32,6 @@
#include <paludis/selection.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
-#include <paludis/package_database.hh>
#include <iostream>
#include <cstdlib>
@@ -99,7 +98,7 @@ namespace
const PrintIDEnvironmentVariableCommandLine & cmdline
)
{
- auto repo(env->package_database()->fetch_repository(id->repository_name()));
+ auto repo(env->fetch_repository(id->repository_name()));
if (0 != repo->environment_variable_interface())
{
diff --git a/src/clients/cave/cmd_print_ids.cc b/src/clients/cave/cmd_print_ids.cc
index 4abfa66..3cfae92 100644
--- a/src/clients/cave/cmd_print_ids.cc
+++ b/src/clients/cave/cmd_print_ids.cc
@@ -23,7 +23,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -31,6 +30,7 @@
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/map.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
diff --git a/src/clients/cave/cmd_print_packages.cc b/src/clients/cave/cmd_print_packages.cc
index f07b76f..59ef434 100644
--- a/src/clients/cave/cmd_print_packages.cc
+++ b/src/clients/cave/cmd_print_packages.cc
@@ -24,10 +24,10 @@
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/stringify.hh>
#include <iostream>
#include <cstdlib>
@@ -94,7 +94,7 @@ PrintPackagesCommand::run(
std::set<QualifiedPackageName> all_packages;
- for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories());
+ for (auto r(env->begin_repositories()), r_end(env->end_repositories());
r != r_end; ++r)
{
if (cmdline.a_repository.specified())
diff --git a/src/clients/cave/cmd_print_repositories.cc b/src/clients/cave/cmd_print_repositories.cc
index 56d14e2..897cfda 100644
--- a/src/clients/cave/cmd_print_repositories.cc
+++ b/src/clients/cave/cmd_print_repositories.cc
@@ -22,7 +22,6 @@
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -94,8 +93,8 @@ PrintRepositoriesCommand::run(
std::set<RepositoryName> repository_names;
- for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository>
- r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories());
+ for (IndirectIterator<Environment::RepositoryConstIterator, const Repository>
+ r(env->begin_repositories()), r_end(env->end_repositories());
r != r_end; ++r)
{
if (cmdline.a_repository_format.specified())
diff --git a/src/clients/cave/cmd_print_repository_metadata.cc b/src/clients/cave/cmd_print_repository_metadata.cc
index c0a25ca..abeed8a 100644
--- a/src/clients/cave/cmd_print_repository_metadata.cc
+++ b/src/clients/cave/cmd_print_repository_metadata.cc
@@ -28,7 +28,7 @@
#include <paludis/util/options.hh>
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/package_database.hh>
+#include <paludis/repository.hh>
#include <iostream>
#include <algorithm>
@@ -133,7 +133,7 @@ PrintRepositoryMetadataCommand::run(
throw args::DoHelp("print-repository-metadata takes exactly one parameter");
RepositoryName name(*cmdline.begin_parameters());
- const std::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(name));
+ const std::shared_ptr<const Repository> repo(env->fetch_repository(name));
for (Repository::MetadataConstIterator m(repo->begin_metadata()), m_end(repo->end_metadata()) ;
m != m_end ; ++m)
diff --git a/src/clients/cave/cmd_print_set.cc b/src/clients/cave/cmd_print_set.cc
index 181d4db..1d383c5 100644
--- a/src/clients/cave/cmd_print_set.cc
+++ b/src/clients/cave/cmd_print_set.cc
@@ -24,7 +24,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/spec_tree.hh>
#include <paludis/util/set.hh>
@@ -33,6 +32,7 @@
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/map.hh>
#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/stringify.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
diff --git a/src/clients/cave/cmd_print_sets.cc b/src/clients/cave/cmd_print_sets.cc
index c307bb8..18b915c 100644
--- a/src/clients/cave/cmd_print_sets.cc
+++ b/src/clients/cave/cmd_print_sets.cc
@@ -22,7 +22,6 @@
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/set.hh>
diff --git a/src/clients/cave/cmd_print_sync_protocols.cc b/src/clients/cave/cmd_print_sync_protocols.cc
index d6f1bc1..529e94f 100644
--- a/src/clients/cave/cmd_print_sync_protocols.cc
+++ b/src/clients/cave/cmd_print_sync_protocols.cc
@@ -22,7 +22,6 @@
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/fs_iterator.hh>
#include <paludis/util/fs_stat.hh>
diff --git a/src/clients/cave/cmd_print_unused_distfiles.cc b/src/clients/cave/cmd_print_unused_distfiles.cc
index 489a3eb..a9a1e3e 100644
--- a/src/clients/cave/cmd_print_unused_distfiles.cc
+++ b/src/clients/cave/cmd_print_unused_distfiles.cc
@@ -31,7 +31,6 @@
#include <paludis/mask.hh>
#include <paludis/metadata_key.hh>
#include <paludis/name.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
#include <paludis/selection.hh>
@@ -165,7 +164,7 @@ PrintUnusedDistfilesCommand::run(
c != c_end ; ++c)
selections.push_back(selection::AllVersionsUnsorted(generator::InRepository(RepositoryName(*c))));
- std::set<std::shared_ptr<const PackageID>, PackageIDComparator> already_done((PackageIDComparator(env->package_database().get())));
+ std::set<std::shared_ptr<const PackageID>, PackageIDComparator> already_done((PackageIDComparator(env.get())));
for (auto s(selections.begin()), s_end(selections.end()) ;
s != s_end ; ++s)
{
@@ -191,9 +190,8 @@ PrintUnusedDistfilesCommand::run(
std::set<FSPath, FSPathComparator> distdirs;
- const std::shared_ptr<const PackageDatabase> pkgdb(env->package_database());
- for (auto repo(pkgdb->begin_repositories()), end(pkgdb->end_repositories()) ;
- repo != end ; ++repo)
+ for (auto repo(env->begin_repositories()), end(env->end_repositories()) ;
+ repo != end ; ++repo)
{
auto distdir_metadata((*repo)->find_metadata("distdir"));
if (distdir_metadata != (*repo)->end_metadata())
diff --git a/src/clients/cave/cmd_report.cc b/src/clients/cave/cmd_report.cc
index 2376752..4aefa3a 100644
--- a/src/clients/cave/cmd_report.cc
+++ b/src/clients/cave/cmd_report.cc
@@ -27,7 +27,6 @@
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/filter.hh>
@@ -50,6 +49,8 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
#include <paludis/resolver/collect_purges.hh>
#include <paludis/resolver/collect_installed.hh>
diff --git a/src/clients/cave/cmd_search.cc b/src/clients/cave/cmd_search.cc
index 1a36dd0..c3f8ed3 100644
--- a/src/clients/cave/cmd_search.cc
+++ b/src/clients/cave/cmd_search.cc
@@ -28,7 +28,6 @@
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/filter.hh>
@@ -49,6 +48,7 @@
#include <paludis/util/mutex.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <cstdlib>
#include <iostream>
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index dead782..df30177 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -29,7 +29,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/filter.hh>
@@ -46,12 +45,15 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
#include <paludis/action.hh>
#include <paludis/mask.hh>
#include <paludis/choice.hh>
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/mask_utils.hh>
#include <paludis/permitted_choice_value_parameter_values.hh>
+#include <paludis/contents.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
@@ -1107,7 +1109,7 @@ namespace
{
cout << fuc(fs_repository_heading(), fv<'s'>(stringify(s)));
- const std::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(s));
+ const std::shared_ptr<const Repository> repo(env->fetch_repository(s));
std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(repo->begin_metadata(), repo->end_metadata());
for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator
k(keys.begin()), k_end(keys.end()) ; k != k_end ; ++k)
@@ -1172,7 +1174,7 @@ namespace
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
{
- auto repo(env->package_database()->fetch_repository((*i)->repository_name()));
+ auto repo(env->fetch_repository((*i)->repository_name()));
if (repo->installed_root_key())
all_installed->push_back(*i);
else
@@ -1228,7 +1230,7 @@ namespace
header_out << " ";
need_space = true;
- auto repo(env->package_database()->fetch_repository((*i)->repository_name()));
+ auto repo(env->fetch_repository((*i)->repository_name()));
if (repo->installed_root_key())
header_out << fuc(fs_package_version_installed(), fv<'s'>(stringify((*i)->canonical_form(idcf_version))));
else
@@ -1406,7 +1408,7 @@ ShowCommand::run(
try
{
RepositoryName repo_name(*p);
- if (env->package_database()->has_repository_named(repo_name))
+ if (env->has_repository_named(repo_name))
{
do_one_repository(cmdline, env, basic_ppos, repo_name);
continue;
diff --git a/src/clients/cave/cmd_sync.cc b/src/clients/cave/cmd_sync.cc
index 04d8d5b..fe9ede4 100644
--- a/src/clients/cave/cmd_sync.cc
+++ b/src/clients/cave/cmd_sync.cc
@@ -21,7 +21,6 @@
#include "exceptions.hh"
#include "colours.hh"
#include "format_user_config.hh"
-#include <paludis/package_database.hh>
#include <paludis/util/action_queue.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/named_value.hh>
@@ -32,6 +31,8 @@
#include <paludis/util/executor.hh>
#include <paludis/util/timestamp.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
#include <paludis/output_manager.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/repository.hh>
@@ -139,7 +140,7 @@ namespace
if (cmdline.a_sequential.specified())
return "";
- const std::shared_ptr<const Repository> r(env->package_database()->fetch_repository(name));
+ const std::shared_ptr<const Repository> r(env->fetch_repository(name));
if (r->sync_host_key() && r->sync_host_key()->value()->end() != r->sync_host_key()->value()->find(cmdline.a_suffix.argument()))
return r->sync_host_key()->value()->find(cmdline.a_suffix.argument())->second;
else
@@ -172,7 +173,7 @@ namespace
make_null_shared_ptr()).max_exit_status())
throw SyncFailedError("Sync aborted by hook");
- const std::shared_ptr<Repository> repo(env->package_database()->fetch_repository(name));
+ const std::shared_ptr<Repository> repo(env->fetch_repository(name));
CreateOutputManagerForRepositorySyncInfo info(repo->name(),
cmdline.a_sequential.specified() ? oe_exclusive : oe_with_others,
ClientOutputFeatures() + cof_summary_at_end);
@@ -200,7 +201,7 @@ namespace
try
{
- const std::shared_ptr<Repository> repo(env->package_database()->fetch_repository(name));
+ const std::shared_ptr<Repository> repo(env->fetch_repository(name));
if (! repo->sync(cmdline.a_suffix.argument(), cmdline.a_revision.argument(), output_manager))
skipped = true;
@@ -375,13 +376,12 @@ SyncCommand::run(
p != p_end ; ++p)
{
RepositoryName n(*p);
- if (! env->package_database()->has_repository_named(n))
+ if (! env->has_repository_named(n))
throw NothingMatching(*p);
repos.insert(n);
}
else
- for (PackageDatabase::RepositoryConstIterator p(env->package_database()->begin_repositories()),
- p_end(env->package_database()->end_repositories()) ;
+ for (auto p(env->begin_repositories()), p_end(env->end_repositories()) ;
p != p_end ; ++p)
repos.insert((*p)->name());
@@ -399,8 +399,7 @@ SyncCommand::run(
retcode |= sync_these(env, cmdline, repos);
- for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()),
- r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ for (auto r(env->begin_repositories()), r_end(env->end_repositories()) ; r != r_end ; ++r)
{
(*r)->invalidate();
(*r)->purge_invalid_cache();
diff --git a/src/clients/cave/cmd_sync_protocol_options.cc b/src/clients/cave/cmd_sync_protocol_options.cc
index 1c7a297..46b01c0 100644
--- a/src/clients/cave/cmd_sync_protocol_options.cc
+++ b/src/clients/cave/cmd_sync_protocol_options.cc
@@ -23,7 +23,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/util/fs_iterator.hh>
@@ -32,6 +31,7 @@
#include <paludis/util/process.hh>
#include <paludis/util/system.hh>
#include <paludis/util/env_var_names.hh>
+#include <paludis/util/join.hh>
#include <cstdlib>
#include <iostream>
diff --git a/src/clients/cave/cmd_update_world.cc b/src/clients/cave/cmd_update_world.cc
index 08d6553..e2ebd3e 100644
--- a/src/clients/cave/cmd_update_world.cc
+++ b/src/clients/cave/cmd_update_world.cc
@@ -25,8 +25,8 @@
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/options.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/generator.hh>
#include <paludis/selection.hh>
#include <paludis/filter.hh>
@@ -126,7 +126,7 @@ UpdateWorldCommand::run(
QualifiedPackageName q("x/x");
if (std::string::npos == p->find('/'))
- q = env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(*p));
+ q = env->fetch_unique_qualified_package_name(PackageNamePart(*p));
else
q = QualifiedPackageName(*p);
diff --git a/src/clients/cave/cmd_verify.cc b/src/clients/cave/cmd_verify.cc
index c1a9358..8dbe003 100644
--- a/src/clients/cave/cmd_verify.cc
+++ b/src/clients/cave/cmd_verify.cc
@@ -34,8 +34,8 @@
#include <paludis/util/md5.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
@@ -47,6 +47,7 @@
#include <paludis/hook.hh>
#include <paludis/metadata_key.hh>
#include <paludis/output_manager_from_environment.hh>
+#include <paludis/contents.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
diff --git a/src/clients/cave/executables_common.cc b/src/clients/cave/executables_common.cc
index 4dc507a..1237680 100644
--- a/src/clients/cave/executables_common.cc
+++ b/src/clients/cave/executables_common.cc
@@ -27,7 +27,6 @@
#include <paludis/filtered_generator.hh>
#include <paludis/generator.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/selection.hh>
#include <paludis/user_dep_spec.hh>
diff --git a/src/clients/cave/owner_common.cc b/src/clients/cave/owner_common.cc
index 156c4a1..183f261 100644
--- a/src/clients/cave/owner_common.cc
+++ b/src/clients/cave/owner_common.cc
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2008 Alexander Færøy
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 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
@@ -27,13 +27,13 @@
#include <paludis/generator.hh>
#include <paludis/metadata_key.hh>
#include <paludis/name.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
#include <paludis/selection.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/fs_stat.hh>
+#include <paludis/util/stringify.hh>
#include <algorithm>
#include <functional>
diff --git a/src/clients/cave/parse_spec_with_nice_error.cc b/src/clients/cave/parse_spec_with_nice_error.cc
index 22f1b90..688f37d 100644
--- a/src/clients/cave/parse_spec_with_nice_error.cc
+++ b/src/clients/cave/parse_spec_with_nice_error.cc
@@ -19,7 +19,7 @@
#include "parse_spec_with_nice_error.hh"
#include "exceptions.hh"
-#include <paludis/package_database.hh>
+#include <paludis/environment.hh>
using namespace paludis;
using namespace cave;
diff --git a/src/clients/cave/resolve_cmdline.cc b/src/clients/cave/resolve_cmdline.cc
index 2a107d7..204171b 100644
--- a/src/clients/cave/resolve_cmdline.cc
+++ b/src/clients/cave/resolve_cmdline.cc
@@ -21,7 +21,6 @@
#include <paludis/args/do_help.hh>
#include <paludis/repository.hh>
#include <paludis/environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/util/map.hh>
#include <paludis/util/log.hh>
#include <paludis/repository_factory.hh>
@@ -450,7 +449,7 @@ ResolveCommandLineImportOptions::apply(const std::shared_ptr<Environment> & env)
std::shared_ptr<Repository> repo(RepositoryFactory::get_instance()->create(env.get(),
std::bind(from_keys, keys, std::placeholders::_1)));
- env->package_database()->add_repository(10, repo);
+ env->add_repository(10, repo);
}
void
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index cd8d643..cfb68dc 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -102,7 +102,6 @@
#include <paludis/package_id.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/package_database.hh>
#include <paludis/filter.hh>
#include <paludis/generator.hh>
#include <paludis/selection.hh>
@@ -689,7 +688,7 @@ namespace
if (std::string::npos != s.find('/'))
return QualifiedPackageName(s);
else
- return env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(s));
+ return env->fetch_unique_qualified_package_name(PackageNamePart(s));
}
struct AllowPretend
diff --git a/src/clients/cave/size_common.cc b/src/clients/cave/size_common.cc
index 22a095d..c069278 100644
--- a/src/clients/cave/size_common.cc
+++ b/src/clients/cave/size_common.cc
@@ -28,7 +28,6 @@
#include <paludis/generator.hh>
#include <paludis/metadata_key.hh>
#include <paludis/name.hh>
-#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
#include <paludis/selection.hh>
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 3e291bb..aa26e60 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -44,8 +44,8 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
-#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/repository.hh>
#include <algorithm>
#include <functional>
#include <iostream>
@@ -349,7 +349,7 @@ main(int argc, char *argv[])
std::shared_ptr<PackageIDSequence> ids(env[selection::AllVersionsSorted(
generator::InRepository(env.main_repository()->name()))]);
- Results results(env.package_database().get());
+ Results results((PackageIDComparator(&env)));
unsigned success(0), total(0);
CategoryNamePart old_cat("OLDCAT");
Mutex mutex;