aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-03 18:22:25 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-04 19:23:09 +0100
commitd4ba35d4f1c5077a5da393b12a3a03e0d4fcbdb4 (patch)
treedd8e9913ac7d2a17a17a0b5e03d899416fff42da
parent5a6f33463b1a396225696ba8c5ad7468fbea4e68 (diff)
downloadpaludis-d4ba35d4f1c5077a5da393b12a3a03e0d4fcbdb4.tar.gz
paludis-d4ba35d4f1c5077a5da393b12a3a03e0d4fcbdb4.tar.xz
Allow deciding upon an ID with changed choices
-rw-r--r--paludis/dep_spec.hh21
-rw-r--r--paludis/elike_use_requirement.cc123
-rw-r--r--paludis/elike_use_requirement_TEST.cc318
-rw-r--r--paludis/match_package.cc16
-rw-r--r--paludis/match_package.hh21
-rw-r--r--paludis/resolver/decider.cc101
-rw-r--r--paludis/resolver/decider.hh4
-rw-r--r--paludis/resolver/required_confirmations-fwd.hh1
-rw-r--r--paludis/resolver/required_confirmations.cc16
-rw-r--r--paludis/resolver/required_confirmations.hh14
-rw-r--r--paludis/user_dep_spec.cc12
-rw-r--r--paludis/user_dep_spec.hh9
-rw-r--r--src/clients/cave/cmd_display_resolution.cc7
-rw-r--r--src/clients/cave/resolve_common.cc5
-rw-r--r--src/output/console_install_task.cc2
15 files changed, 459 insertions, 211 deletions
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 2b3b434..587ea18 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -308,9 +308,28 @@ namespace paludis
* meaningless.
*
* \since 0.44 returns pair<bool, std::string>
+ * \since 0.51 takes optional ChangedChoices arguments
*/
virtual const std::pair<bool, std::string> requirement_met(
- const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ const Environment * const,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID &,
+ const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * If possible, indicate which choices to change to make our
+ * requirement met for a particular ID.
+ *
+ * Verifies that the ID has the appropriate choice, and that that
+ * choice isn't locked.
+ *
+ * \since 0.51
+ */
+ virtual bool accumulate_changes_to_make_met(
+ const Environment * const,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const std::shared_ptr<const PackageID> &,
+ ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Return a human readable string representation of ourself.
diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc
index 1134561..0b810ea 100644
--- a/paludis/elike_use_requirement.cc
+++ b/paludis/elike_use_requirement.cc
@@ -31,6 +31,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/choice.hh>
+#include <paludis/changed_choices.hh>
#include <vector>
#include <functional>
#include <algorithm>
@@ -39,7 +40,10 @@ using namespace paludis;
namespace
{
- bool icky_use_query(const ChoiceNameWithPrefix & f, const PackageID & id, Tribool default_value = Tribool(indeterminate))
+ bool icky_use_query(const ChoiceNameWithPrefix & f,
+ const PackageID & id,
+ const ChangedChoices * const changed_choices,
+ Tribool default_value = Tribool(indeterminate))
{
if (! id.choices_key())
{
@@ -48,6 +52,13 @@ namespace
return false;
}
+ if (changed_choices)
+ {
+ auto c(changed_choices->overridden_value(f));
+ if (! c.is_indeterminate())
+ return c.is_true();
+ }
+
const std::shared_ptr<const ChoiceValue> v(id.choices_key()->value()->find_by_name_with_prefix(f));
if (v)
return v->enabled();
@@ -85,12 +96,16 @@ namespace
virtual bool one_requirement_met_base(
const Environment * const,
const ChoiceNameWithPrefix &,
- const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ const ChangedChoices * const,
+ const PackageID &,
+ const ChangedChoices * const) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
bool one_requirement_met(
const Environment * const env,
const ChoiceNameWithPrefix & c,
- const PackageID & id) const PALUDIS_ATTRIBUTE((warn_unused_result))
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID & id,
+ const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result))
{
if (_ignore_if_no_such_group)
{
@@ -105,7 +120,7 @@ namespace
return true;
}
- return one_requirement_met_base(env, c, id);
+ return one_requirement_met_base(env, c, maybe_changes_to_owner, id, maybe_changes_to_target);
}
virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
@@ -120,7 +135,11 @@ namespace
return _id;
}
- const std::pair<bool, std::string> requirement_met(const Environment * const env, const PackageID & i) const
+ const std::pair<bool, std::string> requirement_met(
+ const Environment * const env,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID & i,
+ const ChangedChoices * const maybe_changes_to_target) const
{
if (_flags.length() >= 2 && ":*" == _flags.substr(_flags.length() - 2))
{
@@ -145,7 +164,7 @@ namespace
std::pair<bool, std::string> result(true, "");
for (Choice::ConstIterator v((*cc)->begin()), v_end((*cc)->end()) ;
v != v_end ; ++v)
- if (! one_requirement_met(env, (*v)->name_with_prefix(), i))
+ if (! one_requirement_met(env, (*v)->name_with_prefix(), maybe_changes_to_owner, i, maybe_changes_to_target))
{
if (! result.first)
result.second.append(", ");
@@ -161,7 +180,7 @@ namespace
}
}
else
- if (! one_requirement_met(env, ChoiceNameWithPrefix(_flags), i))
+ if (! one_requirement_met(env, ChoiceNameWithPrefix(_flags), maybe_changes_to_owner, i, maybe_changes_to_target))
return std::make_pair(false, as_human_string());
return std::make_pair(true, as_human_string());
@@ -185,6 +204,36 @@ namespace
return result;
}
+
+ bool 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;
+
+ if (_flags.length() >= 2 && ":*" == _flags.substr(_flags.length() - 2))
+ {
+ /* too complicated for now */
+ return false;
+ }
+
+ ChoiceNameWithPrefix flag(_flags);
+ const std::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(flag));
+
+ if (! v)
+ {
+ /* warning messages get done elsewhere, no need here */
+ return false;
+ }
+
+ if (v->locked() || ! v->explicitly_listed())
+ return false;
+
+ return changed_choices.add_override_if_possible(flag, ! v->enabled());;
+ }
};
class PALUDIS_VISIBLE EnabledUseRequirement :
@@ -199,10 +248,10 @@ namespace
{
}
- virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag, const ChangedChoices * const,
+ const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, pkg, default_value());
+ return icky_use_query(flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -223,10 +272,10 @@ namespace
{
}
- virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag, const ChangedChoices * const,
+ const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return ! icky_use_query(flag, pkg, default_value());
+ return ! icky_use_query(flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -262,9 +311,9 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return ! icky_use_query(flag, *package_id()) || icky_use_query(flag, pkg, default_value());
+ return ! icky_use_query(flag, *package_id(), maybe_changes_to_owner) || icky_use_query(flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -287,9 +336,9 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, *package_id()) || icky_use_query(flag, pkg, default_value());
+ return icky_use_query(flag, *package_id(), maybe_changes_to_owner) || icky_use_query(flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -312,9 +361,10 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return ! icky_use_query(flag, *package_id()) || ! icky_use_query(flag, pkg, default_value());
+ return ! icky_use_query(flag, *package_id(), maybe_changes_to_owner) ||
+ ! icky_use_query(flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -337,9 +387,10 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, *package_id()) || ! icky_use_query(flag, pkg, default_value());
+ return icky_use_query(flag, *package_id(), maybe_changes_to_owner) ||
+ ! icky_use_query(flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -362,9 +413,9 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, pkg, default_value()) == icky_use_query(flag, *package_id());
+ return icky_use_query(flag, pkg, changed_choices, default_value()) == icky_use_query(flag, *package_id(), maybe_changes_to_owner);
}
virtual const std::string as_human_string() const
@@ -387,9 +438,9 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, pkg, default_value()) != icky_use_query(flag, *package_id());
+ return icky_use_query(flag, pkg, changed_choices, default_value()) != icky_use_query(flag, *package_id(), maybe_changes_to_owner);
}
virtual const std::string as_human_string() const
@@ -414,7 +465,11 @@ namespace
{
}
- virtual const std::pair<bool, std::string> requirement_met(const Environment * const env, const PackageID & id) const
+ virtual const std::pair<bool, std::string> requirement_met(
+ const Environment * const env,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID & id,
+ const ChangedChoices * const maybe_changes_to_target) const
{
using namespace std::placeholders;
@@ -422,7 +477,7 @@ namespace
for (Reqs::const_iterator r(_reqs.begin()), r_end(_reqs.end()) ;
r != r_end ; ++r)
{
- std::pair<bool, std::string> r_result((*r)->requirement_met(env, id));
+ std::pair<bool, std::string> r_result((*r)->requirement_met(env, maybe_changes_to_owner, id, maybe_changes_to_target));
if (! r_result.first)
{
if (! result.first)
@@ -449,6 +504,20 @@ namespace
{
_reqs.push_back(req);
}
+
+ virtual bool 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
+ {
+ 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))
+ return false;
+
+ return true;
+ }
};
template <typename T_>
diff --git a/paludis/elike_use_requirement_TEST.cc b/paludis/elike_use_requirement_TEST.cc
index 4726ff9..fa5afb4 100644
--- a/paludis/elike_use_requirement_TEST.cc
+++ b/paludis/elike_use_requirement_TEST.cc
@@ -73,25 +73,25 @@ namespace test_cases
parse_elike_use_requirement("enabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("disabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[disabled]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'disabled' enabled");
- TEST_CHECK(! req2->requirement_met(&env, *id).first);
+ TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-enabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-disabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-disabled]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'disabled' disabled");
- TEST_CHECK(req4->requirement_met(&env, *id).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
}
} test_simple_use_requirements;
@@ -114,25 +114,25 @@ namespace test_cases
parse_elike_use_requirement("enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[disabled]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'disabled' enabled");
- TEST_CHECK(! req2->requirement_met(&env, *id).first);
+ TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-disabled]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'disabled' disabled");
- TEST_CHECK(req4->requirement_met(&env, *id).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
}
} test_simple_use_requirements_portage_syntax;
@@ -155,31 +155,31 @@ namespace test_cases
parse_elike_use_requirement("enabled,-disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled,-disabled]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("enabled,disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[enabled,disabled]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' enabled");
- TEST_CHECK(! req2->requirement_met(&env, *id).first);
+ TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-enabled,-disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled,-disabled]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled; Flag 'disabled' disabled");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("enabled,-disabled,-enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[enabled,-disabled,-enabled]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' disabled");
- TEST_CHECK(! req4->requirement_met(&env, *id).first);
+ TEST_CHECK(! req4->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
parse_elike_use_requirement("enabled,-disabled,enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req5->as_raw_string(), "[enabled,-disabled,enabled]");
TEST_CHECK_EQUAL(req5->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' enabled");
- TEST_CHECK(req5->requirement_met(&env, *id).first);
+ TEST_CHECK(req5->requirement_met(&env, 0, *id, 0).first);
}
} test_multiple_use_requirements_portage_syntax;
@@ -204,85 +204,85 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
- TEST_CHECK(req3->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req3->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req4->requirement_met(&env, *id).first);
- TEST_CHECK(req4->requirement_met(&env, *id2).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req5->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req5->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req5->requirement_met(&env, *id).first);
- TEST_CHECK(req5->requirement_met(&env, *id2).first);
+ TEST_CHECK(req5->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req5->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req6(
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req6->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req6->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req6->requirement_met(&env, *id).first);
- TEST_CHECK(! req6->requirement_met(&env, *id2).first);
+ TEST_CHECK(req6->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req6->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements;
@@ -307,57 +307,57 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements_portage_syntax;
@@ -382,113 +382,113 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req13->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req13->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req13->requirement_met(&env, *id).first);
- TEST_CHECK(req13->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req13->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req13->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req14->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req14->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req14->requirement_met(&env, *id).first);
- TEST_CHECK(req14->requirement_met(&env, *id2).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req15->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req15->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req15->requirement_met(&env, *id).first);
- TEST_CHECK(req15->requirement_met(&env, *id2).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req16->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req16->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req16->requirement_met(&env, *id).first);
- TEST_CHECK(! req16->requirement_met(&env, *id2).first);
+ TEST_CHECK(req16->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req16->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req17->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req17->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req17->requirement_met(&env, *id).first);
- TEST_CHECK(req17->requirement_met(&env, *id2).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req18->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req18->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req18->requirement_met(&env, *id).first);
- TEST_CHECK(req18->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req18->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req18->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req19->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req19->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req19->requirement_met(&env, *id).first);
- TEST_CHECK(req19->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req19->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req19->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req20->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req20->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req20->requirement_met(&env, *id).first);
- TEST_CHECK(! req20->requirement_met(&env, *id2).first);
+ TEST_CHECK(req20->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req20->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements_both_syntaxes;
@@ -606,113 +606,113 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req13->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req13->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req13->requirement_met(&env, *id).first);
- TEST_CHECK(req13->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req13->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req13->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req14->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req14->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req14->requirement_met(&env, *id).first);
- TEST_CHECK(req14->requirement_met(&env, *id2).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req15->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req15->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req15->requirement_met(&env, *id).first);
- TEST_CHECK(req15->requirement_met(&env, *id2).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req16->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req16->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req16->requirement_met(&env, *id).first);
- TEST_CHECK(! req16->requirement_met(&env, *id2).first);
+ TEST_CHECK(req16->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req16->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req17->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req17->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req17->requirement_met(&env, *id).first);
- TEST_CHECK(req17->requirement_met(&env, *id2).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req18->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req18->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req18->requirement_met(&env, *id).first);
- TEST_CHECK(req18->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req18->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req18->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req19->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req19->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req19->requirement_met(&env, *id).first);
- TEST_CHECK(req19->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req19->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req19->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req20->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req20->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req20->requirement_met(&env, *id).first);
- TEST_CHECK(! req20->requirement_met(&env, *id2).first);
+ TEST_CHECK(req20->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req20->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements_nonstrict;
@@ -737,113 +737,113 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req13->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req13->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req13->requirement_met(&env, *id).first);
- TEST_CHECK(req13->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req13->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req13->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req14->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req14->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req14->requirement_met(&env, *id).first);
- TEST_CHECK(req14->requirement_met(&env, *id2).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req15->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req15->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req15->requirement_met(&env, *id).first);
- TEST_CHECK(req15->requirement_met(&env, *id2).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req16->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req16->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req16->requirement_met(&env, *id).first);
- TEST_CHECK(! req16->requirement_met(&env, *id2).first);
+ TEST_CHECK(req16->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req16->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req17->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req17->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req17->requirement_met(&env, *id).first);
- TEST_CHECK(req17->requirement_met(&env, *id2).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req18->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req18->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req18->requirement_met(&env, *id).first);
- TEST_CHECK(req18->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req18->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req18->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req19->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req19->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req19->requirement_met(&env, *id).first);
- TEST_CHECK(req19->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req19->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req19->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req20->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req20->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req20->requirement_met(&env, *id).first);
- TEST_CHECK(! req20->requirement_met(&env, *id2).first);
+ TEST_CHECK(req20->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req20->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements_portage_syntax_nonstrict;
@@ -866,25 +866,25 @@ namespace test_cases
parse_elike_use_requirement("missing(+)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[missing(+)]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'missing' enabled, assuming enabled if missing");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("missing(-)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[missing(-)]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'missing' enabled, assuming disabled if missing");
- TEST_CHECK(! req2->requirement_met(&env, *id).first);
+ TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-missing(+)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-missing(+)]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'missing' disabled, assuming enabled if missing");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-missing(-)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-missing(-)]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'missing' disabled, assuming disabled if missing");
- TEST_CHECK(req4->requirement_met(&env, *id).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
}
} test_use_requirements_with_defaults;
@@ -907,13 +907,13 @@ namespace test_cases
parse_elike_use_requirement("foo:*", id,
{ euro_allow_default_values, euro_allow_self_deps }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[foo:*]");
- TEST_CHECK(! req1->requirement_met(&env, *id).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("foo:*=", id,
{ euro_allow_default_values, euro_allow_self_deps }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[foo:*=]");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
}
} test_prefix_star_use_requirements;
@@ -941,16 +941,16 @@ namespace test_cases
{ euro_allow_default_values, euro_allow_self_deps,
euro_allow_default_question_values }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[foo:*(?)=]");
- TEST_CHECK(req1->requirement_met(&env, *id2).first);
- TEST_CHECK(req1->requirement_met(&env, *id1).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id2, 0).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id1, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("bar:*(?)=", id2,
{ euro_allow_default_values, euro_allow_self_deps,
euro_allow_default_question_values }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[bar:*(?)=]");
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
- TEST_CHECK(req2->requirement_met(&env, *id1).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id1, 0).first);
}
} test_question_default_requirements;
}
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index b80eb74..c56056f 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -76,10 +76,12 @@ namespace
}
bool
-paludis::match_package(
+paludis::match_package_with_maybe_changes(
const Environment & env,
const PackageDepSpec & spec,
+ const ChangedChoices * const maybe_changes_to_owner,
const PackageID & entry,
+ const ChangedChoices * const maybe_changes_to_target,
const MatchPackageOptions & options)
{
if (spec.package_ptr() && *spec.package_ptr() != entry.name())
@@ -203,7 +205,7 @@ paludis::match_package(
{
for (AdditionalPackageDepSpecRequirements::ConstIterator u(spec.additional_requirements_ptr()->begin()),
u_end(spec.additional_requirements_ptr()->end()) ; u != u_end ; ++u)
- if (! (*u)->requirement_met(&env, entry).first)
+ if (! (*u)->requirement_met(&env, maybe_changes_to_owner, entry, maybe_changes_to_target).first)
return false;
}
}
@@ -212,6 +214,16 @@ paludis::match_package(
}
bool
+paludis::match_package(
+ const Environment & env,
+ const PackageDepSpec & spec,
+ const PackageID & target,
+ const MatchPackageOptions & options)
+{
+ return match_package_with_maybe_changes(env, spec, 0, target, 0, options);
+}
+
+bool
paludis::match_package_in_set(
const Environment & env,
const SetSpecTree & target,
diff --git a/paludis/match_package.hh b/paludis/match_package.hh
index 25d691e..4ecae6d 100644
--- a/paludis/match_package.hh
+++ b/paludis/match_package.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -36,7 +36,7 @@
#include <paludis/spec_tree-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
-#include <memory>
+#include <paludis/changed_choices-fwd.hh>
namespace paludis
{
@@ -54,6 +54,23 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
/**
+ * Return whether the specified PackageID matches the specified
+ * PackageDepSpec, with the specified ChangedChoices applied to the target
+ * and the ID from which the dep came.
+ *
+ * \ingroup g_query
+ * \since 0.51
+ */
+ bool match_package_with_maybe_changes(
+ const Environment & env,
+ const PackageDepSpec & spec,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID & target,
+ const ChangedChoices * const maybe_changes_to_target,
+ const MatchPackageOptions & options)
+ PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
+
+ /**
* Return whether the specified PackageID matches any of the items in the
* specified set.
*
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index f4787d3..165f844 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -61,6 +61,7 @@
#include <paludis/elike_slot_requirement.hh>
#include <paludis/dep_spec_flattener.hh>
#include <paludis/package_id.hh>
+#include <paludis/changed_choices.hh>
#include <paludis/util/pimp-impl.hh>
@@ -826,17 +827,17 @@ namespace
{
}
- bool ok(const std::shared_ptr<const PackageID> & chosen_id) const
+ bool ok(const std::shared_ptr<const PackageID> & chosen_id,
+ const std::shared_ptr<const ChangedChoices> & changed_choices) const
{
if (constraint.spec().if_package())
{
- if (! match_package(*env, *constraint.spec().if_package(), *chosen_id, { }))
+ if (! match_package_with_maybe_changes(*env, *constraint.spec().if_package(), 0, *chosen_id, changed_choices.get(), { }))
return false;
}
else
{
- if (match_package(*env, constraint.spec().if_block()->blocking(),
- *chosen_id, { }))
+ if (match_package_with_maybe_changes(*env, constraint.spec().if_block()->blocking(), 0, *chosen_id, changed_choices.get(), { }))
return false;
}
@@ -845,12 +846,12 @@ namespace
bool visit(const ChangesToMakeDecision & decision) const
{
- return ok(decision.origin_id());
+ return ok(decision.origin_id(), decision.if_changed_choices());
}
bool visit(const ExistingNoChangeDecision & decision) const
{
- return ok(decision.existing_id());
+ return ok(decision.existing_id(), make_null_shared_ptr());
}
bool visit(const NothingNoChangeDecision &) const
@@ -1153,7 +1154,7 @@ namespace
const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(const ChangesToMakeDecision & decision) const
{
if (decision.taken())
- return std::make_pair(decision.origin_id(), make_null_shared_ptr());
+ return std::make_pair(decision.origin_id(), decision.if_changed_choices());
else
return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
@@ -1758,7 +1759,7 @@ const std::shared_ptr<const PackageID>
Decider::_find_existing_id_for(const std::shared_ptr<const Resolution> & resolution) const
{
const std::shared_ptr<const PackageIDSequence> ids(_installed_ids(resolution));
- return std::get<0>(_find_id_for_from(resolution, ids));
+ return std::get<0>(_find_id_for_from(resolution, ids, false, false));
}
bool
@@ -1813,14 +1814,20 @@ Decider::_find_installable_id_candidates_for(
const Decider::FoundID
Decider::_find_installable_id_for(const std::shared_ptr<const Resolution> & resolution, const bool include_unmaskable) const
{
- return _find_id_for_from(resolution, _find_installable_id_candidates_for(resolution, false, include_unmaskable));
+ return _find_id_for_from(resolution, _find_installable_id_candidates_for(resolution, false, include_unmaskable), true, false);
}
const Decider::FoundID
Decider::_find_id_for_from(
const std::shared_ptr<const Resolution> & resolution,
- const std::shared_ptr<const PackageIDSequence> & ids) const
+ const std::shared_ptr<const PackageIDSequence> & ids,
+ const bool try_changing_choices,
+ const bool trying_changing_choices) const
{
+ MatchPackageOptions opts;
+ if (trying_changing_choices)
+ opts += mpo_ignore_additional_requirements;
+
std::shared_ptr<const PackageID> best_version;
for (PackageIDSequence::ReverseConstIterator i(ids->rbegin()), i_end(ids->rend()) ;
i != i_end ; ++i)
@@ -1834,19 +1841,78 @@ Decider::_find_id_for_from(
c != c_end ; ++c)
{
if ((*c)->spec().if_package())
- ok = ok && match_package(*_imp->env, *(*c)->spec().if_package(), **i, { });
+ ok = ok && match_package(*_imp->env, *(*c)->spec().if_package(), **i, opts);
else
- ok = ok && ! match_package(*_imp->env, (*c)->spec().if_block()->blocking(), **i, { });
+ ok = ok && ! match_package(*_imp->env, (*c)->spec().if_block()->blocking(), **i, opts);
if (! ok)
break;
}
if (ok)
- return FoundID(*i, make_null_shared_ptr(), (*i)->version() == best_version->version());
+ {
+ std::shared_ptr<ChangedChoices> changed_choices(std::make_shared<ChangedChoices>());
+ if (trying_changing_choices)
+ {
+ for (Constraints::ConstIterator c(resolution->constraints()->begin()),
+ c_end(resolution->constraints()->end()) ;
+ c != c_end ; ++c)
+ {
+ if (! ok)
+ break;
+
+ if (! (*c)->spec().if_package())
+ {
+ if ((*c)->spec().if_block()->blocking().additional_requirements_ptr() &&
+ ! (*c)->spec().if_block()->blocking().additional_requirements_ptr()->empty())
+ {
+ /* too complicated for now */
+ ok = false;
+ }
+ break;
+ }
+
+ if (! (*c)->spec().if_package()->additional_requirements_ptr())
+ {
+ /* no additional requirements, so no tinkering required */
+ continue;
+ }
+
+ 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, 0, *i, *changed_choices))
+ {
+ ok = false;
+ break;
+ }
+ }
+ }
+
+ /* might have an early requirement of [x], and a later [-x], and
+ * chosen to change because of the latter */
+ for (Constraints::ConstIterator c(resolution->constraints()->begin()),
+ c_end(resolution->constraints()->end()) ;
+ c != c_end ; ++c)
+ {
+ if (! ok)
+ break;
+
+ if ((*c)->spec().if_package())
+ ok = ok && match_package_with_maybe_changes(*_imp->env, *(*c)->spec().if_package(), 0, **i, changed_choices.get(), { });
+ else
+ ok = ok && ! match_package_with_maybe_changes(*_imp->env, (*c)->spec().if_block()->blocking(), 0, **i, changed_choices.get(), { });
+ }
+
+ if (ok)
+ return FoundID(*i, changed_choices->empty() ? make_null_shared_ptr() : changed_choices, (*i)->version() == best_version->version());
+ }
}
- return FoundID(make_null_shared_ptr(), make_null_shared_ptr(), false);
+ if (try_changing_choices && ! trying_changing_choices)
+ return _find_id_for_from(resolution, ids, true, true);
+ else
+ return FoundID(make_null_shared_ptr(), make_null_shared_ptr(), false);
}
const std::shared_ptr<const Constraints>
@@ -2122,6 +2188,13 @@ namespace
if (! fns.confirm_fn()(resolution, c))
changes_to_make_decision.add_required_confirmation(c);
}
+
+ if (changes_to_make_decision.if_changed_choices())
+ {
+ auto c(std::make_shared<ChangedChoicesConfirmation>());
+ if (! fns.confirm_fn()(resolution, c))
+ changes_to_make_decision.add_required_confirmation(c);
+ }
}
void visit(BreakDecision & break_decision) const
diff --git a/paludis/resolver/decider.hh b/paludis/resolver/decider.hh
index 62410a6..7356a10 100644
--- a/paludis/resolver/decider.hh
+++ b/paludis/resolver/decider.hh
@@ -215,7 +215,9 @@ namespace paludis
const bool include_unmaskable) const;
const FoundID _find_id_for_from(
const std::shared_ptr<const Resolution> &,
- const std::shared_ptr<const PackageIDSequence> &) const;
+ const std::shared_ptr<const PackageIDSequence> &,
+ const bool try_changing_choices,
+ const bool trying_changing_choices) const;
const std::shared_ptr<const Constraints> _get_unmatching_constraints(
const std::shared_ptr<const Resolution> &,
diff --git a/paludis/resolver/required_confirmations-fwd.hh b/paludis/resolver/required_confirmations-fwd.hh
index 80ccd41..a30fd59 100644
--- a/paludis/resolver/required_confirmations-fwd.hh
+++ b/paludis/resolver/required_confirmations-fwd.hh
@@ -33,6 +33,7 @@ namespace paludis
struct BreakConfirmation;
struct RemoveSystemPackageConfirmation;
struct MaskedConfirmation;
+ struct ChangedChoicesConfirmation;
typedef Sequence<std::shared_ptr<const RequiredConfirmation> > RequiredConfirmations;
}
diff --git a/paludis/resolver/required_confirmations.cc b/paludis/resolver/required_confirmations.cc
index 95585c8..3ca1046 100644
--- a/paludis/resolver/required_confirmations.cc
+++ b/paludis/resolver/required_confirmations.cc
@@ -40,6 +40,8 @@ RequiredConfirmation::deserialise(Deserialisation & d)
return RemoveSystemPackageConfirmation::deserialise(d);
else if (d.class_name() == "MaskedConfirmation")
return MaskedConfirmation::deserialise(d);
+ else if (d.class_name() == "ChangedChoicesConfirmation")
+ return ChangedChoicesConfirmation::deserialise(d);
else
throw InternalError(PALUDIS_HERE, "unknown class '" + stringify(d.class_name()) + "'");
@@ -116,6 +118,20 @@ MaskedConfirmation::serialise(Serialiser & s) const
;
}
+const std::shared_ptr<ChangedChoicesConfirmation>
+ChangedChoicesConfirmation::deserialise(Deserialisation & d)
+{
+ Deserialisator v(d, "ChangedChoicesConfirmation");
+ return std::make_shared<ChangedChoicesConfirmation>();
+}
+
+void
+ChangedChoicesConfirmation::serialise(Serialiser & s) const
+{
+ s.object("ChangedChoicesConfirmation")
+ ;
+}
+
template class Sequence<std::shared_ptr<const RequiredConfirmation> >;
template class WrappedForwardIterator<RequiredConfirmations::ConstIteratorTag, const std::shared_ptr<const RequiredConfirmation> >;
diff --git a/paludis/resolver/required_confirmations.hh b/paludis/resolver/required_confirmations.hh
index 4520561..622ec56 100644
--- a/paludis/resolver/required_confirmations.hh
+++ b/paludis/resolver/required_confirmations.hh
@@ -32,7 +32,8 @@ namespace paludis
{
class PALUDIS_VISIBLE RequiredConfirmation :
public virtual DeclareAbstractAcceptMethods<RequiredConfirmation, MakeTypeList<
- DowngradeConfirmation, NotBestConfirmation, BreakConfirmation, RemoveSystemPackageConfirmation, MaskedConfirmation>::Type>
+ DowngradeConfirmation, NotBestConfirmation, BreakConfirmation, RemoveSystemPackageConfirmation,
+ MaskedConfirmation, ChangedChoicesConfirmation>::Type>
{
public:
virtual void serialise(Serialiser &) const = 0;
@@ -95,6 +96,17 @@ namespace paludis
virtual void serialise(Serialiser &) const;
};
+
+ class PALUDIS_VISIBLE ChangedChoicesConfirmation :
+ public RequiredConfirmation,
+ public ImplementAcceptMethods<RequiredConfirmation, ChangedChoicesConfirmation>
+ {
+ public:
+ static const std::shared_ptr<ChangedChoicesConfirmation> deserialise(
+ Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void serialise(Serialiser &) const;
+ };
}
}
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 2a24214..ad76b09 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -749,7 +749,7 @@ namespace
}
const std::pair<bool, std::string>
-UserKeyRequirement::requirement_met(const Environment * const, const PackageID & id) const
+UserKeyRequirement::requirement_met(const Environment * const, const ChangedChoices * const, const PackageID & id, const ChangedChoices * const) const
{
Context context("When working out whether '" + stringify(id) + "' matches " + as_raw_string() + ":");
@@ -783,6 +783,16 @@ UserKeyRequirement::as_raw_string() const
return "[." + _imp->key + std::string(1, _imp->op) + _imp->value + "]";
}
+bool
+UserKeyRequirement::accumulate_changes_to_make_met(
+ const Environment * const,
+ const ChangedChoices * const,
+ const std::shared_ptr<const PackageID> &,
+ ChangedChoices &) const
+{
+ return false;
+}
+
VersionSpecOptions
paludis::user_version_spec_options()
{
diff --git a/paludis/user_dep_spec.hh b/paludis/user_dep_spec.hh
index 041e90d..b95dd14 100644
--- a/paludis/user_dep_spec.hh
+++ b/paludis/user_dep_spec.hh
@@ -78,9 +78,16 @@ namespace paludis
///\}
virtual const std::pair<bool, std::string> requirement_met(
- const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const Environment * const, const ChangedChoices *,
+ const PackageID &, const ChangedChoices * const) const PALUDIS_ATTRIBUTE((warn_unused_result));
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(
+ const Environment * const,
+ const ChangedChoices * const,
+ const std::shared_ptr<const PackageID> &,
+ ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
extern template class Pimp<UserKeyRequirement>;
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 0c81a18..134cf94 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -710,6 +710,11 @@ namespace
{
return "being unmasked";
}
+
+ std::string visit(const ChangedChoicesConfirmation &) const
+ {
+ return "being reconfigured";
+ }
};
std::string stringify_confirmation(const RequiredConfirmation & c)
@@ -1306,7 +1311,7 @@ namespace
a_end((*c)->spec().if_package()->additional_requirements_ptr()->end()) ;
a != a_end ; ++a)
{
- const std::pair<bool, std::string> p((*a)->requirement_met(env.get(), *u->package_id()));
+ const std::pair<bool, std::string> p((*a)->requirement_met(env.get(), 0, *u->package_id(), 0));
if (p.first)
continue;
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index edd2682..fac762c 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -1285,6 +1285,11 @@ namespace
{
return false;
}
+
+ bool visit(const ChangedChoicesConfirmation &) const
+ {
+ return false;
+ }
};
bool confirm_fn(
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index feb9b49..8675157 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -1766,7 +1766,7 @@ ConsoleInstallTask::on_additional_requirements_not_met_error(const AdditionalReq
i_end(e.query().additional_requirements_ptr()->end()) ;
i != i_end ; ++i)
{
- const std::pair<bool, std::string> r((*i)->requirement_met(environment(), *e.package_id()));
+ const std::pair<bool, std::string> r((*i)->requirement_met(environment(), 0, *e.package_id(), 0));
if (r.first)
continue;
output_stream() << " * " << r.second << endl;