aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-04 10:53:34 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-04 10:53:34 +0100
commit06be6a35f0c6c6aa2418e24f1a85d481099917c9 (patch)
treebe3dbdfa3bc01fd1160f3f5a2dae91cd887d280f
parent71342f5adab47f6dd1b695ddf917fbb54b964193 (diff)
downloadpaludis-06be6a35f0c6c6aa2418e24f1a85d481099917c9.tar.gz
paludis-06be6a35f0c6c6aa2418e24f1a85d481099917c9.tar.xz
Crude via-binary support
-rw-r--r--paludis/resolver/constraint.cc5
-rw-r--r--paludis/resolver/decider.cc70
-rw-r--r--paludis/resolver/decider.hh8
-rw-r--r--paludis/resolver/orderer.cc6
-rw-r--r--paludis/resolver/reason-fwd.hh1
-rw-r--r--paludis/resolver/reason.cc45
-rw-r--r--paludis/resolver/reason.hh17
-rw-r--r--paludis/resolver/resolver_functions.hh13
-rw-r--r--paludis/resolver/resolver_test.cc31
-rw-r--r--paludis/resolver/resolver_test.hh8
-rw-r--r--src/clients/cave/cmd_display_resolution.cc10
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.cc6
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.hh2
-rw-r--r--src/clients/cave/cmd_resolve_dump.cc5
-rw-r--r--src/clients/cave/resolve_common.cc118
15 files changed, 319 insertions, 26 deletions
diff --git a/paludis/resolver/constraint.cc b/paludis/resolver/constraint.cc
index a50c0fe..c18a54c 100644
--- a/paludis/resolver/constraint.cc
+++ b/paludis/resolver/constraint.cc
@@ -179,6 +179,11 @@ namespace
return make_null_shared_ptr();
}
+ const std::tr1::shared_ptr<const PackageID> visit(const ViaBinaryReason &) const
+ {
+ return make_null_shared_ptr();
+ }
+
const std::tr1::shared_ptr<const PackageID> visit(const WasUsedByReason &) const
{
return make_null_shared_ptr();
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 0de2ebc..2ddb39d 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -43,6 +43,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/log.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/environment.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/repository.hh>
@@ -146,6 +147,71 @@ Decider::_resolve_decide_with_dependencies()
}
bool
+Decider::_resolve_vias()
+{
+ Context context("When finding vias:");
+
+ bool changed(false);
+
+ for (ResolutionsByResolvent::ConstIterator i(_imp->resolutions_by_resolvent->begin()),
+ i_end(_imp->resolutions_by_resolvent->end()) ;
+ i != i_end ; ++i)
+ {
+ if ((*i)->resolvent().destination_type() == dt_create_binary)
+ continue;
+
+ if (! _always_via_binary(*i))
+ continue;
+
+ _imp->env->trigger_notifier_callback(NotifierCallbackResolverStepEvent());
+
+ Resolvent binary_resolvent((*i)->resolvent());
+ binary_resolvent.destination_type() = dt_create_binary;
+
+ const std::tr1::shared_ptr<Resolution> binary_resolution(_resolution_for_resolvent(binary_resolvent, true));
+
+ bool already(false);
+ for (Constraints::ConstIterator c(binary_resolution->constraints()->begin()),
+ c_end(binary_resolution->constraints()->end()) ;
+ c != c_end ; ++c)
+ if (simple_visitor_cast<const ViaBinaryReason>(*(*c)->reason()))
+ {
+ already = true;
+ break;
+ }
+
+ if (already)
+ continue;
+
+ changed = true;
+
+ const std::tr1::shared_ptr<const ConstraintSequence> constraints(_make_constraints_for_via_binary(binary_resolution, *i));
+
+ for (ConstraintSequence::ConstIterator c(constraints->begin()), c_end(constraints->end()) ;
+ c != c_end ; ++c)
+ _apply_resolution_constraint(binary_resolution, *c);
+
+ _decide(binary_resolution);
+ }
+
+ return changed;
+}
+
+bool
+Decider::_always_via_binary(const std::tr1::shared_ptr<const Resolution> & resolution) const
+{
+ return _imp->fns.always_via_binary_fn()(resolution);
+}
+
+const std::tr1::shared_ptr<ConstraintSequence>
+Decider::_make_constraints_for_via_binary(
+ const std::tr1::shared_ptr<const Resolution> & resolution,
+ const std::tr1::shared_ptr<const Resolution> & other_resolution) const
+{
+ return _imp->fns.get_constraints_for_via_binary_fn()(resolution, other_resolution);
+}
+
+bool
Decider::_resolve_dependents()
{
Context context("When finding dependents:");
@@ -1887,6 +1953,10 @@ Decider::resolve()
_imp->env->trigger_notifier_callback(NotifierCallbackResolverStageEvent("Deciding"));
_resolve_decide_with_dependencies();
+ _imp->env->trigger_notifier_callback(NotifierCallbackResolverStageEvent("Vialating"));
+ if (_resolve_vias())
+ continue;
+
_imp->env->trigger_notifier_callback(NotifierCallbackResolverStageEvent("Finding Dependents"));
if (_resolve_dependents())
continue;
diff --git a/paludis/resolver/decider.hh b/paludis/resolver/decider.hh
index 6bbe1c4..782de33 100644
--- a/paludis/resolver/decider.hh
+++ b/paludis/resolver/decider.hh
@@ -106,6 +106,10 @@ namespace paludis
const std::tr1::shared_ptr<const Resolution> & from_resolution,
const std::tr1::shared_ptr<const Constraint> & from_constraint) const;
+ const std::tr1::shared_ptr<ConstraintSequence> _make_constraints_for_via_binary(
+ const std::tr1::shared_ptr<const Resolution> & resolution,
+ const std::tr1::shared_ptr<const Resolution> & from_resolution) const;
+
void _apply_resolution_constraint(
const std::tr1::shared_ptr<Resolution> &,
const std::tr1::shared_ptr<const Constraint> &);
@@ -142,11 +146,15 @@ namespace paludis
const ChangesToMakeDecision &) const;
void _resolve_decide_with_dependencies();
+ bool _resolve_vias() PALUDIS_ATTRIBUTE((warn_unused_result));
bool _resolve_dependents() PALUDIS_ATTRIBUTE((warn_unused_result));
bool _resolve_purges() PALUDIS_ATTRIBUTE((warn_unused_result));
void _resolve_destinations();
void _resolve_confirmations();
+ bool _via_binary(const std::tr1::shared_ptr<const Resolution> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool _always_via_binary(const std::tr1::shared_ptr<const Resolution> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
void _fixup_changes_to_make_decision(
const std::tr1::shared_ptr<const Resolution> &,
ChangesToMakeDecision &) const;
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index 9d592e2..52d30f4 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -320,6 +320,12 @@ namespace
{
}
+ void visit(const ViaBinaryReason &)
+ {
+ /* we do clever binary arrows later, to get binaries that just
+ * happen to work anyway right too */
+ }
+
void visit(const DependentReason & r)
{
NAGIndex from(make_named_values<NAGIndex>(
diff --git a/paludis/resolver/reason-fwd.hh b/paludis/resolver/reason-fwd.hh
index d76f90f..cbe8cd5 100644
--- a/paludis/resolver/reason-fwd.hh
+++ b/paludis/resolver/reason-fwd.hh
@@ -34,6 +34,7 @@ namespace paludis
struct DependentReason;
struct WasUsedByReason;
struct LikeOtherDestinationTypeReason;
+ struct ViaBinaryReason;
}
}
diff --git a/paludis/resolver/reason.cc b/paludis/resolver/reason.cc
index e90e903..18353b7 100644
--- a/paludis/resolver/reason.cc
+++ b/paludis/resolver/reason.cc
@@ -319,6 +319,43 @@ LikeOtherDestinationTypeReason::serialise(Serialiser & s) const
;
}
+namespace paludis
+{
+ template <>
+ struct Implementation<ViaBinaryReason>
+ {
+ const Resolvent other_resolvent;
+
+ Implementation(const Resolvent & s) :
+ other_resolvent(s)
+ {
+ }
+ };
+}
+
+ViaBinaryReason::ViaBinaryReason(const Resolvent & r) :
+ PrivateImplementationPattern<ViaBinaryReason>(new Implementation<ViaBinaryReason>(r))
+{
+}
+
+ViaBinaryReason::~ViaBinaryReason()
+{
+}
+
+const Resolvent
+ViaBinaryReason::other_resolvent() const
+{
+ return _imp->other_resolvent;
+}
+
+void
+ViaBinaryReason::serialise(Serialiser & s) const
+{
+ s.object("ViaBinaryReason")
+ .member(SerialiserFlags<>(), "other_resolvent", other_resolvent())
+ ;
+}
+
const std::tr1::shared_ptr<Reason>
Reason::deserialise(Deserialisation & d)
{
@@ -378,6 +415,13 @@ Reason::deserialise(Deserialisation & d)
v.member<std::tr1::shared_ptr<Reason> >("reason_for_other")
));
}
+ else if (d.class_name() == "ViaBinaryReason")
+ {
+ Deserialisator v(d, "ViaBinaryReason");
+ return make_shared_ptr(new ViaBinaryReason(
+ v.member<Resolvent>("other_resolvent")
+ ));
+ }
else
throw InternalError(PALUDIS_HERE, "unknown class '" + stringify(d.class_name()) + "'");
}
@@ -388,4 +432,5 @@ template class PrivateImplementationPattern<SetReason>;
template class PrivateImplementationPattern<PresetReason>;
template class PrivateImplementationPattern<WasUsedByReason>;
template class PrivateImplementationPattern<LikeOtherDestinationTypeReason>;
+template class PrivateImplementationPattern<ViaBinaryReason>;
diff --git a/paludis/resolver/reason.hh b/paludis/resolver/reason.hh
index 759505d..8ccd47e 100644
--- a/paludis/resolver/reason.hh
+++ b/paludis/resolver/reason.hh
@@ -39,7 +39,7 @@ namespace paludis
class Reason :
public virtual DeclareAbstractAcceptMethods<Reason, MakeTypeList<
TargetReason, DependencyReason, DependentReason, WasUsedByReason, PresetReason,
- SetReason, LikeOtherDestinationTypeReason>::Type>
+ SetReason, LikeOtherDestinationTypeReason, ViaBinaryReason>::Type>
{
public:
virtual ~Reason() = 0;
@@ -155,12 +155,27 @@ namespace paludis
virtual void serialise(Serialiser &) const;
};
+
+ class ViaBinaryReason :
+ public Reason,
+ private PrivateImplementationPattern<ViaBinaryReason>,
+ public ImplementAcceptMethods<Reason, ViaBinaryReason>
+ {
+ public:
+ ViaBinaryReason(const Resolvent &);
+ ~ViaBinaryReason();
+
+ const Resolvent other_resolvent() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void serialise(Serialiser &) const;
+ };
}
extern template class PrivateImplementationPattern<resolver::DependencyReason>;
extern template class PrivateImplementationPattern<resolver::DependentReason>;
extern template class PrivateImplementationPattern<resolver::WasUsedByReason>;
extern template class PrivateImplementationPattern<resolver::SetReason>;
+ extern template class PrivateImplementationPattern<resolver::ViaBinaryReason>;
}
diff --git a/paludis/resolver/resolver_functions.hh b/paludis/resolver/resolver_functions.hh
index 3e69941..0eee78f 100644
--- a/paludis/resolver/resolver_functions.hh
+++ b/paludis/resolver/resolver_functions.hh
@@ -47,11 +47,13 @@ namespace paludis
namespace n
{
typedef Name<struct allowed_to_remove_fn_name> allowed_to_remove_fn;
+ typedef Name<struct always_via_binary_fn_name> always_via_binary_fn;
typedef Name<struct can_use_fn_name> can_use_fn;
typedef Name<struct confirm_fn_name> confirm_fn;
typedef Name<struct find_repository_for_fn_name> find_repository_for_fn;
typedef Name<struct get_constraints_for_dependent_fn_name> get_constraints_for_dependent_fn;
typedef Name<struct get_constraints_for_purge_fn_name> get_constraints_for_purge_fn;
+ typedef Name<struct get_constraints_for_via_binary_fn_name> get_constraints_for_via_binary_fn;
typedef Name<struct get_destination_types_for_fn_name> get_destination_types_for_fn;
typedef Name<struct get_initial_constraints_for_fn_name> get_initial_constraints_for_fn;
typedef Name<struct get_resolvents_for_fn_name> get_resolvents_for_fn;
@@ -72,6 +74,10 @@ namespace paludis
)> AllowedToRemoveFunction;
typedef std::tr1::function<bool (
+ const std::tr1::shared_ptr<const Resolution> &
+ )> AlwaysViaBinaryFunction;
+
+ typedef std::tr1::function<bool (
const std::tr1::shared_ptr<const PackageID> &
)> CanUseFunction;
@@ -97,6 +103,11 @@ namespace paludis
const std::tr1::shared_ptr<const ChangeByResolventSequence> &
)> GetConstraintsForPurgeFunction;
+ typedef std::tr1::function<std::tr1::shared_ptr<ConstraintSequence> (
+ const std::tr1::shared_ptr<const Resolution> &,
+ const std::tr1::shared_ptr<const Resolution> &
+ )> GetConstraintsForViaBinaryFunction;
+
typedef std::tr1::function<DestinationTypes (
const PackageDepSpec &,
const std::tr1::shared_ptr<const PackageID> &,
@@ -149,11 +160,13 @@ namespace paludis
struct ResolverFunctions
{
NamedValue<n::allowed_to_remove_fn, AllowedToRemoveFunction> allowed_to_remove_fn;
+ NamedValue<n::always_via_binary_fn, AlwaysViaBinaryFunction> always_via_binary_fn;
NamedValue<n::can_use_fn, CanUseFunction> can_use_fn;
NamedValue<n::confirm_fn, ConfirmFunction> confirm_fn;
NamedValue<n::find_repository_for_fn, FindRepositoryForFunction> find_repository_for_fn;
NamedValue<n::get_constraints_for_dependent_fn, GetConstraintsForDependentFunction> get_constraints_for_dependent_fn;
NamedValue<n::get_constraints_for_purge_fn, GetConstraintsForPurgeFunction> get_constraints_for_purge_fn;
+ NamedValue<n::get_constraints_for_via_binary_fn, GetConstraintsForViaBinaryFunction> get_constraints_for_via_binary_fn;
NamedValue<n::get_destination_types_for_fn, GetDestinationTypesForFunction> get_destination_types_for_fn;
NamedValue<n::get_initial_constraints_for_fn, GetInitialConstraintsFunction> get_initial_constraints_for_fn;
NamedValue<n::get_resolvents_for_fn, GetResolventsForFunction> get_resolvents_for_fn;
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index 9a87349..ef297f0 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -288,6 +288,28 @@ paludis::resolver::resolver_test::get_constraints_for_purge_fn(
return result;
}
+const std::tr1::shared_ptr<ConstraintSequence>
+paludis::resolver::resolver_test::get_constraints_for_via_binary_fn(
+ const std::tr1::shared_ptr<const Resolution> & resolution,
+ const std::tr1::shared_ptr<const Resolution> & because_resolution)
+{
+ PartiallyMadePackageDepSpec partial_spec((PartiallyMadePackageDepSpecOptions()));
+ partial_spec.package(resolution->resolvent().package());
+ PackageDepSpec spec(partial_spec);
+
+ std::tr1::shared_ptr<ConstraintSequence> result(new ConstraintSequence);
+ result->push_back(make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ n::destination_type() = resolution->resolvent().destination_type(),
+ n::nothing_is_fine_too() = false,
+ n::reason() = make_shared_ptr(new ViaBinaryReason(because_resolution->resolvent())),
+ n::spec() = spec,
+ n::untaken() = false,
+ n::use_existing() = ue_if_possible
+ ))));
+
+ return result;
+}
+
bool
paludis::resolver::resolver_test::can_use_fn(
const std::tr1::shared_ptr<const PackageID> &)
@@ -295,6 +317,13 @@ paludis::resolver::resolver_test::can_use_fn(
return true;
}
+bool
+paludis::resolver::resolver_test::always_via_binary_fn(
+ const std::tr1::shared_ptr<const Resolution> &)
+{
+ return false;
+}
+
ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s, const std::string & e,
const std::string & l) :
TestCase(s),
@@ -348,12 +377,14 @@ ResolverTestCase::get_resolver_functions(InitialConstraints & initial_constraint
return make_named_values<ResolverFunctions>(
n::allowed_to_remove_fn() = std::tr1::bind(&allowed_to_remove_fn,
allowed_to_remove_names, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ n::always_via_binary_fn() = &always_via_binary_fn,
n::can_use_fn() = &can_use_fn,
n::confirm_fn() = &confirm_fn,
n::find_repository_for_fn() = std::tr1::bind(&find_repository_for_fn,
&env, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
n::get_constraints_for_dependent_fn() = &get_constraints_for_dependent_fn,
n::get_constraints_for_purge_fn() = &get_constraints_for_purge_fn,
+ n::get_constraints_for_via_binary_fn() = &get_constraints_for_via_binary_fn,
n::get_destination_types_for_fn() = &get_destination_types_for_fn,
n::get_initial_constraints_for_fn() =
std::tr1::bind(&initial_constraints_for_fn, std::tr1::ref(initial_constraints),
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index ab0c0d6..3561c8c 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -78,6 +78,11 @@ namespace paludis
const std::tr1::shared_ptr<const PackageID> & id,
const std::tr1::shared_ptr<const ChangeByResolventSequence> & ids);
+ const std::tr1::shared_ptr<ConstraintSequence>
+ get_constraints_for_via_binary_fn(
+ const std::tr1::shared_ptr<const Resolution> &,
+ const std::tr1::shared_ptr<const Resolution> &);
+
std::tr1::shared_ptr<Resolvents> get_resolvents_for_fn(const PackageDepSpec & spec,
const std::tr1::shared_ptr<const SlotName> &,
const std::tr1::shared_ptr<const Reason> &);
@@ -125,6 +130,9 @@ namespace paludis
bool can_use_fn(
const std::tr1::shared_ptr<const PackageID> &);
+ bool always_via_binary_fn(
+ const std::tr1::shared_ptr<const Resolution> &);
+
struct ResolverTestCase : test::TestCase
{
TestEnvironment env;
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index c97b6d8..91defa1 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -237,6 +237,11 @@ namespace
return std::make_pair(rr.first + " (to be like " + stringify(r.other_resolvent()) + ")", rr.second);
}
+ std::pair<std::string, Tribool> visit(const ViaBinaryReason & r) const
+ {
+ return std::make_pair("to install via binary for " + stringify(r.other_resolvent()), false);
+ }
+
std::pair<std::string, Tribool> visit(const PresetReason & r) const
{
std::pair<std::string, Tribool> rr("", indeterminate);
@@ -742,6 +747,11 @@ namespace
return false;
}
+ bool visit(const ViaBinaryReason &) const
+ {
+ return false;
+ }
+
bool visit(const DependentReason &) const
{
return false;
diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc
index d833bfa..7cbc992 100644
--- a/src/clients/cave/cmd_resolve_cmdline.cc
+++ b/src/clients/cave/cmd_resolve_cmdline.cc
@@ -239,9 +239,9 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A
("all", 'a', "Care about all dependencies")
("none", 'n', "Don't care about dependencies at all"),
"auto"),
-// a_via_binary(&g_destination_options, "via-binary", 'b', "When building a package matching the supplied spec, "
-// "create a binary package and use that for the install. May be specified multiple times. If this option "
-// "is not specified, a package will be built multiple times for multiple destinations"),
+ a_via_binary(&g_destination_options, "via-binary", 'b', "When building a package matching the supplied spec, "
+ "create a binary package and use that for the install. May be specified multiple times. If this option "
+ "is not specified, a package will be built multiple times for multiple destinations"),
#endif
// g_query_options(this, "Query Options", "Query the user interactively when making decisions. "
diff --git a/src/clients/cave/cmd_resolve_cmdline.hh b/src/clients/cave/cmd_resolve_cmdline.hh
index c79d03c..ccb3a0c 100644
--- a/src/clients/cave/cmd_resolve_cmdline.hh
+++ b/src/clients/cave/cmd_resolve_cmdline.hh
@@ -95,7 +95,7 @@ namespace paludis
args::ArgsGroup g_destination_options;
args::EnumArg a_make;
args::EnumArg a_make_dependencies;
-// args::StringSetArg a_via_binary;
+ args::StringSetArg a_via_binary;
// args::SwitchArg a_fetch;
#endif
diff --git a/src/clients/cave/cmd_resolve_dump.cc b/src/clients/cave/cmd_resolve_dump.cc
index 802424d..604a42e 100644
--- a/src/clients/cave/cmd_resolve_dump.cc
+++ b/src/clients/cave/cmd_resolve_dump.cc
@@ -173,6 +173,11 @@ namespace
str = "LikeOtherDestinationTypeReason(" + stringify(r.other_resolvent()) + " " + f.str + ")";
}
+ void visit(const ViaBinaryReason & r)
+ {
+ str = "ViaBinaryReason(" + stringify(r.other_resolvent()) + ")";
+ }
+
void visit(const DependentReason & r)
{
str = "Dependent(" + stringify(*r.id_and_resolvent_being_removed().package_id()) + ")";
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index fef34a8..eed013f 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -39,6 +39,7 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/map.hh>
#include <paludis/util/make_shared_copy.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/args/do_help.hh>
#include <paludis/args/escape.hh>
#include <paludis/resolver/resolver.hh>
@@ -128,6 +129,11 @@ namespace
return DestinationTypes() + dt_install_to_slash;
}
+ DestinationTypes visit(const ViaBinaryReason &) const
+ {
+ return DestinationTypes();
+ }
+
DestinationTypes visit(const WasUsedByReason &) const
{
return DestinationTypes() + dt_install_to_slash;
@@ -353,6 +359,11 @@ namespace
return ue_if_possible;
}
+ UseExisting visit(const ViaBinaryReason &) const
+ {
+ return ue_if_possible;
+ }
+
UseExisting visit(const SetReason & r) const
{
UseExistingVisitor v(resolution_options, true);
@@ -564,6 +575,11 @@ namespace
return false;
}
+ bool visit(const ViaBinaryReason &) const
+ {
+ return false;
+ }
+
bool visit(const TargetReason &) const
{
return true;
@@ -943,6 +959,11 @@ namespace
return true;
}
+ bool visit(const ViaBinaryReason &) const
+ {
+ return false;
+ }
+
bool visit(const SetReason & r) const
{
return r.reason_for_set()->accept_returning<bool>(*this);
@@ -1232,6 +1253,31 @@ namespace
return result;
}
+ const std::tr1::shared_ptr<ConstraintSequence> get_constraints_for_via_binary_fn(
+ const Environment * const,
+ const std::tr1::shared_ptr<const Resolution> & resolution,
+ const std::tr1::shared_ptr<const Resolution> & other_resolution)
+ {
+ const std::tr1::shared_ptr<ConstraintSequence> result(new ConstraintSequence);
+
+ PartiallyMadePackageDepSpec partial_spec((PartiallyMadePackageDepSpecOptions()));
+ partial_spec.package(resolution->resolvent().package());
+ PackageDepSpec spec(partial_spec);
+
+ const std::tr1::shared_ptr<ViaBinaryReason> reason(new ViaBinaryReason(other_resolution->resolvent()));
+
+ result->push_back(make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ n::destination_type() = resolution->resolvent().destination_type(),
+ n::nothing_is_fine_too() = false,
+ n::reason() = reason,
+ n::spec() = spec,
+ n::untaken() = false,
+ n::use_existing() = ue_if_possible
+ ))));
+
+ return result;
+ }
+
bool can_use_fn(
const Environment * const env,
const PackageDepSpecList & list,
@@ -1240,6 +1286,18 @@ namespace
return ! match_any(env, list, id);
}
+ bool always_via_binary_fn(
+ const Environment * const env,
+ const PackageDepSpecList & list,
+ const std::tr1::shared_ptr<const Resolution> & resolution)
+ {
+ const ChangesToMakeDecision * changes_decision(simple_visitor_cast<const ChangesToMakeDecision>(*resolution->decision()));
+ if (! changes_decision)
+ return false;
+
+ return match_any(env, list, changes_decision->origin_id());
+ }
+
void serialise_resolved(StringListStream & ser_stream, const Resolved & resolved)
{
Serialiser ser(ser_stream);
@@ -1473,6 +1531,11 @@ namespace
return "from target";
}
+ const std::string visit(const ViaBinaryReason &) const
+ {
+ return "from via binary";
+ }
+
const std::string visit(const PresetReason & r) const
{
std::string result("from preset");
@@ -1547,7 +1610,8 @@ paludis::cave::resolve_common(
PackageDepSpecList allowed_to_remove_specs, allowed_to_break_specs, remove_if_dependent_specs,
less_restrictive_remove_blockers_specs, purge_specs, with, without,
permit_old_version, permit_downgrade, take, take_from, ignore, ignore_from,
- favour, avoid, early, late, no_dependencies_from, no_blockers_from, not_usable_specs;
+ favour, avoid, early, late, no_dependencies_from, no_blockers_from, not_usable_specs,
+ via_binary_specs;
bool allowed_to_break_system(false);
for (args::StringSetArg::ConstIterator i(resolution_options.a_permit_uninstall.begin_args()),
@@ -1673,6 +1737,14 @@ paludis::cave::resolve_common(
not_usable_specs.push_back(parse_user_package_dep_spec(*i, env.get(),
UserPackageDepSpecOptions() + updso_allow_wildcards));
+#ifdef ENABLE_PBINS
+ for (args::StringSetArg::ConstIterator i(resolution_options.a_via_binary.begin_args()),
+ i_end(resolution_options.a_via_binary.end_args()) ;
+ i != i_end ; ++i)
+ via_binary_specs.push_back(parse_user_package_dep_spec(*i, env.get(),
+ UserPackageDepSpecOptions() + updso_allow_wildcards));
+#endif
+
std::tr1::shared_ptr<Generator> all_binary_repos_generator, not_binary_repos_generator;
for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()),
r_end(env->package_database()->end_repositories()) ;
@@ -1740,42 +1812,46 @@ paludis::cave::resolve_common(
ResolverFunctions resolver_functions(make_named_values<ResolverFunctions>(
n::allowed_to_remove_fn() = std::tr1::bind(&allowed_to_remove_fn,
- env.get(), std::tr1::cref(allowed_to_remove_specs), _1, _2),
+ env.get(), std::tr1::cref(allowed_to_remove_specs), _1, _2),
+ n::always_via_binary_fn() = std::tr1::bind(&always_via_binary_fn,
+ env.get(), std::tr1::cref(via_binary_specs), _1),
n::can_use_fn() = std::tr1::bind(&can_use_fn,
env.get(), std::tr1::cref(not_usable_specs), _1),
n::confirm_fn() = std::tr1::bind(&confirm_fn,
- env.get(), std::tr1::cref(resolution_options), std::tr1::cref(permit_downgrade),
- std::tr1::cref(permit_old_version), std::tr1::cref(allowed_to_break_specs),
- allowed_to_break_system, _1, _2),
+ env.get(), std::tr1::cref(resolution_options), std::tr1::cref(permit_downgrade),
+ std::tr1::cref(permit_old_version), std::tr1::cref(allowed_to_break_specs),
+ allowed_to_break_system, _1, _2),
n::find_repository_for_fn() = std::tr1::bind(&find_repository_for_fn,
- env.get(), std::tr1::cref(resolution_options), _1, _2),
+ env.get(), std::tr1::cref(resolution_options), _1, _2),
n::get_constraints_for_dependent_fn() = std::tr1::bind(&get_constraints_for_dependent_fn,
- env.get(), std::tr1::cref(less_restrictive_remove_blockers_specs), _1, _2, _3),
+ env.get(), std::tr1::cref(less_restrictive_remove_blockers_specs), _1, _2, _3),
n::get_constraints_for_purge_fn() = std::tr1::bind(&get_constraints_for_purge_fn,
- env.get(), std::tr1::cref(purge_specs), _1, _2, _3),
+ env.get(), std::tr1::cref(purge_specs), _1, _2, _3),
+ n::get_constraints_for_via_binary_fn() = std::tr1::bind(&get_constraints_for_via_binary_fn,
+ env.get(), _1, _2),
n::get_destination_types_for_fn() = std::tr1::bind(&get_destination_types_for_fn,
- env.get(), std::tr1::cref(resolution_options), _1, _2, _3),
+ env.get(), std::tr1::cref(resolution_options), _1, _2, _3),
n::get_initial_constraints_for_fn() = std::tr1::bind(&initial_constraints_for_fn,
- env.get(), std::tr1::cref(resolution_options), std::tr1::cref(without),
- std::tr1::cref(initial_constraints), all_binary_repos_generator, _1),
+ env.get(), std::tr1::cref(resolution_options), std::tr1::cref(without),
+ std::tr1::cref(initial_constraints), all_binary_repos_generator, _1),
n::get_resolvents_for_fn() = std::tr1::bind(&get_resolvents_for_fn,
- env.get(), std::tr1::cref(resolution_options), _1, _2, _3, DestinationTypes()),
+ env.get(), std::tr1::cref(resolution_options), _1, _2, _3, DestinationTypes()),
n::get_use_existing_fn() = std::tr1::bind(&use_existing_fn,
- env.get(), std::tr1::cref(resolution_options), std::tr1::cref(without), std::tr1::cref(with), _1, _2, _3),
+ env.get(), std::tr1::cref(resolution_options), std::tr1::cref(without), std::tr1::cref(with), _1, _2, _3),
n::interest_in_spec_fn() = std::tr1::bind(&interest_in_spec_fn,
- env.get(), std::tr1::cref(resolution_options), std::tr1::cref(take), std::tr1::cref(take_from),
- std::tr1::cref(ignore), std::tr1::cref(ignore_from), std::tr1::cref(no_blockers_from),
- std::tr1::cref(no_dependencies_from), _1, _2),
+ env.get(), std::tr1::cref(resolution_options), std::tr1::cref(take), std::tr1::cref(take_from),
+ std::tr1::cref(ignore), std::tr1::cref(ignore_from), std::tr1::cref(no_blockers_from),
+ std::tr1::cref(no_dependencies_from), _1, _2),
n::make_destination_filtered_generator_fn() = std::tr1::bind(&make_destination_filtered_generator_with_resolution,
- env.get(), std::tr1::cref(resolution_options), all_binary_repos_generator, _1, _2),
+ env.get(), std::tr1::cref(resolution_options), all_binary_repos_generator, _1, _2),
n::make_origin_filtered_generator_fn() = std::tr1::bind(&make_origin_filtered_generator,
- env.get(), std::tr1::cref(resolution_options), not_binary_repos_generator, _1, _2),
+ env.get(), std::tr1::cref(resolution_options), not_binary_repos_generator, _1, _2),
n::order_early_fn() = std::tr1::bind(&order_early_fn,
- env.get(), std::tr1::cref(resolution_options), std::tr1::cref(early), std::tr1::cref(late), _1),
+ env.get(), std::tr1::cref(resolution_options), std::tr1::cref(early), std::tr1::cref(late), _1),
n::prefer_or_avoid_fn() = std::tr1::bind(&prefer_or_avoid_fn,
- env.get(), std::tr1::cref(resolution_options), std::tr1::cref(favour), std::tr1::cref(avoid), _1),
+ env.get(), std::tr1::cref(resolution_options), std::tr1::cref(favour), std::tr1::cref(avoid), _1),
n::remove_if_dependent_fn() = std::tr1::bind(&remove_if_dependent_fn,
- env.get(), std::tr1::cref(remove_if_dependent_specs), _1)
+ env.get(), std::tr1::cref(remove_if_dependent_specs), _1)
));
ScopedSelectionCache selection_cache(env.get());