diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | doc/api/cplusplus/doxygen.conf.in | 1 | ||||
-rw-r--r-- | doc/api/cplusplus/examples/example_command_line.hh | 3 | ||||
-rw-r--r-- | doc/api/cplusplus/groups.doxygen | 2 | ||||
-rw-r--r-- | paludis/Makefile.am.m4 | 1 | ||||
-rw-r--r-- | paludis/environment_factory.cc | 1 | ||||
-rw-r--r-- | paludis/environments/no_config/Makefile.am | 56 | ||||
-rw-r--r-- | paludis/environments/no_config/no_config_environment.cc | 593 | ||||
-rw-r--r-- | paludis/environments/no_config/no_config_environment.hh | 219 | ||||
-rw-r--r-- | paludis/environments/no_config/no_config_environment.se | 23 | ||||
-rw-r--r-- | paludis/environments/no_config/no_config_environment_TEST.cc | 44 | ||||
-rwxr-xr-x | paludis/environments/no_config/no_config_environment_TEST_cleanup.sh | 9 | ||||
-rwxr-xr-x | paludis/environments/no_config/no_config_environment_TEST_setup.sh | 25 | ||||
-rw-r--r-- | paludis/environments/no_config/registration.cc | 123 | ||||
-rw-r--r-- | python/environment.cc | 54 | ||||
-rw-r--r-- | ruby/environment.cc | 151 | ||||
-rw-r--r-- | ruby/paludis_ruby.hh | 2 |
18 files changed, 4 insertions, 1312 deletions
diff --git a/.gitignore b/.gitignore index 9db97a258..f249bcf78 100644 --- a/.gitignore +++ b/.gitignore @@ -245,7 +245,6 @@ paludis-*.*.*.tar.bz2 /paludis/elike_use_requirement_TEST /paludis/environment_implementation_TEST /paludis/environments/adapted/adapted_environment_TEST -/paludis/environments/no_config/no_config_environment_TEST /paludis/environments/paludis/paludis_environment_TEST /paludis/environments/paludis/world_TEST /paludis/environments/portage/portage_environment_TEST diff --git a/configure.ac b/configure.ac index 495d59ab3..2c1b7d8c4 100644 --- a/configure.ac +++ b/configure.ac @@ -1518,17 +1518,16 @@ fi dnl }}} dnl {{{ environments -m4_define(ALL_ENVIRONMENTS_m4, [no_config,paludis,portage,test]) +m4_define(ALL_ENVIRONMENTS_m4, [paludis,portage,test]) ALL_ENVIRONMENTS=`echo ALL_ENVIRONMENTS_m4 | tr , ' '` -DEFAULT_ENVIRONMENTS="no_config paludis test" +DEFAULT_ENVIRONMENTS="paludis test" AC_MSG_CHECKING([which environments to build...]) AC_ARG_WITH([environments], [ --with-environments=foo,bar,... Build the specified environments: all All available environments - default Equivalent to no_config,paludis,test + default Equivalent to paludis,test - no_config Configurationless environment paludis Standard Paludis environments portage Portage configuration (dodgy) test For test cases], @@ -1833,7 +1832,6 @@ AC_CONFIG_FILES([ paludis/distributions/exherbo/Makefile paludis/distributions/gentoo/Makefile paludis/environments/Makefile - paludis/environments/no_config/Makefile paludis/environments/paludis/Makefile paludis/environments/portage/Makefile paludis/environments/test/Makefile diff --git a/doc/api/cplusplus/doxygen.conf.in b/doc/api/cplusplus/doxygen.conf.in index a26ce8d01..ba2094106 100644 --- a/doc/api/cplusplus/doxygen.conf.in +++ b/doc/api/cplusplus/doxygen.conf.in @@ -555,7 +555,6 @@ WARN_LOGFILE = INPUT = ../../../paludis \ ../../../paludis/args \ ../../../paludis/environments \ - ../../../paludis/environments/no_config \ ../../../paludis/environments/test \ ../../../paludis/fetchers \ ../../../paludis/repositories/fake \ diff --git a/doc/api/cplusplus/examples/example_command_line.hh b/doc/api/cplusplus/examples/example_command_line.hh index d66fa7fc1..ac9c580a9 100644 --- a/doc/api/cplusplus/examples/example_command_line.hh +++ b/doc/api/cplusplus/examples/example_command_line.hh @@ -19,8 +19,7 @@ namespace examples * * Most Paludis clients should support at least '--help', '--version' * and '--log-level'. If paludis::EnvironmentFactory is used to create - * the environment (as opposed to, say, paludis::NoConfigEnvironment), - * then '--environment' must also be an option. + * the environment then '--environment' must also be an option. * * Clients are free to use whichever command line handling library they * prefer, but for convenience all Paludis core clients use a common utility diff --git a/doc/api/cplusplus/groups.doxygen b/doc/api/cplusplus/groups.doxygen index 99262c90f..4e2db4f64 100644 --- a/doc/api/cplusplus/groups.doxygen +++ b/doc/api/cplusplus/groups.doxygen @@ -86,8 +86,6 @@ using namespace paludis; * * An Environment subclass is the starting point for most programs. For programs * that use user configuration, EnvironmentMaker is used to obtain an instance. - * For programs that operate without configuration, NoConfigEnvironment should - * be used instead. * * \section Examples * diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4 index a95473950..1b9f5eb42 100644 --- a/paludis/Makefile.am.m4 +++ b/paludis/Makefile.am.m4 @@ -115,7 +115,6 @@ endif ') condenv(dummy) -condenv(no_config) condenv(paludis) condenv(portage) condenv(test) diff --git a/paludis/environment_factory.cc b/paludis/environment_factory.cc index f03071f03..00b8fbd76 100644 --- a/paludis/environment_factory.cc +++ b/paludis/environment_factory.cc @@ -78,7 +78,6 @@ EnvironmentFactory::EnvironmentFactory() : using namespace environment_groups; register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_dummy>::Type *>(0), this); - register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_no_config>::Type *>(0), this); register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_paludis>::Type *>(0), this); register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_portage>::Type *>(0), this); register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_test>::Type *>(0), this); diff --git a/paludis/environments/no_config/Makefile.am b/paludis/environments/no_config/Makefile.am deleted file mode 100644 index 4d8170a84..000000000 --- a/paludis/environments/no_config/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -include $(top_srcdir)/misc/common-makefile.am - -DISTCLEANFILES = no_config_environment-se.hh no_config_environment-se.cc -AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@ -DEFS= \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)\" - -libpaludisnoconfigenvironment_la_SOURCES = \ - no_config_environment.cc no_config_environment.hh \ - registration.cc - -noinst_LTLIBRARIES = libpaludisnoconfigenvironment.la - -paludis_environment_no_config_includedir = $(includedir)/paludis-$(PALUDIS_PC_SLOT)/paludis/environments/no_config -paludis_environment_no_config_include_HEADERS = \ - no_config_environment.hh \ - no_config_environment-se.hh - -EXTRA_DIST = \ - no_config_environment-se.hh \ - no_config_environment-se.cc \ - no_config_environment.se \ - no_config_environment_TEST.cc \ - no_config_environment_TEST_setup.sh \ - no_config_environment_TEST_cleanup.sh - -TESTS = no_config_environment_TEST - -check_PROGRAMS = $(TESTS) -check_SCRIPTS = no_config_environment_TEST_setup.sh no_config_environment_TEST_cleanup.sh - -no_config_environment_TEST_SOURCES = no_config_environment_TEST.cc - -no_config_environment_TEST_LDADD = \ - $(top_builddir)/paludis/util/gtest_runner.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(DYNAMIC_LD_LIBS) - -no_config_environment_TEST_LDFLAGS = @GTESTDEPS_LDFLAGS@ @GTESTDEPS_LIBS@ - -no_config_environment_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ @GTESTDEPS_CXXFLAGS@ - -BUILT_SOURCES = \ - no_config_environment-se.hh \ - no_config_environment-se.cc - -no_config_environment-se.hh : no_config_environment.se $(top_srcdir)/misc/make_se.bash - $(top_srcdir)/misc/make_se.bash --header $(srcdir)/no_config_environment.se > $@ - -no_config_environment-se.cc : no_config_environment.se $(top_srcdir)/misc/make_se.bash - $(top_srcdir)/misc/make_se.bash --source $(srcdir)/no_config_environment.se > $@ - diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc deleted file mode 100644 index e256f05ec..000000000 --- a/paludis/environments/no_config/no_config_environment.cc +++ /dev/null @@ -1,593 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * 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 - * 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/environments/no_config/no_config_environment.hh> - -#include <paludis/util/tokeniser.hh> -#include <paludis/util/log.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/util/map-impl.hh> -#include <paludis/util/set.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/create_iterator-impl.hh> -#include <paludis/util/pimp-impl.hh> -#include <paludis/util/config_file.hh> -#include <paludis/util/wrapped_output_iterator-impl.hh> -#include <paludis/util/tribool.hh> -#include <paludis/util/make_named_values.hh> -#include <paludis/util/graph-impl.hh> -#include <paludis/util/hashes.hh> -#include <paludis/util/member_iterator-impl.hh> -#include <paludis/util/sequence-impl.hh> -#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/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> -#include <set> -#include <list> - -#include "config.h" - -using namespace paludis; -using namespace paludis::no_config_environment; - -#include <paludis/environments/no_config/no_config_environment-se.cc> - -namespace paludis -{ - template<> - struct Imp<NoConfigEnvironment> - { - const no_config_environment::Params params; - - const FSPath top_level_dir; - const FSPath write_cache; - bool accept_unstable; - bool is_vdb; - - std::shared_ptr<Repository> main_repo; - std::shared_ptr<Repository> master_repo; - std::list<std::shared_ptr<Repository> > extra_repos; - - 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(const no_config_environment::Params & params); - void initialise(NoConfigEnvironment * const env); - }; - - /* This goat is for Dave Wickham */ -} - -namespace -{ - bool is_vdb_repository(const FSPath & location, no_config_environment::RepositoryType type) - { - switch (type) - { - case ncer_ebuild: - return false; - case ncer_vdb: - return true; - case ncer_auto: - case last_ncer: - ; - } - - Context context("When determining repository type at '" + stringify(location) + "':"); - - if (! location.stat().is_directory()) - throw ConfigurationError("Location is not a directory"); - - if ((location / "profiles").stat().is_directory()) - { - Log::get_instance()->message("no_config_environment.ebuild_detected", ll_debug, lc_context) - << "Found profiles/, looks like Ebuild format"; - return false; - } - - int outer_count(0); - for (FSIterator d(location, { fsio_want_directories }), d_end ; d != d_end ; ++d) - { - int inner_count(0); - for (FSIterator e(*d, { fsio_want_directories }), e_end ; e != e_end ; ++e) - { - if ((*e / "CONTENTS").stat().exists()) - { - Log::get_instance()->message("no_config_environment.vdb_detected", ll_debug, lc_context) - << "Found '" << stringify(*e) << "/CONTENTS', looks like VDB format"; - return true; - } - - if (inner_count++ >= 5) - break; - } - - if (outer_count++ >= 5) - break; - } - - throw ConfigurationError("Can't work out what kind of repository this is"); - } - - std::string from_keys(const std::shared_ptr<const Map<std::string, std::string> > & m, - const std::string & k) - { - Map<std::string, std::string>::ConstIterator mm(m->find(k)); - if (m->end() == mm) - return ""; - else - return mm->second; - } -} - -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())), - 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())), - preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("root", "Root", - mkt_normal, FSPath("/"))), - system_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("system_root", "System Root", - mkt_normal, FSPath("/"))) -{ -} - -void -Imp<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env) -{ - Context context("When initialising NoConfigEnvironment at '" + stringify(params.repository_dir()) + "':"); - - if (! is_vdb) - { - /* don't assume these're in initialisable order. */ - std::map<FSPath, bool, FSPathComparator> repository_dirs; - RepositoryName main_repository_name("x"); - bool ignored_one(false); - - repository_dirs.insert(std::make_pair(params.repository_dir(), true)); - for (FSPathSequence::ConstIterator d(params.extra_repository_dirs()->begin()), d_end(params.extra_repository_dirs()->end()) ; - d != d_end ; ++d) - { - if (params.repository_dir().realpath() == d->realpath()) - { - Log::get_instance()->message("no_config_environment.extra_repository.ignoring", ll_warning, lc_context) - << "Ignoring extra_repository_dir '" << *d << "' because it is the same as repository_dir"; - ignored_one = true; - continue; - } - - repository_dirs.insert(std::make_pair(*d, false)); - } - - std::unordered_map<RepositoryName, std::function<std::string (const std::string &)>, - Hash<RepositoryName> > repo_configs; - - for (auto r(repository_dirs.begin()), r_end(repository_dirs.end()) ; - r != r_end ; ++r) - { - Context local_context("When reading repository at location '" + stringify(r->first) + "':"); - - std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>()); - - if (params.extra_params()) - std::copy(params.extra_params()->begin(), params.extra_params()->end(), keys->inserter()); - - keys->insert("format", "e"); - keys->insert("location", stringify(r->first.realpath())); - keys->insert("profiles", params.profiles_if_not_auto().empty() ? "(auto)" : params.profiles_if_not_auto()); - keys->insert("ignore_deprecated_profiles", "true"); - keys->insert("write_cache", stringify(params.write_cache())); - keys->insert("names_cache", "/var/empty"); - keys->insert("builddir", "/var/empty"); - - if (params.disable_metadata_cache()) - keys->insert("cache", "/var/empty"); - - if (r->second && ! params.master_repository_name().empty()) - keys->insert("master_repository", params.master_repository_name()); - - if ((r->first / "metadata" / "profiles_desc.conf").stat().exists()) - keys->insert("layout", "exheres"); - - std::function<std::string (const std::string &)> repo_func( - std::bind(&from_keys, keys, std::placeholders::_1)); - - RepositoryName name(RepositoryFactory::get_instance()->name(env, repo_func)); - if (ignored_one && r->second && stringify(name) == params.master_repository_name()) - keys->erase(std::string("master_repository")); - if (! repo_configs.insert(std::make_pair(name, repo_func)).second) - { - Log::get_instance()->message("no_config_environment.repositories.duplicate", ll_warning, lc_context) - << "Duplicate repository name '" << name << "' from path '" << r->first << "', skipping"; - continue; - } - - if (r->second) - main_repository_name = name; - } - - /* work out order for repository creation */ - DirectedGraph<RepositoryName, bool> repository_deps; - std::for_each(first_iterator(repo_configs.begin()), first_iterator(repo_configs.end()), std::bind( - std::mem_fn(&DirectedGraph<RepositoryName, bool>::add_node), - &repository_deps, std::placeholders::_1)); - - for (std::unordered_map<RepositoryName, std::function<std::string (const std::string &)>, Hash<RepositoryName> >::const_iterator - r(repo_configs.begin()), r_end(repo_configs.end()) ; r != r_end ; ++r) - { - std::shared_ptr<const RepositoryNameSet> deps(RepositoryFactory::get_instance()->dependencies( - env, r->second)); - for (RepositoryNameSet::ConstIterator d(deps->begin()), d_end(deps->end()) ; - d != d_end ; ++d) - { - if (*d == r->first) - { - Log::get_instance()->message("no_config_environment.repositories.self_dependent", ll_warning, lc_context) - << "Repository '" + stringify(r->first) + "' incorrectly requires itself"; - continue; - } - - try - { - repository_deps.add_edge(r->first, *d, true); - } - catch (const NoSuchGraphNodeError &) - { - throw ConfigurationError("Repository '" + stringify(r->first) + "' requires repository '" + - stringify(*d) + "', which is not configured"); - } - } - } - - try - { - std::list<RepositoryName> ordered_repos; - repository_deps.topological_sort(std::back_inserter(ordered_repos)); - - for (std::list<RepositoryName>::const_iterator o(ordered_repos.begin()), o_end(ordered_repos.end()) ; - o != o_end ; ++o) - { - std::unordered_map<RepositoryName, std::function<std::string (const std::string &)>, Hash<RepositoryName> >::const_iterator - c(repo_configs.find(*o)); - if (c == repo_configs.end()) - throw InternalError(PALUDIS_HERE, "*o not in repo_configs"); - - std::shared_ptr<Repository> repo(RepositoryFactory::get_instance()->create(env, c->second)); - if (repo->name() == main_repository_name) - { - main_repo = repo; - env->add_repository(3, repo); - } - else if (stringify(repo->name()) == params.master_repository_name()) - { - master_repo = repo; - env->add_repository(2, repo); - } - else - env->add_repository(1, repo); - } - } - catch (const NoGraphTopologicalOrderExistsError & x) - { - throw ConfigurationError("Repositories have circular dependencies. Unresolvable repositories are '" - + join(x.remaining_nodes()->begin(), x.remaining_nodes()->end(), "', '") + "'"); - } - - if (! main_repo) - throw ConfigurationError("Don't have a main repository"); - - if ((! params.master_repository_name().empty()) && (! master_repo) && - (params.master_repository_name() != stringify(main_repo->name()))) - throw ConfigurationError("Can't find repository '" + params.master_repository_name() + "'"); - } - else - { - Log::get_instance()->message("no_config_environment.vdb_detected", ll_debug, lc_context) << "VDB, using vdb_db"; - - std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>()); - if (params.extra_params()) - std::copy(params.extra_params()->begin(), params.extra_params()->end(), keys->inserter()); - - keys->insert("format", "vdb"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(top_level_dir.realpath())); - - env->add_repository(1, RepositoryFactory::get_instance()->create(env, - std::bind(from_keys, keys, std::placeholders::_1))); - } -} - -NoConfigEnvironment::NoConfigEnvironment(const no_config_environment::Params & params) : - _imp(params) -{ - _imp->initialise(this); - -#if 0 - if (_imp->main_repo) - if ((*_imp->main_repo).e_interface()->end_profiles() != (*_imp->main_repo).e_interface()->begin_profiles()) - (*_imp->main_repo).e_interface()->set_profile((*_imp->main_repo).e_interface()->begin_profiles()); - - if (_imp->master_repo) - if ((*_imp->master_repo).e_interface()->end_profiles() != - (*_imp->master_repo).e_interface()->begin_profiles()) - (*_imp->master_repo).e_interface()->set_profile( - (*_imp->master_repo).e_interface()->begin_profiles()); -#endif - - add_metadata_key(_imp->format_key); - add_metadata_key(_imp->repository_dir_key); - add_metadata_key(_imp->preferred_root_key); - add_metadata_key(_imp->system_root_key); -} - -NoConfigEnvironment::~NoConfigEnvironment() -{ -} - -FSPath -NoConfigEnvironment::main_repository_dir() const -{ - return _imp->top_level_dir; -} - -std::shared_ptr<Repository> -NoConfigEnvironment::main_repository() -{ - return _imp->main_repo; -} - -std::shared_ptr<const Repository> -NoConfigEnvironment::main_repository() const -{ - return _imp->main_repo; -} - -std::shared_ptr<Repository> -NoConfigEnvironment::master_repository() -{ - return _imp->master_repo; -} - -std::shared_ptr<const Repository> -NoConfigEnvironment::master_repository() const -{ - return _imp->master_repo; -} - -bool -NoConfigEnvironment::accept_keywords( - const std::shared_ptr<const KeywordNameSet> & keywords, - const std::shared_ptr<const PackageID> &) const -{ - if (_imp->is_vdb) - return true; - - std::list<KeywordName> accepted; - if (_imp->main_repo->accept_keywords_key()) - tokenise_whitespace(_imp->main_repo->accept_keywords_key()->parse_value(), - create_inserter<KeywordName>(std::back_inserter(accepted))); - - tokenise_whitespace(_imp->params.extra_accept_keywords(), - create_inserter<KeywordName>(std::back_inserter(accepted))); - - if (accepted.empty()) - throw ConfigurationError("Don't know how to work out whether keywords are acceptable"); - - for (KeywordNameSet::ConstIterator k(keywords->begin()), k_end(keywords->end()) ; - k != k_end ; ++k) - { - if (accepted.end() != std::find(accepted.begin(), accepted.end(), *k)) - return true; - - if (_imp->accept_unstable && stringify(*k).at(0) == '~') - if (accepted.end() != std::find(accepted.begin(), accepted.end(), KeywordName(stringify(*k).substr(1)))) - return true; - } - - return false; -} - -bool -NoConfigEnvironment::add_to_world(const QualifiedPackageName &) const -{ - return false; -} - -bool -NoConfigEnvironment::remove_from_world(const QualifiedPackageName &) const -{ - return false; -} - -bool -NoConfigEnvironment::add_to_world(const SetName &) const -{ - return false; -} - -bool -NoConfigEnvironment::remove_from_world(const SetName &) const -{ - return false; -} - -bool -NoConfigEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const -{ - return false; -} - -const std::shared_ptr<const Mask> -NoConfigEnvironment::mask_for_breakage(const std::shared_ptr<const PackageID> &) const -{ - return std::shared_ptr<const Mask>(); -} - -const std::shared_ptr<const Mask> -NoConfigEnvironment::mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const -{ - return std::shared_ptr<const Mask>(); -} - -uid_t -NoConfigEnvironment::reduced_uid() const -{ - return getuid(); -} - -gid_t -NoConfigEnvironment::reduced_gid() const -{ - return getgid(); -} - -std::shared_ptr<const MirrorsSequence> -NoConfigEnvironment::mirrors(const std::string &) const -{ - return std::make_shared<MirrorsSequence>(); -} - -bool -NoConfigEnvironment::accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const -{ - return true; -} - -HookResult -NoConfigEnvironment::perform_hook( - const Hook &, - const std::shared_ptr<OutputManager> & - ) const -{ - return make_named_values<HookResult>(n::max_exit_status() = 0, n::output() = ""); -} - -std::shared_ptr<const FSPathSequence> -NoConfigEnvironment::hook_dirs() const -{ - return std::make_shared<FSPathSequence>(); -} - -void -NoConfigEnvironment::need_keys_added() const -{ -} - -const std::shared_ptr<const MetadataValueKey<std::string> > -NoConfigEnvironment::format_key() const -{ - return _imp->format_key; -} - -const std::shared_ptr<const MetadataValueKey<FSPath> > -NoConfigEnvironment::config_location_key() const -{ - return std::shared_ptr<const MetadataValueKey<FSPath> >(); -} - -const std::shared_ptr<const MetadataValueKey<FSPath> > -NoConfigEnvironment::preferred_root_key() const -{ - return _imp->preferred_root_key; -} - -const std::shared_ptr<const MetadataValueKey<FSPath> > -NoConfigEnvironment::system_root_key() const -{ - return _imp->system_root_key; -} - -const Tribool -NoConfigEnvironment::want_choice_enabled( - const std::shared_ptr<const PackageID> &, - const std::shared_ptr<const Choice> &, - const UnprefixedChoiceName & - ) const -{ - return Tribool(indeterminate); -} - -const std::string -NoConfigEnvironment::value_for_choice_parameter( - const std::shared_ptr<const PackageID> &, - const std::shared_ptr<const Choice> &, - const UnprefixedChoiceName & - ) const -{ - return ""; -} - -std::shared_ptr<const Set<UnprefixedChoiceName> > -NoConfigEnvironment::known_choice_value_names( - const std::shared_ptr<const PackageID> &, - const std::shared_ptr<const Choice> & - ) const -{ - return std::make_shared<Set<UnprefixedChoiceName>>(); -} - -const std::shared_ptr<OutputManager> -NoConfigEnvironment::create_output_manager(const CreateOutputManagerInfo &) const -{ - return std::make_shared<StandardOutputManager>(); -} - -void -NoConfigEnvironment::populate_sets() const -{ -} - -const std::shared_ptr<Repository> -NoConfigEnvironment::repository_from_new_config_file(const FSPath &) -{ - throw InternalError(PALUDIS_HERE, "can't create repositories on the fly for NoConfigEnvironment"); -} - -void -NoConfigEnvironment::update_config_files_for_package_move(const PackageDepSpec &, const QualifiedPackageName &) const -{ -} - -Tribool -NoConfigEnvironment::interest_in_suggestion( - const std::shared_ptr<const PackageID> &, - const PackageDepSpec &) const -{ - return indeterminate; -} - diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh deleted file mode 100644 index 60be54777..000000000 --- a/paludis/environments/no_config/no_config_environment.hh +++ /dev/null @@ -1,219 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * 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 - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_ENVIRONMENT_NO_CONFIG_NO_CONFIG_ENVIRONMENT_HH -#define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_NO_CONFIG_NO_CONFIG_ENVIRONMENT_HH 1 - -#include <paludis/environment_implementation.hh> -#include <paludis/util/pimp.hh> -#include <paludis/util/map-fwd.hh> - -namespace paludis -{ - namespace n - { - typedef Name<struct name_accept_unstable> accept_unstable; - typedef Name<struct name_disable_metadata_cache> disable_metadata_cache; - typedef Name<struct name_extra_accept_keywords> extra_accept_keywords; - typedef Name<struct name_extra_params> extra_params; - typedef Name<struct name_extra_repository_dirs> extra_repository_dirs; - typedef Name<struct name_master_repository_name> master_repository_name; - typedef Name<struct name_profiles_if_not_auto> profiles_if_not_auto; - typedef Name<struct name_repository_dir> repository_dir; - typedef Name<struct name_repository_type> repository_type; - typedef Name<struct name_write_cache> write_cache; - } - - namespace no_config_environment - { -#include <paludis/environments/no_config/no_config_environment-se.hh> - - /** - * Parameters for a NoConfigEnvironment. - * - * \see NoConfigEnvironment - * \ingroup grpnoconfigenvironment - * \nosubgrouping - */ - struct Params - { - NamedValue<n::accept_unstable, bool> accept_unstable; - NamedValue<n::disable_metadata_cache, bool> disable_metadata_cache; - NamedValue<n::extra_accept_keywords, std::string> extra_accept_keywords; - NamedValue<n::extra_params, std::shared_ptr<Map<std::string, std::string> > > extra_params; - NamedValue<n::extra_repository_dirs, std::shared_ptr<const FSPathSequence> > extra_repository_dirs; - NamedValue<n::master_repository_name, std::string> master_repository_name; - - /** - * The profiles to use. - * - * Leave empty for automatic selection (which may not always be possible). - * - * \since 0.44 - */ - NamedValue<n::profiles_if_not_auto, std::string> profiles_if_not_auto; - - NamedValue<n::repository_dir, FSPath> repository_dir; - NamedValue<n::repository_type, no_config_environment::RepositoryType> repository_type; - NamedValue<n::write_cache, FSPath> write_cache; - }; - } - - /** - * An environment that uses a single repository, with no user configuration. - * - * \ingroup grpnoconfigenvironment - * \nosubgrouping - */ - class PALUDIS_VISIBLE NoConfigEnvironment : - public EnvironmentImplementation - { - private: - Pimp<NoConfigEnvironment> _imp; - - virtual void need_keys_added() const; - - protected: - virtual void populate_sets() const; - - public: - ///\name Basic operations - ///\{ - - NoConfigEnvironment(const no_config_environment::Params & params); - - virtual ~NoConfigEnvironment(); - - ///\} - - ///\name NoConfigEnvironment-specific configuration options - ///\{ - - /** - * What is our top level directory for our main repository? - */ - FSPath main_repository_dir() const; - - ///\} - - ///\name NoConfigEnvironment-specific repository information - ///\{ - - /** - * Fetch our 'main' repository. - */ - std::shared_ptr<Repository> main_repository(); - - /** - * Fetch our 'main' repository. - */ - std::shared_ptr<const Repository> main_repository() const; - - /** - * Fetch our 'master' repository (may be zero). - */ - std::shared_ptr<Repository> master_repository(); - - /** - * Fetch our 'master' repository (may be zero). - */ - std::shared_ptr<const Repository> master_repository() const; - - ///\} - - virtual const Tribool want_choice_enabled( - const std::shared_ptr<const PackageID> &, - const std::shared_ptr<const Choice> &, - const UnprefixedChoiceName & - ) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual const std::string value_for_choice_parameter( - const std::shared_ptr<const PackageID> &, - const std::shared_ptr<const Choice> &, - const UnprefixedChoiceName & - ) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual std::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names( - const std::shared_ptr<const PackageID> &, - const std::shared_ptr<const Choice> & - ) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual Tribool interest_in_suggestion( - const std::shared_ptr<const PackageID> & from_id, - const PackageDepSpec & spec) 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)); - - virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const std::shared_ptr<const PackageID> &) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual const std::shared_ptr<const Mask> mask_for_breakage(const std::shared_ptr<const PackageID> &) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool will_be_used_for_overridden) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual std::shared_ptr<const FSPathSequence> hook_dirs() const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual uid_t reduced_uid() const; - - virtual gid_t reduced_gid() const; - - virtual std::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual HookResult perform_hook( - const Hook &, - const std::shared_ptr<OutputManager> &) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - - virtual bool add_to_world(const QualifiedPackageName &) const; - - virtual bool add_to_world(const SetName &) const; - - virtual bool remove_from_world(const QualifiedPackageName &) const; - - virtual bool remove_from_world(const SetName &) const; - - virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const; - virtual const std::shared_ptr<const MetadataValueKey<FSPath> > config_location_key() const; - virtual const std::shared_ptr<const MetadataValueKey<FSPath> > preferred_root_key() const; - virtual const std::shared_ptr<const MetadataValueKey<FSPath> > system_root_key() const; - - virtual const std::shared_ptr<OutputManager> create_output_manager( - const CreateOutputManagerInfo &) const; - - virtual const std::shared_ptr<Repository> repository_from_new_config_file( - const FSPath &) PALUDIS_ATTRIBUTE((noreturn)); - - virtual void update_config_files_for_package_move( - const PackageDepSpec &, const QualifiedPackageName &) const; - }; -} - -#endif diff --git a/paludis/environments/no_config/no_config_environment.se b/paludis/environments/no_config/no_config_environment.se deleted file mode 100644 index 32376de2d..000000000 --- a/paludis/environments/no_config/no_config_environment.se +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -# vim: set sw=4 sts=4 et ft=sh : - -make_enum_RepositoryType() -{ - namespace no_config_environment - want_destringify - prefix ncer - - key ncer_ebuild "Ebuilds" - key ncer_vdb "VDB" - key ncer_auto "Automatic" - - doxygen_comment << "END" - /** - * Type of repository for NoConfigEnvironment. - * - * \see NoConfigEnvironment - * \since 0.28 - */ -END -} - diff --git a/paludis/environments/no_config/no_config_environment_TEST.cc b/paludis/environments/no_config/no_config_environment_TEST.cc deleted file mode 100644 index c4403df15..000000000 --- a/paludis/environments/no_config/no_config_environment_TEST.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * 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 - * 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/environments/no_config/no_config_environment.hh> - -#include <paludis/util/sequence.hh> -#include <paludis/util/make_named_values.hh> - -#include <gtest/gtest.h> - -using namespace paludis; - -TEST(NoConfigEnvironment, Construction) -{ - NoConfigEnvironment e(make_named_values<no_config_environment::Params>( - n::accept_unstable() = false, - n::disable_metadata_cache() = false, - n::extra_accept_keywords() = "", - n::extra_params() = std::shared_ptr<Map<std::string, std::string> >(), - n::extra_repository_dirs() = std::make_shared<FSPathSequence>(), - n::master_repository_name() = "", - n::profiles_if_not_auto() = "", - n::repository_dir() = FSPath("no_config_environment_TEST_dir/repo"), - n::repository_type() = no_config_environment::ncer_auto, - n::write_cache() = FSPath("/var/empty") - )); -} - diff --git a/paludis/environments/no_config/no_config_environment_TEST_cleanup.sh b/paludis/environments/no_config/no_config_environment_TEST_cleanup.sh deleted file mode 100755 index 1948f4236..000000000 --- a/paludis/environments/no_config/no_config_environment_TEST_cleanup.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -if [ -d no_config_environment_TEST_dir ] ; then - rm -fr no_config_environment_TEST_dir -else - true -fi - diff --git a/paludis/environments/no_config/no_config_environment_TEST_setup.sh b/paludis/environments/no_config/no_config_environment_TEST_setup.sh deleted file mode 100755 index a4421aaa2..000000000 --- a/paludis/environments/no_config/no_config_environment_TEST_setup.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir no_config_environment_TEST_dir || exit 2 -cd no_config_environment_TEST_dir || exit 3 - -mkdir -p repo/{profiles/profile,cat-one/pkg-one} -cat <<END > repo/profiles/repo_name -foo -END -cat <<END > repo/profiles/categories -cat-one -END -cat <<END > repo/profiles/profiles.desc -foo profile stable -END -cat <<END > repo/profiles/profile/make.defaults -ARCH="foo" -USE="moo" -USE_EXPAND="EXP MORE_EXP THIRD_EXP" -EXP="one" -MORE_EXP="one" -THIRD_EXP="one" -END - diff --git a/paludis/environments/no_config/registration.cc b/paludis/environments/no_config/registration.cc deleted file mode 100644 index 0f6f74b25..000000000 --- a/paludis/environments/no_config/registration.cc +++ /dev/null @@ -1,123 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009, 2010 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/environments/no_config/no_config_environment.hh> -#include <paludis/environment_factory.hh> -#include <paludis/util/map.hh> -#include <paludis/util/set.hh> -#include <paludis/util/tokeniser.hh> -#include <paludis/util/destringify.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/make_named_values.hh> -#include <list> -#include "config.h" - -using namespace paludis; - -namespace -{ - std::shared_ptr<Environment> - make_no_config_environment(const std::string & s) - { - Context context("When making NoConfigEnvironment using spec '" + s + "':"); - - std::shared_ptr<Map<std::string, std::string> > extra_params( - std::make_shared<Map<std::string, std::string>>()); - FSPath repository_dir(FSPath::cwd()); - std::shared_ptr<FSPathSequence> extra_repository_dirs(std::make_shared<FSPathSequence>()); - FSPath write_cache("/var/empty"); - std::string profile; - std::string master_repository_name; - bool disable_metadata_cache(false); - bool accept_unstable(false); - no_config_environment::RepositoryType repository_type(no_config_environment::ncer_auto); - std::string extra_accept_keywords; - - std::list<std::string> tokens; - tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(s, ":", "", std::back_inserter(tokens)); - for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ; - t != t_end ; ++t) - { - std::string::size_type p(t->find('=')); - if (std::string::npos == p) - repository_dir = FSPath(*t); - else - { - std::string key(t->substr(0, p)), value(t->substr(p + 1)); - - if (key == "write-cache") - write_cache = FSPath(value); - else if (key == "master-repository-name") - master_repository_name = value; - else if (key == "master-repository-dir") - throw ConfigurationError("NoConfigEnvironment key master-repository-dir is no longer " - "supported, use master-repository-name and extra-repository-dir"); - else if (key == "extra-repository-dir") - extra_repository_dirs->push_back(FSPath(value)); - else if (key == "profile") - profile = value; - else if (key == "repository-dir") - repository_dir = FSPath(value); - else if (key == "disable-metadata-cache") - disable_metadata_cache = destringify<bool>(value); - else if (key == "accept-unstable") - accept_unstable = destringify<bool>(value); - else if (key == "repository-type") - repository_type = destringify<no_config_environment::RepositoryType>(value); - else if (key == "extra-accept-keywords") - extra_accept_keywords = value; - else - extra_params->insert(key, value); - } - } - - return std::make_shared<NoConfigEnvironment>( - make_named_values<no_config_environment::Params>( - n::accept_unstable() = accept_unstable, - n::disable_metadata_cache() = disable_metadata_cache, - n::extra_accept_keywords() = extra_accept_keywords, - n::extra_params() = extra_params, - n::extra_repository_dirs() = extra_repository_dirs, - n::master_repository_name() = master_repository_name, - n::profiles_if_not_auto() = profile, - n::repository_dir() = repository_dir, - n::repository_type() = repository_type, - n::write_cache() = write_cache - )); - } -} - -namespace paludis -{ - namespace environment_groups - { - ENVIRONMENT_GROUPS_DECLS; - } - - template <> - void register_environment<environment_groups::no_config>(const environment_groups::no_config * const, - EnvironmentFactory * const factory) - { - std::shared_ptr<Set<std::string> > no_config_formats(std::make_shared<Set<std::string>>()); - no_config_formats->insert("no_config"); - no_config_formats->insert("no-config"); - factory->add_environment_format(no_config_formats, &make_no_config_environment); - } -} - diff --git a/python/environment.cc b/python/environment.cc index d208bb2f2..df754c9a2 100644 --- a/python/environment.cc +++ b/python/environment.cc @@ -24,8 +24,6 @@ #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> @@ -428,28 +426,6 @@ class EnvironmentImplementationWrapper : BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(fetch_unique_qualified_package_name_overloads, fetch_unique_qualified_package_name, 1, 3) -struct NoConfigEnvironmentWrapper : - NoConfigEnvironment -{ - NoConfigEnvironmentWrapper(const FSPath & env_dir, const FSPath & cache_dir, - const std::string & master_repo_name, const std::shared_ptr<const FSPathSequence> & extra_repository_dirs - ) : - NoConfigEnvironment(make_named_values<no_config_environment::Params>( - n::accept_unstable() = false, - n::disable_metadata_cache() = false, - n::extra_accept_keywords() = "", - n::extra_params() = make_null_shared_ptr(), - n::extra_repository_dirs() = extra_repository_dirs, - n::master_repository_name() = master_repo_name, - n::profiles_if_not_auto() = "", - n::repository_dir() = env_dir, - n::repository_type() = no_config_environment::ncer_auto, - n::write_cache() = cache_dir - )) - { - } -}; - void expose_environment() { /** @@ -691,36 +667,6 @@ void expose_environment() ; /** - * NoConfigEnvironment - */ - std::shared_ptr<Repository> (NoConfigEnvironment::*main_repository)() - = &NoConfigEnvironment::main_repository; - std::shared_ptr<Repository> (NoConfigEnvironment::*master_repository)() - = &NoConfigEnvironment::master_repository; - bp::class_<NoConfigEnvironmentWrapper, bp::bases<Environment>, boost::noncopyable> - ( - "NoConfigEnvironment", - "An environment that uses a single repository, with no user configuration.", - bp::init<const FSPath &, const FSPath &, const std::string &, const std::shared_ptr<const FSPathSequence> &>( - (bp::arg("environment_dir"), bp::arg("write_cache_dir")="/var/empty", - bp::arg("master_repository_name")="", - bp::arg("extra_repository_dirs") = std::make_shared<FSPathSequence>()), - "__init__(environment_dir, write_cache_dir=\"/var/empty\", " - "master_repository_name=\"\", extra_repository_dirs=[])" - ) - ) - .add_property("main_repository", main_repository, - "[ro] Repository\n" - "Main repository." - ) - - .add_property("master_repository", master_repository, - "[ro] Repository\n" - "Master repository." - ) - ; - - /** * TestEnvironment */ bp::class_<TestEnvironment, bp::bases<Environment>, boost::noncopyable> diff --git a/ruby/environment.cc b/ruby/environment.cc index ac9db1191..1b90c487e 100644 --- a/ruby/environment.cc +++ b/ruby/environment.cc @@ -20,7 +20,6 @@ #include <paludis_ruby.hh> #include <paludis/environments/paludis/paludis_environment.hh> -#include <paludis/environments/no_config/no_config_environment.hh> #include <paludis/environments/test/test_environment.hh> #include <paludis/environment_factory.hh> #include <paludis/util/wrapped_forward_iterator.hh> @@ -36,7 +35,6 @@ namespace { static VALUE c_environment; static VALUE c_paludis_environment; - static VALUE c_no_config_environment; static VALUE c_test_environment; static VALUE c_environment_factory; @@ -271,129 +269,6 @@ namespace return rb_str_new2(value_to_paludis_environment(self)->config_dir().c_str()); } - VALUE - no_config_environment_init(int, VALUE*, VALUE self) - { - return self; - } - - /* - * call-seq: - * NoConfigEnvironment.new(environment_dir) -> NoConfigEnvironment - * NoConfigEnvironment.new(environment_dir, write_cache_dir) -> NoConfigEnvironment - * NoConfigEnvironment.new(environment_dir, write_cache_dir, master_repository_name) -> NoConfigEnvironment - * NoConfigEnvironment.new(environment_dir, write_cache_dir, master_repository_name, [extra_repository_dirs]) -> NoConfigEnvironment - * - * Create a new NoConfigEnvironment from the specified directory. A write cache, master repository name - * and extra repository dirs may also be specified. - */ - VALUE - no_config_environment_new(int argc, VALUE* argv, VALUE self) - { - try - { - std::string write_cache, master_repository_name; - std::shared_ptr<FSPathSequence> extra_repository_dirs(std::make_shared<FSPathSequence>()); - if (1 == argc) - { - write_cache = "/var/empty/"; - master_repository_name = ""; - } - else if (2 == argc) - { - write_cache = StringValuePtr(argv[1]); - master_repository_name = ""; - } - else if (3 == argc) - { - write_cache = StringValuePtr(argv[1]); - master_repository_name = StringValuePtr(argv[2]); - } - else if (4 == argc) - { - write_cache = StringValuePtr(argv[1]); - master_repository_name = StringValuePtr(argv[2]); - - Check_Type(argv[3], T_ARRAY); - for (int i(0) ; i < RARRAY_LEN(argv[3]) ; ++i) - { - VALUE entry(rb_ary_entry(argv[3], i)); - extra_repository_dirs->push_back(FSPath(stringify(StringValuePtr(entry)))); - } - } - else - rb_raise(rb_eArgError, "NoConfigEnvironment.new expects one to four arguments, but got %d", argc); - - std::string path; - if (rb_obj_is_kind_of(argv[0], rb_cDir)) - { - VALUE v = rb_funcall(argv[0], rb_intern("path"), 0); - path = StringValuePtr(v); - } - else - path = StringValuePtr(argv[0]); - - std::shared_ptr<Environment> * e = new std::shared_ptr<Environment>(new - NoConfigEnvironment(make_named_values<no_config_environment::Params>( - n::accept_unstable() = false, - n::disable_metadata_cache() = false, - n::extra_accept_keywords() = "", - n::extra_params() = std::shared_ptr<Map<std::string, std::string> >(), - n::extra_repository_dirs() = extra_repository_dirs, - n::master_repository_name() = master_repository_name, - n::profiles_if_not_auto() = "", - n::repository_dir() = FSPath(path), - n::repository_type() = no_config_environment::ncer_auto, - n::write_cache() = write_cache - ))); - VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<Environment> >::free, e)); - rb_obj_call_init(tdata, argc, argv); - return tdata; - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } - } - - /* - * call-seq: - * main_repository -> Repository - * - * Return the main Repository in this environment - */ - VALUE - no_config_environment_main_repository(VALUE self) - { - try - { - return repository_to_value(value_to_no_config_environment(self)->main_repository()); - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } - } - - /* - * call-seq: - * master_repository -> PortageRepository - * - * Return the master repository in this environment - */ - VALUE - no_config_environment_master_repository(VALUE self) - { - try - { - return repository_to_value(value_to_no_config_environment(self)->master_repository()); - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } - } - /* * call-seq: * create(spec) -> Environment @@ -626,17 +501,6 @@ namespace rb_define_method(c_paludis_environment, "config_dir", RUBY_FUNC_CAST(&paludis_environment_config_dir), 0); /* - * Document-class: Paludis::NoConfigEnvironment - * - * An environment that uses a single repository, with no user configuration. - */ - c_no_config_environment = rb_define_class_under(paludis_module(), "NoConfigEnvironment", c_environment); - rb_define_singleton_method(c_no_config_environment, "new", RUBY_FUNC_CAST(&no_config_environment_new), -1); - rb_define_method(c_no_config_environment, "initialize", RUBY_FUNC_CAST(&no_config_environment_init), -1); - rb_define_method(c_no_config_environment, "main_repository", RUBY_FUNC_CAST(&no_config_environment_main_repository), 0); - rb_define_method(c_no_config_environment, "master_repository", RUBY_FUNC_CAST(&no_config_environment_master_repository), 0); - - /* * Document-class: Paludis::TestEnvironment * * A crude test environment. @@ -672,21 +536,6 @@ paludis::ruby::value_to_environment(VALUE v) } } -std::shared_ptr<NoConfigEnvironment> -paludis::ruby::value_to_no_config_environment(VALUE v) -{ - if (rb_obj_is_kind_of(v, c_no_config_environment)) - { - std::shared_ptr<Environment> * v_ptr; - Data_Get_Struct(v, std::shared_ptr<Environment>, v_ptr); - return std::static_pointer_cast<NoConfigEnvironment>(*v_ptr); - } - else - { - rb_raise(rb_eTypeError, "Can't convert %s into NoConfigEnvironment", rb_obj_classname(v)); - } -} - RegisterRubyClass::Register paludis_ruby_register_environment PALUDIS_ATTRIBUTE((used)) (&do_register_environment); diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh index 15130e617..2b243d053 100644 --- a/ruby/paludis_ruby.hh +++ b/ruby/paludis_ruby.hh @@ -28,7 +28,6 @@ #include <paludis/util/exception.hh> #include <paludis/util/singleton.hh> #include <paludis/environment.hh> -#include <paludis/environments/no_config/no_config_environment.hh> #include <paludis/repository.hh> #include <paludis/contents.hh> #include <paludis/mask-fwd.hh> @@ -94,7 +93,6 @@ namespace paludis std::shared_ptr<const DepSpec> value_to_dep_spec(VALUE v); QualifiedPackageName value_to_qualified_package_name(VALUE v); std::shared_ptr<Environment> value_to_environment(VALUE v); - std::shared_ptr<NoConfigEnvironment> value_to_no_config_environment(VALUE v); std::shared_ptr<Repository> value_to_repository(VALUE); std::shared_ptr<const SupportsActionTestBase> value_to_supports_action_test_base(VALUE v); std::shared_ptr<Action> value_to_action(VALUE v); |