aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-06 18:10:58 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-06 18:10:58 +0000
commit9dfecca9df5def7fab895e2909f4e05cf2d47892 (patch)
tree1c61d11d3c275113cf5aef471c82bcac4c74d06d
parentd6f5e30e1c5843a7644e79963950228cb04b4fb6 (diff)
downloadpaludis-9dfecca9df5def7fab895e2909f4e05cf2d47892.tar.gz
paludis-9dfecca9df5def7fab895e2909f4e05cf2d47892.tar.xz
Allow returning reasons for additional requirements not being met
Rather than returning a bool, return a pair<bool, string>, with the string being allowed to contain a detailed reason if the bool is false. Don't actually return useful reasons anywhere or use those reasons for anything yet.
-rw-r--r--paludis/dep_spec.hh11
-rw-r--r--paludis/elike_use_requirement.cc12
-rw-r--r--paludis/elike_use_requirement_TEST.cc310
-rw-r--r--paludis/match_package.cc4
-rw-r--r--paludis/user_dep_spec.cc8
-rw-r--r--paludis/user_dep_spec.hh5
6 files changed, 181 insertions, 169 deletions
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 598c265..b06c50d 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -301,8 +301,17 @@ namespace paludis
/**
* Is our requirement met for a given PackageID?
+ *
+ * The string in the return type might be a description of why the
+ * requirement was not met. Sometimes better messages can be given
+ * than simply the return value of as_human_string() when the ID to
+ * be matched is known. If the bool is false, the string is
+ * meaningless.
+ *
+ * \since 0.44 returns pair<bool, std::string>
*/
- virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual const std::pair<bool, std::string> requirement_met(
+ const Environment * const, const PackageID &) 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 07a292a..c0c1944 100644
--- a/paludis/elike_use_requirement.cc
+++ b/paludis/elike_use_requirement.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2008, 2009, 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
@@ -374,12 +374,14 @@ namespace
{
}
- virtual bool requirement_met(const Environment * const env, const PackageID & id) const
+ virtual const std::pair<bool, std::string> requirement_met(const Environment * const env, const PackageID & id) const
{
using namespace std::tr1::placeholders;
- return _reqs.end() == std::find_if(_reqs.begin(), _reqs.end(), std::tr1::bind(
- std::logical_not<bool>(), std::tr1::bind(
- &UseRequirement::requirement_met, _1, env, std::tr1::cref(id))));
+ return std::make_pair(
+ _reqs.end() == std::find_if(_reqs.begin(), _reqs.end(), std::tr1::bind(
+ std::logical_not<bool>(), std::tr1::bind(
+ &UseRequirement::requirement_met, _1, env, std::tr1::cref(id)))),
+ as_human_string());
}
virtual const std::string as_human_string() const
diff --git a/paludis/elike_use_requirement_TEST.cc b/paludis/elike_use_requirement_TEST.cc
index a646ca6..6a493fc 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::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(req1->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(! req2->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(! req3->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(req4->requirement_met(&env, *id).first);
}
} test_simple_use_requirements;
@@ -114,25 +114,25 @@ namespace test_cases
parse_elike_use_requirement("enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(req1->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(! req2->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(! req3->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(req4->requirement_met(&env, *id).first);
}
} test_simple_use_requirements_portage_syntax;
@@ -155,31 +155,31 @@ namespace test_cases
parse_elike_use_requirement("enabled,-disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(req1->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("enabled,disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(! req2->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-enabled,-disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(! req3->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("enabled,-disabled,-enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(! req4->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
parse_elike_use_requirement("enabled,-disabled,enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(req5->requirement_met(&env, *id).first);
}
} test_multiple_use_requirements_portage_syntax;
@@ -204,85 +204,85 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req1->requirement_met(&env, *id2));
+ TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(! req1->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req2->requirement_met(&env, *id2));
+ TEST_CHECK(req2->requirement_met(&env, *id).first);
+ TEST_CHECK(req2->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req3->requirement_met(&env, *id2));
+ TEST_CHECK(! req3->requirement_met(&env, *id).first);
+ TEST_CHECK(req3->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req4->requirement_met(&env, *id2));
+ TEST_CHECK(req4->requirement_met(&env, *id).first);
+ TEST_CHECK(req4->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
parse_elike_use_requirement("pkgname!?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req5->requirement_met(&env, *id2));
+ TEST_CHECK(req5->requirement_met(&env, *id).first);
+ TEST_CHECK(req5->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req6(
parse_elike_use_requirement("pkgname!?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req6->requirement_met(&env, *id2));
+ TEST_CHECK(req6->requirement_met(&env, *id).first);
+ TEST_CHECK(! req6->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("-pkgname!?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req7->requirement_met(&env, *id2));
+ TEST_CHECK(req7->requirement_met(&env, *id).first);
+ TEST_CHECK(req7->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("-pkgname!?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req8->requirement_met(&env, *id2));
+ TEST_CHECK(! req8->requirement_met(&env, *id).first);
+ TEST_CHECK(req8->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req9->requirement_met(&env, *id2));
+ TEST_CHECK(req9->requirement_met(&env, *id).first);
+ TEST_CHECK(! req9->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req10->requirement_met(&env, *id2));
+ TEST_CHECK(! req10->requirement_met(&env, *id).first);
+ TEST_CHECK(req10->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("pkgname!=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req11->requirement_met(&env, *id2));
+ TEST_CHECK(! req11->requirement_met(&env, *id).first);
+ TEST_CHECK(req11->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("pkgname!=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req12->requirement_met(&env, *id2));
+ TEST_CHECK(req12->requirement_met(&env, *id).first);
+ TEST_CHECK(! req12->requirement_met(&env, *id2).first);
}
} test_complex_use_requirements;
@@ -307,57 +307,57 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req1->requirement_met(&env, *id2));
+ TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(! req1->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req2->requirement_met(&env, *id2));
+ TEST_CHECK(req2->requirement_met(&env, *id).first);
+ TEST_CHECK(req2->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req7->requirement_met(&env, *id2));
+ TEST_CHECK(req7->requirement_met(&env, *id).first);
+ TEST_CHECK(req7->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req8->requirement_met(&env, *id2));
+ TEST_CHECK(! req8->requirement_met(&env, *id).first);
+ TEST_CHECK(req8->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req9->requirement_met(&env, *id2));
+ TEST_CHECK(req9->requirement_met(&env, *id).first);
+ TEST_CHECK(! req9->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req10->requirement_met(&env, *id2));
+ TEST_CHECK(! req10->requirement_met(&env, *id).first);
+ TEST_CHECK(req10->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req11->requirement_met(&env, *id2));
+ TEST_CHECK(! req11->requirement_met(&env, *id).first);
+ TEST_CHECK(req11->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req12->requirement_met(&env, *id2));
+ TEST_CHECK(req12->requirement_met(&env, *id).first);
+ TEST_CHECK(! req12->requirement_met(&env, *id2).first);
}
} test_complex_use_requirements_portage_syntax;
@@ -382,113 +382,113 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req1->requirement_met(&env, *id2));
+ TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(! req1->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req2->requirement_met(&env, *id2));
+ TEST_CHECK(req2->requirement_met(&env, *id).first);
+ TEST_CHECK(req2->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req7->requirement_met(&env, *id2));
+ TEST_CHECK(req7->requirement_met(&env, *id).first);
+ TEST_CHECK(req7->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req8->requirement_met(&env, *id2));
+ TEST_CHECK(! req8->requirement_met(&env, *id).first);
+ TEST_CHECK(req8->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req9->requirement_met(&env, *id2));
+ TEST_CHECK(req9->requirement_met(&env, *id).first);
+ TEST_CHECK(! req9->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req10->requirement_met(&env, *id2));
+ TEST_CHECK(! req10->requirement_met(&env, *id).first);
+ TEST_CHECK(req10->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req11->requirement_met(&env, *id2));
+ TEST_CHECK(! req11->requirement_met(&env, *id).first);
+ TEST_CHECK(req11->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req12->requirement_met(&env, *id2));
+ TEST_CHECK(req12->requirement_met(&env, *id).first);
+ TEST_CHECK(! req12->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
parse_elike_use_requirement("-pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req13->requirement_met(&env, *id2));
+ TEST_CHECK(! req13->requirement_met(&env, *id).first);
+ TEST_CHECK(req13->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
parse_elike_use_requirement("-pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req14->requirement_met(&env, *id2));
+ TEST_CHECK(req14->requirement_met(&env, *id).first);
+ TEST_CHECK(req14->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
parse_elike_use_requirement("pkgname!?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req15->requirement_met(&env, *id2));
+ TEST_CHECK(req15->requirement_met(&env, *id).first);
+ TEST_CHECK(req15->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
parse_elike_use_requirement("pkgname!?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req16->requirement_met(&env, *id2));
+ TEST_CHECK(req16->requirement_met(&env, *id).first);
+ TEST_CHECK(! req16->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
parse_elike_use_requirement("-pkgname!?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req17->requirement_met(&env, *id2));
+ TEST_CHECK(req17->requirement_met(&env, *id).first);
+ TEST_CHECK(req17->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
parse_elike_use_requirement("-pkgname!?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req18->requirement_met(&env, *id2));
+ TEST_CHECK(! req18->requirement_met(&env, *id).first);
+ TEST_CHECK(req18->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
parse_elike_use_requirement("pkgname!=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req19->requirement_met(&env, *id2));
+ TEST_CHECK(! req19->requirement_met(&env, *id).first);
+ TEST_CHECK(req19->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
parse_elike_use_requirement("pkgname!=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req20->requirement_met(&env, *id2));
+ TEST_CHECK(req20->requirement_met(&env, *id).first);
+ TEST_CHECK(! req20->requirement_met(&env, *id2).first);
}
} test_complex_use_requirements_both_syntaxes;
@@ -606,113 +606,113 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req1->requirement_met(&env, *id2));
+ TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(! req1->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req2->requirement_met(&env, *id2));
+ TEST_CHECK(req2->requirement_met(&env, *id).first);
+ TEST_CHECK(req2->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req7->requirement_met(&env, *id2));
+ TEST_CHECK(req7->requirement_met(&env, *id).first);
+ TEST_CHECK(req7->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req8->requirement_met(&env, *id2));
+ TEST_CHECK(! req8->requirement_met(&env, *id).first);
+ TEST_CHECK(req8->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req9->requirement_met(&env, *id2));
+ TEST_CHECK(req9->requirement_met(&env, *id).first);
+ TEST_CHECK(! req9->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req10->requirement_met(&env, *id2));
+ TEST_CHECK(! req10->requirement_met(&env, *id).first);
+ TEST_CHECK(req10->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req11->requirement_met(&env, *id2));
+ TEST_CHECK(! req11->requirement_met(&env, *id).first);
+ TEST_CHECK(req11->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req12->requirement_met(&env, *id2));
+ TEST_CHECK(req12->requirement_met(&env, *id).first);
+ TEST_CHECK(! req12->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
parse_elike_use_requirement("-pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req13->requirement_met(&env, *id2));
+ TEST_CHECK(! req13->requirement_met(&env, *id).first);
+ TEST_CHECK(req13->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
parse_elike_use_requirement("-pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req14->requirement_met(&env, *id2));
+ TEST_CHECK(req14->requirement_met(&env, *id).first);
+ TEST_CHECK(req14->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
parse_elike_use_requirement("pkgname!?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req15->requirement_met(&env, *id2));
+ TEST_CHECK(req15->requirement_met(&env, *id).first);
+ TEST_CHECK(req15->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
parse_elike_use_requirement("pkgname!?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req16->requirement_met(&env, *id2));
+ TEST_CHECK(req16->requirement_met(&env, *id).first);
+ TEST_CHECK(! req16->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
parse_elike_use_requirement("-pkgname!?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req17->requirement_met(&env, *id2));
+ TEST_CHECK(req17->requirement_met(&env, *id).first);
+ TEST_CHECK(req17->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
parse_elike_use_requirement("-pkgname!?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req18->requirement_met(&env, *id2));
+ TEST_CHECK(! req18->requirement_met(&env, *id).first);
+ TEST_CHECK(req18->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
parse_elike_use_requirement("pkgname!=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req19->requirement_met(&env, *id2));
+ TEST_CHECK(! req19->requirement_met(&env, *id).first);
+ TEST_CHECK(req19->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
parse_elike_use_requirement("pkgname!=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req20->requirement_met(&env, *id2));
+ TEST_CHECK(req20->requirement_met(&env, *id).first);
+ TEST_CHECK(! req20->requirement_met(&env, *id2).first);
}
} test_complex_use_requirements_nonstrict;
@@ -737,113 +737,113 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req1->requirement_met(&env, *id2));
+ TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(! req1->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req2->requirement_met(&env, *id2));
+ TEST_CHECK(req2->requirement_met(&env, *id).first);
+ TEST_CHECK(req2->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req7->requirement_met(&env, *id2));
+ TEST_CHECK(req7->requirement_met(&env, *id).first);
+ TEST_CHECK(req7->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req8->requirement_met(&env, *id2));
+ TEST_CHECK(! req8->requirement_met(&env, *id).first);
+ TEST_CHECK(req8->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req9->requirement_met(&env, *id2));
+ TEST_CHECK(req9->requirement_met(&env, *id).first);
+ TEST_CHECK(! req9->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req10->requirement_met(&env, *id2));
+ TEST_CHECK(! req10->requirement_met(&env, *id).first);
+ TEST_CHECK(req10->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req11->requirement_met(&env, *id2));
+ TEST_CHECK(! req11->requirement_met(&env, *id).first);
+ TEST_CHECK(req11->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req12->requirement_met(&env, *id2));
+ TEST_CHECK(req12->requirement_met(&env, *id).first);
+ TEST_CHECK(! req12->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
parse_elike_use_requirement("-pkgname?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req13->requirement_met(&env, *id2));
+ TEST_CHECK(! req13->requirement_met(&env, *id).first);
+ TEST_CHECK(req13->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
parse_elike_use_requirement("-pkgname?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req14->requirement_met(&env, *id2));
+ TEST_CHECK(req14->requirement_met(&env, *id).first);
+ TEST_CHECK(req14->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
parse_elike_use_requirement("pkgname!?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req15->requirement_met(&env, *id2));
+ TEST_CHECK(req15->requirement_met(&env, *id).first);
+ TEST_CHECK(req15->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
parse_elike_use_requirement("pkgname!?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req16->requirement_met(&env, *id2));
+ TEST_CHECK(req16->requirement_met(&env, *id).first);
+ TEST_CHECK(! req16->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
parse_elike_use_requirement("-pkgname!?", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req17->requirement_met(&env, *id2));
+ TEST_CHECK(req17->requirement_met(&env, *id).first);
+ TEST_CHECK(req17->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
parse_elike_use_requirement("-pkgname!?", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req18->requirement_met(&env, *id2));
+ TEST_CHECK(! req18->requirement_met(&env, *id).first);
+ TEST_CHECK(req18->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
parse_elike_use_requirement("pkgname!=", id, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(req19->requirement_met(&env, *id2));
+ TEST_CHECK(! req19->requirement_met(&env, *id).first);
+ TEST_CHECK(req19->requirement_met(&env, *id2).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
parse_elike_use_requirement("pkgname!=", id2, ELikeUseRequirementOptions() + 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));
- TEST_CHECK(! req20->requirement_met(&env, *id2));
+ TEST_CHECK(req20->requirement_met(&env, *id).first);
+ TEST_CHECK(! req20->requirement_met(&env, *id2).first);
}
} test_complex_use_requirements_portage_syntax_nonstrict;
@@ -866,25 +866,25 @@ namespace test_cases
parse_elike_use_requirement("missing(+)", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(req1->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("missing(-)", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(! req2->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-missing(+)", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(! req3->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-missing(-)", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + 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));
+ TEST_CHECK(req4->requirement_met(&env, *id).first);
}
} test_use_requirements_with_defaults;
@@ -907,13 +907,13 @@ namespace test_cases
parse_elike_use_requirement("foo:*", id,
ELikeUseRequirementOptions() + euro_allow_default_values + euro_allow_self_deps));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[foo:*]");
- TEST_CHECK(! req1->requirement_met(&env, *id));
+ TEST_CHECK(! req1->requirement_met(&env, *id).first);
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("foo:*=", id,
ELikeUseRequirementOptions() + euro_allow_default_values + euro_allow_self_deps));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[foo:*=]");
- TEST_CHECK(req2->requirement_met(&env, *id));
+ TEST_CHECK(req2->requirement_met(&env, *id).first);
}
} test_prefix_star_use_requirements;
}
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index b15983b..ee44379 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009, 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
@@ -204,7 +204,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))
+ if (! (*u)->requirement_met(&env, entry).first)
return false;
}
}
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 7c95b70..bbef7a2 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 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
@@ -744,17 +744,17 @@ namespace
};
}
-bool
+const std::pair<bool, std::string>
UserKeyRequirement::requirement_met(const Environment * const, const PackageID & id) const
{
Context context("When working out whether '" + stringify(id) + "' matches " + as_raw_string() + ":");
PackageID::MetadataConstIterator m(id.find_metadata(_imp->key));
if (m == id.end_metadata())
- return false;
+ return std::make_pair(false, as_human_string());
KeyComparator c(_imp->value, _imp->op);
- return (*m)->accept_returning<bool>(c);
+ return std::make_pair((*m)->accept_returning<bool>(c), as_human_string());
}
const std::string
diff --git a/paludis/user_dep_spec.hh b/paludis/user_dep_spec.hh
index 4433a5f..5ff57fd 100644
--- a/paludis/user_dep_spec.hh
+++ b/paludis/user_dep_spec.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 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
@@ -77,7 +77,8 @@ namespace paludis
///\}
- virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::pair<bool, std::string> requirement_met(
+ const Environment * const, const PackageID &) 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));
};