diff options
author | 2018-03-20 16:08:03 +0100 | |
---|---|---|
committer | 2022-01-12 23:01:39 +0100 | |
commit | 6097401d9188c3ff8ea2791b352d9009d32711f7 (patch) | |
tree | 93fd580456ef78b0e4ff93d5cdaa214fa2ee5efa | |
parent | 9d5c09b0d54d053aea5b15aef1c94282735abf66 (diff) | |
download | paludis-cross.tar.gz paludis-cross.tar.xz |
resolver: improve the behaviour of suggestions on crosscross
Only auto-take crossed suggestions if they are in the same cross. This
prevents unnecessary targets from being added as suggestions to the
resolvent which would not build due to having a foreign cross target.
Change-Id: Ifaf418319924dc98519f7f548e0a104bac013978
-rw-r--r-- | paludis/resolver/interest_in_spec_helper.cc | 16 | ||||
-rw-r--r-- | paludis/resolver/interest_in_spec_helper.hh | 1 | ||||
-rw-r--r-- | src/clients/cave/resolve_common.cc | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/paludis/resolver/interest_in_spec_helper.cc b/paludis/resolver/interest_in_spec_helper.cc index df68f8a36..d4bbcb5e6 100644 --- a/paludis/resolver/interest_in_spec_helper.cc +++ b/paludis/resolver/interest_in_spec_helper.cc @@ -62,6 +62,7 @@ namespace paludis bool follow_installed_dependencies; Tribool take_suggestions; Tribool take_recommendations; + std::string cross_compile_host; Imp(const Environment * const e) : env(e), @@ -155,6 +156,12 @@ InterestInSpecHelper::set_take_recommendations(const Tribool v) _imp->take_recommendations = v; } +void +InterestInSpecHelper::set_cross_compile_host(const std::string & host) +{ + _imp->cross_compile_host = host; +} + namespace { bool ignore_dep_from( @@ -176,6 +183,7 @@ namespace const PackageDepSpecCollection & no_dependencies_from_specs; const bool follow_installed_build_dependencies; const bool follow_installed_dependencies; + const std::string host; const SanitisedDependency dep; bool visit(const ExistingNoChangeDecision & decision) const @@ -204,7 +212,8 @@ namespace const std::shared_ptr<const PackageIDSequence> installed_ids( (*env)[selection::SomeArbitraryVersion( generator::Matches(*dep.spec().if_package(), dep.from_id(), { }) | - filter::InstalledAtRoot(env->system_root_key()->parse_value()))]); + filter::InstalledAtRoot(env->system_root_key()->parse_value()) | + filter::CrossCompileHost(host))]); if (installed_ids->empty()) return false; } @@ -254,7 +263,7 @@ InterestInSpecHelper::operator() (const std::shared_ptr<const Resolution> & reso Context context("When determining interest in '" + stringify(dep.spec()) + "':"); CareAboutDepFnVisitor v{_imp->env, _imp->no_blockers_from_specs, _imp->no_dependencies_from_specs, - _imp->follow_installed_build_dependencies, _imp->follow_installed_dependencies, dep}; + _imp->follow_installed_build_dependencies, _imp->follow_installed_dependencies, _imp->cross_compile_host, dep}; if (resolution->decision()->accept_returning<bool>(v)) { @@ -303,7 +312,8 @@ InterestInSpecHelper::operator() (const std::shared_ptr<const Resolution> & reso { const std::shared_ptr<const PackageIDSequence> installed_ids = (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*dep.spec().if_package(), dep.from_id(), {}) | - filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]; + filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()) | + filter::CrossCompileHost(_imp->cross_compile_host))]; if (! installed_ids->empty()) return si_take; } diff --git a/paludis/resolver/interest_in_spec_helper.hh b/paludis/resolver/interest_in_spec_helper.hh index f2f54e304..b89a9139c 100644 --- a/paludis/resolver/interest_in_spec_helper.hh +++ b/paludis/resolver/interest_in_spec_helper.hh @@ -59,6 +59,7 @@ namespace paludis void set_take_suggestions(const Tribool); void set_take_recommendations(const Tribool); + void set_cross_compile_host(const std::string &); SpecInterest operator() ( const std::shared_ptr<const Resolution> &, diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc index b80de62e6..9b333dcf8 100644 --- a/src/clients/cave/resolve_common.cc +++ b/src/clients/cave/resolve_common.cc @@ -979,6 +979,8 @@ paludis::cave::resolve_common( remove_if_dependent_helper.add_remove_if_dependent_spec(parse_spec_with_nice_error(spec, env.get(), {updso_allow_wildcards}, filter::All())); InterestInSpecHelper interest_in_spec_helper(env.get()); + if (resolution_options.a_cross_host.specified()) + interest_in_spec_helper.set_cross_compile_host(resolution_options.a_cross_host.argument()); for (const auto & spec : resolution_options.a_take.args()) { bool might_be_group(std::string::npos == |