aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-03 19:14:36 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-03 19:14:36 +0100
commite30daaa82a43e387ec22e0175f6c3faaf7da17e5 (patch)
tree8075e632b8a295d3990b0be0613bd370e1585f28
parent1819f770003b2d5bb99d1499de54b473fa96b879 (diff)
downloadpaludis-e30daaa82a43e387ec22e0175f6c3faaf7da17e5.tar.gz
paludis-e30daaa82a43e387ec22e0175f6c3faaf7da17e5.tar.xz
Pass qpn_s to the use_installed function
-rw-r--r--paludis/resolver/resolver.cc16
-rw-r--r--paludis/resolver/resolver.hh2
-rw-r--r--paludis/resolver/resolver_functions.hh4
-rw-r--r--src/clients/cave/cmd_resolve.cc6
4 files changed, 19 insertions, 9 deletions
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index 886b8cc..8d22e26 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -271,7 +271,7 @@ Resolver::add_target_with_reason(const PackageDepSpec & spec, const std::tr1::sh
+ stringify(*qpn_s) + "':");
const std::tr1::shared_ptr<Resolution> dep_resolution(_resolution_for_qpn_s(*qpn_s, true));
- const std::tr1::shared_ptr<Constraint> constraint(_make_constraint_from_target(spec, reason));
+ const std::tr1::shared_ptr<Constraint> constraint(_make_constraint_from_target(*qpn_s, spec, reason));
_apply_resolution_constraint(*qpn_s, dep_resolution, constraint);
}
@@ -418,14 +418,17 @@ Resolver::qpn_s_from_id(const std::tr1::shared_ptr<const PackageID> & id) const
}
const std::tr1::shared_ptr<Constraint>
-Resolver::_make_constraint_from_target(const PackageDepSpec & spec, const std::tr1::shared_ptr<const Reason> & reason) const
+Resolver::_make_constraint_from_target(
+ const QPN_S & qpn_s,
+ const PackageDepSpec & spec,
+ const std::tr1::shared_ptr<const Reason> & reason) const
{
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
value_for<n::desire_strength>(ds_target),
value_for<n::reason>(reason),
value_for<n::spec>(spec),
value_for<n::to_destination_slash>(true),
- value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(spec, reason))
+ value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(qpn_s, spec, reason))
)));
}
@@ -439,7 +442,7 @@ Resolver::_make_constraint_from_dependency(const QPN_S & qpn_s, const SanitisedD
value_for<n::reason>(reason),
value_for<n::spec>(dep.spec()),
value_for<n::to_destination_slash>(_dependency_to_destination_slash(qpn_s, dep)),
- value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(dep.spec(), reason))
+ value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(qpn_s, dep.spec(), reason))
)));
}
@@ -950,11 +953,12 @@ Resolver::_suggest_restart_with(const QPN_S & qpn_s,
const std::tr1::shared_ptr<const Constraint> & constraint,
const std::tr1::shared_ptr<const Decision> & decision) const
{
- throw SuggestRestart(qpn_s, resolution->decision(), constraint, decision, _make_constraint_for_preloading(decision));
+ throw SuggestRestart(qpn_s, resolution->decision(), constraint, decision, _make_constraint_for_preloading(qpn_s, decision));
}
const std::tr1::shared_ptr<const Constraint>
Resolver::_make_constraint_for_preloading(
+ const QPN_S & qpn_s,
const std::tr1::shared_ptr<const Decision> & d) const
{
const std::tr1::shared_ptr<PresetReason> reason(new PresetReason);
@@ -964,7 +968,7 @@ Resolver::_make_constraint_for_preloading(
value_for<n::reason>(reason),
value_for<n::spec>(d->package_id()->uniquely_identifying_spec()),
value_for<n::to_destination_slash>(false),
- value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(d->package_id()->uniquely_identifying_spec(), reason))
+ value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(qpn_s, d->package_id()->uniquely_identifying_spec(), reason))
)));
}
diff --git a/paludis/resolver/resolver.hh b/paludis/resolver/resolver.hh
index fc0aa7a..851891b 100644
--- a/paludis/resolver/resolver.hh
+++ b/paludis/resolver/resolver.hh
@@ -58,6 +58,7 @@ namespace paludis
const std::tr1::shared_ptr<Resolution> _resolution_for_qpn_s(const QPN_S &) const;
const std::tr1::shared_ptr<Constraint> _make_constraint_from_target(
+ const QPN_S &,
const PackageDepSpec &,
const std::tr1::shared_ptr<const Reason> &) const;
@@ -139,6 +140,7 @@ namespace paludis
const std::tr1::shared_ptr<const Decision> &) const PALUDIS_ATTRIBUTE((noreturn));
const std::tr1::shared_ptr<const Constraint> _make_constraint_for_preloading(
+ const QPN_S &,
const std::tr1::shared_ptr<const Decision> &) const;
DesireStrength _desire_strength_from_sanitised_dependency(
diff --git a/paludis/resolver/resolver_functions.hh b/paludis/resolver/resolver_functions.hh
index b4b3e70..ad665dc 100644
--- a/paludis/resolver/resolver_functions.hh
+++ b/paludis/resolver/resolver_functions.hh
@@ -38,7 +38,9 @@ namespace paludis
namespace resolver
{
typedef std::tr1::function<UseInstalled (
- const PackageDepSpec &, const std::tr1::shared_ptr<const Reason> &)> GetUseInstalledFunction;
+ const QPN_S &,
+ const PackageDepSpec &,
+ const std::tr1::shared_ptr<const Reason> &)> GetUseInstalledFunction;
struct ResolverFunctions
{
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index bac5aa2..d9a216d 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -528,7 +528,9 @@ namespace
}
};
- UseInstalled use_installed_fn(const ResolveCommandLine & cmdline, const PackageDepSpec &,
+ UseInstalled use_installed_fn(const ResolveCommandLine & cmdline,
+ const QPN_S &,
+ const PackageDepSpec &,
const std::tr1::shared_ptr<const Reason> & reason)
{
UseInstalledVisitor v(cmdline, false);
@@ -561,7 +563,7 @@ ResolveCommand::run(
ResolverFunctions resolver_functions(make_named_values<ResolverFunctions>(
value_for<n::get_use_installed_fn>(std::tr1::bind(&use_installed_fn,
- std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2))
+ std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2, std::tr1::placeholders::_3))
));
std::tr1::shared_ptr<Resolver> resolver(new Resolver(env.get(), resolver_functions));
try