aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-19 17:54:52 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-19 17:54:52 +0100
commit62e333a285f16fa1404d974f6d62c580363eb029 (patch)
tree561d5676d9b9266e1c97bf621bd6f1279a6751e4
parentb67e87e3817f6816ddacdc16aa2d4935cbbd9e1c (diff)
downloadpaludis-62e333a285f16fa1404d974f6d62c580363eb029.tar.gz
paludis-62e333a285f16fa1404d974f6d62c580363eb029.tar.xz
Make destinations make more sense
-rw-r--r--paludis/resolver/Makefile.am18
-rw-r--r--paludis/resolver/constraint-fwd.hh2
-rw-r--r--paludis/resolver/constraint.cc73
-rw-r--r--paludis/resolver/constraint.hh25
-rw-r--r--paludis/resolver/decision.se6
-rw-r--r--paludis/resolver/destination_types-fwd.hh2
-rw-r--r--paludis/resolver/resolver.cc365
-rw-r--r--paludis/resolver/resolver.hh17
-rw-r--r--paludis/resolver/resolver_functions.hh10
-rw-r--r--paludis/resolver/resolver_test.cc11
-rw-r--r--paludis/resolver/resolver_test.hh4
-rw-r--r--paludis/resolver/use_existing-fwd.hh (renamed from paludis/resolver/use_installed-fwd.hh)6
-rw-r--r--paludis/resolver/use_existing.cc (renamed from paludis/resolver/use_installed.cc)4
-rw-r--r--paludis/resolver/use_existing.hh (renamed from paludis/resolver/use_installed.hh)6
-rw-r--r--paludis/resolver/use_existing.se18
-rw-r--r--paludis/resolver/use_installed.se18
-rw-r--r--src/clients/cave/cmd_display_resolution.cc45
-rw-r--r--src/clients/cave/cmd_resolve.cc50
-rw-r--r--src/clients/cave/cmd_resolve_dump.cc2
19 files changed, 335 insertions, 347 deletions
diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am
index 6208ff9..335576d 100644
--- a/paludis/resolver/Makefile.am
+++ b/paludis/resolver/Makefile.am
@@ -3,17 +3,17 @@ MAINTAINERCLEANFILES = Makefile.in
DISTCLEANFILES = \
decision-se.hh decision-se.cc \
destination_types-se.hh destination_types-se.cc \
- use_installed-se.hh use_installed-se.cc
+ use_existing-se.hh use_existing-se.cc
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
EXTRA_DIST = \
decision-se.hh decision-se.cc decision.se \
destination_types-se.hh destination_types-se.cc destination_types.se \
- use_installed-se.hh use_installed-se.cc use_installed.se \
+ use_existing-se.hh use_existing-se.cc use_existing.se \
$(check_SCRIPTS)
BUILT_SOURCES = \
decision-se.hh decision-se.cc \
destination_types-se.hh destination_types-se.cc \
- use_installed-se.hh use_installed-se.cc
+ use_existing-se.hh use_existing-se.cc
noinst_HEADERS = \
arrow.hh arrow-fwd.hh \
@@ -30,7 +30,7 @@ noinst_HEADERS = \
sanitised_dependencies.hh sanitised_dependencies-fwd.hh \
serialise.hh serialise-fwd.hh serialise-impl.hh \
suggest_restart.hh suggest_restart-fwd.hh \
- use_installed.hh use_installed-fwd.hh use_installed-se.hh
+ use_existing.hh use_existing-fwd.hh use_existing-se.hh
libpaludisresolver_a_SOURCES = \
arrow.cc \
@@ -46,7 +46,7 @@ libpaludisresolver_a_SOURCES = \
sanitised_dependencies.cc \
serialise.cc \
suggest_restart.cc \
- use_installed.cc
+ use_existing.cc
TESTS_ENVIRONMENT = env \
PALUDIS_OPTIONS="" \
@@ -156,11 +156,11 @@ distcheck-deps-subdirs :
for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
-use_installed-se.hh : use_installed.se $(top_srcdir)/misc/make_se.bash
- if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/use_installed.se > $@ ; then rm -f $@ ; exit 1 ; fi
+use_existing-se.hh : use_existing.se $(top_srcdir)/misc/make_se.bash
+ if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/use_existing.se > $@ ; then rm -f $@ ; exit 1 ; fi
-use_installed-se.cc : use_installed.se $(top_srcdir)/misc/make_se.bash
- if ! $(top_srcdir)/misc/make_se.bash --source $(srcdir)/use_installed.se > $@ ; then rm -f $@ ; exit 1 ; fi
+use_existing-se.cc : use_existing.se $(top_srcdir)/misc/make_se.bash
+ if ! $(top_srcdir)/misc/make_se.bash --source $(srcdir)/use_existing.se > $@ ; then rm -f $@ ; exit 1 ; fi
decision-se.hh : decision.se $(top_srcdir)/misc/make_se.bash
if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/decision.se > $@ ; then rm -f $@ ; exit 1 ; fi
diff --git a/paludis/resolver/constraint-fwd.hh b/paludis/resolver/constraint-fwd.hh
index 74c607c..adbb06d 100644
--- a/paludis/resolver/constraint-fwd.hh
+++ b/paludis/resolver/constraint-fwd.hh
@@ -30,6 +30,8 @@ namespace paludis
{
struct Constraint;
struct Constraints;
+
+ typedef Sequence<std::tr1::shared_ptr<const Constraint> > ConstraintSequence;
}
}
diff --git a/paludis/resolver/constraint.cc b/paludis/resolver/constraint.cc
index cf15f0d..dc6187d 100644
--- a/paludis/resolver/constraint.cc
+++ b/paludis/resolver/constraint.cc
@@ -25,7 +25,9 @@
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/make_named_values.hh>
+#include <algorithm>
#include <sstream>
+#include <vector>
#include <list>
using namespace paludis;
@@ -36,16 +38,16 @@ namespace paludis
template <>
struct Implementation<Constraints>
{
- UseInstalled strictest_use_installed;
- bool nothing_is_fine_too;
- bool all_untaken;
- DestinationTypes to_destinations;
+ UseExisting strictest_use_existing_for_all;
+ bool nothing_is_fine_too_for_all;
+ bool all_untaken_for_all;
+
Sequence<std::tr1::shared_ptr<const Constraint> > constraints;
Implementation() :
- strictest_use_installed(ui_if_possible),
- nothing_is_fine_too(true),
- all_untaken(true)
+ strictest_use_existing_for_all(static_cast<UseExisting>(last_ue - 1)),
+ nothing_is_fine_too_for_all(true),
+ all_untaken_for_all(true)
{
}
};
@@ -60,6 +62,24 @@ Constraints::~Constraints()
{
}
+bool
+Constraints::all_untaken_for_all() const
+{
+ return _imp->all_untaken_for_all;
+}
+
+bool
+Constraints::nothing_is_fine_too_for_all() const
+{
+ return _imp->nothing_is_fine_too_for_all;
+}
+
+UseExisting
+Constraints::strictest_use_existing_for_all() const
+{
+ return _imp->strictest_use_existing_for_all;
+}
+
Constraints::ConstIterator
Constraints::begin() const
{
@@ -76,10 +96,9 @@ void
Constraints::add(const std::tr1::shared_ptr<const Constraint> & c)
{
_imp->constraints.push_back(c);
- _imp->strictest_use_installed = std::min(_imp->strictest_use_installed, c->use_installed());
- _imp->nothing_is_fine_too = _imp->nothing_is_fine_too && c->nothing_is_fine_too();
- _imp->to_destinations |= c->to_destinations();
- _imp->all_untaken = _imp->all_untaken && c->untaken();
+ _imp->strictest_use_existing_for_all = std::min(_imp->strictest_use_existing_for_all, c->use_existing());
+ _imp->nothing_is_fine_too_for_all = _imp->nothing_is_fine_too_for_all && c->nothing_is_fine_too();
+ _imp->all_untaken_for_all = _imp->all_untaken_for_all && c->untaken();
}
bool
@@ -88,30 +107,6 @@ Constraints::empty() const
return _imp->constraints.empty();
}
-UseInstalled
-Constraints::strictest_use_installed() const
-{
- return _imp->strictest_use_installed;
-}
-
-bool
-Constraints::nothing_is_fine_too() const
-{
- return _imp->nothing_is_fine_too;
-}
-
-bool
-Constraints::all_untaken() const
-{
- return _imp->all_untaken;
-}
-
-const DestinationTypes
-Constraints::to_destinations() const
-{
- return _imp->to_destinations;
-}
-
void
Constraints::serialise(Serialiser & s) const
{
@@ -135,12 +130,12 @@ void
Constraint::serialise(Serialiser & s) const
{
s.object("Constraint")
+ .member(SerialiserFlags<>(), "destination_type", stringify(destination_type()))
.member(SerialiserFlags<>(), "nothing_is_fine_too", nothing_is_fine_too())
.member(SerialiserFlags<serialise::might_be_null>(), "reason", reason())
.member(SerialiserFlags<>(), "spec", spec())
- .member(SerialiserFlags<>(), "to_destinations", to_destinations())
.member(SerialiserFlags<>(), "untaken", stringify(untaken()))
- .member(SerialiserFlags<>(), "use_installed", stringify(use_installed()))
+ .member(SerialiserFlags<>(), "use_existing", stringify(use_existing()))
;
}
@@ -181,13 +176,13 @@ Constraint::deserialise(Deserialisation & d)
IDFinder id_finder;
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ value_for<n::destination_type>(destringify<DestinationType>(v.member<std::string>("destination_type"))),
value_for<n::nothing_is_fine_too>(v.member<bool>("nothing_is_fine_too")),
value_for<n::reason>(reason),
value_for<n::spec>(PackageOrBlockDepSpec::deserialise(*v.find_remove_member("spec"),
reason->accept_returning<std::tr1::shared_ptr<const PackageID> >(id_finder))),
- value_for<n::to_destinations>(v.member<DestinationTypes>("to_destinations")),
value_for<n::untaken>(v.member<bool>("untaken")),
- value_for<n::use_installed>(destringify<UseInstalled>(v.member<std::string>("use_installed")))
+ value_for<n::use_existing>(destringify<UseExisting>(v.member<std::string>("use_existing")))
)));
}
diff --git a/paludis/resolver/constraint.hh b/paludis/resolver/constraint.hh
index f7fe15e..c780181 100644
--- a/paludis/resolver/constraint.hh
+++ b/paludis/resolver/constraint.hh
@@ -22,10 +22,10 @@
#include <paludis/resolver/constraint-fwd.hh>
#include <paludis/resolver/reason-fwd.hh>
-#include <paludis/resolver/use_installed-fwd.hh>
+#include <paludis/resolver/use_existing-fwd.hh>
#include <paludis/resolver/sanitised_dependencies.hh>
#include <paludis/resolver/serialise-fwd.hh>
-#include <paludis/resolver/destination_types.hh>
+#include <paludis/resolver/destination_types-fwd.hh>
#include <paludis/util/named_value.hh>
#include <paludis/util/options.hh>
#include <paludis/dep_spec.hh>
@@ -35,24 +35,25 @@ namespace paludis
{
namespace n
{
+ struct destination_type;
+ struct for_slash;
struct nothing_is_fine_too;
struct reason;
struct spec;
- struct to_destinations;
struct untaken;
- struct use_installed;
+ struct use_existing;
}
namespace resolver
{
struct Constraint
{
+ NamedValue<n::destination_type, DestinationType> destination_type;
NamedValue<n::nothing_is_fine_too, bool> nothing_is_fine_too;
NamedValue<n::reason, std::tr1::shared_ptr<const Reason> > reason;
NamedValue<n::spec, PackageOrBlockDepSpec> spec;
- NamedValue<n::to_destinations, DestinationTypes> to_destinations;
NamedValue<n::untaken, bool> untaken;
- NamedValue<n::use_installed, UseInstalled> use_installed;
+ NamedValue<n::use_existing, UseExisting> use_existing;
void serialise(Serialiser &) const;
@@ -67,10 +68,14 @@ namespace paludis
Constraints();
~Constraints();
- UseInstalled strictest_use_installed() const PALUDIS_ATTRIBUTE((warn_unused_result));
- bool nothing_is_fine_too() const PALUDIS_ATTRIBUTE((warn_unused_result));
- bool all_untaken() const PALUDIS_ATTRIBUTE((warn_unused_result));
- const DestinationTypes to_destinations() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool nothing_is_fine_too_for_all() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool nothing_is_fine_too_for(const DestinationType) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool all_untaken_for_all() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool all_untaken_for(const DestinationType) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ UseExisting strictest_use_existing_for_all() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ UseExisting strictest_use_existing_for(const DestinationType) const PALUDIS_ATTRIBUTE((warn_unused_result));
void add(const std::tr1::shared_ptr<const Constraint> &);
diff --git a/paludis/resolver/decision.se b/paludis/resolver/decision.se
index 3ad8de0..58a615e 100644
--- a/paludis/resolver/decision.se
+++ b/paludis/resolver/decision.se
@@ -6,9 +6,9 @@ make_enum_DecisionKind()
prefix dk
namespace paludis::resolver
- key dk_installable "Installable package"
- key dk_installed "Installed package"
- key dk_nothing "We decided nothing"
+ key dk_changes_to_make "We have changes to make"
+ key dk_existing_no_change "We have no changes to make, and there's an existing ID."
+ key dk_nothing_no_change "We have no changes to make, and there's no existing ID"
key dk_unable_to_decide "We couldn't decide. No if_package_id."
want_destringify
diff --git a/paludis/resolver/destination_types-fwd.hh b/paludis/resolver/destination_types-fwd.hh
index d4dd07b..1fa156b 100644
--- a/paludis/resolver/destination_types-fwd.hh
+++ b/paludis/resolver/destination_types-fwd.hh
@@ -21,7 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_DESTINATION_TYPES_FWD_HH 1
#include <paludis/util/attributes.hh>
-#include <paludis/util/options-fwd.hh>
#include <iosfwd>
namespace paludis
@@ -31,7 +30,6 @@ namespace paludis
#include <paludis/resolver/destination_types-se.hh>
- typedef Options<DestinationType> DestinationTypes;
}
}
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index 04e2cb8..ba36e71 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -137,10 +137,14 @@ Resolver::_resolve_decide_with_dependencies()
for (ResolutionsByQPN_SMap::iterator i(_imp->resolutions_by_qpn_s.begin()), i_end(_imp->resolutions_by_qpn_s.end()) ;
i != i_end ; ++i)
{
+ /* we've already decided */
if (i->second->decision())
continue;
- if (i->second->constraints()->all_untaken() && state == deciding_non_suggestions)
+ /* we're only being suggested. don't do this on the first pass, so
+ * we don't have to do restarts for suggestions later becoming hard
+ * deps. */
+ if (state == deciding_non_suggestions && i->second->constraints()->all_untaken_for_all())
continue;
_imp->env->trigger_notifier_callback(NotifierCallbackResolverStepEvent());
@@ -148,18 +152,20 @@ Resolver::_resolve_decide_with_dependencies()
changed = true;
_decide(i->first, i->second);
+ /* we don't have anything left to do unless we're a 'real' decision */
switch (i->second->decision()->kind())
{
- case dk_installed:
- case dk_installable:
+ case dk_existing_no_change:
+ case dk_changes_to_make:
break;
- case dk_nothing:
+ case dk_nothing_no_change:
case dk_unable_to_decide:
case last_dk:
continue;
}
+ /* we don't do dependencies for suggestions */
if (i->second->decision()->taken())
_add_dependencies(i->first, i->second);
}
@@ -182,35 +188,31 @@ Resolver::_resolve_destinations()
}
const std::tr1::shared_ptr<Destinations>
-Resolver::_make_destinations_for(const QPN_S & qpn_s,
+Resolver::_make_destinations_for(
+ const QPN_S & qpn_s,
const std::tr1::shared_ptr<const Resolution> & resolution) const
{
- Context context("When finding destinations for '" + stringify(qpn_s) + "':");
-
switch (resolution->decision()->kind())
{
- case dk_installed:
- case dk_nothing:
+ case dk_existing_no_change:
+ case dk_nothing_no_change:
case dk_unable_to_decide:
return make_shared_ptr(new Destinations(make_named_values<Destinations>(
value_for<n::slash>(make_null_shared_ptr())
)));
+ case dk_changes_to_make:
case last_dk:
- case dk_installable:
break;
}
- bool requires_slash(resolution->constraints()->to_destinations()[dt_slash]);
-
- return make_shared_ptr(new Destinations(
- make_named_values<Destinations>(
- value_for<n::slash>(requires_slash ?
- _make_slash_destination_for(qpn_s, resolution) :
- make_null_shared_ptr())
+ bool requires_slash(true); // (resolution->constraints()->for_destination_type(dt_slash)->required());
+ return make_shared_ptr(new Destinations(make_named_values<Destinations>(
+ value_for<n::slash>(requires_slash ? _make_slash_destination_for(qpn_s, resolution) : make_null_shared_ptr())
)));
}
+
const std::tr1::shared_ptr<Destination>
Resolver::_make_slash_destination_for(const QPN_S & qpn_s,
const std::tr1::shared_ptr<const Resolution> & resolution) const
@@ -316,9 +318,11 @@ 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(*qpn_s, spec, reason));
+ const std::tr1::shared_ptr<ConstraintSequence> constraints(_make_constraints_from_target(*qpn_s, spec, reason));
- _apply_resolution_constraint(*qpn_s, dep_resolution, constraint);
+ for (ConstraintSequence::ConstIterator c(constraints->begin()), c_end(constraints->end()) ;
+ c != c_end ; ++c)
+ _apply_resolution_constraint(*qpn_s, dep_resolution, *c);
}
}
@@ -392,37 +396,42 @@ Resolver::_resolution_for_qpn_s(const QPN_S & qpn_s) const
return i->second;
}
-const std::tr1::shared_ptr<Constraint>
-Resolver::_make_constraint_from_target(
+const std::tr1::shared_ptr<ConstraintSequence>
+Resolver::_make_constraints_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::nothing_is_fine_too>(false),
- value_for<n::reason>(reason),
- value_for<n::spec>(spec),
- value_for<n::to_destinations>(DestinationTypes() + dt_slash),
- value_for<n::untaken>(false),
- value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(qpn_s, spec, reason))
- )));
+ const std::tr1::shared_ptr<ConstraintSequence> result(new ConstraintSequence);
+ result->push_back(make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ value_for<n::destination_type>(dt_slash),
+ value_for<n::nothing_is_fine_too>(false),
+ value_for<n::reason>(reason),
+ value_for<n::spec>(spec),
+ value_for<n::untaken>(false),
+ value_for<n::use_existing>(_imp->fns.get_use_existing_fn()(qpn_s, spec, reason))
+ ))));
+ return result;
}
-const std::tr1::shared_ptr<Constraint>
-Resolver::_make_constraint_from_dependency(const QPN_S & qpn_s, const SanitisedDependency & dep,
+const std::tr1::shared_ptr<ConstraintSequence>
+Resolver::_make_constraints_from_dependency(const QPN_S & qpn_s, const SanitisedDependency & dep,
const std::tr1::shared_ptr<const Reason> & reason) const
{
+ const std::tr1::shared_ptr<ConstraintSequence> result(new ConstraintSequence);
if (dep.spec().if_package())
- return make_shared_ptr(new Constraint(make_named_values<Constraint>(
- value_for<n::nothing_is_fine_too>(false),
- value_for<n::reason>(reason),
- value_for<n::spec>(*dep.spec().if_package()),
- value_for<n::to_destinations>(_destination_types_for_dependency(qpn_s, dep)),
- value_for<n::untaken>(! _imp->fns.take_dependency_fn()(qpn_s, dep,
- reason)),
- value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(qpn_s, *dep.spec().if_package(),
- reason))
- )));
+ {
+ result->push_back(make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ value_for<n::destination_type>(dt_slash),
+ value_for<n::nothing_is_fine_too>(false),
+ value_for<n::reason>(reason),
+ value_for<n::spec>(*dep.spec().if_package()),
+ value_for<n::untaken>(! _imp->fns.take_dependency_fn()(qpn_s, dep,
+ reason)),
+ value_for<n::use_existing>(_imp->fns.get_use_existing_fn()(qpn_s, *dep.spec().if_package(),
+ reason))
+ ))));
+ }
else if (dep.spec().if_block())
{
/* nothing is fine too if there's nothing installed matching the block. */
@@ -430,17 +439,19 @@ Resolver::_make_constraint_from_dependency(const QPN_S & qpn_s, const SanitisedD
generator::Matches(dep.spec().if_block()->blocking(), MatchPackageOptions()) |
filter::InstalledAtRoot(FSEntry("/")))]);
- return make_shared_ptr(new Constraint(make_named_values<Constraint>(
- value_for<n::nothing_is_fine_too>(ids->empty()),
- value_for<n::reason>(reason),
- value_for<n::spec>(dep.spec()),
- value_for<n::to_destinations>(DestinationTypes() + dt_slash),
- value_for<n::untaken>(false),
- value_for<n::use_installed>(ui_if_possible)
- )));
+ result->push_back(make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ value_for<n::destination_type>(dt_slash),
+ value_for<n::nothing_is_fine_too>(ids->empty()),
+ value_for<n::reason>(reason),
+ value_for<n::spec>(dep.spec()),
+ value_for<n::untaken>(false),
+ value_for<n::use_existing>(ue_if_possible)
+ ))));
}
else
throw InternalError(PALUDIS_HERE, "resolver bug: huh? it's not a block and it's not a package");
+
+ return result;
}
void
@@ -474,27 +485,27 @@ Resolver::_verify_new_constraint(const QPN_S & qpn_s,
else
ok = constraint->nothing_is_fine_too();
- if (ok && dk_installed == resolution->decision()->kind())
+ if (ok && dk_existing_no_change == resolution->decision()->kind())
{
- switch (constraint->use_installed())
+ switch (constraint->use_existing())
{
- case ui_if_possible:
+ case ue_if_possible:
break;
- case ui_only_if_transient:
+ case ue_only_if_transient:
ok = resolution->decision()->is_transient();
break;
- case ui_if_same:
+ case ue_if_same:
ok = resolution->decision()->is_same();
break;
- case ui_if_same_version:
+ case ue_if_same_version:
ok = resolution->decision()->is_same_version();
break;
- case ui_never:
- case last_ui:
+ case ue_never:
+ case last_ue:
ok = false;
break;
}
@@ -518,27 +529,7 @@ Resolver::_made_wrong_decision(const QPN_S & qpn_s,
const std::tr1::shared_ptr<Decision> decision(_try_to_find_decision_for(qpn_s, adapted_resolution));
if (decision)
- {
- /* can we preload and restart? */
- if (_initial_constraints_for(qpn_s)->empty())
- {
- /* we've not already locked this to something. yes! */
- _suggest_restart_with(qpn_s, resolution, constraint, decision);
- }
- else if (decision->if_package_id())
- {
- /* we can restart if we've selected the same or a newer version
- * than before. but we don't support that yet. */
- throw InternalError(PALUDIS_HERE, "unimplemented: should have selected "
- + stringify(*decision->if_package_id()));
- }
- else
- {
- /* probably possible if we can fix a block either by upgrading or
- * removing, and we're later forced to remove */
- throw InternalError(PALUDIS_HERE, "unimplemented: should have selected nothing");
- }
- }
+ _suggest_restart_with(qpn_s, resolution, constraint, decision);
else
{
std::string old_decision("none");
@@ -565,13 +556,15 @@ 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(qpn_s, decision));
+ throw SuggestRestart(qpn_s, resolution->decision(), constraint, decision,
+ _make_constraint_for_preloading(qpn_s, decision, constraint->destination_type()));
}
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<const Decision> & d,
+ const DestinationType t) const
{
const std::tr1::shared_ptr<PresetReason> reason(new PresetReason);
@@ -579,12 +572,12 @@ Resolver::_make_constraint_for_preloading(
throw InternalError(PALUDIS_HERE, "resolver bug: not decided. shouldn't happen.");
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ value_for<n::destination_type>(t),
value_for<n::nothing_is_fine_too>(false),
value_for<n::reason>(reason),
value_for<n::spec>(d->if_package_id()->uniquely_identifying_spec()),
- value_for<n::to_destinations>(DestinationTypes()),
value_for<n::untaken>(! d->taken()),
- value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(
+ value_for<n::use_existing>(_imp->fns.get_use_existing_fn()(
qpn_s, d->if_package_id()->uniquely_identifying_spec(), reason))
)));
}
@@ -647,9 +640,11 @@ Resolver::_add_dependencies(const QPN_S & our_qpn_s, const std::tr1::shared_ptr<
qpn_s != qpn_s_end ; ++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_dependency(our_qpn_s, *s, reason));
+ const std::tr1::shared_ptr<ConstraintSequence> constraints(_make_constraints_from_dependency(our_qpn_s, *s, reason));
- _apply_resolution_constraint(*qpn_s, dep_resolution, constraint);
+ for (ConstraintSequence::ConstIterator c(constraints->begin()), c_end(constraints->end()) ;
+ c != c_end ; ++c)
+ _apply_resolution_constraint(*qpn_s, dep_resolution, *c);
}
}
}
@@ -741,47 +736,51 @@ Resolver::_resolve_arrows()
for (ResolutionsByQPN_SMap::iterator i(_imp->resolutions_by_qpn_s.begin()), i_end(_imp->resolutions_by_qpn_s.end()) ;
i != i_end ; ++i)
- {
for (Constraints::ConstIterator c(i->second->constraints()->begin()),
c_end(i->second->constraints()->end()) ;
c != c_end ; ++c)
- {
- GetDependencyReason gdr;
- const DependencyReason * if_dependency_reason((*c)->reason()->accept_returning<const DependencyReason *>(gdr));
- if (! if_dependency_reason)
- continue;
+ _resolve_arrow(i->first, i->second, *c);
+}
- const QPN_S from_qpns(if_dependency_reason->from_id());
- const std::tr1::shared_ptr<Resolution> resolution(_resolution_for_qpn_s(from_qpns, false));
+void
+Resolver::_resolve_arrow(
+ const QPN_S & qpn_s,
+ const std::tr1::shared_ptr<Resolution> &,
+ const std::tr1::shared_ptr<const Constraint> & constraint)
+{
+ GetDependencyReason gdr;
+ const DependencyReason * if_dependency_reason(constraint->reason()->accept_returning<const DependencyReason *>(gdr));
+ if (! if_dependency_reason)
+ return;
- if ((*c)->spec().if_block())
- {
- if ((*c)->spec().if_block()->strong())
- {
- resolution->arrows()->push_back(make_shared_ptr(new Arrow(make_named_values<Arrow>(
- value_for<n::ignorable_pass>(0),
- value_for<n::to_qpn_s>(i->first)
- ))));
- }
- continue;
- }
- else
- {
- ArrowInfo a(*if_dependency_reason);
- if (a.causes_pre_arrow)
- {
- int ignorable_pass(0);
- if (_already_met(if_dependency_reason->sanitised_dependency()))
- ignorable_pass = 1;
- else if (a.ignorable)
- ignorable_pass = 2;
-
- resolution->arrows()->push_back(make_shared_ptr(new Arrow(make_named_values<Arrow>(
- value_for<n::ignorable_pass>(ignorable_pass),
- value_for<n::to_qpn_s>(i->first)
- ))));
- }
- }
+ const QPN_S from_qpns(if_dependency_reason->from_id());
+ const std::tr1::shared_ptr<Resolution> resolution(_resolution_for_qpn_s(from_qpns, false));
+
+ if (constraint->spec().if_block())
+ {
+ if (constraint->spec().if_block()->strong())
+ {
+ resolution->arrows()->push_back(make_shared_ptr(new Arrow(make_named_values<Arrow>(
+ value_for<n::ignorable_pass>(0),
+ value_for<n::to_qpn_s>(qpn_s)
+ ))));
+ }
+ }
+ else
+ {
+ ArrowInfo a(*if_dependency_reason);
+ if (a.causes_pre_arrow)
+ {
+ int ignorable_pass(0);
+ if (_already_met(if_dependency_reason->sanitised_dependency()))
+ ignorable_pass = 1;
+ else if (a.ignorable)
+ ignorable_pass = 2;
+
+ resolution->arrows()->push_back(make_shared_ptr(new Arrow(make_named_values<Arrow>(
+ value_for<n::ignorable_pass>(ignorable_pass),
+ value_for<n::to_qpn_s>(qpn_s)
+ ))));
}
}
}
@@ -817,8 +816,8 @@ Resolver::_resolve_order()
{
switch (i->second->decision()->kind())
{
- case dk_installed:
- case dk_nothing:
+ case dk_existing_no_change:
+ case dk_nothing_no_change:
i->second->already_ordered() = true;
break;
@@ -830,7 +829,7 @@ Resolver::_resolve_order()
_imp->resolution_lists->untaken()->append(i->second);
break;
- case dk_installable:
+ case dk_changes_to_make:
if (! i->second->decision()->taken())
{
i->second->already_ordered() = true;
@@ -941,12 +940,6 @@ Resolver::_initial_constraints_for(const QPN_S & qpn_s) const
return _imp->fns.get_initial_constraints_for_fn()(qpn_s);
}
-DestinationTypes
-Resolver::_destination_types_for_dependency(const QPN_S &, const SanitisedDependency &) const
-{
- return DestinationTypes() + dt_slash;
-}
-
Resolver::ResolutionsByQPN_SConstIterator
Resolver::begin_resolutions_by_qpn_s() const
{
@@ -1071,8 +1064,10 @@ Resolver::find_any_score(const QPN_S & our_qpn_s, const SanitisedDependency & de
qpn_s != qpn_s_end ; ++qpn_s)
{
const std::tr1::shared_ptr<Resolution> resolution(_create_resolution_for_qpn_s(*qpn_s));
- const std::tr1::shared_ptr<Constraint> constraint(_make_constraint_from_dependency(our_qpn_s, dep, reason));
- resolution->constraints()->add(constraint);
+ const std::tr1::shared_ptr<ConstraintSequence> constraints(_make_constraints_from_dependency(our_qpn_s, dep, reason));
+ for (ConstraintSequence::ConstIterator c(constraints->begin()), c_end(constraints->end()) ;
+ c != c_end ; ++c)
+ resolution->constraints()->add(*c);
const std::tr1::shared_ptr<Decision> decision(_try_to_find_decision_for(*qpn_s, resolution));
if (decision)
return 20 + operator_bias;
@@ -1227,79 +1222,79 @@ Resolver::_try_to_find_decision_for(
const QPN_S & qpn_s,
const std::tr1::shared_ptr<const Resolution> & resolution) const
{
- const std::tr1::shared_ptr<const PackageID> installed_id(_find_installed_id_for(qpn_s, resolution));
+ const std::tr1::shared_ptr<const PackageID> existing_id(_find_existing_id_for(qpn_s, resolution));
std::pair<const std::tr1::shared_ptr<const PackageID>, bool> installable_id_best(_find_installable_id_for(qpn_s, resolution));
const std::tr1::shared_ptr<const PackageID> installable_id(installable_id_best.first);
bool best(installable_id_best.second);
- if (resolution->constraints()->nothing_is_fine_too() && ! installed_id)
+ if (resolution->constraints()->nothing_is_fine_too_for_all() && ! existing_id)
{
- /* nothing installed, but nothing's ok */
+ /* nothing existing, but nothing's ok */
return make_shared_ptr(new Decision(make_named_values<Decision>(
value_for<n::if_package_id>(make_null_shared_ptr()),
value_for<n::is_best>(false),
value_for<n::is_same>(false),
value_for<n::is_same_version>(false),
value_for<n::is_transient>(false),
- value_for<n::kind>(dk_nothing),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::kind>(dk_nothing_no_change),
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
}
- else if (installable_id && ! installed_id)
+ else if (installable_id && ! existing_id)
{
- /* there's nothing suitable installed. */
+ /* there's nothing suitable existing. */
return make_shared_ptr(new Decision(make_named_values<Decision>(
value_for<n::if_package_id>(installable_id),
value_for<n::is_best>(best),
value_for<n::is_same>(false),
value_for<n::is_same_version>(false),
value_for<n::is_transient>(false),
- value_for<n::kind>(dk_installable),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::kind>(dk_changes_to_make),
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
}
- else if (installed_id && ! installable_id)
+ else if (existing_id && ! installable_id)
{
/* there's nothing installable. this may or may not be ok. */
- bool is_transient(installed_id->transient_key() && installed_id->transient_key()->value());
+ bool is_transient(existing_id->transient_key() && existing_id->transient_key()->value());
- switch (resolution->constraints()->strictest_use_installed())
+ switch (resolution->constraints()->strictest_use_existing_for_all())
{
- case ui_if_possible:
+ case ue_if_possible:
break;
- case ui_only_if_transient:
- case ui_if_same:
- case ui_if_same_version:
+ case ue_only_if_transient:
+ case ue_if_same:
+ case ue_if_same_version:
if (! is_transient)
return make_null_shared_ptr();
break;
- case ui_never:
+ case ue_never:
return make_null_shared_ptr();
- case last_ui:
+ case last_ue:
break;
}
return make_shared_ptr(new Decision(make_named_values<Decision>(
- value_for<n::if_package_id>(installed_id),
+ value_for<n::if_package_id>(existing_id),
value_for<n::is_best>(false),
value_for<n::is_same>(true),
value_for<n::is_same_version>(true),
value_for<n::is_transient>(is_transient),
- value_for<n::kind>(dk_installed),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::kind>(dk_existing_no_change),
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
}
- else if ((! installed_id) && (! installable_id))
+ else if ((! existing_id) && (! installable_id))
{
return make_null_shared_ptr();
}
- else if (installed_id && installable_id)
+ else if (existing_id && installable_id)
{
- bool is_same_version(installed_id->version() == installable_id->version());
+ bool is_same_version(existing_id->version() == installable_id->version());
bool is_same(false);
if (is_same_version)
@@ -1307,7 +1302,7 @@ Resolver::_try_to_find_decision_for(
is_same = true;
std::set<ChoiceNameWithPrefix> common;
- if (installed_id->choices_key() && installable_id->choices_key())
+ if (existing_id->choices_key() && installable_id->choices_key())
{
std::set<ChoiceNameWithPrefix> i_common, u_common;
for (Choices::ConstIterator k(installable_id->choices_key()->value()->begin()),
@@ -1323,8 +1318,8 @@ Resolver::_try_to_find_decision_for(
i_common.insert((*i)->name_with_prefix());
}
- for (Choices::ConstIterator k(installed_id->choices_key()->value()->begin()),
- k_end(installed_id->choices_key()->value()->end()) ;
+ for (Choices::ConstIterator k(existing_id->choices_key()->value()->begin()),
+ k_end(existing_id->choices_key()->value()->end()) ;
k != k_end ; ++k)
{
if (! (*k)->consider_added_or_changed())
@@ -1345,40 +1340,40 @@ Resolver::_try_to_find_decision_for(
for (std::set<ChoiceNameWithPrefix>::const_iterator f(common.begin()), f_end(common.end()) ;
f != f_end ; ++f)
if (installable_id->choices_key()->value()->find_by_name_with_prefix(*f)->enabled() !=
- installed_id->choices_key()->value()->find_by_name_with_prefix(*f)->enabled())
+ existing_id->choices_key()->value()->find_by_name_with_prefix(*f)->enabled())
{
is_same = false;
break;
}
}
- bool is_transient(installed_id->transient_key() && installed_id->transient_key()->value());
+ bool is_transient(existing_id->transient_key() && existing_id->transient_key()->value());
- /* we've got installed and installable. do we have any reason not to pick the installed id? */
- switch (resolution->constraints()->strictest_use_installed())
+ /* we've got existing and installable. do we have any reason not to pick the existing id? */
+ switch (resolution->constraints()->strictest_use_existing_for_all())
{
- case ui_only_if_transient:
- case ui_never:
+ case ue_only_if_transient:
+ case ue_never:
return make_shared_ptr(new Decision(make_named_values<Decision>(
value_for<n::if_package_id>(installable_id),
value_for<n::is_best>(best),
value_for<n::is_same>(is_same),
value_for<n::is_same_version>(is_same_version),
value_for<n::is_transient>(false),
- value_for<n::kind>(dk_installable),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::kind>(dk_changes_to_make),
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
- case ui_if_same:
+ case ue_if_same:
if (is_same)
return make_shared_ptr(new Decision(make_named_values<Decision>(
- value_for<n::if_package_id>(installed_id),
+ value_for<n::if_package_id>(existing_id),
value_for<n::is_best>(false),
value_for<n::is_same>(is_same),
value_for<n::is_same_version>(is_same_version),
value_for<n::is_transient>(false),
- value_for<n::kind>(dk_installed),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::kind>(dk_existing_no_change),
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
else
return make_shared_ptr(new Decision(make_named_values<Decision>(
@@ -1387,20 +1382,20 @@ Resolver::_try_to_find_decision_for(
value_for<n::is_same>(is_same),
value_for<n::is_same_version>(is_same_version),
value_for<n::is_transient>(is_transient),
- value_for<n::kind>(dk_installable),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::kind>(dk_changes_to_make),
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
- case ui_if_same_version:
+ case ue_if_same_version:
if (is_same_version)
return make_shared_ptr(new Decision(make_named_values<Decision>(
- value_for<n::if_package_id>(installed_id),
+ value_for<n::if_package_id>(existing_id),
value_for<n::is_best>(false),
value_for<n::is_same>(is_same),
value_for<n::is_same_version>(is_same_version),
value_for<n::is_transient>(false),
- value_for<n::kind>(dk_installed),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::kind>(dk_existing_no_change),
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
else
return make_shared_ptr(new Decision(make_named_values<Decision>(
@@ -1409,22 +1404,22 @@ Resolver::_try_to_find_decision_for(
value_for<n::is_same>(is_same),
value_for<n::is_same_version>(is_same_version),
value_for<n::is_transient>(is_transient),
- value_for<n::kind>(dk_installable),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::kind>(dk_changes_to_make),
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
- case ui_if_possible:
+ case ue_if_possible:
return make_shared_ptr(new Decision(make_named_values<Decision>(
- value_for<n::if_package_id>(installed_id),
+ value_for<n::if_package_id>(existing_id),
value_for<n::is_best>(false),
value_for<n::is_same>(is_same),
value_for<n::is_same_version>(is_same_version),
value_for<n::is_transient>(false),
- value_for<n::kind>(dk_installed),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::kind>(dk_existing_no_change),
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
- case last_ui:
+ case last_ue:
break;
}
}
@@ -1444,12 +1439,12 @@ Resolver::_cannot_decide_for(
value_for<n::is_same_version>(false),
value_for<n::is_transient>(false),
value_for<n::kind>(dk_unable_to_decide),
- value_for<n::taken>(! resolution->constraints()->all_untaken())
+ value_for<n::taken>(! resolution->constraints()->all_untaken_for_all())
)));
}
const std::tr1::shared_ptr<const PackageID>
-Resolver::_find_installed_id_for(const QPN_S & qpn_s, const std::tr1::shared_ptr<const Resolution> & resolution) const
+Resolver::_find_existing_id_for(const QPN_S & qpn_s, const std::tr1::shared_ptr<const Resolution> & resolution) const
{
const std::tr1::shared_ptr<const PackageIDSequence> ids((*_imp->env)[selection::AllVersionsSorted(
generator::Package(qpn_s.package()) |
diff --git a/paludis/resolver/resolver.hh b/paludis/resolver/resolver.hh
index 2d275ce..dc2ff17 100644
--- a/paludis/resolver/resolver.hh
+++ b/paludis/resolver/resolver.hh
@@ -27,7 +27,7 @@
#include <paludis/resolver/sanitised_dependencies-fwd.hh>
#include <paludis/resolver/decision-fwd.hh>
#include <paludis/resolver/reason-fwd.hh>
-#include <paludis/resolver/use_installed-fwd.hh>
+#include <paludis/resolver/use_existing-fwd.hh>
#include <paludis/resolver/destinations-fwd.hh>
#include <paludis/resolver/resolutions-fwd.hh>
#include <paludis/resolver/resolver_functions-fwd.hh>
@@ -64,12 +64,12 @@ namespace paludis
const PackageDepSpec & spec,
const std::tr1::shared_ptr<const Reason> & reason) const;
- const std::tr1::shared_ptr<Constraint> _make_constraint_from_target(
+ const std::tr1::shared_ptr<ConstraintSequence> _make_constraints_from_target(
const QPN_S &,
const PackageDepSpec &,
const std::tr1::shared_ptr<const Reason> &) const;
- const std::tr1::shared_ptr<Constraint> _make_constraint_from_dependency(
+ const std::tr1::shared_ptr<ConstraintSequence> _make_constraints_from_dependency(
const QPN_S &, const SanitisedDependency &,
const std::tr1::shared_ptr<const Reason> &) const;
@@ -92,7 +92,8 @@ namespace paludis
const std::tr1::shared_ptr<const Constraint> _make_constraint_for_preloading(
const QPN_S & qpn_s,
- const std::tr1::shared_ptr<const Decision> & d) const;
+ const std::tr1::shared_ptr<const Decision> & d,
+ const DestinationType t) const;
const std::tr1::shared_ptr<Destinations> _make_destinations_for(const QPN_S &,
const std::tr1::shared_ptr<const Resolution> &) const;
@@ -104,6 +105,9 @@ namespace paludis
const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Repository> &) const;
+ void _resolve_arrow(const QPN_S &, const std::tr1::shared_ptr<Resolution> &,
+ const std::tr1::shared_ptr<const Constraint> &);
+
void _resolve_decide_with_dependencies();
void _resolve_destinations();
void _resolve_arrows();
@@ -133,9 +137,6 @@ namespace paludis
const std::tr1::shared_ptr<Constraints> _initial_constraints_for(const QPN_S &) const;
- DestinationTypes _destination_types_for_dependency(
- const QPN_S &, const SanitisedDependency &) const;
-
bool _same_slot(const std::tr1::shared_ptr<const PackageID> & a,
const std::tr1::shared_ptr<const PackageID> & b) const;
@@ -143,7 +144,7 @@ namespace paludis
const std::string _find_cycle(const QPN_S &, const int ignorable_pass) const;
- const std::tr1::shared_ptr<const PackageID> _find_installed_id_for(
+ const std::tr1::shared_ptr<const PackageID> _find_existing_id_for(
const QPN_S &, const std::tr1::shared_ptr<const Resolution> &) const;
const std::pair<const std::tr1::shared_ptr<const PackageID>, bool> _find_installable_id_for(
const QPN_S &, const std::tr1::shared_ptr<const Resolution> &) const;
diff --git a/paludis/resolver/resolver_functions.hh b/paludis/resolver/resolver_functions.hh
index cba7d19..e8a16e0 100644
--- a/paludis/resolver/resolver_functions.hh
+++ b/paludis/resolver/resolver_functions.hh
@@ -21,7 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_RESOLVER_FUNCTIONS_HH 1
#include <paludis/resolver/resolver_functions-fwd.hh>
-#include <paludis/resolver/use_installed-fwd.hh>
+#include <paludis/resolver/use_existing-fwd.hh>
#include <paludis/resolver/resolution-fwd.hh>
#include <paludis/resolver/qpn_s-fwd.hh>
#include <paludis/resolver/reason-fwd.hh>
@@ -35,7 +35,7 @@ namespace paludis
struct care_about_dep_fn;
struct get_initial_constraints_for_fn;
struct get_qpn_s_s_for_fn;
- struct get_use_installed_fn;
+ struct get_use_existing_fn;
struct take_dependency_fn;
}
@@ -62,18 +62,18 @@ namespace paludis
const std::tr1::shared_ptr<const Reason> &
)> TakeDependencyFunction;
- typedef std::tr1::function<UseInstalled (
+ typedef std::tr1::function<UseExisting (
const QPN_S &,
const PackageDepSpec &,
const std::tr1::shared_ptr<const Reason> &
- )> GetUseInstalledFunction;
+ )> GetUseExistingFunction;
struct ResolverFunctions
{
NamedValue<n::care_about_dep_fn, CareAboutDepFunction> care_about_dep_fn;
NamedValue<n::get_initial_constraints_for_fn, GetInitialConstraintsFunction> get_initial_constraints_for_fn;
NamedValue<n::get_qpn_s_s_for_fn, GetQPNSSForFunction> get_qpn_s_s_for_fn;
- NamedValue<n::get_use_installed_fn, GetUseInstalledFunction> get_use_installed_fn;
+ NamedValue<n::get_use_existing_fn, GetUseExistingFunction> get_use_existing_fn;
NamedValue<n::take_dependency_fn, TakeDependencyFunction> take_dependency_fn;
};
}
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index f2ba1fd..1d7a676 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -155,13 +155,13 @@ paludis::resolver::resolver_test::take_dependency_fn(
return ! is_suggestion(dep);
}
-UseInstalled
-paludis::resolver::resolver_test::get_use_installed_fn(
+UseExisting
+paludis::resolver::resolver_test::get_use_existing_fn(
const QPN_S &,
const PackageDepSpec &,
const std::tr1::shared_ptr<const Reason> &)
{
- return ui_never;
+ return ue_never;
}
ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s, const std::string & e,
@@ -217,7 +217,7 @@ ResolverTestCase::get_resolutions(const PackageDepSpec & target)
std::tr1::bind(&initial_constraints_for_fn, std::tr1::ref(initial_constraints),
std::tr1::placeholders::_1)),
value_for<n::get_qpn_s_s_for_fn>(&get_qpn_s_s_for_fn),
- value_for<n::get_use_installed_fn>(&get_use_installed_fn),
+ value_for<n::get_use_existing_fn>(&get_use_existing_fn),
value_for<n::take_dependency_fn>(&take_dependency_fn)
));
resolver.add_target(target);
@@ -226,8 +226,7 @@ ResolverTestCase::get_resolutions(const PackageDepSpec & target)
}
catch (const SuggestRestart & e)
{
- initial_constraints.insert(std::make_pair(e.qpn_s(), make_shared_ptr(new Constraints))).first->second->add(
- e.suggested_preset());
+ initial_constraints.insert(std::make_pair(e.qpn_s(), make_shared_ptr(new Constraints))).first->second->add(e.suggested_preset());
}
}
}
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index 43e0be9..cb0d60b 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -25,7 +25,7 @@
#include <paludis/resolver/resolution-fwd.hh>
#include <paludis/resolver/sanitised_dependencies-fwd.hh>
#include <paludis/resolver/reason-fwd.hh>
-#include <paludis/resolver/use_installed-fwd.hh>
+#include <paludis/resolver/use_existing-fwd.hh>
#include <paludis/resolver/resolutions-fwd.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -64,7 +64,7 @@ namespace paludis
const SanitisedDependency & dep,
const std::tr1::shared_ptr<const Reason> &);
- UseInstalled get_use_installed_fn(
+ UseExisting get_use_existing_fn(
const QPN_S &,
const PackageDepSpec &,
const std::tr1::shared_ptr<const Reason> &);
diff --git a/paludis/resolver/use_installed-fwd.hh b/paludis/resolver/use_existing-fwd.hh
index 358c4c1..4e3d5bb 100644
--- a/paludis/resolver/use_installed-fwd.hh
+++ b/paludis/resolver/use_existing-fwd.hh
@@ -17,8 +17,8 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_USE_INSTALLED_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_RESOLVER_USE_INSTALLED_FWD_HH 1
+#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_USE_EXISTING_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_RESOLVER_USE_EXISTING_FWD_HH 1
#include <paludis/util/attributes.hh>
#include <iosfwd>
@@ -27,7 +27,7 @@ namespace paludis
{
namespace resolver
{
-#include <paludis/resolver/use_installed-se.hh>
+#include <paludis/resolver/use_existing-se.hh>
}
}
diff --git a/paludis/resolver/use_installed.cc b/paludis/resolver/use_existing.cc
index e611566..3be6785 100644
--- a/paludis/resolver/use_installed.cc
+++ b/paludis/resolver/use_existing.cc
@@ -17,7 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/resolver/use_installed.hh>
+#include <paludis/resolver/use_existing.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <ostream>
@@ -25,5 +25,5 @@
using namespace paludis;
using namespace paludis::resolver;
-#include <paludis/resolver/use_installed-se.cc>
+#include <paludis/resolver/use_existing-se.cc>
diff --git a/paludis/resolver/use_installed.hh b/paludis/resolver/use_existing.hh
index c114c61..cb5adf2 100644
--- a/paludis/resolver/use_installed.hh
+++ b/paludis/resolver/use_existing.hh
@@ -17,10 +17,10 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_USE_INSTALLED_HH
-#define PALUDIS_GUARD_PALUDIS_RESOLVER_USE_INSTALLED_HH 1
+#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_USE_EXISTING_HH
+#define PALUDIS_GUARD_PALUDIS_RESOLVER_USE_EXISTING_HH 1
-#include <paludis/resolver/use_installed-fwd.hh>
+#include <paludis/resolver/use_existing-fwd.hh>
namespace paludis
{
diff --git a/paludis/resolver/use_existing.se b/paludis/resolver/use_existing.se
new file mode 100644
index 0000000..4258ae6
--- /dev/null
+++ b/paludis/resolver/use_existing.se
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_UseExisting()
+{
+ prefix ue
+ namespace paludis::resolver
+
+ # must be kept in strictness order
+ key ue_never "Never"
+ key ue_only_if_transient "Only if it is transient"
+ key ue_if_same "If it is the same"
+ key ue_if_same_version "If it is the same version"
+ key ue_if_possible "If possible"
+
+ want_destringify
+}
+
diff --git a/paludis/resolver/use_installed.se b/paludis/resolver/use_installed.se
deleted file mode 100644
index 1ff9b09..0000000
--- a/paludis/resolver/use_installed.se
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et ft=sh :
-
-make_enum_UseInstalled()
-{
- prefix ui
- namespace paludis::resolver
-
- # must be kept in strictness order
- key ui_never "Never"
- key ui_only_if_transient "Only if it is transient"
- key ui_if_same "If it is the same"
- key ui_if_same_version "If it is the same version"
- key ui_if_possible "If possible"
-
- want_destringify
-}
-
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 25bafa3..54216b2 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -211,7 +211,7 @@ namespace
cout << endl;
}
- if ((! resolution->decision()->is_best()) && resolution->decision()->kind() == dk_installable)
+ if ((! resolution->decision()->is_best()) && resolution->decision()->kind() == dk_changes_to_make)
cout << c::bold_red() << " Which prevented selection of the best candidate" << c::normal() << endl;
}
}
@@ -580,43 +580,36 @@ namespace
{
std::cout << " * " << (*c)->spec();
- switch ((*c)->use_installed())
+ switch ((*c)->use_existing())
{
- case ui_if_same:
- std::cout << ", use installed if same";
+ case ue_if_same:
+ std::cout << ", use existing if same";
break;
- case ui_never:
- std::cout << ", never using installed";
+ case ue_never:
+ std::cout << ", never using existing";
break;
- case ui_only_if_transient:
- std::cout << ", using installed only if transient";
+ case ue_only_if_transient:
+ std::cout << ", using existing only if transient";
break;
- case ui_if_same_version:
- std::cout << ", use installed if same version";
+ case ue_if_same_version:
+ std::cout << ", use existing if same version";
break;
- case ui_if_possible:
- std::cout << ", use installed if possible";
+ case ue_if_possible:
+ std::cout << ", use existing if possible";
break;
- case last_ui:
+ case last_ue:
break;
}
- for (DestinationType t(static_cast<DestinationType>(0)), t_end(last_dt) ;
- t != t_end ; t = static_cast<DestinationType>(static_cast<int>(t) + 1))
+ switch ((*c)->destination_type())
{
- if (! (*c)->to_destinations()[t])
- continue;
-
- switch (t)
- {
- case dt_slash:
- std::cout << ", installing to /";
- break;
+ case dt_slash:
+ std::cout << ", installing to /";
+ break;
- case last_dt:
- break;
- }
+ case last_dt:
+ break;
}
std::cout << std::endl;
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index ad4afd8..16f128f 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -103,64 +103,64 @@ namespace
}
}
- UseInstalled use_installed_from_cmdline(const args::EnumArg & a, const bool is_set)
+ UseExisting use_existing_from_cmdline(const args::EnumArg & a, const bool is_set)
{
if (a.argument() == "auto")
- return is_set ? ui_if_same : ui_never;
+ return is_set ? ue_if_same : ue_never;
else if (a.argument() == "never")
- return ui_never;
+ return ue_never;
else if (a.argument() == "if-transient")
- return ui_only_if_transient;
+ return ue_only_if_transient;
else if (a.argument() == "if-same")
- return ui_if_same;
+ return ue_if_same;
else if (a.argument() == "if-same-version")
- return ui_if_same_version;
+ return ue_if_same_version;
else if (a.argument() == "if-possible")
- return ui_if_possible;
+ return ue_if_possible;
else
throw args::DoHelp("Don't understand argument '" + a.argument() + "' to '--" + a.long_name() + "'");
}
- struct UseInstalledVisitor
+ struct UseExistingVisitor
{
const ResolveCommandLine & cmdline;
const bool from_set;
- UseInstalledVisitor(const ResolveCommandLine & c, const bool f) :
+ UseExistingVisitor(const ResolveCommandLine & c, const bool f) :
cmdline(c),
from_set(f)
{
}
- UseInstalled visit(const DependencyReason &) const
+ UseExisting visit(const DependencyReason &) const
{
- return use_installed_from_cmdline(cmdline.resolution_options.a_keep, false);
+ return use_existing_from_cmdline(cmdline.resolution_options.a_keep, false);
}
- UseInstalled visit(const TargetReason &) const
+ UseExisting visit(const TargetReason &) const
{
- return use_installed_from_cmdline(cmdline.resolution_options.a_keep_targets, from_set);
+ return use_existing_from_cmdline(cmdline.resolution_options.a_keep_targets, from_set);
}
- UseInstalled visit(const PresetReason &) const
+ UseExisting visit(const PresetReason &) const
{
- return ui_if_possible;
+ return ue_if_possible;
}
- UseInstalled visit(const SetReason & r) const
+ UseExisting visit(const SetReason & r) const
{
- UseInstalledVisitor v(cmdline, true);
- return r.reason_for_set()->accept_returning<UseInstalled>(v);
+ UseExistingVisitor v(cmdline, true);
+ return r.reason_for_set()->accept_returning<UseExisting>(v);
}
};
- UseInstalled use_installed_fn(const ResolveCommandLine & cmdline,
+ UseExisting use_existing_fn(const ResolveCommandLine & cmdline,
const QPN_S &,
const PackageDepSpec &,
const std::tr1::shared_ptr<const Reason> & reason)
{
- UseInstalledVisitor v(cmdline, false);
- return reason->accept_returning<UseInstalled>(v);
+ UseExistingVisitor v(cmdline, false);
+ return reason->accept_returning<UseExisting>(v);
}
int reinstall_scm_days(const ResolveCommandLine & cmdline)
@@ -253,12 +253,12 @@ namespace
if ((-1 != n) && installed_is_scm_older_than(env, qpn_s, n))
{
result->add(make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ value_for<n::destination_type>(dt_slash),
value_for<n::nothing_is_fine_too>(false),
value_for<n::reason>(make_shared_ptr(new PresetReason)),
value_for<n::spec>(make_package_dep_spec(PartiallyMadePackageDepSpecOptions()).package(qpn_s.package())),
- value_for<n::to_destinations>(DestinationTypes()),
value_for<n::untaken>(false),
- value_for<n::use_installed>(ui_only_if_transient)
+ value_for<n::use_existing>(ue_only_if_transient)
))));
}
@@ -482,7 +482,7 @@ namespace
const QPN_S &, const std::tr1::shared_ptr<const Resolution> & resolution,
const SanitisedDependency & dep)
{
- if (dk_installed == resolution->decision()->kind())
+ if (dk_nothing_no_change == resolution->decision()->kind())
{
if (! cmdline.resolution_options.a_follow_installed_build_dependencies.specified())
if (is_just_build_dep(dep))
@@ -683,7 +683,7 @@ ResolveCommand::run(
env.get(), std::tr1::cref(cmdline), std::tr1::cref(initial_constraints), std::tr1::placeholders::_1)),
value_for<n::get_qpn_s_s_for_fn>(std::tr1::bind(&get_qpn_s_s_for_fn,
env.get(), std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2)),
- value_for<n::get_use_installed_fn>(std::tr1::bind(&use_installed_fn,
+ value_for<n::get_use_existing_fn>(std::tr1::bind(&use_existing_fn,
std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2, std::tr1::placeholders::_3)),
value_for<n::take_dependency_fn>(std::tr1::bind(&take_dependency_fn, env.get(),
std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2, std::tr1::placeholders::_3))
diff --git a/src/clients/cave/cmd_resolve_dump.cc b/src/clients/cave/cmd_resolve_dump.cc
index eea19e9..ed0e785 100644
--- a/src/clients/cave/cmd_resolve_dump.cc
+++ b/src/clients/cave/cmd_resolve_dump.cc
@@ -166,7 +166,7 @@ namespace
ss << "; nothing is fine too";
ss
<< "; untaken: " << stringify(c.untaken())
- << "; use_installed: " << stringify(c.use_installed())
+ << "; use_existing: " << stringify(c.use_existing())
<< "; reason: ";
ReasonFinder r;