aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Benedikt Morbach <benedikt.morbach@googlemail.com> 2018-03-20 16:08:03 +0100
committerAvatar Heiko Becker <heirecka@exherbo.org> 2018-07-24 23:12:15 +0200
commitfbecd4e04f7364ee664cb49ffcd572df40003ea5 (patch)
tree87d161f7630d177a4bc5ca253b7aba8d6d1e4dd3
parentde6602f7db023a626283b4a8c7459be3555f52d3 (diff)
downloadpaludis-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.
-rw-r--r--paludis/resolver/interest_in_spec_helper.cc16
-rw-r--r--paludis/resolver/interest_in_spec_helper.hh1
-rw-r--r--src/clients/cave/resolve_common.cc2
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 df68f8a..d4bbcb5 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 f2f54e3..b89a913 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 b80de62..9b333dc 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 ==