aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-07 22:20:31 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-07 22:20:31 +0100
commit1f846d5ab7afac54766e5f744eee27edf05d5135 (patch)
tree65dc2071bf26ea6d64975d0e1ae5ce67ca62e3bd
parent3b2d7e83d8735916d89a9bd61bdf9c92d77f016e (diff)
downloadpaludis-1f846d5ab7afac54766e5f744eee27edf05d5135.tar.gz
paludis-1f846d5ab7afac54766e5f744eee27edf05d5135.tar.xz
let constraints be negated
-rw-r--r--paludis/resolver/constraint.cc5
-rw-r--r--paludis/resolver/constraint.hh6
-rw-r--r--paludis/resolver/resolver.cc11
-rw-r--r--src/clients/cave/cmd_resolve.cc9
4 files changed, 22 insertions, 9 deletions
diff --git a/paludis/resolver/constraint.cc b/paludis/resolver/constraint.cc
index e1150a8..2fb9d23 100644
--- a/paludis/resolver/constraint.cc
+++ b/paludis/resolver/constraint.cc
@@ -32,7 +32,10 @@ std::ostream &
paludis::resolver::operator<< (std::ostream & s, const Constraint & c)
{
std::stringstream ss;
- ss << "Constraint(spec: " << c.spec()
+ ss << "Constraint(base spec: " << c.base_spec();
+ if (c.is_blocker())
+ ss << "; blocker";
+ ss
<< "; use_installed: " << stringify(c.use_installed())
<< "; reason: " << (c.reason() ? stringify(*c.reason()) : "none")
<< ")";
diff --git a/paludis/resolver/constraint.hh b/paludis/resolver/constraint.hh
index 97f8b16..be95f4e 100644
--- a/paludis/resolver/constraint.hh
+++ b/paludis/resolver/constraint.hh
@@ -31,8 +31,9 @@ namespace paludis
{
namespace n
{
+ struct base_spec;
+ struct is_blocker;
struct reason;
- struct spec;
struct to_destination_slash;
struct use_installed;
}
@@ -41,8 +42,9 @@ namespace paludis
{
struct Constraint
{
+ NamedValue<n::base_spec, PackageDepSpec> base_spec;
+ NamedValue<n::is_blocker, bool> is_blocker;
NamedValue<n::reason, std::tr1::shared_ptr<const Reason> > reason;
- NamedValue<n::spec, PackageDepSpec> 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 1362363..89807e6 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -354,8 +354,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::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))
)));
@@ -366,8 +367,9 @@ Resolver::_make_constraint_from_dependency(const QPN_S & qpn_s, const SanitisedD
const std::tr1::shared_ptr<const Reason> & reason) const
{
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ value_for<n::base_spec>(dep.spec()),
+ value_for<n::is_blocker>(false),
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()(qpn_s, dep.spec(), reason))
)));
@@ -431,7 +433,7 @@ Resolver::_constraint_matches(
break;
}
- ok = ok && match_package(*_imp->env, c->spec(), *decision->package_id(), MatchPackageOptions());
+ ok = ok && (c->is_blocker() ^ match_package(*_imp->env, c->base_spec(), *decision->package_id(), MatchPackageOptions()));
return ok;
}
@@ -917,8 +919,9 @@ Resolver::_make_constraint_for_preloading(
const std::tr1::shared_ptr<PresetReason> reason(new PresetReason);
return make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ value_for<n::base_spec>(d->package_id()->uniquely_identifying_spec()),
+ value_for<n::is_blocker>(false),
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()(qpn_s, d->package_id()->uniquely_identifying_spec(), reason))
)));
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index 700f2ad..8702c8e 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -536,7 +536,11 @@ namespace
c_end(r->second->constraints()->end()) ;
c != c_end ; ++c)
{
- std::cout << " * " << (*c)->spec();
+ if ((*c)->is_blocker())
+ std::cout << " * blocker " << (*c)->base_spec();
+ else
+ std::cout << " * " << (*c)->base_spec();
+
switch ((*c)->use_installed())
{
case ui_if_same:
@@ -765,8 +769,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::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)
))));