aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-09 20:30:33 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-09 20:30:33 +0100
commita9fb7d9135116fb588d3322e64e25f52fca65351 (patch)
treeeb09e4ba25266c0955247d169d2b219cbff517ee
parentb707b6e9f1c4512b746a14adc96263e528fc6761 (diff)
downloadpaludis-a9fb7d9135116fb588d3322e64e25f52fca65351.tar.gz
paludis-a9fb7d9135116fb588d3322e64e25f52fca65351.tar.xz
we have a class for this now
-rw-r--r--paludis/resolver/constraint.cc4
-rw-r--r--paludis/resolver/constraint.hh7
-rw-r--r--paludis/resolver/resolver.cc21
-rw-r--r--src/clients/cave/cmd_resolve.cc8
4 files changed, 17 insertions, 23 deletions
diff --git a/paludis/resolver/constraint.cc b/paludis/resolver/constraint.cc
index 5abdc37..356948b 100644
--- a/paludis/resolver/constraint.cc
+++ b/paludis/resolver/constraint.cc
@@ -32,9 +32,7 @@ std::ostream &
paludis::resolver::operator<< (std::ostream & s, const Constraint & c)
{
std::stringstream ss;
- ss << "Constraint(base spec: " << c.base_spec();
- if (c.is_blocker())
- ss << "; blocker";
+ ss << "Constraint(spec: " << c.spec();
if (c.nothing_is_fine_too())
ss << "; nothing is fine too";
ss
diff --git a/paludis/resolver/constraint.hh b/paludis/resolver/constraint.hh
index 6e7ac31..1cc46cc 100644
--- a/paludis/resolver/constraint.hh
+++ b/paludis/resolver/constraint.hh
@@ -23,6 +23,7 @@
#include <paludis/resolver/constraint-fwd.hh>
#include <paludis/resolver/reason-fwd.hh>
#include <paludis/resolver/use_installed-fwd.hh>
+#include <paludis/resolver/sanitised_dependencies.hh>
#include <paludis/util/named_value.hh>
#include <paludis/dep_spec.hh>
#include <tr1/memory>
@@ -31,10 +32,9 @@ namespace paludis
{
namespace n
{
- struct base_spec;
- struct is_blocker;
struct nothing_is_fine_too;
struct reason;
+ struct spec;
struct to_destination_slash;
struct use_installed;
}
@@ -43,10 +43,9 @@ namespace paludis
{
struct Constraint
{
- NamedValue<n::base_spec, PackageDepSpec> base_spec;
- NamedValue<n::is_blocker, bool> is_blocker;
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_destination_slash, bool> to_destination_slash;
NamedValue<n::use_installed, UseInstalled> use_installed;
};
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index bf7e56c..0d83fdf 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -356,10 +356,9 @@ Resolver::_make_constraint_from_target(
const std::tr1::shared_ptr<const Reason> & reason) const
{
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
- value_for<n::base_spec>(spec),
- value_for<n::is_blocker>(false),
value_for<n::nothing_is_fine_too>(false),
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()(qpn_s, spec, reason))
)));
@@ -371,19 +370,17 @@ Resolver::_make_constraint_from_dependency(const QPN_S & qpn_s, const SanitisedD
{
if (dep.spec().if_package())
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
- value_for<n::base_spec>(*dep.spec().if_package()),
- value_for<n::is_blocker>(false),
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_destination_slash>(_dependency_to_destination_slash(qpn_s, dep)),
value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(qpn_s, *dep.spec().if_package(), reason))
)));
else if (dep.spec().if_block())
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
- value_for<n::base_spec>(*dep.spec().if_block()->blocked_spec()),
- value_for<n::is_blocker>(true),
value_for<n::nothing_is_fine_too>(true),
value_for<n::reason>(reason),
+ value_for<n::spec>(dep.spec()),
value_for<n::to_destination_slash>(true),
value_for<n::use_installed>(ui_if_possible)
)));
@@ -450,7 +447,12 @@ Resolver::_constraint_matches(
}
if (decision->if_package_id())
- ok = ok && (c->is_blocker() ^ match_package(*_imp->env, c->base_spec(), *decision->if_package_id(), MatchPackageOptions()));
+ {
+ if (c->spec().if_block())
+ ok = ok && ! match_package(*_imp->env, *c->spec().if_block()->blocked_spec(), *decision->if_package_id(), MatchPackageOptions());
+ else
+ ok = ok && match_package(*_imp->env, *c->spec().if_package(), *decision->if_package_id(), MatchPackageOptions());
+ }
else
ok = ok && c->nothing_is_fine_too();
@@ -709,7 +711,7 @@ Resolver::_resolve_arrows()
c_end(i->second->constraints()->end()) ;
c != c_end ; ++c)
{
- if ((*c)->is_blocker())
+ if ((*c)->spec().if_block())
{
/* todo: strong blocks do impose arrows */
continue;
@@ -1004,10 +1006,9 @@ Resolver::_make_constraint_for_preloading(
throw InternalError(PALUDIS_HERE, "not decided. shouldn't happen.");
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
- value_for<n::base_spec>(d->if_package_id()->uniquely_identifying_spec()),
- value_for<n::is_blocker>(false),
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_destination_slash>(false),
value_for<n::use_installed>(_imp->fns.get_use_installed_fn()(
qpn_s, d->if_package_id()->uniquely_identifying_spec(), reason))
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index 896745f..58ebbc3 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -548,10 +548,7 @@ namespace
c_end(r->second->constraints()->end()) ;
c != c_end ; ++c)
{
- if ((*c)->is_blocker())
- std::cout << " * blocker " << (*c)->base_spec();
- else
- std::cout << " * " << (*c)->base_spec();
+ std::cout << " * " << (*c)->spec();
switch ((*c)->use_installed())
{
@@ -781,10 +778,9 @@ 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::base_spec>(make_package_dep_spec(PartiallyMadePackageDepSpecOptions()).package(qpn_s.package())),
- value_for<n::is_blocker>(false),
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_destination_slash>(false),
value_for<n::use_installed>(ui_only_if_transient)
))));