aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-01 20:34:58 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-01 20:34:58 +0000
commitc62994832bf483e9974eec057d9d8d13f9b202ed (patch)
treef79e43a97647e470bcb9414985ec648df8e7626d
parent27dd26e3f7dfbc71755b52b4305242559e1645a7 (diff)
downloadpaludis-c62994832bf483e9974eec057d9d8d13f9b202ed.tar.gz
paludis-c62994832bf483e9974eec057d9d8d13f9b202ed.tar.xz
DepSpec::accumulate_changes_to_make_met returns Tribool
-rw-r--r--paludis/additional_package_dep_spec_requirement.hh7
-rw-r--r--paludis/elike_use_requirement.cc16
-rw-r--r--paludis/resolver/decider.cc4
-rw-r--r--paludis/user_dep_spec.cc3
-rw-r--r--paludis/user_dep_spec.hh2
5 files changed, 22 insertions, 10 deletions
diff --git a/paludis/additional_package_dep_spec_requirement.hh b/paludis/additional_package_dep_spec_requirement.hh
index 05232b7..3b3f70d 100644
--- a/paludis/additional_package_dep_spec_requirement.hh
+++ b/paludis/additional_package_dep_spec_requirement.hh
@@ -23,6 +23,7 @@
#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/tribool-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/changed_choices-fwd.hh>
#include <paludis/package_id-fwd.hh>
@@ -70,9 +71,13 @@ namespace paludis
* Verifies that the ID has the appropriate choice, and that that
* choice isn't locked.
*
+ * Returns true for changes made, false for not possible,
+ * indeterminate for nothing needs changing.
+ *
* \since 0.51
+ * \since 0.55 returns Tribool
*/
- virtual bool accumulate_changes_to_make_met(
+ virtual Tribool accumulate_changes_to_make_met(
const Environment * const,
const ChangedChoices * const maybe_changes_to_owner,
const std::shared_ptr<const PackageID> &,
diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc
index dbf6253..1c7c120 100644
--- a/paludis/elike_use_requirement.cc
+++ b/paludis/elike_use_requirement.cc
@@ -211,14 +211,14 @@ namespace
return result;
}
- bool accumulate_changes_to_make_met(
+ Tribool accumulate_changes_to_make_met(
const Environment * const env,
const ChangedChoices * const maybe_changes_to_owner,
const std::shared_ptr<const PackageID> & id,
ChangedChoices & changed_choices) const
{
if (requirement_met(env, maybe_changes_to_owner, *id, &changed_choices).first)
- return true;
+ return indeterminate;
if (_flags.length() >= 2 && ":*" == _flags.substr(_flags.length() - 2))
{
@@ -548,18 +548,24 @@ namespace
_reqs.push_back(req);
}
- virtual bool accumulate_changes_to_make_met(
+ virtual Tribool accumulate_changes_to_make_met(
const Environment * const env,
const ChangedChoices * const maybe_changes_to_owner,
const std::shared_ptr<const PackageID> & id,
ChangedChoices & changed_choices) const
{
+ Tribool result(indeterminate);
for (auto r(_reqs.begin()), r_end(_reqs.end()) ;
r != r_end ; ++r)
- if (! (*r)->accumulate_changes_to_make_met(env, maybe_changes_to_owner, id, changed_choices))
+ {
+ auto b((*r)->accumulate_changes_to_make_met(env, maybe_changes_to_owner, id, changed_choices));
+ if (b.is_false())
return false;
+ else if (b.is_true())
+ result = true;
+ }
- return true;
+ return result;
}
};
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 2de8eb7..d99b767 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -1895,8 +1895,8 @@ Decider::_find_id_for_from(
for (auto a((*c)->spec().if_package()->additional_requirements_ptr()->begin()),
a_end((*c)->spec().if_package()->additional_requirements_ptr()->end()) ;
a != a_end ; ++a)
- if (! (*a)->accumulate_changes_to_make_met(_imp->env,
- get_changed_choices_for(*c).get(), *i, *changed_choices))
+ if ((*a)->accumulate_changes_to_make_met(_imp->env,
+ get_changed_choices_for(*c).get(), *i, *changed_choices).is_false())
{
ok = false;
break;
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 61ec80d..f3c72ec 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -40,6 +40,7 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/tribool.hh>
#include <algorithm>
using namespace paludis;
@@ -873,7 +874,7 @@ UserKeyRequirement::as_raw_string() const
return "[." + _imp->key + std::string(1, _imp->op) + _imp->value + "]";
}
-bool
+Tribool
UserKeyRequirement::accumulate_changes_to_make_met(
const Environment * const,
const ChangedChoices * const,
diff --git a/paludis/user_dep_spec.hh b/paludis/user_dep_spec.hh
index d248e6a..286e35f 100644
--- a/paludis/user_dep_spec.hh
+++ b/paludis/user_dep_spec.hh
@@ -84,7 +84,7 @@ namespace paludis
virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual bool accumulate_changes_to_make_met(
+ virtual Tribool accumulate_changes_to_make_met(
const Environment * const,
const ChangedChoices * const,
const std::shared_ptr<const PackageID> &,