diff options
author | 2014-09-14 14:51:53 +0100 | |
---|---|---|
committer | 2014-09-14 14:51:53 +0100 | |
commit | a8defde758297825a692608f5c36daeaeb536402 (patch) | |
tree | 577d01f0f321fd6e498a94430652e882452310f5 | |
parent | b28e304730944bde7e87390ad3880155642a70b4 (diff) | |
download | paludis-a8defde758297825a692608f5c36daeaeb536402.tar.gz paludis-a8defde758297825a692608f5c36daeaeb536402.tar.xz |
Add --chroot-path
-rw-r--r-- | paludis/resolver/find_repository_for_helper.cc | 22 | ||||
-rw-r--r-- | paludis/resolver/find_repository_for_helper.hh | 5 | ||||
-rw-r--r-- | src/clients/cave/resolve_cmdline.cc | 4 | ||||
-rw-r--r-- | src/clients/cave/resolve_cmdline.hh | 3 | ||||
-rw-r--r-- | src/clients/cave/resolve_common.cc | 2 |
5 files changed, 30 insertions, 6 deletions
diff --git a/paludis/resolver/find_repository_for_helper.cc b/paludis/resolver/find_repository_for_helper.cc index 16e7a81da..82d29e0a0 100644 --- a/paludis/resolver/find_repository_for_helper.cc +++ b/paludis/resolver/find_repository_for_helper.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010, 2011, 2013 Ciaran McCreesh + * Copyright (c) 2010, 2011, 2013, 2014 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,6 +33,8 @@ #include <paludis/environment.hh> #include <paludis/repository.hh> +#include <memory> + using namespace paludis; using namespace paludis::resolver; @@ -42,6 +44,7 @@ namespace paludis struct Imp<FindRepositoryForHelper> { const Environment * const env; + std::unique_ptr<const FSPath> chroot_path; Imp(const Environment * const e) : env(e) @@ -83,8 +86,14 @@ FindRepositoryForHelper::operator() ( break; case dt_install_to_chroot: - if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->parse_value() == _imp->env->system_root_key()->parse_value())) - continue; + if (_imp->chroot_path) { + if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->parse_value() != *_imp->chroot_path)) + continue; + } + else { + if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->parse_value() == _imp->env->system_root_key()->parse_value())) + continue; + } break; case dt_create_binary: @@ -125,7 +134,14 @@ FindRepositoryForHelper::operator() ( return result; } +void +FindRepositoryForHelper::set_chroot_path(const FSPath & p) +{ + _imp->chroot_path.reset(new FSPath(p)); +} + namespace paludis { template class Pimp<FindRepositoryForHelper>; } + diff --git a/paludis/resolver/find_repository_for_helper.hh b/paludis/resolver/find_repository_for_helper.hh index e4e7d6365..34cb544a0 100644 --- a/paludis/resolver/find_repository_for_helper.hh +++ b/paludis/resolver/find_repository_for_helper.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010, 2011 Ciaran McCreesh + * Copyright (c) 2010, 2011, 2014 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 @@ -25,6 +25,7 @@ #include <paludis/resolver/decision-fwd.hh> #include <paludis/util/pimp.hh> #include <paludis/util/attributes.hh> +#include <paludis/util/fs_path-fwd.hh> #include <paludis/environment-fwd.hh> #include <paludis/repository-fwd.hh> #include <memory> @@ -42,6 +43,8 @@ namespace paludis explicit FindRepositoryForHelper(const Environment * const); ~FindRepositoryForHelper(); + void set_chroot_path(const FSPath &); + const std::shared_ptr<const Repository> operator() ( const std::shared_ptr<const Resolution> &, const ChangesToMakeDecision &) const; diff --git a/src/clients/cave/resolve_cmdline.cc b/src/clients/cave/resolve_cmdline.cc index f60c2bdb0..b6895152d 100644 --- a/src/clients/cave/resolve_cmdline.cc +++ b/src/clients/cave/resolve_cmdline.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh + * Copyright (c) 2009, 2010, 2011, 2014 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 @@ -295,6 +295,8 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A "all"), a_one_binary_per_slot(&g_destination_options, "one-binary-per-slot", '\0', "When building a binary package, " "remove other versions in the same repository and slot (as would be done for non-binary packages).", true), + a_chroot_path(&g_destination_options, "chroot-path", '\0', "When making a chroot, only consider destination " + "repositories whose root is this value."), // g_query_options(this, "Query Options", "Query the user interactively when making decisions. " // "If only --query is specified, prompt for everything. Otherwise, prompt only for the specified decisions."), diff --git a/src/clients/cave/resolve_cmdline.hh b/src/clients/cave/resolve_cmdline.hh index 9631e9475..4edaf22a7 100644 --- a/src/clients/cave/resolve_cmdline.hh +++ b/src/clients/cave/resolve_cmdline.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh + * Copyright (c) 2009, 2010, 2011, 2014 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 @@ -103,6 +103,7 @@ namespace paludis args::StringSetArg a_via_binary; args::EnumArg a_dependencies_to_slash; args::SwitchArg a_one_binary_per_slot; + args::StringArg a_chroot_path; // args::ArgsGroup g_query_options; // args::SwitchArg a_query; diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc index 4e8c233e1..fe1cb8f51 100644 --- a/src/clients/cave/resolve_common.cc +++ b/src/clients/cave/resolve_common.cc @@ -831,6 +831,8 @@ paludis::cave::resolve_common( find_replacing_helper.set_one_binary_per_slot(resolution_options.a_one_binary_per_slot.specified()); FindRepositoryForHelper find_repository_for_helper(env.get()); + if (resolution_options.a_chroot_path.specified()) + find_repository_for_helper.set_chroot_path(FSPath(resolution_options.a_chroot_path.argument())); GetConstraintsForDependentHelper get_constraints_for_dependent_helper(env.get()); for (args::StringSetArg::ConstIterator i(resolution_options.a_less_restrictive_remove_blockers.begin_args()), |