aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-09-01 17:16:25 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2008-09-01 17:18:09 +0100
commitdf9ef00684498f74e18b5a4be8b56b8cdc61eb84 (patch)
tree838ead00aa8fe1fbf940301b0bb39eaff636580a
parentf687f2305ab5a3964829b0f11d26cfb42171e444 (diff)
downloadpaludis-df9ef00684498f74e18b5a4be8b56b8cdc61eb84.tar.gz
paludis-df9ef00684498f74e18b5a4be8b56b8cdc61eb84.tar.xz
Change the handling of the two USE-dep syntaxes.
Make it possible for an EAPI to accept both, and do so for paludis-1. Allow both anyway if strict parsing is disabled.
-rw-r--r--paludis/elike_package_dep_spec-fwd.hh2
-rw-r--r--paludis/elike_package_dep_spec.cc52
-rw-r--r--paludis/elike_use_requirement.cc121
-rw-r--r--paludis/elike_use_requirement.se2
-rw-r--r--paludis/elike_use_requirement_TEST.cc532
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf2
6 files changed, 603 insertions, 108 deletions
diff --git a/paludis/elike_package_dep_spec-fwd.hh b/paludis/elike_package_dep_spec-fwd.hh
index aaf40ae..5b4960c 100644
--- a/paludis/elike_package_dep_spec-fwd.hh
+++ b/paludis/elike_package_dep_spec-fwd.hh
@@ -57,7 +57,7 @@ namespace paludis
bool elike_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
const ELikePackageDepSpecOptions & options, bool & had_bracket_version_requirements,
- const std::tr1::shared_ptr<const PackageID> & id) PALUDIS_VISIBLE;
+ bool & had_use_requirements, const std::tr1::shared_ptr<const PackageID> & id) PALUDIS_VISIBLE;
void elike_remove_trailing_repo_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
const ELikePackageDepSpecOptions & options) PALUDIS_VISIBLE;
diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc
index 96d82e2..17e2f2b 100644
--- a/paludis/elike_package_dep_spec.cc
+++ b/paludis/elike_package_dep_spec.cc
@@ -86,7 +86,7 @@ paludis::elike_check_sanity(const std::string & s)
bool
paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
const ELikePackageDepSpecOptions & options, bool & had_bracket_version_requirements,
- const std::tr1::shared_ptr<const PackageID> & id)
+ bool & had_use_requirements, const std::tr1::shared_ptr<const PackageID> & id)
{
std::string::size_type use_group_p;
if (std::string::npos == ((use_group_p = s.rfind('['))))
@@ -143,6 +143,7 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial
opos = flag.find_first_of("|&");
if (std::string::npos == opos)
{
+
ver = flag;
flag.clear();
}
@@ -178,31 +179,38 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial
break;
default:
- if (options[epdso_allow_use_deps_portage] || ! options[epdso_allow_use_deps])
+ if (! options[epdso_allow_use_deps] && ! options[epdso_allow_use_deps_portage])
{
- if (! options[epdso_allow_use_deps_portage])
+ if (options[epdso_strict_parsing])
+ throw PackageDepSpecError("USE dependencies not safe for use here");
+ else
{
- if (options[epdso_strict_parsing])
- throw PackageDepSpecError("USE dependencies not safe for use here");
- else
- {
- // Use Portage syntax for this case, as it
- // should only happen in Gentoo EAPIs
- Log::get_instance()->message("e.package_dep_spec.use_not_allowed", ll_warning, lc_context)
- << "USE dependencies not safe for use here";
- }
+ Log::get_instance()->message("e.package_dep_spec.use_not_allowed", ll_warning, lc_context)
+ << "USE dependencies not safe for use here";
}
-
- std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req(parse_elike_use_requirement(flag,
- id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
- result.additional_requirement(req);
}
- else
+
+ if (! options[epdso_allow_use_deps] && had_use_requirements)
{
- std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req(parse_elike_use_requirement(flag,
- id, ELikeUseRequirementOptions() + euro_allow_self_deps));
- result.additional_requirement(req);
+ if (options[epdso_strict_parsing])
+ throw PackageDepSpecError("multiple sets of USE dependencies not safe for use here");
+ else
+ {
+ Log::get_instance()->message("e.package_dep_spec.use_multiple_not_allowed", ll_warning, lc_context)
+ << "multiple sets of USE dependencies not safe for use here";
+ }
}
+ had_use_requirements = true;
+
+ ELikeUseRequirementOptions euro;
+ euro += euro_allow_self_deps;
+ if (options[epdso_allow_use_deps_portage])
+ euro += options[epdso_allow_use_deps] ? euro_both_syntaxes : euro_portage_syntax;
+ if (options[epdso_strict_parsing])
+ euro += euro_strict_parsing;
+
+ std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req(parse_elike_use_requirement(flag, id, euro));
+ result.additional_requirement(req);
break;
};
@@ -428,7 +436,7 @@ paludis::partial_parse_elike_package_dep_spec(
Context context("When parsing elike package dep spec '" + ss + "':");
- bool had_bracket_version_requirements(false);
+ bool had_bracket_version_requirements(false), had_use_requirements(false);
return partial_parse_generic_elike_package_dep_spec(ss, make_named_values<GenericELikePackageDepSpecParseFunctions>(
value_for<n::add_package_requirement>(std::tr1::bind(&elike_add_package_requirement, _1, _2)),
@@ -441,7 +449,7 @@ paludis::partial_parse_elike_package_dep_spec(
value_for<n::remove_trailing_repo_if_exists>(std::tr1::bind(&elike_remove_trailing_repo_if_exists, _1, _2, options)),
value_for<n::remove_trailing_slot_if_exists>(std::tr1::bind(&elike_remove_trailing_slot_if_exists, _1, _2, options)),
value_for<n::remove_trailing_square_bracket_if_exists>(std::tr1::bind(&elike_remove_trailing_square_bracket_if_exists,
- _1, _2, options, std::tr1::ref(had_bracket_version_requirements), id))
+ _1, _2, options, std::tr1::ref(had_bracket_version_requirements), std::tr1::ref(had_use_requirements), id))
));
}
diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc
index acac8eb..d3ae113 100644
--- a/paludis/elike_use_requirement.cc
+++ b/paludis/elike_use_requirement.cc
@@ -23,6 +23,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/join.hh>
#include <paludis/util/tokeniser.hh>
+#include <paludis/util/log.hh>
#include <paludis/dep_spec.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
@@ -278,10 +279,35 @@ namespace
flag.erase(flag.length() - 1);
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
- std::string::size_type not_position(options[euro_portage_syntax] ? 0 : flag.length() - 1);
- if ('!' == flag.at(not_position))
+
+ if ('!' == flag.at(flag.length() - 1))
+ {
+ if (options[euro_portage_syntax] && ! options[euro_both_syntaxes])
+ {
+ if (options[euro_strict_parsing])
+ throw ELikeUseRequirementError(s, "[use!=] not safe for use here");
+ else
+ Log::get_instance()->message("e.use_requirement.flag_not_equal_not_allowed", ll_warning, lc_context)
+ << "[use!=] not safe for use here";
+ }
+
+ flag.erase(flag.length() - 1, 1);
+ if (flag.empty())
+ throw ELikeUseRequirementError(s, "Invalid [] contents");
+ return make_shared_ptr(new NotEqualUseRequirement(UseFlagName(flag), id));
+ }
+ else if ('!' == flag.at(0))
{
- flag.erase(not_position, 1);
+ if (! options[euro_portage_syntax] && ! options[euro_both_syntaxes])
+ {
+ if (options[euro_strict_parsing])
+ throw ELikeUseRequirementError(s, "[!use=] not safe for use here");
+ else
+ Log::get_instance()->message("e.use_requirement.not_flag_equal_not_allowed", ll_warning, lc_context)
+ << "[!use=] not safe for use here";
+ }
+
+ flag.erase(0, 1);
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
return make_shared_ptr(new NotEqualUseRequirement(UseFlagName(flag), id));
@@ -297,16 +323,24 @@ namespace
flag.erase(flag.length() - 1);
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
- std::string::size_type not_position(options[euro_portage_syntax] ? 0 : flag.length() - 1);
- if ('!' == flag.at(not_position))
+
+ if ('!' == flag.at(flag.length() - 1))
{
- flag.erase(not_position, 1);
+ flag.erase(flag.length() - 1, 1);
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
- if (options[euro_portage_syntax])
- return make_shared_ptr(new IfNotMineThenNotUseRequirement(UseFlagName(flag), id));
- else if ('-' == flag.at(0))
+
+ if ('-' == flag.at(0))
{
+ if (options[euro_portage_syntax] && ! options[euro_both_syntaxes])
+ {
+ if (options[euro_strict_parsing])
+ throw ELikeUseRequirementError(s, "[-use!?] not safe for use here");
+ else
+ Log::get_instance()->message("e.use_requirement.minus_flag_not_question_not_allowed", ll_warning, lc_context)
+ << "[-use!?] not safe for use here";
+ }
+
flag.erase(0, 1);
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
@@ -314,12 +348,49 @@ namespace
return make_shared_ptr(new IfNotMineThenNotUseRequirement(UseFlagName(flag), id));
}
else
+ {
+ if (options[euro_portage_syntax] && ! options[euro_both_syntaxes])
+ {
+ if (options[euro_strict_parsing])
+ throw ELikeUseRequirementError(s, "[use!?] not safe for use here");
+ else
+ Log::get_instance()->message("e.use_requirement.flag_not_question_not_allowed", ll_warning, lc_context)
+ << "[use!?] not safe for use here";
+ }
+
return make_shared_ptr(new IfNotMineThenUseRequirement(UseFlagName(flag), id));
+ }
+ }
+ else if ('!' == flag.at(0))
+ {
+ if (! options[euro_portage_syntax] && ! options[euro_both_syntaxes])
+ {
+ if (options[euro_strict_parsing])
+ throw ELikeUseRequirementError(s, "[!use?] not safe for use here");
+ else
+ Log::get_instance()->message("e.use_requirement.not_flag_question_not_allowed", ll_warning, lc_context)
+ << "[!use?] not safe for use here";
+ }
+
+ flag.erase(0, 1);
+ if (flag.empty())
+ throw ELikeUseRequirementError(s, "Invalid [] contents");
+
+ return make_shared_ptr(new IfNotMineThenNotUseRequirement(UseFlagName(flag), id));
}
else
{
- if (! options[euro_portage_syntax] && '-' == flag.at(0))
+ if ('-' == flag.at(0))
{
+ if (options[euro_portage_syntax] && ! options[euro_both_syntaxes])
+ {
+ if (options[euro_strict_parsing])
+ throw ELikeUseRequirementError(s, "[-use?] not safe for use here");
+ else
+ Log::get_instance()->message("e.use_requirement.minus_flag_question_not_allowed", ll_warning, lc_context)
+ << "[-use?] not safe for use here";
+ }
+
flag.erase(0, 1);
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
@@ -354,23 +425,25 @@ paludis::parse_elike_use_requirement(const std::string & s,
Context context("When parsing use requirement '" + s + "':");
std::tr1::shared_ptr<UseRequirements> result(new UseRequirements("[" + s + "]"));
- if (options[euro_portage_syntax])
+ std::string::size_type pos(0);
+ for (;;)
{
- std::string::size_type pos(0);
- for (;;)
+ std::string::size_type comma(s.find(',', pos));
+ std::string flag(s.substr(pos, std::string::npos == comma ? comma : comma - pos));
+ result->add_requirement(parse_one_use_requirement(s, flag, id, options));
+ if (std::string::npos == comma)
+ break;
+
+ if (! options[euro_portage_syntax] && ! options[euro_both_syntaxes])
{
- std::string::size_type comma(s.find(',', pos));
- std::string flag(s.substr(pos, std::string::npos == comma ? comma : comma - pos));
- result->add_requirement(parse_one_use_requirement(s, flag, id, options));
- if (std::string::npos == comma)
- break;
- pos = comma + 1;
+ if (options[euro_strict_parsing])
+ throw ELikeUseRequirementError(s, "[use,use] not safe for use here");
+ else
+ Log::get_instance()->message("e.use_requirement.comma_separated_not_allowed", ll_warning, lc_context)
+ << "[use,use] not safe for use here";
}
- }
- else
- {
- std::string flag(s);
- result->add_requirement(parse_one_use_requirement(s, flag, id, options));
+
+ pos = comma + 1;
}
return result;
diff --git a/paludis/elike_use_requirement.se b/paludis/elike_use_requirement.se
index 4e61a01..cdda575 100644
--- a/paludis/elike_use_requirement.se
+++ b/paludis/elike_use_requirement.se
@@ -8,5 +8,7 @@ make_enum_ELikeUseRequirementOption()
key euro_allow_self_deps "Allow self-dependent use deps"
key euro_portage_syntax "Parse using Portage syntax"
+ key euro_both_syntaxes "Accept both Portage and Paludis syntax"
+ key euro_strict_parsing "Error rather than warn for violations"
}
diff --git a/paludis/elike_use_requirement_TEST.cc b/paludis/elike_use_requirement_TEST.cc
index 62d9e5c..02d21ca 100644
--- a/paludis/elike_use_requirement_TEST.cc
+++ b/paludis/elike_use_requirement_TEST.cc
@@ -44,25 +44,25 @@ namespace test_cases
id->iuse_key()->set_from_string("enabled disabled", IUseFlagParseOptions());
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
- parse_elike_use_requirement("enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions()));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
- parse_elike_use_requirement("disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions()));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
- parse_elike_use_requirement("-enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions()));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
- parse_elike_use_requirement("-disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions()));
+ 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));
@@ -82,25 +82,25 @@ namespace test_cases
id->iuse_key()->set_from_string("enabled disabled", IUseFlagParseOptions());
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
- parse_elike_use_requirement("enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
- parse_elike_use_requirement("disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
- parse_elike_use_requirement("-enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
- parse_elike_use_requirement("-disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax));
+ 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));
@@ -120,31 +120,31 @@ namespace test_cases
id->iuse_key()->set_from_string("enabled disabled", IUseFlagParseOptions());
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
- parse_elike_use_requirement("enabled,-disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
- parse_elike_use_requirement("enabled,disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
- parse_elike_use_requirement("-enabled,-disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
- parse_elike_use_requirement("enabled,-disabled,-enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
- parse_elike_use_requirement("enabled,-disabled,enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax));
+ 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));
@@ -166,84 +166,84 @@ namespace test_cases
id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
- parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
- parse_elike_use_requirement("pkgname?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
- parse_elike_use_requirement("-pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
- parse_elike_use_requirement("-pkgname?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
- parse_elike_use_requirement("pkgname!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req6(
- parse_elike_use_requirement("pkgname!?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
- parse_elike_use_requirement("-pkgname!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
- parse_elike_use_requirement("-pkgname!?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
- parse_elike_use_requirement("pkgname=", id, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
- parse_elike_use_requirement("pkgname=", id2, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
- parse_elike_use_requirement("pkgname!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
- parse_elike_use_requirement("pkgname!=", id2, ELikeUseRequirementOptions() + euro_allow_self_deps));
+ 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));
@@ -266,56 +266,56 @@ namespace test_cases
id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
- parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
- parse_elike_use_requirement("pkgname?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
- parse_elike_use_requirement("!pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
- parse_elike_use_requirement("!pkgname?", id2, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
- parse_elike_use_requirement("pkgname=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
- parse_elike_use_requirement("pkgname=", id2, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
- parse_elike_use_requirement("!pkgname=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
+ 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));
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
- parse_elike_use_requirement("!pkgname=", id2, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
+ 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));
@@ -323,6 +323,134 @@ namespace test_cases
}
} test_complex_use_requirements_portage_syntax;
+ struct ComplexUseRequirementsBothSyntaxesTest : TestCase
+ {
+ ComplexUseRequirementsBothSyntaxesTest() : TestCase("complex use requirements both syntaxes") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
+ env.package_database()->add_repository(1, fake);
+ std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
+ id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
+ id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+
+ std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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_complex_use_requirements_both_syntaxes;
+
struct MalformedUseRequirementsTest : TestCase
{
MalformedUseRequirementsTest() : TestCase("malformed use requirements") { }
@@ -335,20 +463,20 @@ namespace test_cases
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
- TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps), NameError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), NameError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("-?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("-!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("=", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("-?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("-!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("!test?", id, ELikeUseRequirementOptions() + euro_allow_self_deps), NameError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("!test=", id, ELikeUseRequirementOptions() + euro_allow_self_deps), NameError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("test1,test2", id, ELikeUseRequirementOptions() + euro_allow_self_deps), NameError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("!test?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("!test=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("test1,test2", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
}
} test_malformed_use_requirements;
@@ -364,25 +492,309 @@ namespace test_cases
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
- TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), NameError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement(",", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("test,", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement(",test", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("test,,test", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement(",", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("test,", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement(",test", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("test,,test", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("test!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("-test?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("-test!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError);
- TEST_CHECK_THROWS(parse_elike_use_requirement("test!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax), NameError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("test!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("-test?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("-test!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("test!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
}
} test_malformed_use_requirements_portage_syntax;
+
+ struct MalformedUseRequirementsBothSyntaxesTest : TestCase
+ {
+ MalformedUseRequirementsBothSyntaxesTest() : TestCase("malformed use requirements both syntaxes") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
+ env.package_database()->add_repository(1, fake);
+ std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
+ id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+
+ TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), NameError);
+
+ TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("!?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("!=", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+
+ TEST_CHECK_THROWS(parse_elike_use_requirement(",", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("test,", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement(",test", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+ TEST_CHECK_THROWS(parse_elike_use_requirement("test,,test", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
+ }
+ } test_malformed_use_requirements_both_syntaxes;
+
+ struct ComplexUseRequirementsNonstrictTest : TestCase
+ {
+ ComplexUseRequirementsNonstrictTest() : TestCase("complex use requirements non-strict") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
+ env.package_database()->add_repository(1, fake);
+ std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
+ id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
+ id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+
+ std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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_complex_use_requirements_nonstrict;
+
+ struct ComplexUseRequirementsPortageSyntaxNonstrictTest : TestCase
+ {
+ ComplexUseRequirementsPortageSyntaxNonstrictTest() : TestCase("complex use requirements portage syntax non-strict") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
+ env.package_database()->add_repository(1, fake);
+ std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
+ id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
+ id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+
+ std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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));
+
+ 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_complex_use_requirements_portage_syntax_nonstrict;
}
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 50ed2d7..baee76f 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -5,7 +5,7 @@
exported_name = paludis-1
can_be_pbin = true
-package_dep_spec_parse_options = allow_slot_deps allow_use_deps allow_ranged_deps \
+package_dep_spec_parse_options = allow_slot_deps allow_use_deps allow_use_deps_portage allow_ranged_deps \
allow_repository_deps allow_tilde_greater_deps strict_parsing \
allow_slot_equal_deps allow_slot_star_deps
dependency_spec_tree_parse_options = disallow_any_use uri_supports_arrow