Pass PackageIDs by shared_ptr
This commit is contained in:
parent
a1b11d0590
commit
97c38fc7c0
@ -55,13 +55,13 @@ int main(int argc, char * argv[])
|
||||
{
|
||||
/* Is it paludis? */
|
||||
if (match_package(*env, make_package_dep_spec({ }).package(
|
||||
QualifiedPackageName("sys-apps/paludis")), **i, { }))
|
||||
QualifiedPackageName("sys-apps/paludis")), *i, { }))
|
||||
cout << left << setw(50) << (stringify(**i) + ":") << " " << "paludis" << endl;
|
||||
|
||||
/* No. Is it in system or world? */
|
||||
else if (match_package_in_set(*env, *system, **i, { }))
|
||||
else if (match_package_in_set(*env, *system, *i, { }))
|
||||
cout << left << setw(50) << (stringify(**i) + ":") << " " << "system" << endl;
|
||||
else if (match_package_in_set(*env, *world, **i, { }))
|
||||
else if (match_package_in_set(*env, *world, *i, { }))
|
||||
cout << left << setw(50) << (stringify(**i) + ":") << " " << "world" << endl;
|
||||
else
|
||||
cout << left << setw(50) << (stringify(**i) + ":") << " " << "nothing" << endl;
|
||||
|
@ -57,11 +57,12 @@ namespace paludis
|
||||
*
|
||||
* \since 0.44 returns pair<bool, std::string>
|
||||
* \since 0.51 takes optional ChangedChoices arguments
|
||||
* \since 0.58 takes id by shared_ptr
|
||||
*/
|
||||
virtual const std::pair<bool, std::string> requirement_met(
|
||||
const Environment * const,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const PackageID &,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
|
@ -44,14 +44,14 @@ namespace
|
||||
bool icky_use_query(
|
||||
const ELikeUseRequirementOptions & options,
|
||||
const ChoiceNameWithPrefix & f,
|
||||
const PackageID & id,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const ChangedChoices * const changed_choices,
|
||||
Tribool default_value = Tribool(indeterminate))
|
||||
{
|
||||
if (! id.choices_key())
|
||||
if (! id->choices_key())
|
||||
{
|
||||
Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
|
||||
"ID '" << id << "' has no choices, so couldn't get the state of flag '" << f << "'";
|
||||
"ID '" << *id << "' has no choices, so couldn't get the state of flag '" << f << "'";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -62,14 +62,14 @@ namespace
|
||||
return c.is_true();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const ChoiceValue> v(id.choices_key()->value()->find_by_name_with_prefix(f));
|
||||
const std::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(f));
|
||||
if (v)
|
||||
return v->enabled();
|
||||
|
||||
if (default_value.is_indeterminate() && ! id.choices_key()->value()->has_matching_contains_every_value_prefix(f) &&
|
||||
if (default_value.is_indeterminate() && ! id->choices_key()->value()->has_matching_contains_every_value_prefix(f) &&
|
||||
options[euro_missing_is_qa])
|
||||
Log::get_instance()->message("elike_use_requirement.query", ll_qa, lc_context) <<
|
||||
"ID '" << id << "' has no flag named '" << f << "'";
|
||||
"ID '" << *id << "' has no flag named '" << f << "'";
|
||||
return default_value.is_true();
|
||||
}
|
||||
|
||||
@ -103,24 +103,24 @@ namespace
|
||||
const Environment * const,
|
||||
const ChoiceNameWithPrefix &,
|
||||
const ChangedChoices * const,
|
||||
const PackageID &,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const ChangedChoices * const) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
bool one_requirement_met(
|
||||
const Environment * const env,
|
||||
const ChoiceNameWithPrefix & c,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const PackageID & id,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result))
|
||||
{
|
||||
if (_ignore_if_no_such_group)
|
||||
{
|
||||
std::string::size_type p(_flags.find(':'));
|
||||
ChoicePrefixName prefix((std::string::npos == p) ? "" : _flags.substr(0, p));
|
||||
if (! id.choices_key())
|
||||
if (! id->choices_key())
|
||||
return true;
|
||||
Choices::ConstIterator k(id.choices_key()->value()->find(prefix));
|
||||
if (id.choices_key()->value()->end() == k)
|
||||
Choices::ConstIterator k(id->choices_key()->value()->find(prefix));
|
||||
if (id->choices_key()->value()->end() == k)
|
||||
return true;
|
||||
if ((*k)->begin() == (*k)->end())
|
||||
return true;
|
||||
@ -144,7 +144,7 @@ namespace
|
||||
const std::pair<bool, std::string> requirement_met(
|
||||
const Environment * const env,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const PackageID & i,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const ChangedChoices * const maybe_changes_to_target) const
|
||||
{
|
||||
if (_flags.length() >= 2 && ":*" == _flags.substr(_flags.length() - 2))
|
||||
@ -170,7 +170,7 @@ namespace
|
||||
std::pair<bool, std::string> result(true, "");
|
||||
for (Choice::ConstIterator v((*cc)->begin()), v_end((*cc)->end()) ;
|
||||
v != v_end ; ++v)
|
||||
if (! one_requirement_met(env, (*v)->name_with_prefix(), maybe_changes_to_owner, i, maybe_changes_to_target))
|
||||
if (! one_requirement_met(env, (*v)->name_with_prefix(), maybe_changes_to_owner, id, maybe_changes_to_target))
|
||||
{
|
||||
if (! result.first)
|
||||
result.second.append(", ");
|
||||
@ -186,7 +186,7 @@ namespace
|
||||
}
|
||||
}
|
||||
else
|
||||
if (! one_requirement_met(env, ChoiceNameWithPrefix(_flags), maybe_changes_to_owner, i, maybe_changes_to_target))
|
||||
if (! one_requirement_met(env, ChoiceNameWithPrefix(_flags), maybe_changes_to_owner, id, maybe_changes_to_target))
|
||||
return std::make_pair(false, as_human_string());
|
||||
|
||||
return std::make_pair(true, as_human_string());
|
||||
@ -217,7 +217,7 @@ namespace
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
ChangedChoices & changed_choices) const
|
||||
{
|
||||
if (requirement_met(env, maybe_changes_to_owner, *id, &changed_choices).first)
|
||||
if (requirement_met(env, maybe_changes_to_owner, id, &changed_choices).first)
|
||||
return indeterminate;
|
||||
|
||||
if (_flags.length() >= 2 && ":*" == _flags.substr(_flags.length() - 2))
|
||||
@ -288,7 +288,7 @@ namespace
|
||||
}
|
||||
|
||||
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag, const ChangedChoices * const,
|
||||
const PackageID & pkg, const ChangedChoices * const changed_choices) const
|
||||
const std::shared_ptr<const PackageID> & pkg, const ChangedChoices * const changed_choices) const
|
||||
{
|
||||
return icky_use_query(_options, flag, pkg, changed_choices, default_value());
|
||||
}
|
||||
@ -312,7 +312,7 @@ namespace
|
||||
}
|
||||
|
||||
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag, const ChangedChoices * const,
|
||||
const PackageID & pkg, const ChangedChoices * const changed_choices) const
|
||||
const std::shared_ptr<const PackageID> & pkg, const ChangedChoices * const changed_choices) const
|
||||
{
|
||||
return ! icky_use_query(_options, flag, pkg, changed_choices, default_value());
|
||||
}
|
||||
@ -350,9 +350,10 @@ namespace
|
||||
}
|
||||
|
||||
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
|
||||
const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
|
||||
const ChangedChoices * const maybe_changes_to_owner, const std::shared_ptr<const PackageID> & pkg,
|
||||
const ChangedChoices * const changed_choices) const
|
||||
{
|
||||
return ! icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner) ||
|
||||
return ! icky_use_query(_options, flag, package_id(), maybe_changes_to_owner) ||
|
||||
icky_use_query(_options, flag, pkg, changed_choices, default_value());
|
||||
}
|
||||
|
||||
@ -376,9 +377,10 @@ namespace
|
||||
}
|
||||
|
||||
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
|
||||
const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const std::shared_ptr<const PackageID> & pkg, const ChangedChoices * const changed_choices) const
|
||||
{
|
||||
return icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner) ||
|
||||
return icky_use_query(_options, flag, package_id(), maybe_changes_to_owner) ||
|
||||
icky_use_query(_options, flag, pkg, changed_choices, default_value());
|
||||
}
|
||||
|
||||
@ -402,9 +404,10 @@ namespace
|
||||
}
|
||||
|
||||
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
|
||||
const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
|
||||
const ChangedChoices * const maybe_changes_to_owner, const std::shared_ptr<const PackageID> & pkg,
|
||||
const ChangedChoices * const changed_choices) const
|
||||
{
|
||||
return ! icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner) ||
|
||||
return ! icky_use_query(_options, flag, package_id(), maybe_changes_to_owner) ||
|
||||
! icky_use_query(_options, flag, pkg, changed_choices, default_value());
|
||||
}
|
||||
|
||||
@ -428,9 +431,10 @@ namespace
|
||||
}
|
||||
|
||||
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
|
||||
const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
|
||||
const ChangedChoices * const maybe_changes_to_owner, const std::shared_ptr<const PackageID> & pkg,
|
||||
const ChangedChoices * const changed_choices) const
|
||||
{
|
||||
return icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner) ||
|
||||
return icky_use_query(_options, flag, package_id(), maybe_changes_to_owner) ||
|
||||
! icky_use_query(_options, flag, pkg, changed_choices, default_value());
|
||||
}
|
||||
|
||||
@ -454,10 +458,11 @@ namespace
|
||||
}
|
||||
|
||||
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
|
||||
const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
|
||||
const ChangedChoices * const maybe_changes_to_owner, const std::shared_ptr<const PackageID> & pkg,
|
||||
const ChangedChoices * const changed_choices) const
|
||||
{
|
||||
return icky_use_query(_options, flag, pkg, changed_choices, default_value()) ==
|
||||
icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner);
|
||||
icky_use_query(_options, flag, package_id(), maybe_changes_to_owner);
|
||||
}
|
||||
|
||||
virtual const std::string as_human_string() const
|
||||
@ -480,10 +485,11 @@ namespace
|
||||
}
|
||||
|
||||
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
|
||||
const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
|
||||
const ChangedChoices * const maybe_changes_to_owner, const std::shared_ptr<const PackageID> & pkg,
|
||||
const ChangedChoices * const changed_choices) const
|
||||
{
|
||||
return icky_use_query(_options, flag, pkg, changed_choices, default_value()) !=
|
||||
icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner);
|
||||
icky_use_query(_options, flag, package_id(), maybe_changes_to_owner);
|
||||
}
|
||||
|
||||
virtual const std::string as_human_string() const
|
||||
@ -511,7 +517,7 @@ namespace
|
||||
virtual const std::pair<bool, std::string> requirement_met(
|
||||
const Environment * const env,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const PackageID & id,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const ChangedChoices * const maybe_changes_to_target) const
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
|
@ -74,25 +74,25 @@ namespace test_cases
|
||||
parse_elike_use_requirement("enabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled]");
|
||||
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("disabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[disabled]");
|
||||
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'disabled' enabled");
|
||||
TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req2->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-enabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled]");
|
||||
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled");
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("-disabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-disabled]");
|
||||
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'disabled' disabled");
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, id, 0).first);
|
||||
}
|
||||
} test_simple_use_requirements;
|
||||
|
||||
@ -115,25 +115,25 @@ namespace test_cases
|
||||
parse_elike_use_requirement("enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled]");
|
||||
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[disabled]");
|
||||
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'disabled' enabled");
|
||||
TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req2->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled]");
|
||||
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled");
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("-disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-disabled]");
|
||||
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'disabled' disabled");
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, id, 0).first);
|
||||
}
|
||||
} test_simple_use_requirements_portage_syntax;
|
||||
|
||||
@ -156,31 +156,31 @@ namespace test_cases
|
||||
parse_elike_use_requirement("enabled,-disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled,-disabled]");
|
||||
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("enabled,disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[enabled,disabled]");
|
||||
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' enabled");
|
||||
TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req2->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-enabled,-disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled,-disabled]");
|
||||
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled; Flag 'disabled' disabled");
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("enabled,-disabled,-enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req4->as_raw_string(), "[enabled,-disabled,-enabled]");
|
||||
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' disabled");
|
||||
TEST_CHECK(! req4->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req4->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
|
||||
parse_elike_use_requirement("enabled,-disabled,enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req5->as_raw_string(), "[enabled,-disabled,enabled]");
|
||||
TEST_CHECK_EQUAL(req5->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' enabled");
|
||||
TEST_CHECK(req5->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req5->requirement_met(&env, 0, id, 0).first);
|
||||
}
|
||||
} test_multiple_use_requirements_portage_syntax;
|
||||
|
||||
@ -205,85 +205,85 @@ namespace test_cases
|
||||
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-pkgname?]");
|
||||
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req3->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req3->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-pkgname?]");
|
||||
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
|
||||
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req5->as_raw_string(), "[pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req5->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req5->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req5->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req5->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req5->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req6(
|
||||
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req6->as_raw_string(), "[pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req6->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req6->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req6->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req6->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req6->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req7->as_raw_string(), "[-pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req8->as_raw_string(), "[-pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req11->as_raw_string(), "[pkgname!=]");
|
||||
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req12->as_raw_string(), "[pkgname!=]");
|
||||
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, id2, 0).first);
|
||||
}
|
||||
} test_complex_use_requirements;
|
||||
|
||||
@ -308,57 +308,57 @@ namespace test_cases
|
||||
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
|
||||
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
|
||||
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
|
||||
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
|
||||
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, id2, 0).first);
|
||||
}
|
||||
} test_complex_use_requirements_portage_syntax;
|
||||
|
||||
@ -383,113 +383,113 @@ namespace test_cases
|
||||
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
|
||||
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
|
||||
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
|
||||
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
|
||||
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
|
||||
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req13->as_raw_string(), "[-pkgname?]");
|
||||
TEST_CHECK_EQUAL(req13->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req13->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req13->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req13->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req13->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
|
||||
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req14->as_raw_string(), "[-pkgname?]");
|
||||
TEST_CHECK_EQUAL(req14->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
|
||||
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req15->as_raw_string(), "[pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req15->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
|
||||
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req16->as_raw_string(), "[pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req16->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req16->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req16->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req16->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req16->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
|
||||
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req17->as_raw_string(), "[-pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req17->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
|
||||
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req18->as_raw_string(), "[-pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req18->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req18->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req18->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req18->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req18->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
|
||||
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req19->as_raw_string(), "[pkgname!=]");
|
||||
TEST_CHECK_EQUAL(req19->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req19->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req19->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req19->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req19->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
|
||||
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req20->as_raw_string(), "[pkgname!=]");
|
||||
TEST_CHECK_EQUAL(req20->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req20->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req20->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req20->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req20->requirement_met(&env, 0, id2, 0).first);
|
||||
}
|
||||
} test_complex_use_requirements_both_syntaxes;
|
||||
|
||||
@ -607,113 +607,113 @@ namespace test_cases
|
||||
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
|
||||
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
|
||||
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
|
||||
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
|
||||
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
|
||||
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req13->as_raw_string(), "[-pkgname?]");
|
||||
TEST_CHECK_EQUAL(req13->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req13->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req13->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req13->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req13->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
|
||||
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req14->as_raw_string(), "[-pkgname?]");
|
||||
TEST_CHECK_EQUAL(req14->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
|
||||
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req15->as_raw_string(), "[pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req15->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
|
||||
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req16->as_raw_string(), "[pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req16->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req16->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req16->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req16->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req16->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
|
||||
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req17->as_raw_string(), "[-pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req17->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
|
||||
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req18->as_raw_string(), "[-pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req18->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req18->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req18->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req18->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req18->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
|
||||
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req19->as_raw_string(), "[pkgname!=]");
|
||||
TEST_CHECK_EQUAL(req19->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req19->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req19->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req19->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req19->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
|
||||
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req20->as_raw_string(), "[pkgname!=]");
|
||||
TEST_CHECK_EQUAL(req20->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req20->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req20->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req20->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req20->requirement_met(&env, 0, id2, 0).first);
|
||||
}
|
||||
} test_complex_use_requirements_nonstrict;
|
||||
|
||||
@ -738,113 +738,113 @@ namespace test_cases
|
||||
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
|
||||
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
|
||||
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req7->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
|
||||
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req8->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req8->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req9->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req9->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
|
||||
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req10->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req10->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
|
||||
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req11->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req11->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
|
||||
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req12->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req12->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
|
||||
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req13->as_raw_string(), "[-pkgname?]");
|
||||
TEST_CHECK_EQUAL(req13->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req13->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req13->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req13->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req13->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
|
||||
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req14->as_raw_string(), "[-pkgname?]");
|
||||
TEST_CHECK_EQUAL(req14->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req14->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
|
||||
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req15->as_raw_string(), "[pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req15->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req15->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
|
||||
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req16->as_raw_string(), "[pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req16->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req16->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req16->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req16->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req16->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
|
||||
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req17->as_raw_string(), "[-pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req17->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req17->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
|
||||
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req18->as_raw_string(), "[-pkgname!?]");
|
||||
TEST_CHECK_EQUAL(req18->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(! req18->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req18->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req18->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req18->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
|
||||
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req19->as_raw_string(), "[pkgname!=]");
|
||||
TEST_CHECK_EQUAL(req19->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
|
||||
TEST_CHECK(! req19->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req19->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(! req19->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(req19->requirement_met(&env, 0, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
|
||||
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps, euro_portage_syntax }));
|
||||
TEST_CHECK_EQUAL(req20->as_raw_string(), "[pkgname!=]");
|
||||
TEST_CHECK_EQUAL(req20->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
|
||||
TEST_CHECK(req20->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req20->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req20->requirement_met(&env, 0, id, 0).first);
|
||||
TEST_CHECK(! req20->requirement_met(&env, 0, id2, 0).first);
|
||||
}
|
||||
} test_complex_use_requirements_portage_syntax_nonstrict;
|
||||
|
||||
@ -867,25 +867,25 @@ namespace test_cases
|
||||
parse_elike_use_requirement("missing(+)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[missing(+)]");
|
||||
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'missing' enabled, assuming enabled if missing");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("missing(-)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[missing(-)]");
|
||||
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'missing' enabled, assuming disabled if missing");
|
||||
TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req2->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-missing(+)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-missing(+)]");
|
||||
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'missing' disabled, assuming enabled if missing");
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req3->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("-missing(-)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
|
||||
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-missing(-)]");
|
||||
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'missing' disabled, assuming disabled if missing");
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req4->requirement_met(&env, 0, id, 0).first);
|
||||
}
|
||||
} test_use_requirements_with_defaults;
|
||||
|
||||
@ -908,13 +908,13 @@ namespace test_cases
|
||||
parse_elike_use_requirement("foo:*", id,
|
||||
{ euro_allow_default_values, euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[foo:*]");
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(! req1->requirement_met(&env, 0, id, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("foo:*=", id,
|
||||
{ euro_allow_default_values, euro_allow_self_deps }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[foo:*=]");
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id, 0).first);
|
||||
}
|
||||
} test_prefix_star_use_requirements;
|
||||
|
||||
@ -942,16 +942,16 @@ namespace test_cases
|
||||
{ euro_allow_default_values, euro_allow_self_deps,
|
||||
euro_allow_default_question_values }));
|
||||
TEST_CHECK_EQUAL(req1->as_raw_string(), "[foo:*(?)=]");
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, *id1, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id2, 0).first);
|
||||
TEST_CHECK(req1->requirement_met(&env, 0, id1, 0).first);
|
||||
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("bar:*(?)=", id2,
|
||||
{ euro_allow_default_values, euro_allow_self_deps,
|
||||
euro_allow_default_question_values }));
|
||||
TEST_CHECK_EQUAL(req2->as_raw_string(), "[bar:*(?)=]");
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, *id1, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id2, 0).first);
|
||||
TEST_CHECK(req2->requirement_met(&env, 0, id1, 0).first);
|
||||
}
|
||||
} test_question_default_requirements;
|
||||
}
|
||||
|
@ -173,8 +173,12 @@ namespace paludis
|
||||
*
|
||||
* Used by PackageID implementations. Generally PackageID's masks methods
|
||||
* should be used rather than calling this directly.
|
||||
*
|
||||
* \since 0.58 takes id by shared_ptr
|
||||
*/
|
||||
virtual bool accept_license(const std::string &, const PackageID &) const
|
||||
virtual bool accept_license(
|
||||
const std::string &,
|
||||
const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
@ -184,8 +188,12 @@ namespace paludis
|
||||
*
|
||||
* Used by PackageID implementations. Generally PackageID's masks methods
|
||||
* should be used rather than calling this directly.
|
||||
*
|
||||
* \since 0.58 takes id by shared_ptr
|
||||
*/
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const PackageID &) const
|
||||
virtual bool accept_keywords(
|
||||
const std::shared_ptr<const KeywordNameSet> &,
|
||||
const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
@ -195,8 +203,11 @@ namespace paludis
|
||||
*
|
||||
* Used by PackageID implementations. Generally PackageID's masks methods
|
||||
* should be used rather than calling this directly.
|
||||
*
|
||||
* \since 0.58 takes id by shared_ptr
|
||||
*/
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(
|
||||
const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
@ -209,8 +220,11 @@ namespace paludis
|
||||
*
|
||||
* Used by PackageID implementations. Generally PackageID's masks methods
|
||||
* should be used rather than calling this directly.
|
||||
*
|
||||
* \since 0.58 takes id by shared_ptr
|
||||
*/
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const PackageID &,
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const bool will_be_used_for_overridden) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
@ -222,8 +236,11 @@ namespace paludis
|
||||
*
|
||||
* Used by PackageID implementations. Generally PackageID's masks methods
|
||||
* should be used rather than calling this directly.
|
||||
*
|
||||
* \since 0.58 takes id by shared_ptr
|
||||
*/
|
||||
virtual bool unmasked_by_user(const PackageID &) const
|
||||
virtual bool unmasked_by_user(
|
||||
const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
///\}
|
||||
|
@ -447,8 +447,9 @@ NoConfigEnvironment::set_paludis_command(const std::string & s)
|
||||
}
|
||||
|
||||
bool
|
||||
NoConfigEnvironment::accept_keywords(const std::shared_ptr<const KeywordNameSet> & keywords,
|
||||
const PackageID &) const
|
||||
NoConfigEnvironment::accept_keywords(
|
||||
const std::shared_ptr<const KeywordNameSet> & keywords,
|
||||
const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
if (_imp->is_vdb)
|
||||
return true;
|
||||
@ -503,19 +504,19 @@ NoConfigEnvironment::remove_from_world(const SetName &) const
|
||||
}
|
||||
|
||||
bool
|
||||
NoConfigEnvironment::unmasked_by_user(const PackageID &) const
|
||||
NoConfigEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const Mask>
|
||||
NoConfigEnvironment::mask_for_breakage(const PackageID &) const
|
||||
NoConfigEnvironment::mask_for_breakage(const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
return std::shared_ptr<const Mask>();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const Mask>
|
||||
NoConfigEnvironment::mask_for_user(const PackageID &, const bool) const
|
||||
NoConfigEnvironment::mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
|
||||
{
|
||||
return std::shared_ptr<const Mask>();
|
||||
}
|
||||
@ -539,7 +540,7 @@ NoConfigEnvironment::mirrors(const std::string &) const
|
||||
}
|
||||
|
||||
bool
|
||||
NoConfigEnvironment::accept_license(const std::string &, const PackageID &) const
|
||||
NoConfigEnvironment::accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -179,19 +179,19 @@ namespace paludis
|
||||
|
||||
virtual void set_paludis_command(const std::string &);
|
||||
|
||||
virtual bool accept_license(const std::string &, const PackageID &) const
|
||||
virtual bool accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const PackageID &) const
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const PackageID &, const bool will_be_used_for_overridden) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool will_be_used_for_overridden) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool unmasked_by_user(const PackageID &) const
|
||||
virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual std::shared_ptr<const FSPathSequence> hook_dirs() const
|
||||
|
@ -132,7 +132,7 @@ KeywordsConf::add(const FSPath & filename)
|
||||
}
|
||||
|
||||
bool
|
||||
KeywordsConf::query(const std::shared_ptr<const KeywordNameSet> & k, const PackageID & e) const
|
||||
KeywordsConf::query(const std::shared_ptr<const KeywordNameSet> & k, const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
static const KeywordName star_keyword("*");
|
||||
static const KeywordName minus_star_keyword("-*");
|
||||
@ -143,7 +143,7 @@ KeywordsConf::query(const std::shared_ptr<const KeywordNameSet> & k, const Packa
|
||||
/* highest priority: specific */
|
||||
bool break_when_done(false);
|
||||
{
|
||||
SpecificMap::const_iterator i(_imp->qualified.find(e.name()));
|
||||
SpecificMap::const_iterator i(_imp->qualified.find(e->name()));
|
||||
if (i != _imp->qualified.end())
|
||||
{
|
||||
for (PDSToKeywordsList::const_iterator j(i->second.begin()), j_end(i->second.end()) ;
|
||||
|
@ -60,7 +60,7 @@ namespace paludis
|
||||
/**
|
||||
* Query a collection of keywords.
|
||||
*/
|
||||
bool query(const std::shared_ptr<const KeywordNameSet> &, const PackageID &) const;
|
||||
bool query(const std::shared_ptr<const KeywordNameSet> &, const std::shared_ptr<const PackageID> &) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -132,12 +132,12 @@ LicensesConf::add(const FSPath & filename)
|
||||
}
|
||||
|
||||
bool
|
||||
LicensesConf::query(const std::string & t, const PackageID & e) const
|
||||
LicensesConf::query(const std::string & t, const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
/* highest priority: specific */
|
||||
bool break_when_done(false);
|
||||
{
|
||||
SpecificMap::const_iterator i(_imp->qualified.find(e.name()));
|
||||
SpecificMap::const_iterator i(_imp->qualified.find(e->name()));
|
||||
if (i != _imp->qualified.end())
|
||||
{
|
||||
for (PDSToLicensesList::const_iterator j(i->second.begin()), j_end(i->second.end()) ;
|
||||
|
@ -60,7 +60,7 @@ namespace paludis
|
||||
/**
|
||||
* Query a particular license.
|
||||
*/
|
||||
bool query(const std::string &, const PackageID &) const;
|
||||
bool query(const std::string &, const std::shared_ptr<const PackageID> &) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ namespace
|
||||
return false;
|
||||
|
||||
if (rule.matches_requirement() && ! match_package(*env, *rule.matches_requirement(),
|
||||
*i.package_id(), { }))
|
||||
i.package_id(), { }))
|
||||
return false;
|
||||
|
||||
if (! rule.ignore_unfetched_requirement().is_indeterminate())
|
||||
|
@ -98,7 +98,7 @@ PackageMaskConf::add(const FSPath & filename)
|
||||
}
|
||||
|
||||
bool
|
||||
PackageMaskConf::query(const PackageID & e) const
|
||||
PackageMaskConf::query(const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
if (indirect_iterator(_imp->masks.end()) != std::find_if(
|
||||
|
@ -61,7 +61,7 @@ namespace paludis
|
||||
/**
|
||||
* Query a mask.
|
||||
*/
|
||||
bool query(const PackageID &) const;
|
||||
bool query(const std::shared_ptr<const PackageID> &) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -175,26 +175,26 @@ PaludisEnvironment::~PaludisEnvironment()
|
||||
|
||||
bool
|
||||
PaludisEnvironment::accept_keywords(const std::shared_ptr<const KeywordNameSet> & k,
|
||||
const PackageID & e) const
|
||||
const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
return _imp->config->keywords_conf()->query(k, e);
|
||||
}
|
||||
|
||||
bool
|
||||
PaludisEnvironment::accept_license(const std::string & license, const PackageID & d) const
|
||||
PaludisEnvironment::accept_license(const std::string & license, const std::shared_ptr<const PackageID> & d) const
|
||||
{
|
||||
if (license == "*")
|
||||
return true;
|
||||
if (license == "-*")
|
||||
return false;
|
||||
|
||||
Context context("When checking license of '" + license + "' for '" + stringify(d) + "':");
|
||||
Context context("When checking license of '" + license + "' for '" + stringify(*d) + "':");
|
||||
|
||||
return _imp->config->licenses_conf()->query(license, d);
|
||||
}
|
||||
|
||||
bool
|
||||
PaludisEnvironment::unmasked_by_user(const PackageID & d) const
|
||||
PaludisEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> & d) const
|
||||
{
|
||||
return _imp->config->package_unmask_conf()->query(d);
|
||||
}
|
||||
@ -411,11 +411,11 @@ namespace
|
||||
}
|
||||
|
||||
const std::shared_ptr<const Mask>
|
||||
PaludisEnvironment::mask_for_breakage(const PackageID & id) const
|
||||
PaludisEnvironment::mask_for_breakage(const std::shared_ptr<const PackageID> & id) const
|
||||
{
|
||||
if (! _imp->config->accept_all_breaks_portage())
|
||||
{
|
||||
std::shared_ptr<const Set<std::string> > breakages(id.breaks_portage());
|
||||
std::shared_ptr<const Set<std::string> > breakages(id->breaks_portage());
|
||||
if (breakages)
|
||||
{
|
||||
std::list<std::string> bad_breakages;
|
||||
@ -431,7 +431,7 @@ PaludisEnvironment::mask_for_breakage(const PackageID & id) const
|
||||
}
|
||||
|
||||
const std::shared_ptr<const Mask>
|
||||
PaludisEnvironment::mask_for_user(const PackageID & d, const bool o) const
|
||||
PaludisEnvironment::mask_for_user(const std::shared_ptr<const PackageID> & d, const bool o) const
|
||||
{
|
||||
if (_imp->config->package_mask_conf()->query(d))
|
||||
return std::make_shared<UserConfigMask>(o);
|
||||
|
@ -116,19 +116,19 @@ namespace paludis
|
||||
virtual std::string distribution() const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const PackageID &) const
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool accept_license(const std::string &, const PackageID &) const
|
||||
virtual bool accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const PackageID &, const bool) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool unmasked_by_user(const PackageID &) const
|
||||
virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool add_to_world(const QualifiedPackageName &) const;
|
||||
|
@ -194,7 +194,7 @@ SuggestionsConf::interest_in_suggestion(
|
||||
for (PDSToValuesList::const_iterator j(i->second.begin()), j_end(i->second.end()) ;
|
||||
j != j_end ; ++j)
|
||||
{
|
||||
if (! match_package(*_imp->env, *j->first, *from_id, { }))
|
||||
if (! match_package(*_imp->env, *j->first, from_id, { }))
|
||||
continue;
|
||||
|
||||
for (ValuesList::const_iterator l(j->second.begin()), l_end(j->second.end()) ;
|
||||
@ -238,7 +238,7 @@ SuggestionsConf::interest_in_suggestion(
|
||||
}
|
||||
}
|
||||
|
||||
if (! match_package_in_set(*_imp->env, *i->second.first, *from_id, { }))
|
||||
if (! match_package_in_set(*_imp->env, *i->second.first, from_id, { }))
|
||||
continue;
|
||||
|
||||
for (ValuesList::const_iterator l(i->second.second.begin()), l_end(i->second.second.end()) ;
|
||||
@ -269,7 +269,7 @@ SuggestionsConf::interest_in_suggestion(
|
||||
for (PDSToValuesList::const_iterator j(_imp->unqualified.begin()), j_end(_imp->unqualified.end()) ;
|
||||
j != j_end ; ++j)
|
||||
{
|
||||
if (! match_package(*_imp->env, *j->first, *from_id, { }))
|
||||
if (! match_package(*_imp->env, *j->first, from_id, { }))
|
||||
continue;
|
||||
|
||||
for (ValuesList::const_iterator l(j->second.begin()), l_end(j->second.end()) ;
|
||||
|
@ -586,7 +586,7 @@ PortageEnvironment::want_choice_enabled(
|
||||
for (PackageUse::const_iterator i(_imp->package_use.begin()), i_end(_imp->package_use.end()) ;
|
||||
i != i_end ; ++i)
|
||||
{
|
||||
if (! match_package(*this, *i->first, *id, { }))
|
||||
if (! match_package(*this, *i->first, id, { }))
|
||||
continue;
|
||||
|
||||
if (i->second == stringify(f))
|
||||
@ -630,7 +630,7 @@ namespace
|
||||
|
||||
bool
|
||||
PortageEnvironment::accept_keywords(const std::shared_ptr <const KeywordNameSet> & keywords,
|
||||
const PackageID & d) const
|
||||
const std::shared_ptr<const PackageID> & d) const
|
||||
{
|
||||
if (keywords->end() != keywords->find(KeywordName("*")))
|
||||
return true;
|
||||
@ -673,7 +673,7 @@ PortageEnvironment::accept_keywords(const std::shared_ptr <const KeywordNameSet>
|
||||
}
|
||||
|
||||
bool
|
||||
PortageEnvironment::unmasked_by_user(const PackageID & e) const
|
||||
PortageEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
for (PackageUnmask::const_iterator i(_imp->package_unmask.begin()), i_end(_imp->package_unmask.end()) ;
|
||||
i != i_end ; ++i)
|
||||
@ -702,7 +702,7 @@ PortageEnvironment::known_choice_value_names(const std::shared_ptr<const Package
|
||||
for (PackageUse::const_iterator i(_imp->package_use.begin()), i_end(_imp->package_use.end()) ;
|
||||
i != i_end ; ++i)
|
||||
{
|
||||
if (! match_package(*this, *i->first, *id, { }))
|
||||
if (! match_package(*this, *i->first, id, { }))
|
||||
continue;
|
||||
|
||||
if (0 == i->second.compare(0, prefix_lower.length(), prefix_lower, 0, prefix_lower.length()))
|
||||
@ -778,7 +778,7 @@ PortageEnvironment::mirrors(const std::string & m) const
|
||||
}
|
||||
|
||||
bool
|
||||
PortageEnvironment::accept_license(const std::string &, const PackageID &) const
|
||||
PortageEnvironment::accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -838,11 +838,11 @@ namespace
|
||||
}
|
||||
|
||||
const std::shared_ptr<const Mask>
|
||||
PortageEnvironment::mask_for_breakage(const PackageID & id) const
|
||||
PortageEnvironment::mask_for_breakage(const std::shared_ptr<const PackageID> & id) const
|
||||
{
|
||||
if (! _imp->ignore_all_breaks_portage)
|
||||
{
|
||||
std::shared_ptr<const Set<std::string> > breakages(id.breaks_portage());
|
||||
std::shared_ptr<const Set<std::string> > breakages(id->breaks_portage());
|
||||
if (breakages)
|
||||
{
|
||||
std::set<std::string> bad_breakages;
|
||||
@ -858,7 +858,7 @@ PortageEnvironment::mask_for_breakage(const PackageID & id) const
|
||||
}
|
||||
|
||||
const std::shared_ptr<const Mask>
|
||||
PortageEnvironment::mask_for_user(const PackageID & d, const bool o) const
|
||||
PortageEnvironment::mask_for_user(const std::shared_ptr<const PackageID> & d, const bool o) const
|
||||
{
|
||||
for (PackageMask::const_iterator i(_imp->package_mask.begin()), i_end(_imp->package_mask.end()) ;
|
||||
i != i_end ; ++i)
|
||||
|
@ -141,19 +141,19 @@ namespace paludis
|
||||
|
||||
virtual void set_paludis_command(const std::string &);
|
||||
|
||||
virtual bool accept_license(const std::string &, const PackageID &) const
|
||||
virtual bool accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const PackageID &) const
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const PackageID &, const bool) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool unmasked_by_user(const PackageID &) const
|
||||
virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual uid_t reduced_uid() const;
|
||||
|
@ -57,7 +57,7 @@ namespace
|
||||
};
|
||||
|
||||
bool accept_keyword(const TestPortageEnvironment & env,
|
||||
const KeywordName & k, const PackageID & e)
|
||||
const KeywordName & k, const std::shared_ptr<const PackageID> & e)
|
||||
{
|
||||
std::shared_ptr<KeywordNameSet> kk(std::make_shared<KeywordNameSet>());
|
||||
kk->insert(k);
|
||||
@ -145,46 +145,46 @@ namespace test_cases
|
||||
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-x-1",
|
||||
&env, { })), { }))]->begin());
|
||||
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("arch"), *idx));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), *idx));
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("~arch"), *idx));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("arch"), idx));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), idx));
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("~arch"), idx));
|
||||
|
||||
const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(
|
||||
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
|
||||
&env, { })), { }))]->begin());
|
||||
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("arch"), *id1));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), *id1));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("~arch"), *id1));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("arch"), id1));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), id1));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("~arch"), id1));
|
||||
|
||||
const std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne(
|
||||
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-two-1",
|
||||
&env, { })), { }))]->begin());
|
||||
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), *id2));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("arch"), *id2));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("~arch"), *id2));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), id2));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("arch"), id2));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("~arch"), id2));
|
||||
|
||||
const std::shared_ptr<const PackageID> id3(*env[selection::RequireExactlyOne(
|
||||
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-three-1",
|
||||
&env, { })), { }))]->begin());
|
||||
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("other_arch"), *id3));
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("arch"), *id3));
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("~arch"), *id3));
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("other_arch"), id3));
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("arch"), id3));
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("~arch"), id3));
|
||||
|
||||
const std::shared_ptr<const PackageID> id4(*env[selection::RequireExactlyOne(
|
||||
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-four-1",
|
||||
&env, { })), { }))]->begin());
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("fred"), *id4));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("fred"), id4));
|
||||
std::shared_ptr<const KeywordNameSet> empty(std::make_shared<KeywordNameSet>());
|
||||
TEST_CHECK(env.accept_keywords(empty, *id4));
|
||||
TEST_CHECK(env.accept_keywords(empty, id4));
|
||||
|
||||
const std::shared_ptr<const PackageID> id5(*env[selection::RequireExactlyOne(
|
||||
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-five-1",
|
||||
&env, { })), { }))]->begin());
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("~foo"), *id5));
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("foo"), *id5));
|
||||
TEST_CHECK(accept_keyword(env, KeywordName("~foo"), id5));
|
||||
TEST_CHECK(! accept_keyword(env, KeywordName("foo"), id5));
|
||||
}
|
||||
} test_accept_keywords;
|
||||
|
||||
|
@ -89,13 +89,13 @@ TestEnvironment::~TestEnvironment()
|
||||
}
|
||||
|
||||
bool
|
||||
TestEnvironment::accept_keywords(const std::shared_ptr<const KeywordNameSet> & k, const PackageID &) const
|
||||
TestEnvironment::accept_keywords(const std::shared_ptr<const KeywordNameSet> & k, const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
return k->end() != k->find(KeywordName("test")) || k->end() != k->find(KeywordName("*"));
|
||||
}
|
||||
|
||||
bool
|
||||
TestEnvironment::accept_license(const std::string &, const PackageID &) const
|
||||
TestEnvironment::accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -179,19 +179,19 @@ TestEnvironment::hook_dirs() const
|
||||
}
|
||||
|
||||
const std::shared_ptr<const Mask>
|
||||
TestEnvironment::mask_for_breakage(const PackageID &) const
|
||||
TestEnvironment::mask_for_breakage(const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
return std::shared_ptr<const Mask>();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const Mask>
|
||||
TestEnvironment::mask_for_user(const PackageID &, const bool) const
|
||||
TestEnvironment::mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
|
||||
{
|
||||
return std::shared_ptr<const Mask>();
|
||||
}
|
||||
|
||||
bool
|
||||
TestEnvironment::unmasked_by_user(const PackageID &) const
|
||||
TestEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -78,19 +78,19 @@ namespace paludis
|
||||
const std::shared_ptr<const PackageID> fetch_package_id(const QualifiedPackageName &,
|
||||
const VersionSpec &, const RepositoryName &) const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool accept_license(const std::string &, const PackageID &) const
|
||||
virtual bool accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const PackageID &) const
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const PackageID &, const bool) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool unmasked_by_user(const PackageID &) const
|
||||
virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual std::shared_ptr<const FSPathSequence> hook_dirs() const
|
||||
|
@ -411,7 +411,7 @@ namespace
|
||||
for (PackageIDSet::ConstIterator i(id->begin()), i_end(id->end()) ;
|
||||
i != i_end ; ++i)
|
||||
{
|
||||
if (match_package(*env, spec, **i, options))
|
||||
if (match_package(*env, spec, *i, options))
|
||||
result->insert(*i);
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ namespace
|
||||
env->package_database()->fetch_repository(*r)->package_ids(*q));
|
||||
for (PackageIDSequence::ConstIterator i(id->begin()), i_end(id->end()) ;
|
||||
i != i_end ; ++i)
|
||||
if (match_package(*env, spec, **i, options))
|
||||
if (match_package(*env, spec, *i, options))
|
||||
result->insert(*i);
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ namespace
|
||||
case dlk_provided:
|
||||
case dlk_already_installed:
|
||||
case dlk_subpackage:
|
||||
return match_package(*env, a, *e.second->package_id(), o);
|
||||
return match_package(*env, a, e.second->package_id(), o);
|
||||
|
||||
case dlk_block:
|
||||
case dlk_masked:
|
||||
@ -498,7 +498,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
|
||||
if (! best_visible_candidate && ! already_installed->empty() &&
|
||||
(*already_installed->last())->behaviours_key() &&
|
||||
(*already_installed->last())->behaviours_key()->value()->end() != (*already_installed->last())->behaviours_key()->value()->find("transient") &&
|
||||
(dl_target_package != d->_imp->opts->target_type() || ! d->is_top_level_target(**already_installed->last())))
|
||||
(dl_target_package != d->_imp->opts->target_type() || ! d->is_top_level_target(*already_installed->last())))
|
||||
{
|
||||
Log::get_instance()->message("dep_list.no_visible.transient", ll_debug, lc_context) << "No visible packages matching '"
|
||||
<< *node.spec() << "', silently falling back to installed package '" << **already_installed->last() << "' as it is transient";
|
||||
@ -528,7 +528,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
|
||||
bool local_success(false);
|
||||
for (DepListOverrideMasksFunctions::ConstIterator o(d->_imp->opts->override_masks()->begin()),
|
||||
o_end(next(of)) ; o != o_end ; ++o)
|
||||
if ((*o)(**p, **m))
|
||||
if ((*o)(*p, **m))
|
||||
local_success = true;
|
||||
|
||||
success &= local_success;
|
||||
@ -564,7 +564,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
|
||||
else if (already_installed->empty())
|
||||
can_fall_back = true;
|
||||
else
|
||||
can_fall_back = ! d->is_top_level_target(**already_installed->last());
|
||||
can_fall_back = ! d->is_top_level_target(*already_installed->last());
|
||||
|
||||
continue;
|
||||
|
||||
@ -614,7 +614,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
|
||||
/* we have an already installed version. do we want to use it? */
|
||||
if (! already_installed_in_same_slot->empty())
|
||||
{
|
||||
if (d->prefer_installed_over_uninstalled(**already_installed_in_same_slot->last(), *best_visible_candidate))
|
||||
if (d->prefer_installed_over_uninstalled(*already_installed_in_same_slot->last(), best_visible_candidate))
|
||||
{
|
||||
Log::get_instance()->message("dep_list.installed_over_best_visible", ll_debug, lc_context)
|
||||
<< "Taking installed package '" << **already_installed_in_same_slot->last() << "' over '"
|
||||
@ -631,7 +631,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
|
||||
{
|
||||
/* we have an already installed, but not in the same slot, and our options
|
||||
* allow us to take this. */
|
||||
if (d->prefer_installed_over_uninstalled(**already_installed->last(), *best_visible_candidate))
|
||||
if (d->prefer_installed_over_uninstalled(*already_installed->last(), best_visible_candidate))
|
||||
{
|
||||
Log::get_instance()->message("dep_list.installed_over_slot", ll_debug, lc_context) <<
|
||||
"Taking installed package '" << **already_installed->last() << "' over '" << *best_visible_candidate <<
|
||||
@ -903,7 +903,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
|
||||
for (PackageIDSequence::ConstIterator aa(already_installed->begin()),
|
||||
aa_end(already_installed->end()) ; aa != aa_end ; ++aa)
|
||||
{
|
||||
if (! match_package(*d->_imp->env, node.spec()->blocking(), **aa, d->_imp->opts->match_package_options()))
|
||||
if (! match_package(*d->_imp->env, node.spec()->blocking(), *aa, d->_imp->opts->match_package_options()))
|
||||
continue;
|
||||
|
||||
bool replaced(false);
|
||||
@ -973,7 +973,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
|
||||
for (std::list<MergeList::const_iterator>::const_iterator r(will_be_installed.begin()),
|
||||
r_end(will_be_installed.end()) ; r != r_end ; ++r)
|
||||
{
|
||||
if (! match_package(*d->_imp->env, node.spec()->blocking(), *(*r)->package_id(), d->_imp->opts->match_package_options()))
|
||||
if (! match_package(*d->_imp->env, node.spec()->blocking(), (*r)->package_id(), d->_imp->opts->match_package_options()))
|
||||
continue;
|
||||
|
||||
/* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking
|
||||
@ -1010,7 +1010,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
|
||||
for (MergeList::const_iterator r(d->_imp->merge_list.begin()),
|
||||
r_end(d->_imp->merge_list.end()) ; r != r_end ; ++r)
|
||||
{
|
||||
if (! match_package(*d->_imp->env, node.spec()->blocking(), *r->package_id(), d->_imp->opts->match_package_options()))
|
||||
if (! match_package(*d->_imp->env, node.spec()->blocking(), r->package_id(), d->_imp->opts->match_package_options()))
|
||||
continue;
|
||||
|
||||
/* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking
|
||||
@ -1136,7 +1136,7 @@ DepList::add_package(const std::shared_ptr<const PackageID> & p, const std::shar
|
||||
_imp->merge_list.insert(_imp->merge_list_insert_position,
|
||||
make_named_values<DepListEntry>(
|
||||
n::associated_entry() = static_cast<DepListEntry *>(0),
|
||||
n::destination() = p->virtual_for_key() ? std::shared_ptr<Repository>() : find_destination(*p, destinations),
|
||||
n::destination() = p->virtual_for_key() ? std::shared_ptr<Repository>() : find_destination(p, destinations),
|
||||
n::generation() = _imp->merge_list_generation,
|
||||
n::handled() = p->virtual_for_key() ?
|
||||
std::shared_ptr<DepListEntryHandled>(std::make_shared<DepListEntryNoHandlingRequired>()) :
|
||||
@ -1326,7 +1326,7 @@ DepList::add_suggested_package(const std::shared_ptr<const PackageID> & p,
|
||||
_imp->merge_list.insert(_imp->merge_list_insert_position,
|
||||
make_named_values<DepListEntry>(
|
||||
n::associated_entry() = &*_imp->current_merge_list_entry,
|
||||
n::destination() = find_destination(*p, destinations),
|
||||
n::destination() = find_destination(p, destinations),
|
||||
n::generation() = _imp->merge_list_generation,
|
||||
n::handled() = std::make_shared<DepListEntryNoHandlingRequired>(),
|
||||
n::kind() = dlk_suggested,
|
||||
@ -1486,8 +1486,9 @@ namespace
|
||||
}
|
||||
|
||||
bool
|
||||
DepList::prefer_installed_over_uninstalled(const PackageID & installed,
|
||||
const PackageID & uninstalled)
|
||||
DepList::prefer_installed_over_uninstalled(
|
||||
const std::shared_ptr<const PackageID> & installed,
|
||||
const std::shared_ptr<const PackageID> & uninstalled)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -1519,13 +1520,13 @@ DepList::prefer_installed_over_uninstalled(const PackageID & installed,
|
||||
return true;
|
||||
|
||||
if (dl_reinstall_scm_never != _imp->opts->reinstall_scm())
|
||||
if (uninstalled.version() == installed.version() &&
|
||||
(installed.version().is_scm() || is_scm(installed.name())))
|
||||
if (uninstalled->version() == installed->version() &&
|
||||
(installed->version().is_scm() || is_scm(installed->name())))
|
||||
{
|
||||
static Timestamp current_time(Timestamp::now()); /* static to avoid weirdness */
|
||||
Timestamp installed_time(current_time);
|
||||
if (installed.installed_time_key())
|
||||
installed_time = installed.installed_time_key()->value();
|
||||
if (installed->installed_time_key())
|
||||
installed_time = installed->installed_time_key()->value();
|
||||
|
||||
do
|
||||
{
|
||||
@ -1557,17 +1558,17 @@ DepList::prefer_installed_over_uninstalled(const PackageID & installed,
|
||||
|
||||
/* use != rather than > to correctly force a downgrade when packages are
|
||||
* removed. */
|
||||
if (uninstalled.version() != installed.version())
|
||||
if (uninstalled->version() != installed->version())
|
||||
return false;
|
||||
|
||||
if (dl_reinstall_if_use_changed == _imp->opts->reinstall())
|
||||
{
|
||||
std::set<ChoiceNameWithPrefix> common;
|
||||
if (installed.choices_key() && uninstalled.choices_key())
|
||||
if (installed->choices_key() && uninstalled->choices_key())
|
||||
{
|
||||
std::set<ChoiceNameWithPrefix> i_common, u_common;
|
||||
for (Choices::ConstIterator k(installed.choices_key()->value()->begin()),
|
||||
k_end(installed.choices_key()->value()->end()) ;
|
||||
for (Choices::ConstIterator k(installed->choices_key()->value()->begin()),
|
||||
k_end(installed->choices_key()->value()->end()) ;
|
||||
k != k_end ; ++k)
|
||||
{
|
||||
if (! (*k)->consider_added_or_changed())
|
||||
@ -1579,8 +1580,8 @@ DepList::prefer_installed_over_uninstalled(const PackageID & installed,
|
||||
i_common.insert((*i)->name_with_prefix());
|
||||
}
|
||||
|
||||
for (Choices::ConstIterator k(uninstalled.choices_key()->value()->begin()),
|
||||
k_end(uninstalled.choices_key()->value()->end()) ;
|
||||
for (Choices::ConstIterator k(uninstalled->choices_key()->value()->begin()),
|
||||
k_end(uninstalled->choices_key()->value()->end()) ;
|
||||
k != k_end ; ++k)
|
||||
{
|
||||
if (! (*k)->consider_added_or_changed())
|
||||
@ -1600,8 +1601,8 @@ DepList::prefer_installed_over_uninstalled(const PackageID & installed,
|
||||
|
||||
for (std::set<ChoiceNameWithPrefix>::const_iterator f(common.begin()), f_end(common.end()) ;
|
||||
f != f_end ; ++f)
|
||||
if (installed.choices_key()->value()->find_by_name_with_prefix(*f)->enabled() !=
|
||||
uninstalled.choices_key()->value()->find_by_name_with_prefix(*f)->enabled())
|
||||
if (installed->choices_key()->value()->find_by_name_with_prefix(*f)->enabled() !=
|
||||
uninstalled->choices_key()->value()->find_by_name_with_prefix(*f)->enabled())
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1642,7 +1643,7 @@ DepList::end() const
|
||||
}
|
||||
|
||||
bool
|
||||
DepList::is_top_level_target(const PackageID & e) const
|
||||
DepList::is_top_level_target(const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
if (! _imp->current_top_level_target)
|
||||
throw InternalError(PALUDIS_HERE, "current_top_level_target not set?");
|
||||
@ -1686,7 +1687,7 @@ DepList::has_errors() const
|
||||
}
|
||||
|
||||
std::shared_ptr<Repository>
|
||||
DepList::find_destination(const PackageID & p,
|
||||
DepList::find_destination(const std::shared_ptr<const PackageID> & p,
|
||||
const std::shared_ptr<const DestinationsSet> & dd)
|
||||
{
|
||||
for (DestinationsSet::ConstIterator d(dd->begin()), d_end(dd->end()) ;
|
||||
@ -1749,7 +1750,7 @@ paludis::is_viable_any_child(const DependencySpecTree::BasicNode & i)
|
||||
return true;
|
||||
}
|
||||
|
||||
template class Sequence<std::function<bool (const PackageID &, const Mask &)> >;
|
||||
template class Sequence<std::function<bool (const std::shared_ptr<const PackageID> &, const Mask &)> >;
|
||||
template class WrappedForwardIterator<DepList::IteratorTag, DepListEntry>;
|
||||
template class WrappedForwardIterator<DepList::ConstIteratorTag, const DepListEntry>;
|
||||
|
||||
|
@ -85,7 +85,7 @@ namespace paludis
|
||||
*
|
||||
* \ingroup g_dep_list
|
||||
*/
|
||||
typedef Sequence<std::function<bool (const PackageID &, const Mask &)> > DepListOverrideMasksFunctions;
|
||||
typedef Sequence<std::function<bool (const std::shared_ptr<const PackageID> &, const Mask &)> > DepListOverrideMasksFunctions;
|
||||
|
||||
/**
|
||||
* An entry in a DepList.
|
||||
@ -156,7 +156,7 @@ namespace paludis
|
||||
/**
|
||||
* Find an appropriate destination for a package.
|
||||
*/
|
||||
std::shared_ptr<Repository> find_destination(const PackageID &,
|
||||
std::shared_ptr<Repository> find_destination(const std::shared_ptr<const PackageID> &,
|
||||
const std::shared_ptr<const DestinationsSet> &);
|
||||
|
||||
/**
|
||||
@ -169,8 +169,9 @@ namespace paludis
|
||||
* Return whether we prefer the first parameter, which is installed,
|
||||
* over the second, which isn't.
|
||||
*/
|
||||
bool prefer_installed_over_uninstalled(const PackageID &,
|
||||
const PackageID &);
|
||||
bool prefer_installed_over_uninstalled(
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const std::shared_ptr<const PackageID> &);
|
||||
|
||||
/**
|
||||
* Add a package to the list.
|
||||
@ -205,7 +206,7 @@ namespace paludis
|
||||
* Return whether the specified PackageID is matched by
|
||||
* the top level target.
|
||||
*/
|
||||
bool is_top_level_target(const PackageID &) const;
|
||||
bool is_top_level_target(const std::shared_ptr<const PackageID> &) const;
|
||||
|
||||
void add_not_top_level(
|
||||
const bool only_if_not_suggested_label,
|
||||
|
@ -85,9 +85,9 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
NoDestinationError::NoDestinationError(const PackageID & p,
|
||||
NoDestinationError::NoDestinationError(const std::shared_ptr<const PackageID> & p,
|
||||
const std::shared_ptr<const DestinationsSet> & d) throw () :
|
||||
DepListError("No suitable destination for '" + stringify(p) + "' in (" +
|
||||
DepListError("No suitable destination for '" + stringify(*p) + "' in (" +
|
||||
destinations_to_string(d) + ")")
|
||||
{
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ namespace paludis
|
||||
///\name Basic operations
|
||||
///\{
|
||||
|
||||
NoDestinationError(const PackageID &,
|
||||
NoDestinationError(const std::shared_ptr<const PackageID> &,
|
||||
const std::shared_ptr<const DestinationsSet> &) throw ();
|
||||
|
||||
///\}
|
||||
|
@ -1728,7 +1728,7 @@ namespace
|
||||
if (! d->handled())
|
||||
continue;
|
||||
|
||||
if (! match_package(*env, *node.spec(), *d->package_id(), { }))
|
||||
if (! match_package(*env, *node.spec(), d->package_id(), { }))
|
||||
continue;
|
||||
|
||||
CheckHandledVisitor v;
|
||||
|
@ -32,7 +32,7 @@
|
||||
using namespace paludis;
|
||||
|
||||
bool
|
||||
paludis::override_tilde_keywords(const Environment * const e, const PackageID & id, const Mask & m)
|
||||
paludis::override_tilde_keywords(const Environment * const e, const std::shared_ptr<const PackageID> & id, const Mask & m)
|
||||
{
|
||||
Context c("When working out whether mask is a tilde keyword mask for override:");
|
||||
|
||||
@ -57,7 +57,7 @@ paludis::override_tilde_keywords(const Environment * const e, const PackageID &
|
||||
}
|
||||
|
||||
bool
|
||||
paludis::override_unkeyworded(const Environment * const e, const PackageID & id, const Mask & m)
|
||||
paludis::override_unkeyworded(const Environment * const e, const std::shared_ptr<const PackageID> & id, const Mask & m)
|
||||
{
|
||||
Context c("When working out whether mask is an unkeyworded mask for override:");
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Ciaran McCreesh
|
||||
* Copyright (c) 2007, 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
|
||||
@ -43,7 +43,7 @@ namespace paludis
|
||||
* \ingroup g_dep_list
|
||||
* \since 0.26
|
||||
*/
|
||||
bool override_tilde_keywords(const Environment * const e, const PackageID & i, const Mask & m)
|
||||
bool override_tilde_keywords(const Environment * const e, const std::shared_ptr<const PackageID> & i, const Mask & m)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
|
||||
/**
|
||||
@ -52,7 +52,7 @@ namespace paludis
|
||||
* \ingroup g_dep_list
|
||||
* \since 0.26
|
||||
*/
|
||||
bool override_unkeyworded(const Environment * const e, const PackageID & i, const Mask & m)
|
||||
bool override_unkeyworded(const Environment * const e, const std::shared_ptr<const PackageID> & i, const Mask & m)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
|
||||
/**
|
||||
|
@ -172,7 +172,7 @@ UninstallList::add_errors_for_system()
|
||||
continue;
|
||||
|
||||
bool needed(false);
|
||||
if (match_package_in_set(*_imp->env, *system, *l->package_id(), { }))
|
||||
if (match_package_in_set(*_imp->env, *system, l->package_id(), { }))
|
||||
needed = true;
|
||||
|
||||
if ((! needed) && l->package_id()->provide_key())
|
||||
@ -186,7 +186,7 @@ UninstallList::add_errors_for_system()
|
||||
generator::Matches(**v, { }))]);
|
||||
for (PackageIDSequence::ConstIterator i(virtuals->begin()), i_end(virtuals->end()) ;
|
||||
i != i_end && ! needed ; ++i)
|
||||
if (match_package_in_set(*_imp->env, *system, **i, { }))
|
||||
if (match_package_in_set(*_imp->env, *system, *i, { }))
|
||||
needed = true;
|
||||
}
|
||||
}
|
||||
@ -473,7 +473,7 @@ UninstallList::add_unused_dependencies()
|
||||
for (PackageIDSet::ConstIterator i(unused_dependencies->begin()),
|
||||
i_end(unused_dependencies->end()) ; i != i_end ; ++i)
|
||||
{
|
||||
if (match_package_in_set(*_imp->env, *world, **i, { }))
|
||||
if (match_package_in_set(*_imp->env, *world, *i, { }))
|
||||
continue;
|
||||
|
||||
if (_imp->uninstall_list.end() != std::find_if(_imp->uninstall_list.begin(),
|
||||
@ -550,7 +550,7 @@ UninstallList::collect_world() const
|
||||
for (PackageIDSet::ConstIterator i(everything->begin()),
|
||||
i_end(everything->end()) ; i != i_end ; ++i)
|
||||
{
|
||||
if (match_package_in_set(*_imp->env, *world, **i, { }))
|
||||
if (match_package_in_set(*_imp->env, *world, *i, { }))
|
||||
result->insert(*i);
|
||||
}
|
||||
|
||||
|
@ -49,10 +49,10 @@ namespace
|
||||
{
|
||||
struct SlotRequirementChecker
|
||||
{
|
||||
const PackageID & id;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
bool result;
|
||||
|
||||
SlotRequirementChecker(const PackageID & i) :
|
||||
SlotRequirementChecker(const std::shared_ptr<const PackageID> & i) :
|
||||
id(i),
|
||||
result(true)
|
||||
{
|
||||
@ -60,7 +60,7 @@ namespace
|
||||
|
||||
void visit(const SlotExactRequirement & s)
|
||||
{
|
||||
result = id.slot_key() && id.slot_key()->value() == s.slot();
|
||||
result = id->slot_key() && id->slot_key()->value() == s.slot();
|
||||
}
|
||||
|
||||
void visit(const SlotAnyLockedRequirement &)
|
||||
@ -80,17 +80,17 @@ paludis::match_package_with_maybe_changes(
|
||||
const Environment & env,
|
||||
const PackageDepSpec & spec,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const PackageID & entry,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const ChangedChoices * const maybe_changes_to_target,
|
||||
const MatchPackageOptions & options)
|
||||
{
|
||||
if (spec.package_ptr() && *spec.package_ptr() != entry.name())
|
||||
if (spec.package_ptr() && *spec.package_ptr() != id->name())
|
||||
return false;
|
||||
|
||||
if (spec.package_name_part_ptr() && *spec.package_name_part_ptr() != entry.name().package())
|
||||
if (spec.package_name_part_ptr() && *spec.package_name_part_ptr() != id->name().package())
|
||||
return false;
|
||||
|
||||
if (spec.category_name_part_ptr() && *spec.category_name_part_ptr() != entry.name().category())
|
||||
if (spec.category_name_part_ptr() && *spec.category_name_part_ptr() != id->name().category())
|
||||
return false;
|
||||
|
||||
if (spec.version_requirements_ptr())
|
||||
@ -99,7 +99,7 @@ paludis::match_package_with_maybe_changes(
|
||||
case vr_and:
|
||||
for (VersionRequirements::ConstIterator r(spec.version_requirements_ptr()->begin()),
|
||||
r_end(spec.version_requirements_ptr()->end()) ; r != r_end ; ++r)
|
||||
if (! r->version_operator().as_version_spec_comparator()(entry.version(), r->version_spec()))
|
||||
if (! r->version_operator().as_version_spec_comparator()(id->version(), r->version_spec()))
|
||||
return false;
|
||||
break;
|
||||
|
||||
@ -108,7 +108,7 @@ paludis::match_package_with_maybe_changes(
|
||||
bool matched(false);
|
||||
for (VersionRequirements::ConstIterator r(spec.version_requirements_ptr()->begin()),
|
||||
r_end(spec.version_requirements_ptr()->end()) ; r != r_end ; ++r)
|
||||
if (r->version_operator().as_version_spec_comparator()(entry.version(), r->version_spec()))
|
||||
if (r->version_operator().as_version_spec_comparator()(id->version(), r->version_spec()))
|
||||
{
|
||||
matched = true;
|
||||
break;
|
||||
@ -124,49 +124,49 @@ paludis::match_package_with_maybe_changes(
|
||||
}
|
||||
|
||||
if (spec.in_repository_ptr())
|
||||
if (*spec.in_repository_ptr() != entry.repository()->name())
|
||||
if (*spec.in_repository_ptr() != id->repository()->name())
|
||||
return false;
|
||||
|
||||
if (spec.from_repository_ptr())
|
||||
{
|
||||
if (! entry.from_repositories_key())
|
||||
if (! id->from_repositories_key())
|
||||
return false;
|
||||
|
||||
if (entry.from_repositories_key()->value()->end() == entry.from_repositories_key()->value()->find(
|
||||
if (id->from_repositories_key()->value()->end() == id->from_repositories_key()->value()->find(
|
||||
stringify(*spec.from_repository_ptr())))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spec.installed_at_path_ptr())
|
||||
{
|
||||
if (! entry.repository()->installed_root_key())
|
||||
if (! id->repository()->installed_root_key())
|
||||
return false;
|
||||
if (entry.repository()->installed_root_key()->value() != *spec.installed_at_path_ptr())
|
||||
if (id->repository()->installed_root_key()->value() != *spec.installed_at_path_ptr())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spec.installable_to_repository_ptr())
|
||||
{
|
||||
if (! entry.supports_action(SupportsActionTest<InstallAction>()))
|
||||
if (! id->supports_action(SupportsActionTest<InstallAction>()))
|
||||
return false;
|
||||
if (! spec.installable_to_repository_ptr()->include_masked())
|
||||
if (entry.masked())
|
||||
if (id->masked())
|
||||
return false;
|
||||
|
||||
const std::shared_ptr<const Repository> dest(env.package_database()->fetch_repository(
|
||||
spec.installable_to_repository_ptr()->repository()));
|
||||
if (! dest->destination_interface())
|
||||
return false;
|
||||
if (! dest->destination_interface()->is_suitable_destination_for(entry))
|
||||
if (! dest->destination_interface()->is_suitable_destination_for(id))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spec.installable_to_path_ptr())
|
||||
{
|
||||
if (! entry.supports_action(SupportsActionTest<InstallAction>()))
|
||||
if (! id->supports_action(SupportsActionTest<InstallAction>()))
|
||||
return false;
|
||||
if (! spec.installable_to_path_ptr()->include_masked())
|
||||
if (entry.masked())
|
||||
if (id->masked())
|
||||
return false;
|
||||
|
||||
bool ok(false);
|
||||
@ -180,7 +180,7 @@ paludis::match_package_with_maybe_changes(
|
||||
continue;
|
||||
if ((*d)->installed_root_key()->value() != spec.installable_to_path_ptr()->path())
|
||||
continue;
|
||||
if (! (*d)->destination_interface()->is_suitable_destination_for(entry))
|
||||
if (! (*d)->destination_interface()->is_suitable_destination_for(id))
|
||||
continue;
|
||||
|
||||
ok = true;
|
||||
@ -193,7 +193,7 @@ paludis::match_package_with_maybe_changes(
|
||||
|
||||
if (spec.slot_requirement_ptr())
|
||||
{
|
||||
SlotRequirementChecker v(entry);
|
||||
SlotRequirementChecker v(id);
|
||||
spec.slot_requirement_ptr()->accept(v);
|
||||
if (! v.result)
|
||||
return false;
|
||||
@ -205,7 +205,7 @@ paludis::match_package_with_maybe_changes(
|
||||
{
|
||||
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, maybe_changes_to_owner, entry, maybe_changes_to_target).first)
|
||||
if (! (*u)->requirement_met(&env, maybe_changes_to_owner, id, maybe_changes_to_target).first)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -217,17 +217,17 @@ bool
|
||||
paludis::match_package(
|
||||
const Environment & env,
|
||||
const PackageDepSpec & spec,
|
||||
const PackageID & target,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const MatchPackageOptions & options)
|
||||
{
|
||||
return match_package_with_maybe_changes(env, spec, 0, target, 0, options);
|
||||
return match_package_with_maybe_changes(env, spec, 0, id, 0, options);
|
||||
}
|
||||
|
||||
bool
|
||||
paludis::match_package_in_set(
|
||||
const Environment & env,
|
||||
const SetSpecTree & target,
|
||||
const PackageID & entry,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const MatchPackageOptions & options)
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
@ -236,6 +236,6 @@ paludis::match_package_in_set(
|
||||
target.top()->accept(f);
|
||||
return indirect_iterator(f.end()) != std::find_if(
|
||||
indirect_iterator(f.begin()), indirect_iterator(f.end()),
|
||||
std::bind(&match_package, std::cref(env), _1, std::cref(entry), std::cref(options)));
|
||||
std::bind(&match_package, std::cref(env), _1, std::cref(id), std::cref(options)));
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace paludis
|
||||
bool match_package(
|
||||
const Environment & env,
|
||||
const PackageDepSpec & spec,
|
||||
const PackageID & target,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const MatchPackageOptions & options)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
|
||||
@ -65,7 +65,7 @@ namespace paludis
|
||||
const Environment & env,
|
||||
const PackageDepSpec & spec,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const PackageID & target,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const ChangedChoices * const maybe_changes_to_target,
|
||||
const MatchPackageOptions & options)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
@ -81,7 +81,7 @@ namespace paludis
|
||||
bool match_package_in_set(
|
||||
const Environment & env,
|
||||
const SetSpecTree & spec,
|
||||
const PackageID & target,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const MatchPackageOptions & options)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
}
|
||||
|
@ -61,12 +61,12 @@ PackageDepSpecCollection::match_any(
|
||||
{
|
||||
auto named(_imp->by_name.equal_range(id->name()));
|
||||
for ( ; named.first != named.second ; ++named.first)
|
||||
if (match_package(*env, named.first->second, *id, opts))
|
||||
if (match_package(*env, named.first->second, id, opts))
|
||||
return true;
|
||||
|
||||
for (auto u(_imp->unnamed.begin()), u_end(_imp->unnamed.end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (match_package(*env, *u, *id, opts))
|
||||
if (match_package(*env, *u, id, opts))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -426,7 +426,7 @@ namespace
|
||||
{
|
||||
if (maybe_id)
|
||||
{
|
||||
if (! match_package(*env, i->spec(), *maybe_id, { }))
|
||||
if (! match_package(*env, i->spec(), maybe_id, { }))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@ -453,7 +453,7 @@ namespace
|
||||
{
|
||||
if (maybe_id)
|
||||
{
|
||||
if (! match_package(*env, i->spec(), *maybe_id, { }))
|
||||
if (! match_package(*env, i->spec(), maybe_id, { }))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@ -502,7 +502,7 @@ PaludisLikeOptionsConf::want_choice_enabled_locked(
|
||||
r != r_end ; ++r)
|
||||
{
|
||||
if (! match_package_in_set(*_imp->params.environment(), *r->set_value().value().value(),
|
||||
*maybe_id, { }))
|
||||
maybe_id, { }))
|
||||
continue;
|
||||
|
||||
check_values_groups(_imp->params.environment(), maybe_id, prefix, unprefixed_name, r->values_groups(),
|
||||
@ -561,7 +561,7 @@ PaludisLikeOptionsConf::value_for_choice_parameter(
|
||||
for (SetNamesWithValuesGroups::const_iterator r(_imp->set_specs.begin()), r_end(_imp->set_specs.end()) ;
|
||||
r != r_end ; ++r)
|
||||
{
|
||||
if (! match_package_in_set(*_imp->params.environment(), *r->set_value().value().value(), *id, { }))
|
||||
if (! match_package_in_set(*_imp->params.environment(), *r->set_value().value().value(), id, { }))
|
||||
continue;
|
||||
|
||||
check_values_groups(_imp->params.environment(), id, prefix, unprefixed_name, r->values_groups(),
|
||||
@ -607,7 +607,7 @@ PaludisLikeOptionsConf::known_choice_value_names(
|
||||
r != r_end ; ++r)
|
||||
{
|
||||
if (! match_package_in_set(*_imp->params.environment(), *r->set_value().value().value(),
|
||||
*maybe_id, { }))
|
||||
maybe_id, { }))
|
||||
continue;
|
||||
|
||||
collect_known_from_values_groups(_imp->params.environment(), maybe_id, prefix, r->values_groups(), result);
|
||||
|
@ -401,9 +401,9 @@ AccountsRepository::some_ids_might_not_be_masked() const
|
||||
}
|
||||
|
||||
bool
|
||||
AccountsRepository::is_suitable_destination_for(const PackageID & id) const
|
||||
AccountsRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const
|
||||
{
|
||||
std::string f(id.repository()->format_key() ? id.repository()->format_key()->value() : "");
|
||||
std::string f(id->repository()->format_key() ? id->repository()->format_key()->value() : "");
|
||||
return _imp->handler_if_installed && f == "accounts";
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ namespace paludis
|
||||
///\name Destination functions
|
||||
///\{
|
||||
|
||||
virtual bool is_suitable_destination_for(const PackageID &) const
|
||||
virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
virtual bool is_default_destination() const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
@ -460,9 +460,9 @@ CRANInstalledRepository::invalidate_masks()
|
||||
}
|
||||
|
||||
bool
|
||||
CRANInstalledRepository::is_suitable_destination_for(const PackageID & e) const
|
||||
CRANInstalledRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
std::string f(e.repository()->format_key() ? e.repository()->format_key()->value() : "");
|
||||
std::string f(e->repository()->format_key() ? e->repository()->format_key()->value() : "");
|
||||
return f == "cran";
|
||||
}
|
||||
bool
|
||||
@ -483,7 +483,7 @@ CRANInstalledRepository::merge(const MergeParams & m)
|
||||
Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
|
||||
+ "' to repository '" + stringify(name()) + "':");
|
||||
|
||||
if (! is_suitable_destination_for(*m.package_id()))
|
||||
if (! is_suitable_destination_for(m.package_id()))
|
||||
throw ActionFailedError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
|
||||
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ namespace paludis
|
||||
|
||||
/* RepositoryDestinationInterface */
|
||||
|
||||
virtual bool is_suitable_destination_for(const PackageID &) const
|
||||
virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool is_default_destination() const
|
||||
|
@ -36,9 +36,13 @@ namespace
|
||||
{
|
||||
struct FindAnyFetchesFinder
|
||||
{
|
||||
const Environment * const env;
|
||||
const std::shared_ptr<const PackageID> package_id;
|
||||
bool result;
|
||||
|
||||
FindAnyFetchesFinder() :
|
||||
FindAnyFetchesFinder(const Environment * const e, const std::shared_ptr<const PackageID> & id) :
|
||||
env(e),
|
||||
package_id(id),
|
||||
result(true)
|
||||
{
|
||||
}
|
||||
@ -66,7 +70,9 @@ namespace
|
||||
}
|
||||
|
||||
bool
|
||||
paludis::erepository::can_skip_phase(const std::shared_ptr<const ERepositoryID> & id,
|
||||
paludis::erepository::can_skip_phase(
|
||||
const Environment * const env,
|
||||
const std::shared_ptr<const ERepositoryID> & id,
|
||||
const EAPIPhase & phase)
|
||||
{
|
||||
if (! id->defined_phases_key())
|
||||
@ -87,7 +93,7 @@ paludis::erepository::can_skip_phase(const std::shared_ptr<const ERepositoryID>
|
||||
{
|
||||
if (id->fetches_key())
|
||||
{
|
||||
FindAnyFetchesFinder f;
|
||||
FindAnyFetchesFinder f(env, id);
|
||||
id->fetches_key()->value()->top()->accept(f);
|
||||
if (! f.result)
|
||||
return false;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Ciaran McCreesh
|
||||
* Copyright (c) 2008, 2010 Ciaran McCreesh
|
||||
*
|
||||
* This file is part of the Paludis package manager. Paludis is free software;
|
||||
* you can redistribute it and/or modify it under the terms of the GNU General
|
||||
@ -28,7 +28,9 @@ namespace paludis
|
||||
{
|
||||
namespace erepository
|
||||
{
|
||||
bool can_skip_phase(const std::shared_ptr<const ERepositoryID> & id,
|
||||
bool can_skip_phase(
|
||||
const Environment * const,
|
||||
const std::shared_ptr<const ERepositoryID> & id,
|
||||
const EAPIPhase &) PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
}
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Typ
|
||||
|
||||
if (_imp->env && _imp->id && _imp->check_conditions)
|
||||
{
|
||||
if (_imp->env->accept_license(node.spec()->text(), *_imp->id))
|
||||
if (_imp->env->accept_license(node.spec()->text(), _imp->id))
|
||||
_imp->s << _imp->formatter.format(*node.spec(), format::Accepted());
|
||||
else
|
||||
_imp->s << _imp->formatter.format(*node.spec(), format::Unaccepted());
|
||||
|
@ -205,7 +205,7 @@ paludis::erepository::do_fetch_action(
|
||||
if (skip)
|
||||
continue;
|
||||
|
||||
if (can_skip_phase(id, *phase))
|
||||
if (can_skip_phase(env, id, *phase))
|
||||
continue;
|
||||
|
||||
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
|
||||
|
@ -51,9 +51,13 @@ namespace
|
||||
{
|
||||
struct AcceptLicenseFinder
|
||||
{
|
||||
const Environment * const env;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
std::stringstream s;
|
||||
|
||||
AcceptLicenseFinder()
|
||||
AcceptLicenseFinder(const Environment * const e, const std::shared_ptr<const PackageID> & i) :
|
||||
env(e),
|
||||
id(i)
|
||||
{
|
||||
s << "*";
|
||||
}
|
||||
@ -189,7 +193,7 @@ paludis::erepository::do_install_action(
|
||||
/* make ACCEPT_LICENSE */
|
||||
if (! id->eapi()->supported()->ebuild_environment_variables()->env_accept_license().empty())
|
||||
{
|
||||
AcceptLicenseFinder g;
|
||||
AcceptLicenseFinder g(env, id);
|
||||
if (id->license_key())
|
||||
id->license_key()->value()->top()->accept(g);
|
||||
|
||||
@ -258,7 +262,7 @@ paludis::erepository::do_install_action(
|
||||
if (skip)
|
||||
continue;
|
||||
|
||||
if (can_skip_phase(id, *phase))
|
||||
if (can_skip_phase(env, id, *phase))
|
||||
{
|
||||
output_manager->stdout_stream() << "--- No need to do anything for " << phase->equal_option("skipname") << " phase" << std::endl;
|
||||
continue;
|
||||
|
@ -83,7 +83,7 @@ paludis::erepository::do_pretend_action(
|
||||
|
||||
if (id->raw_myoptions_key())
|
||||
{
|
||||
MyOptionsRequirementsVerifier verifier(id);
|
||||
MyOptionsRequirementsVerifier verifier(env, id);
|
||||
id->raw_myoptions_key()->value()->top()->accept(verifier);
|
||||
|
||||
if (verifier.unmet_requirements() && ! verifier.unmet_requirements()->empty())
|
||||
@ -144,7 +144,7 @@ paludis::erepository::do_pretend_action(
|
||||
|
||||
if (id->required_use_key())
|
||||
{
|
||||
RequiredUseVerifier verifier(id);
|
||||
RequiredUseVerifier verifier(env, id);
|
||||
id->required_use_key()->value()->top()->accept(verifier);
|
||||
|
||||
if (verifier.unmet_requirements() && ! verifier.unmet_requirements()->empty())
|
||||
@ -212,7 +212,7 @@ paludis::erepository::do_pretend_action(
|
||||
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
|
||||
phase != phase_end ; ++phase)
|
||||
{
|
||||
if (can_skip_phase(id, *phase))
|
||||
if (can_skip_phase(env, id, *phase))
|
||||
continue;
|
||||
|
||||
if (! output_manager)
|
||||
|
@ -139,9 +139,9 @@ EInstalledRepository::some_ids_might_not_be_masked() const
|
||||
}
|
||||
|
||||
bool
|
||||
EInstalledRepository::is_suitable_destination_for(const PackageID & e) const
|
||||
EInstalledRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
std::string f(e.repository()->format_key() ? e.repository()->format_key()->value() : "");
|
||||
std::string f(e->repository()->format_key() ? e->repository()->format_key()->value() : "");
|
||||
return f == "e" || f == "ebuild" || f == "exheres" || f == "portage";
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace paludis
|
||||
|
||||
/* RepositoryDestinationInterface */
|
||||
|
||||
virtual bool is_suitable_destination_for(const PackageID &) const
|
||||
virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool is_default_destination() const
|
||||
|
@ -916,7 +916,7 @@ EKeywordsKey::pretty_print_flat(const Formatter<KeywordName> & f) const
|
||||
|
||||
std::shared_ptr<KeywordNameSet> k(std::make_shared<KeywordNameSet>());
|
||||
k->insert(*i);
|
||||
if (_imp->env->accept_keywords(k, *_imp->id))
|
||||
if (_imp->env->accept_keywords(k, _imp->id))
|
||||
result.append(f.format(*i, format::Accepted()));
|
||||
else
|
||||
result.append(f.format(*i, format::Unaccepted()));
|
||||
|
@ -617,13 +617,13 @@ ERepository::package_ids(const QualifiedPackageName & n) const
|
||||
}
|
||||
|
||||
std::shared_ptr<const RepositoryMaskInfo>
|
||||
ERepository::repository_masked(const PackageID & id) const
|
||||
ERepository::repository_masked(const std::shared_ptr<const PackageID> & id) const
|
||||
{
|
||||
Lock l(_imp->mutexes->repo_mask_mutex);
|
||||
|
||||
if (! _imp->has_repo_mask)
|
||||
{
|
||||
Context context("When querying repository mask for '" + stringify(id) + "':");
|
||||
Context context("When querying repository mask for '" + stringify(*id) + "':");
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
@ -664,7 +664,7 @@ ERepository::repository_masked(const PackageID & id) const
|
||||
_imp->has_repo_mask = true;
|
||||
}
|
||||
|
||||
RepositoryMaskMap::iterator r(_imp->repo_mask.find(id.name()));
|
||||
RepositoryMaskMap::iterator r(_imp->repo_mask.find(id->name()));
|
||||
if (_imp->repo_mask.end() == r)
|
||||
return std::shared_ptr<const RepositoryMaskInfo>();
|
||||
else
|
||||
@ -982,11 +982,11 @@ ERepository::params() const
|
||||
}
|
||||
|
||||
bool
|
||||
ERepository::is_suitable_destination_for(const PackageID & e) const
|
||||
ERepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
std::string f(e.repository()->format_key() ? e.repository()->format_key()->value() : "");
|
||||
std::string f(e->repository()->format_key() ? e->repository()->format_key()->value() : "");
|
||||
if (f == "e")
|
||||
return static_cast<const ERepositoryID &>(e).eapi()->supported()->can_be_pbin();
|
||||
return static_cast<const ERepositoryID &>(*e).eapi()->supported()->can_be_pbin();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@ -1863,7 +1863,7 @@ ERepository::merge(const MergeParams & m)
|
||||
Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
|
||||
+ "' to E repository '" + stringify(name()) + "':");
|
||||
|
||||
if (! is_suitable_destination_for(*m.package_id()))
|
||||
if (! is_suitable_destination_for(m.package_id()))
|
||||
throw ActionFailedError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
|
||||
|
||||
auto is_replace(find_id(package_ids(m.package_id()->name()), m.package_id()->version()));
|
||||
|
@ -92,7 +92,7 @@ namespace paludis
|
||||
|
||||
/* RepositoryDestinationInterface */
|
||||
|
||||
virtual bool is_suitable_destination_for(const PackageID &) const
|
||||
virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool is_default_destination() const
|
||||
@ -162,7 +162,7 @@ namespace paludis
|
||||
const std::shared_ptr<const erepository::Layout> layout() const;
|
||||
const std::shared_ptr<const erepository::Profile> profile() const;
|
||||
|
||||
std::shared_ptr<const RepositoryMaskInfo> repository_masked(const PackageID &) const;
|
||||
std::shared_ptr<const RepositoryMaskInfo> repository_masked(const std::shared_ptr<const PackageID> &) const;
|
||||
|
||||
void regenerate_cache() const;
|
||||
|
||||
|
@ -331,10 +331,10 @@ EbuildID::need_keys_added() const
|
||||
add_metadata_key(std::make_shared<LiteralMetadataValueKey<std::string>>("EAPI", "EAPI", mkt_internal, _imp->eapi->name()));
|
||||
|
||||
_imp->repository_mask = std::make_shared<EMutableRepositoryMaskInfoKey>(shared_from_this(), "repository_mask", "Repository masked",
|
||||
std::static_pointer_cast<const ERepository>(repository())->repository_masked(*this), mkt_internal);
|
||||
std::static_pointer_cast<const ERepository>(repository())->repository_masked(shared_from_this()), mkt_internal);
|
||||
add_metadata_key(_imp->repository_mask);
|
||||
_imp->profile_mask = std::make_shared<EMutableRepositoryMaskInfoKey>(shared_from_this(), "profile_mask", "Profile masked",
|
||||
std::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(*this), mkt_internal);
|
||||
std::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(shared_from_this()), mkt_internal);
|
||||
add_metadata_key(_imp->profile_mask);
|
||||
|
||||
std::shared_ptr<const Map<ChoiceNameWithPrefix, std::string> > maybe_use_descriptions;
|
||||
@ -435,16 +435,16 @@ namespace
|
||||
{
|
||||
bool ok;
|
||||
const Environment * const env;
|
||||
bool (Environment::* const func) (const std::string &, const PackageID &) const;
|
||||
const PackageID * const id;
|
||||
bool (Environment::* const func) (const std::string &, const std::shared_ptr<const PackageID> &) const;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
|
||||
LicenceChecker(const Environment * const e,
|
||||
bool (Environment::* const f) (const std::string &, const PackageID &) const,
|
||||
const PackageID * const d) :
|
||||
bool (Environment::* const f) (const std::string &, const std::shared_ptr<const PackageID> &) const,
|
||||
const std::shared_ptr<const PackageID> & i) :
|
||||
ok(true),
|
||||
env(e),
|
||||
func(f),
|
||||
id(d)
|
||||
id(i)
|
||||
{
|
||||
}
|
||||
|
||||
@ -481,7 +481,7 @@ namespace
|
||||
|
||||
void visit(const LicenseSpecTree::NodeType<LicenseDepSpec>::Type & node)
|
||||
{
|
||||
if (! (env->*func)(node.spec()->text(), *id))
|
||||
if (! (env->*func)(node.spec()->text(), id))
|
||||
ok = false;
|
||||
}
|
||||
};
|
||||
@ -513,7 +513,7 @@ EbuildID::need_masks_added() const
|
||||
|
||||
if (keywords_key())
|
||||
{
|
||||
if (! _imp->environment->accept_keywords(keywords_key()->value(), *this))
|
||||
if (! _imp->environment->accept_keywords(keywords_key()->value(), shared_from_this()))
|
||||
{
|
||||
add_mask(std::make_shared<EUnacceptedMask>('K',
|
||||
DistributionData::get_instance()->distribution_from_string(
|
||||
@ -534,7 +534,7 @@ EbuildID::need_masks_added() const
|
||||
|
||||
if (license_key())
|
||||
{
|
||||
LicenceChecker c(_imp->environment, &Environment::accept_license, this);
|
||||
LicenceChecker c(_imp->environment, &Environment::accept_license, shared_from_this());
|
||||
license_key()->value()->top()->accept(c);
|
||||
if (! c.ok)
|
||||
add_mask(std::make_shared<EUnacceptedMask>('L',
|
||||
@ -542,7 +542,7 @@ EbuildID::need_masks_added() const
|
||||
_imp->environment->distribution())->concept_license(), license_key()));
|
||||
}
|
||||
|
||||
if (! _imp->environment->unmasked_by_user(*this))
|
||||
if (! _imp->environment->unmasked_by_user(shared_from_this()))
|
||||
{
|
||||
/* repo unless user */
|
||||
if (_imp->repository_mask->value())
|
||||
@ -553,7 +553,7 @@ EbuildID::need_masks_added() const
|
||||
add_mask(std::make_shared<ERepositoryMask>('P', "profile", _imp->profile_mask));
|
||||
|
||||
/* user */
|
||||
std::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(*this, false));
|
||||
std::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(shared_from_this(), false));
|
||||
if (user_mask)
|
||||
add_mask(user_mask);
|
||||
}
|
||||
@ -576,7 +576,7 @@ EbuildID::need_masks_added() const
|
||||
)));
|
||||
|
||||
/* user */
|
||||
std::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(*this, true));
|
||||
std::shared_ptr<const Mask> user_mask(_imp->environment->mask_for_user(shared_from_this(), true));
|
||||
if (user_mask)
|
||||
add_overridden_mask(std::make_shared<OverriddenMask>(
|
||||
make_named_values<OverriddenMask>(
|
||||
@ -587,7 +587,7 @@ EbuildID::need_masks_added() const
|
||||
}
|
||||
|
||||
/* break portage */
|
||||
std::shared_ptr<const Mask> breaks_mask(_imp->environment->mask_for_breakage(*this));
|
||||
std::shared_ptr<const Mask> breaks_mask(_imp->environment->mask_for_breakage(shared_from_this()));
|
||||
if (breaks_mask)
|
||||
add_mask(breaks_mask);
|
||||
}
|
||||
@ -602,8 +602,8 @@ EbuildID::invalidate_masks() const
|
||||
|
||||
_imp->has_masks = false;
|
||||
PackageID::invalidate_masks();
|
||||
_imp->repository_mask->set_value(std::static_pointer_cast<const ERepository>(repository())->repository_masked(*this));
|
||||
_imp->profile_mask->set_value(std::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(*this));
|
||||
_imp->repository_mask->set_value(std::static_pointer_cast<const ERepository>(repository())->repository_masked(shared_from_this()));
|
||||
_imp->profile_mask->set_value(std::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(shared_from_this()));
|
||||
}
|
||||
|
||||
const std::string
|
||||
|
@ -358,9 +358,9 @@ ExheresProfile::environment_variable(const std::string & s) const
|
||||
}
|
||||
|
||||
const std::shared_ptr<const RepositoryMaskInfo>
|
||||
ExheresProfile::profile_masked(const PackageID & id) const
|
||||
ExheresProfile::profile_masked(const std::shared_ptr<const PackageID> & id) const
|
||||
{
|
||||
PackageMaskMap::const_iterator rr(_imp->package_mask.find(id.name()));
|
||||
PackageMaskMap::const_iterator rr(_imp->package_mask.find(id->name()));
|
||||
if (_imp->package_mask.end() == rr)
|
||||
return std::shared_ptr<const RepositoryMaskInfo>();
|
||||
else
|
||||
|
@ -90,7 +90,7 @@ namespace paludis
|
||||
|
||||
virtual const std::string environment_variable(const std::string &) const;
|
||||
|
||||
virtual const std::shared_ptr<const RepositoryMaskInfo> profile_masked(const PackageID &) const;
|
||||
virtual const std::shared_ptr<const RepositoryMaskInfo> profile_masked(const std::shared_ptr<const PackageID> &) const;
|
||||
|
||||
virtual const std::shared_ptr<const SetSpecTree> system_packages() const;
|
||||
|
||||
|
@ -335,7 +335,7 @@ ExndbamRepository::merge(const MergeParams & m)
|
||||
Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
|
||||
+ "' to Exndbam repository '" + stringify(name()) + "':");
|
||||
|
||||
if (! is_suitable_destination_for(*m.package_id()))
|
||||
if (! is_suitable_destination_for(m.package_id()))
|
||||
throw ActionFailedError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
|
||||
|
||||
std::shared_ptr<const PackageID> if_overwritten_id, if_same_name_id;
|
||||
@ -506,7 +506,7 @@ ExndbamRepository::perform_uninstall(
|
||||
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
|
||||
phase != phase_end ; ++phase)
|
||||
{
|
||||
if (can_skip_phase(id, *phase))
|
||||
if (can_skip_phase(_imp->params.environment(), id, *phase))
|
||||
{
|
||||
output_manager->stdout_stream() << "--- No need to do anything for " <<
|
||||
phase->equal_option("skipname") << " phase" << std::endl;
|
||||
|
@ -46,6 +46,7 @@ namespace paludis
|
||||
template <>
|
||||
struct Imp<MyOptionsRequirementsVerifier>
|
||||
{
|
||||
const Environment * const env;
|
||||
const std::shared_ptr<const ERepositoryID> id;
|
||||
|
||||
std::shared_ptr<Sequence<std::string> > unmet_requirements;
|
||||
@ -53,7 +54,10 @@ namespace paludis
|
||||
std::list<ChildrenList> current_children_stack;
|
||||
std::list<int> number_enabled_stack;
|
||||
|
||||
Imp(const std::shared_ptr<const ERepositoryID> & i) :
|
||||
Imp(
|
||||
const Environment * const e,
|
||||
const std::shared_ptr<const ERepositoryID> & i) :
|
||||
env(e),
|
||||
id(i),
|
||||
unmet_requirements(std::make_shared<Sequence<std::string>>())
|
||||
{
|
||||
@ -64,8 +68,10 @@ namespace paludis
|
||||
};
|
||||
}
|
||||
|
||||
MyOptionsRequirementsVerifier::MyOptionsRequirementsVerifier(const std::shared_ptr<const ERepositoryID> & id) :
|
||||
Pimp<MyOptionsRequirementsVerifier>(id)
|
||||
MyOptionsRequirementsVerifier::MyOptionsRequirementsVerifier(
|
||||
const Environment * const e,
|
||||
const std::shared_ptr<const ERepositoryID> & id) :
|
||||
Pimp<MyOptionsRequirementsVerifier>(e, id)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,9 @@ namespace paludis
|
||||
const std::shared_ptr<const DepSpecAnnotations> &);
|
||||
|
||||
public:
|
||||
MyOptionsRequirementsVerifier(const std::shared_ptr<const ERepositoryID> &);
|
||||
MyOptionsRequirementsVerifier(
|
||||
const Environment * const,
|
||||
const std::shared_ptr<const ERepositoryID> &);
|
||||
~MyOptionsRequirementsVerifier();
|
||||
|
||||
const std::shared_ptr<const Sequence<std::string> > unmet_requirements() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
@ -91,7 +91,7 @@ namespace paludis
|
||||
|
||||
virtual const std::string environment_variable(const std::string &) const = 0;
|
||||
|
||||
virtual const std::shared_ptr<const RepositoryMaskInfo> profile_masked(const PackageID &) const = 0;
|
||||
virtual const std::shared_ptr<const RepositoryMaskInfo> profile_masked(const std::shared_ptr<const PackageID> &) const = 0;
|
||||
|
||||
virtual const std::shared_ptr<const SetSpecTree> system_packages() const = 0;
|
||||
|
||||
|
@ -47,13 +47,17 @@ namespace paludis
|
||||
template <>
|
||||
struct Imp<RequiredUseVerifier>
|
||||
{
|
||||
const Environment * const env;
|
||||
const std::shared_ptr<const ERepositoryID> id;
|
||||
std::shared_ptr<Sequence<std::string> > unmet_requirements;
|
||||
|
||||
std::list<Met> stack;
|
||||
bool top;
|
||||
|
||||
Imp(const std::shared_ptr<const ERepositoryID> & i) :
|
||||
Imp(
|
||||
const Environment * const e,
|
||||
const std::shared_ptr<const ERepositoryID> & i) :
|
||||
env(e),
|
||||
id(i),
|
||||
unmet_requirements(std::make_shared<Sequence<std::string>>()),
|
||||
top(true)
|
||||
@ -63,8 +67,10 @@ namespace paludis
|
||||
};
|
||||
}
|
||||
|
||||
RequiredUseVerifier::RequiredUseVerifier(const std::shared_ptr<const ERepositoryID> & id) :
|
||||
Pimp<RequiredUseVerifier>(id)
|
||||
RequiredUseVerifier::RequiredUseVerifier(
|
||||
const Environment * const e,
|
||||
const std::shared_ptr<const ERepositoryID> & id) :
|
||||
Pimp<RequiredUseVerifier>(e, id)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,9 @@ namespace paludis
|
||||
bool matches(const std::string &);
|
||||
|
||||
public:
|
||||
RequiredUseVerifier(const std::shared_ptr<const ERepositoryID> &);
|
||||
RequiredUseVerifier(
|
||||
const Environment * const,
|
||||
const std::shared_ptr<const ERepositoryID> &);
|
||||
~RequiredUseVerifier();
|
||||
|
||||
const std::shared_ptr<const Sequence<std::string> > unmet_requirements() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
@ -872,7 +872,7 @@ TraditionalProfile::use_masked(
|
||||
for (PackageFlagStatusMapList::const_iterator g(i->package_use_mask.begin()),
|
||||
g_end(i->package_use_mask.end()) ; g != g_end ; ++g)
|
||||
{
|
||||
if (! match_package(*_imp->env, *g->first, *id, { }))
|
||||
if (! match_package(*_imp->env, *g->first, id, { }))
|
||||
continue;
|
||||
|
||||
FlagStatusMap::const_iterator h(g->second.find(value_prefixed));
|
||||
@ -908,7 +908,7 @@ TraditionalProfile::use_forced(
|
||||
for (PackageFlagStatusMapList::const_iterator g(i->package_use_force.begin()),
|
||||
g_end(i->package_use_force.end()) ; g != g_end ; ++g)
|
||||
{
|
||||
if (! match_package(*_imp->env, *g->first, *id, { }))
|
||||
if (! match_package(*_imp->env, *g->first, id, { }))
|
||||
continue;
|
||||
|
||||
FlagStatusMap::const_iterator h(g->second.find(value_prefixed));
|
||||
@ -937,7 +937,7 @@ TraditionalProfile::use_state_ignoring_masks(
|
||||
for (PackageFlagStatusMapList::const_iterator g(i->package_use.begin()),
|
||||
g_end(i->package_use.end()) ; g != g_end ; ++g)
|
||||
{
|
||||
if (! match_package(*_imp->env, *g->first, *id, { }))
|
||||
if (! match_package(*_imp->env, *g->first, id, { }))
|
||||
continue;
|
||||
|
||||
FlagStatusMap::const_iterator h(g->second.find(value_prefixed));
|
||||
@ -1037,9 +1037,9 @@ TraditionalProfile::virtuals() const
|
||||
}
|
||||
|
||||
const std::shared_ptr<const RepositoryMaskInfo>
|
||||
TraditionalProfile::profile_masked(const PackageID & id) const
|
||||
TraditionalProfile::profile_masked(const std::shared_ptr<const PackageID> & id) const
|
||||
{
|
||||
PackageMaskMap::const_iterator rr(_imp->package_mask.find(id.name()));
|
||||
PackageMaskMap::const_iterator rr(_imp->package_mask.find(id->name()));
|
||||
if (_imp->package_mask.end() == rr)
|
||||
return std::shared_ptr<const RepositoryMaskInfo>();
|
||||
else
|
||||
|
@ -87,7 +87,7 @@ namespace paludis
|
||||
|
||||
virtual const std::string environment_variable(const std::string &) const;
|
||||
|
||||
virtual const std::shared_ptr<const RepositoryMaskInfo> profile_masked(const PackageID &) const;
|
||||
virtual const std::shared_ptr<const RepositoryMaskInfo> profile_masked(const std::shared_ptr<const PackageID> &) const;
|
||||
|
||||
virtual const std::shared_ptr<const SetSpecTree> system_packages() const;
|
||||
|
||||
|
@ -434,7 +434,7 @@ VDBRepository::perform_uninstall(
|
||||
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
|
||||
phase != phase_end ; ++phase)
|
||||
{
|
||||
if (can_skip_phase(id, *phase))
|
||||
if (can_skip_phase(_imp->params.environment(), id, *phase))
|
||||
{
|
||||
output_manager->stdout_stream() << "--- No need to do anything for " << phase->equal_option("skipname") << " phase" << std::endl;
|
||||
continue;
|
||||
@ -704,16 +704,16 @@ VDBRepository::load_provided_using_cache() const
|
||||
}
|
||||
|
||||
void
|
||||
VDBRepository::provides_from_package_id(const PackageID & id) const
|
||||
VDBRepository::provides_from_package_id(const std::shared_ptr<const PackageID> & id) const
|
||||
{
|
||||
Context context("When loading VDB PROVIDEs entry for '" + stringify(id) + "':");
|
||||
Context context("When loading VDB PROVIDEs entry for '" + stringify(*id) + "':");
|
||||
|
||||
try
|
||||
{
|
||||
if (! id.provide_key())
|
||||
if (! id->provide_key())
|
||||
return;
|
||||
|
||||
std::shared_ptr<const ProvideSpecTree> provide(id.provide_key()->value());
|
||||
std::shared_ptr<const ProvideSpecTree> provide(id->provide_key()->value());
|
||||
DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->params.environment());
|
||||
provide->top()->accept(f);
|
||||
|
||||
@ -726,12 +726,12 @@ VDBRepository::provides_from_package_id(const PackageID & id) const
|
||||
|
||||
if (pp.category() != CategoryNamePart("virtual"))
|
||||
Log::get_instance()->message("e.vdb.provide.non_virtual", ll_warning, lc_no_context)
|
||||
<< "PROVIDE of non-virtual '" << pp << "' from '" << id << "' will not work as expected";
|
||||
<< "PROVIDE of non-virtual '" << pp << "' from '" << *id << "' will not work as expected";
|
||||
|
||||
qpns->push_back(pp);
|
||||
}
|
||||
|
||||
ProvidesMap::iterator it(_imp->provides_map->find(std::make_pair(id.name(), id.version())));
|
||||
ProvidesMap::iterator it(_imp->provides_map->find(std::make_pair(id->name(), id->version())));
|
||||
if (qpns->empty())
|
||||
{
|
||||
if (_imp->provides_map->end() != it)
|
||||
@ -740,7 +740,7 @@ VDBRepository::provides_from_package_id(const PackageID & id) const
|
||||
else
|
||||
{
|
||||
if (_imp->provides_map->end() == it)
|
||||
_imp->provides_map->insert(std::make_pair(std::make_pair(id.name(), id.version()), qpns));
|
||||
_imp->provides_map->insert(std::make_pair(std::make_pair(id->name(), id->version()), qpns));
|
||||
else
|
||||
it->second = qpns;
|
||||
}
|
||||
@ -752,7 +752,7 @@ VDBRepository::provides_from_package_id(const PackageID & id) const
|
||||
catch (const Exception & ee)
|
||||
{
|
||||
Log::get_instance()->message("e.vdb.provides.failure", ll_warning, lc_no_context) << "Skipping VDB PROVIDE entry for '"
|
||||
<< id << "' due to exception '" << ee.message() << "' (" << ee.what() << ")";
|
||||
<< *id << "' due to exception '" << ee.message() << "' (" << ee.what() << ")";
|
||||
}
|
||||
}
|
||||
|
||||
@ -779,7 +779,7 @@ VDBRepository::load_provided_the_slow_way() const
|
||||
i != i_end ; ++i)
|
||||
for (PackageIDSequence::ConstIterator e(i->second->begin()), e_end(i->second->end()) ;
|
||||
e != e_end ; ++e)
|
||||
provides_from_package_id(**e);
|
||||
provides_from_package_id(*e);
|
||||
|
||||
Log::get_instance()->message("e.vdb.provides.done", ll_debug, lc_no_context) << "Done VDB PROVIDEs map creation";
|
||||
}
|
||||
@ -888,7 +888,7 @@ VDBRepository::merge(const MergeParams & m)
|
||||
Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
|
||||
+ "' to VDB repository '" + stringify(name()) + "':");
|
||||
|
||||
if (! is_suitable_destination_for(*m.package_id()))
|
||||
if (! is_suitable_destination_for(m.package_id()))
|
||||
throw ActionFailedError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
|
||||
|
||||
std::shared_ptr<const ERepositoryID> is_replace(package_id_if_exists(m.package_id()->name(), m.package_id()->version()));
|
||||
@ -1050,7 +1050,7 @@ VDBRepository::merge(const MergeParams & m)
|
||||
|
||||
if (_imp->used_provides_cache || (! _imp->tried_provides_cache && load_provided_using_cache()))
|
||||
{
|
||||
provides_from_package_id(*m.package_id());
|
||||
provides_from_package_id(m.package_id());
|
||||
write_provides_cache();
|
||||
_imp->provides.reset();
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ namespace paludis
|
||||
void _add_metadata_keys() const;
|
||||
|
||||
bool load_provided_using_cache() const;
|
||||
void provides_from_package_id(const PackageID &) const;
|
||||
void provides_from_package_id(const std::shared_ptr<const PackageID> &) const;
|
||||
void load_provided_the_slow_way() const;
|
||||
|
||||
void write_provides_cache() const;
|
||||
|
@ -78,7 +78,7 @@ FakeInstalledRepository::~FakeInstalledRepository()
|
||||
}
|
||||
|
||||
bool
|
||||
FakeInstalledRepository::is_suitable_destination_for(const PackageID &) const
|
||||
FakeInstalledRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
return _imp->is_suitable_destination;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ namespace paludis
|
||||
protected:
|
||||
/* RepositoryDestinationInterface */
|
||||
|
||||
virtual bool is_suitable_destination_for(const PackageID &) const
|
||||
virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool is_default_destination() const
|
||||
|
@ -133,14 +133,14 @@ namespace paludis
|
||||
struct Imp<FakeMetadataCollectionKey<C_> >
|
||||
{
|
||||
std::shared_ptr<C_> collection;
|
||||
const PackageID * const id;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
const Environment * const env;
|
||||
|
||||
const std::string raw_name;
|
||||
const std::string human_name;
|
||||
const MetadataKeyType type;
|
||||
|
||||
Imp(const PackageID * const i, const Environment * const e,
|
||||
Imp(const std::shared_ptr<const PackageID> & i, const Environment * const e,
|
||||
const std::string & r, const std::string & h, const MetadataKeyType t) :
|
||||
id(i),
|
||||
env(e),
|
||||
@ -154,7 +154,7 @@ namespace paludis
|
||||
|
||||
template <typename C_>
|
||||
FakeMetadataCollectionKey<C_>::FakeMetadataCollectionKey(
|
||||
const std::string & r, const std::string & h, const MetadataKeyType t, const PackageID * const i,
|
||||
const std::string & r, const std::string & h, const MetadataKeyType t, const std::shared_ptr<const PackageID> & i,
|
||||
const Environment * const e) :
|
||||
Pimp<FakeMetadataCollectionKey<C_> >(i, e, r, h, t),
|
||||
_imp(Pimp<FakeMetadataCollectionKey<C_> >::_imp)
|
||||
@ -196,7 +196,7 @@ FakeMetadataCollectionKey<C_>::type() const
|
||||
|
||||
FakeMetadataKeywordSetKey::FakeMetadataKeywordSetKey(const std::string & r,
|
||||
const std::string & h, const std::string & v, const MetadataKeyType t,
|
||||
const PackageID * const i, const Environment * const e) :
|
||||
const std::shared_ptr<const PackageID> & i, const Environment * const e) :
|
||||
FakeMetadataCollectionKey<KeywordNameSet>(r, h, t, i, e)
|
||||
{
|
||||
set_from_string(v);
|
||||
@ -720,7 +720,7 @@ namespace paludis
|
||||
mutable bool has_masks;
|
||||
|
||||
Imp(const Environment * const e, const std::shared_ptr<const FakeRepositoryBase> & r,
|
||||
const QualifiedPackageName & q, const VersionSpec & v, const PackageID * const id) :
|
||||
const QualifiedPackageName & q, const VersionSpec & v) :
|
||||
env(e),
|
||||
repository(r),
|
||||
name(q),
|
||||
@ -730,7 +730,6 @@ namespace paludis
|
||||
post_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
|
||||
suggested_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
|
||||
slot(std::make_shared<LiteralMetadataValueKey<SlotName>>("SLOT", "Slot", mkt_internal, SlotName("0"))),
|
||||
keywords(std::make_shared<FakeMetadataKeywordSetKey>("KEYWORDS", "Keywords", "test", mkt_normal, id, env)),
|
||||
behaviours_set(std::make_shared<Set<std::string>>()),
|
||||
has_masks(false)
|
||||
{
|
||||
@ -748,10 +747,9 @@ namespace paludis
|
||||
|
||||
FakePackageID::FakePackageID(const Environment * const e, const std::shared_ptr<const FakeRepositoryBase> & r,
|
||||
const QualifiedPackageName & q, const VersionSpec & v) :
|
||||
Pimp<FakePackageID>(e, r, q, v, this),
|
||||
Pimp<FakePackageID>(e, r, q, v),
|
||||
_imp(Pimp<FakePackageID>::_imp)
|
||||
{
|
||||
add_metadata_key(_imp->keywords);
|
||||
}
|
||||
|
||||
FakePackageID::~FakePackageID()
|
||||
@ -1042,6 +1040,8 @@ FakePackageID::need_keys_added() const
|
||||
_imp->hitchhiker = std::make_shared<FakeMetadataValueKey<long>>("HITCHHIKER", "Hitchhiker",
|
||||
mkt_internal, 42);
|
||||
|
||||
_imp->keywords = std::make_shared<FakeMetadataKeywordSetKey>("KEYWORDS", "Keywords", "test", mkt_normal, shared_from_this(), _imp->env);
|
||||
|
||||
add_metadata_key(_imp->slot);
|
||||
add_metadata_key(_imp->build_dependencies);
|
||||
add_metadata_key(_imp->run_dependencies);
|
||||
@ -1054,6 +1054,7 @@ FakePackageID::need_keys_added() const
|
||||
add_metadata_key(_imp->choices);
|
||||
add_metadata_key(_imp->behaviours);
|
||||
add_metadata_key(_imp->hitchhiker);
|
||||
add_metadata_key(_imp->keywords);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1075,16 +1076,16 @@ namespace
|
||||
{
|
||||
bool ok;
|
||||
const Environment * const env;
|
||||
bool (Environment::* const func) (const std::string &, const PackageID &) const;
|
||||
const PackageID * const id;
|
||||
bool (Environment::* const func) (const std::string &, const std::shared_ptr<const PackageID> &) const;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
|
||||
LicenceChecker(const Environment * const e,
|
||||
bool (Environment::* const f) (const std::string &, const PackageID &) const,
|
||||
const PackageID * const d) :
|
||||
bool (Environment::* const f) (const std::string &, const std::shared_ptr<const PackageID> &) const,
|
||||
const std::shared_ptr<const PackageID> & i) :
|
||||
ok(true),
|
||||
env(e),
|
||||
func(f),
|
||||
id(d)
|
||||
id(i)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1121,7 +1122,7 @@ namespace
|
||||
|
||||
void visit(const LicenseSpecTree::NodeType<LicenseDepSpec>::Type & node)
|
||||
{
|
||||
if (! (env->*func)(node.spec()->text(), *id))
|
||||
if (! (env->*func)(node.spec()->text(), id))
|
||||
ok = false;
|
||||
}
|
||||
};
|
||||
@ -1140,26 +1141,26 @@ FakePackageID::need_masks_added() const
|
||||
Context context("When generating masks for ID '" + canonical_form(idcf_full) + "':");
|
||||
|
||||
if (keywords_key())
|
||||
if (! _imp->env->accept_keywords(keywords_key()->value(), *this))
|
||||
if (! _imp->env->accept_keywords(keywords_key()->value(), shared_from_this()))
|
||||
add_mask(std::make_shared<FakeUnacceptedMask>('K', "keywords", keywords_key()));
|
||||
|
||||
if (license_key())
|
||||
{
|
||||
LicenceChecker c(_imp->env, &Environment::accept_license, this);
|
||||
LicenceChecker c(_imp->env, &Environment::accept_license, shared_from_this());
|
||||
license_key()->value()->top()->accept(c);
|
||||
if (! c.ok)
|
||||
add_mask(std::make_shared<FakeUnacceptedMask>('L', "license", license_key()));
|
||||
}
|
||||
|
||||
if (! _imp->env->unmasked_by_user(*this))
|
||||
if (! _imp->env->unmasked_by_user(shared_from_this()))
|
||||
{
|
||||
std::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(*this, false));
|
||||
std::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(shared_from_this(), false));
|
||||
if (user_mask)
|
||||
add_mask(user_mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(*this, true));
|
||||
std::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(shared_from_this(), true));
|
||||
if (user_mask)
|
||||
add_overridden_mask(std::make_shared<OverriddenMask>(
|
||||
make_named_values<OverriddenMask>(
|
||||
@ -1168,7 +1169,7 @@ FakePackageID::need_masks_added() const
|
||||
)));
|
||||
}
|
||||
|
||||
std::shared_ptr<const Mask> breaks_mask(_imp->env->mask_for_breakage(*this));
|
||||
std::shared_ptr<const Mask> breaks_mask(_imp->env->mask_for_breakage(shared_from_this()));
|
||||
if (breaks_mask)
|
||||
add_mask(breaks_mask);
|
||||
|
||||
@ -1325,7 +1326,7 @@ FakeMetadataKeywordSetKey::pretty_print_flat(const Formatter<KeywordName> & f) c
|
||||
|
||||
std::shared_ptr<KeywordNameSet> k(std::make_shared<KeywordNameSet>());
|
||||
k->insert(*i);
|
||||
if (_imp->env->accept_keywords(k, *_imp->id))
|
||||
if (_imp->env->accept_keywords(k, _imp->id))
|
||||
result.append(f.format(*i, format::Accepted()));
|
||||
else
|
||||
result.append(f.format(*i, format::Unaccepted()));
|
||||
|
@ -64,7 +64,7 @@ namespace paludis
|
||||
typename Pimp<FakeMetadataCollectionKey<C_> >::ImpPtr & _imp;
|
||||
|
||||
FakeMetadataCollectionKey(const std::string &, const std::string &, const MetadataKeyType,
|
||||
const PackageID * const, const Environment * const);
|
||||
const std::shared_ptr<const PackageID> &, const Environment * const);
|
||||
|
||||
public:
|
||||
~FakeMetadataCollectionKey();
|
||||
@ -81,7 +81,7 @@ namespace paludis
|
||||
{
|
||||
public:
|
||||
FakeMetadataKeywordSetKey(const std::string &, const std::string &, const std::string &, const MetadataKeyType,
|
||||
const PackageID * const, const Environment * const);
|
||||
const std::shared_ptr<const PackageID> &, const Environment * const);
|
||||
|
||||
void set_from_string(const std::string &);
|
||||
|
||||
|
@ -345,9 +345,9 @@ RepositoryRepository::sync_host_key() const
|
||||
}
|
||||
|
||||
bool
|
||||
RepositoryRepository::is_suitable_destination_for(const PackageID & e) const
|
||||
RepositoryRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
std::string f(e.repository()->format_key() ? e.repository()->format_key()->value() : "");
|
||||
std::string f(e->repository()->format_key() ? e->repository()->format_key()->value() : "");
|
||||
return f == "unavailable";
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ RepositoryRepository::merge(const MergeParams & m)
|
||||
Context context("When merging '" + stringify(*m.package_id())
|
||||
+ "' to RepositoryRepository repository '" + stringify(name()) + "':");
|
||||
|
||||
if (! is_suitable_destination_for(*m.package_id()))
|
||||
if (! is_suitable_destination_for(m.package_id()))
|
||||
throw ActionFailedError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
|
||||
|
||||
std::string repo_sync(get_string_key(m.package_id(), "REPOSITORY_SYNC"));
|
||||
|
@ -99,7 +99,7 @@ namespace paludis
|
||||
|
||||
virtual bool sync(const std::string &, const std::shared_ptr<OutputManager> &) const;
|
||||
|
||||
virtual bool is_suitable_destination_for(const PackageID &) const
|
||||
virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool is_default_destination() const
|
||||
|
@ -271,7 +271,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
|
||||
Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
|
||||
+ "' to InstalledUnpackagedRepository repository '" + stringify(name()) + "':");
|
||||
|
||||
if (! is_suitable_destination_for(*m.package_id()))
|
||||
if (! is_suitable_destination_for(m.package_id()))
|
||||
throw ActionFailedError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
|
||||
|
||||
FSPath install_under("/");
|
||||
@ -394,9 +394,9 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
|
||||
}
|
||||
|
||||
bool
|
||||
InstalledUnpackagedRepository::is_suitable_destination_for(const PackageID & e) const
|
||||
InstalledUnpackagedRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
std::string f(e.repository()->format_key() ? e.repository()->format_key()->value() : "");
|
||||
std::string f(e->repository()->format_key() ? e->repository()->format_key()->value() : "");
|
||||
return f == "unpackaged";
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ namespace paludis
|
||||
virtual void invalidate();
|
||||
virtual void invalidate_masks();
|
||||
|
||||
virtual bool is_suitable_destination_for(const PackageID &) const
|
||||
virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool is_default_destination() const
|
||||
|
@ -363,9 +363,9 @@ InstalledVirtualsRepository::repository_factory_dependencies(
|
||||
}
|
||||
|
||||
bool
|
||||
InstalledVirtualsRepository::is_suitable_destination_for(const PackageID & e) const
|
||||
InstalledVirtualsRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & e) const
|
||||
{
|
||||
std::string f(e.repository()->format_key() ? e.repository()->format_key()->value() : "");
|
||||
std::string f(e->repository()->format_key() ? e->repository()->format_key()->value() : "");
|
||||
return f == "virtuals";
|
||||
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ namespace paludis
|
||||
|
||||
/* RepositoryDestinationInterface */
|
||||
|
||||
virtual bool is_suitable_destination_for(const PackageID &) const
|
||||
virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual bool is_default_destination() const
|
||||
|
@ -595,8 +595,10 @@ namespace paludis
|
||||
|
||||
/**
|
||||
* Are we a suitable destination for the specified package?
|
||||
*
|
||||
* \since 0.58 takes id by shared_ptr
|
||||
*/
|
||||
virtual bool is_suitable_destination_for(const PackageID &) const
|
||||
virtual bool is_suitable_destination_for(const std::shared_ptr<const PackageID> &) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ namespace
|
||||
i != i_end ; ++i)
|
||||
{
|
||||
if ((! result) || dependent_checker_id(*i)->version() >= result->version())
|
||||
if (match_package(*env, spec, *dependent_checker_id(*i), { }))
|
||||
if (match_package(*env, spec, dependent_checker_id(*i), { }))
|
||||
result = dependent_checker_id(*i);
|
||||
}
|
||||
|
||||
@ -116,14 +116,14 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
if (! match_package(*env, *spec, *dependent_checker_id(*g), { }))
|
||||
if (! match_package(*env, *spec, dependent_checker_id(*g), { }))
|
||||
continue;
|
||||
|
||||
bool any(false);
|
||||
for (typename C_::ConstIterator n(newly_available->begin()), n_end(newly_available->end()) ;
|
||||
n != n_end ; ++n)
|
||||
{
|
||||
if (match_package(*env, *spec, *dependent_checker_id(*n), { }))
|
||||
if (match_package(*env, *spec, dependent_checker_id(*n), { }))
|
||||
{
|
||||
any = true;
|
||||
break;
|
||||
|
@ -39,7 +39,7 @@ paludis::resolver::collect_world(
|
||||
|
||||
for (auto i(from->begin()), i_end(from->end()) ;
|
||||
i != i_end ; ++i)
|
||||
if (match_package_in_set(*env, *set, **i, { }))
|
||||
if (match_package_in_set(*env, *set, *i, { }))
|
||||
result->insert(*i);
|
||||
|
||||
return result;
|
||||
|
@ -437,7 +437,7 @@ Decider::_make_destination_for(
|
||||
{
|
||||
const std::shared_ptr<const Repository> repo(_find_repository_for(resolution, decision));
|
||||
if ((! repo->destination_interface()) ||
|
||||
(! repo->destination_interface()->is_suitable_destination_for(*decision.origin_id())))
|
||||
(! repo->destination_interface()->is_suitable_destination_for(decision.origin_id())))
|
||||
throw InternalError(PALUDIS_HERE, stringify(repo->name()) + " is not a suitable destination for "
|
||||
+ stringify(*decision.origin_id()));
|
||||
|
||||
@ -703,13 +703,13 @@ namespace
|
||||
if (constraint.spec().if_package())
|
||||
{
|
||||
if (! match_package_with_maybe_changes(*env, *constraint.spec().if_package(),
|
||||
changed_choices_for_constraint.get(), *chosen_id, changed_choices.get(), { }))
|
||||
changed_choices_for_constraint.get(), chosen_id, changed_choices.get(), { }))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (match_package_with_maybe_changes(*env, constraint.spec().if_block()->blocking(),
|
||||
changed_choices_for_constraint.get(), *chosen_id, changed_choices.get(), { }))
|
||||
changed_choices_for_constraint.get(), chosen_id, changed_choices.get(), { }))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1847,9 +1847,9 @@ Decider::_find_id_for_from(
|
||||
c != c_end ; ++c)
|
||||
{
|
||||
if ((*c)->spec().if_package())
|
||||
ok = ok && match_package(*_imp->env, *(*c)->spec().if_package(), **i, opts);
|
||||
ok = ok && match_package(*_imp->env, *(*c)->spec().if_package(), *i, opts);
|
||||
else
|
||||
ok = ok && ! match_package(*_imp->env, (*c)->spec().if_block()->blocking(), **i, opts);
|
||||
ok = ok && ! match_package(*_imp->env, (*c)->spec().if_block()->blocking(), *i, opts);
|
||||
|
||||
if (! ok)
|
||||
break;
|
||||
@ -1915,10 +1915,10 @@ Decider::_find_id_for_from(
|
||||
|
||||
if ((*c)->spec().if_package())
|
||||
ok = ok && match_package_with_maybe_changes(*_imp->env, *(*c)->spec().if_package(),
|
||||
get_changed_choices_for(*c).get(), **i, why_changed_choices->changed_choices().get(), { });
|
||||
get_changed_choices_for(*c).get(), *i, why_changed_choices->changed_choices().get(), { });
|
||||
else
|
||||
ok = ok && ! match_package_with_maybe_changes(*_imp->env, (*c)->spec().if_block()->blocking(),
|
||||
get_changed_choices_for(*c).get(), **i, why_changed_choices->changed_choices().get(), { });
|
||||
get_changed_choices_for(*c).get(), *i, why_changed_choices->changed_choices().get(), { });
|
||||
}
|
||||
|
||||
if (ok)
|
||||
@ -2214,7 +2214,7 @@ namespace
|
||||
bool is_system(false);
|
||||
for (PackageIDSequence::ConstIterator i(remove_decision.ids()->begin()), i_end(remove_decision.ids()->end()) ;
|
||||
i != i_end && ! is_system ; ++i)
|
||||
if (match_package_in_set(*env, *env->set(SetName("system")), **i, { }))
|
||||
if (match_package_in_set(*env, *env->set(SetName("system")), *i, { }))
|
||||
is_system = true;
|
||||
|
||||
if (is_system)
|
||||
@ -2315,7 +2315,7 @@ Decider::_resolve_purges()
|
||||
|
||||
/* to catch packages being purged that are also in world and not used
|
||||
* by anything else */
|
||||
if (match_package_in_set(*_imp->env, *world, **i, { }))
|
||||
if (match_package_in_set(*_imp->env, *world, *i, { }))
|
||||
continue;
|
||||
|
||||
const std::shared_ptr<ChangeByResolventSequence> used_to_use(std::make_shared<ChangeByResolventSequence>());
|
||||
|
@ -100,7 +100,7 @@ FindRepositoryForHelper::operator() (
|
||||
}
|
||||
|
||||
if ((*r)->destination_interface() &&
|
||||
(*r)->destination_interface()->is_suitable_destination_for(*decision.origin_id()))
|
||||
(*r)->destination_interface()->is_suitable_destination_for(decision.origin_id()))
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ InterestInSpecHelper::operator() (
|
||||
for (auto l(_imp->take_from_specs.begin()), l_end(_imp->take_from_specs.end()) ;
|
||||
l != l_end ; ++l)
|
||||
{
|
||||
if (match_package(*_imp->env, *l, *id, { }))
|
||||
if (match_package(*_imp->env, *l, id, { }))
|
||||
return si_take;
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ InterestInSpecHelper::operator() (
|
||||
for (auto l(_imp->ignore_from_specs.begin()), l_end(_imp->ignore_from_specs.end()) ;
|
||||
l != l_end ; ++l)
|
||||
{
|
||||
if (match_package(*_imp->env, *l, *id, { }))
|
||||
if (match_package(*_imp->env, *l, id, { }))
|
||||
return si_ignore;
|
||||
}
|
||||
|
||||
|
@ -779,80 +779,84 @@ namespace
|
||||
}
|
||||
|
||||
const std::pair<bool, std::string>
|
||||
UserKeyRequirement::requirement_met(const Environment * const, const ChangedChoices * const, const PackageID & id, const ChangedChoices * const) const
|
||||
UserKeyRequirement::requirement_met(
|
||||
const Environment * const,
|
||||
const ChangedChoices * const,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const ChangedChoices * const) const
|
||||
{
|
||||
Context context("When working out whether '" + stringify(id) + "' matches " + as_raw_string() + ":");
|
||||
Context context("When working out whether '" + stringify(*id) + "' matches " + as_raw_string() + ":");
|
||||
|
||||
const MetadataKey * key(0);
|
||||
|
||||
if (0 == _imp->key.compare(0, 3, "::$"))
|
||||
{
|
||||
if (_imp->key == "::$format")
|
||||
key = id.repository()->format_key().get();
|
||||
key = id->repository()->format_key().get();
|
||||
else if (_imp->key == "::$location")
|
||||
key = id.repository()->location_key().get();
|
||||
key = id->repository()->location_key().get();
|
||||
else if (_imp->key == "::$installed_root")
|
||||
key = id.repository()->installed_root_key().get();
|
||||
key = id->repository()->installed_root_key().get();
|
||||
else if (_imp->key == "::$accept_keywords")
|
||||
key = id.repository()->accept_keywords_key().get();
|
||||
key = id->repository()->accept_keywords_key().get();
|
||||
else if (_imp->key == "::$sync_host")
|
||||
key = id.repository()->sync_host_key().get();
|
||||
key = id->repository()->sync_host_key().get();
|
||||
}
|
||||
else if (0 == _imp->key.compare(0, 1, "$"))
|
||||
{
|
||||
if (_imp->key == "$behaviours")
|
||||
key = id.behaviours_key().get();
|
||||
key = id->behaviours_key().get();
|
||||
else if (_imp->key == "$build_dependencies")
|
||||
key = id.build_dependencies_key().get();
|
||||
key = id->build_dependencies_key().get();
|
||||
else if (_imp->key == "$choices")
|
||||
key = id.choices_key().get();
|
||||
key = id->choices_key().get();
|
||||
else if (_imp->key == "$contained_in")
|
||||
key = id.contained_in_key().get();
|
||||
key = id->contained_in_key().get();
|
||||
else if (_imp->key == "$contains")
|
||||
key = id.contains_key().get();
|
||||
key = id->contains_key().get();
|
||||
else if (_imp->key == "$contents")
|
||||
key = id.contents_key().get();
|
||||
key = id->contents_key().get();
|
||||
else if (_imp->key == "$dependencies")
|
||||
key = id.dependencies_key().get();
|
||||
key = id->dependencies_key().get();
|
||||
else if (_imp->key == "$fetches")
|
||||
key = id.fetches_key().get();
|
||||
key = id->fetches_key().get();
|
||||
else if (_imp->key == "$from_repositories")
|
||||
key = id.from_repositories_key().get();
|
||||
key = id->from_repositories_key().get();
|
||||
else if (_imp->key == "$fs_location")
|
||||
key = id.fs_location_key().get();
|
||||
key = id->fs_location_key().get();
|
||||
else if (_imp->key == "$homepage")
|
||||
key = id.homepage_key().get();
|
||||
key = id->homepage_key().get();
|
||||
else if (_imp->key == "$installed_time")
|
||||
key = id.installed_time_key().get();
|
||||
key = id->installed_time_key().get();
|
||||
else if (_imp->key == "$keywords")
|
||||
key = id.keywords_key().get();
|
||||
key = id->keywords_key().get();
|
||||
else if (_imp->key == "$long_description")
|
||||
key = id.long_description_key().get();
|
||||
key = id->long_description_key().get();
|
||||
else if (_imp->key == "$post_dependencies")
|
||||
key = id.post_dependencies_key().get();
|
||||
key = id->post_dependencies_key().get();
|
||||
else if (_imp->key == "$provide")
|
||||
key = id.provide_key().get();
|
||||
key = id->provide_key().get();
|
||||
else if (_imp->key == "$run_dependencies")
|
||||
key = id.run_dependencies_key().get();
|
||||
key = id->run_dependencies_key().get();
|
||||
else if (_imp->key == "$short_description")
|
||||
key = id.short_description_key().get();
|
||||
key = id->short_description_key().get();
|
||||
else if (_imp->key == "$slot")
|
||||
key = id.slot_key().get();
|
||||
key = id->slot_key().get();
|
||||
else if (_imp->key == "$suggested_dependencies")
|
||||
key = id.suggested_dependencies_key().get();
|
||||
key = id->suggested_dependencies_key().get();
|
||||
else if (_imp->key == "$virtual_for")
|
||||
key = id.virtual_for_key().get();
|
||||
key = id->virtual_for_key().get();
|
||||
}
|
||||
else if (0 == _imp->key.compare(0, 2, "::"))
|
||||
{
|
||||
Repository::MetadataConstIterator m(id.repository()->find_metadata(_imp->key.substr(2)));
|
||||
if (m != id.repository()->end_metadata())
|
||||
Repository::MetadataConstIterator m(id->repository()->find_metadata(_imp->key.substr(2)));
|
||||
if (m != id->repository()->end_metadata())
|
||||
key = m->get();
|
||||
}
|
||||
else
|
||||
{
|
||||
PackageID::MetadataConstIterator m(id.find_metadata(_imp->key));
|
||||
if (m != id.end_metadata())
|
||||
PackageID::MetadataConstIterator m(id->find_metadata(_imp->key));
|
||||
if (m != id->end_metadata())
|
||||
key = m->get();
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ namespace paludis
|
||||
|
||||
virtual const std::pair<bool, std::string> requirement_met(
|
||||
const Environment * const, const ChangedChoices *,
|
||||
const PackageID &, const ChangedChoices * const) const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
const std::shared_ptr<const PackageID> &, const ChangedChoices * const) const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
|
@ -430,75 +430,75 @@ namespace test_cases
|
||||
pkg3->keywords_key()->set_from_string("~d");
|
||||
|
||||
PackageDepSpec a(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS<~a]", &env, { }));
|
||||
TEST_CHECK(match_package(env, a, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, a, *pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, a, *pkg3, { }));
|
||||
TEST_CHECK(match_package(env, a, pkg1, { }));
|
||||
TEST_CHECK(match_package(env, a, pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, a, pkg3, { }));
|
||||
|
||||
PackageDepSpec b(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS<~b]", &env, { }));
|
||||
TEST_CHECK(match_package(env, b, *pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, b, *pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, b, *pkg3, { }));
|
||||
TEST_CHECK(match_package(env, b, pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, b, pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, b, pkg3, { }));
|
||||
|
||||
PackageDepSpec c(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS<~c]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, c, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, c, *pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, c, *pkg3, { }));
|
||||
TEST_CHECK(! match_package(env, c, pkg1, { }));
|
||||
TEST_CHECK(match_package(env, c, pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, c, pkg3, { }));
|
||||
|
||||
PackageDepSpec d(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS>~a]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, d, *pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, d, *pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, d, *pkg3, { }));
|
||||
TEST_CHECK(! match_package(env, d, pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, d, pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, d, pkg3, { }));
|
||||
|
||||
PackageDepSpec e(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS=~d]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, e, *pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, e, *pkg2, { }));
|
||||
TEST_CHECK(match_package(env, e, *pkg3, { }));
|
||||
TEST_CHECK(! match_package(env, e, pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, e, pkg2, { }));
|
||||
TEST_CHECK(match_package(env, e, pkg3, { }));
|
||||
|
||||
PackageDepSpec f(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS=~a ~c]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, f, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, f, *pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, f, *pkg3, { }));
|
||||
TEST_CHECK(! match_package(env, f, pkg1, { }));
|
||||
TEST_CHECK(match_package(env, f, pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, f, pkg3, { }));
|
||||
|
||||
PackageDepSpec g(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER=42]", &env, { }));
|
||||
TEST_CHECK(match_package(env, g, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, g, pkg1, { }));
|
||||
|
||||
PackageDepSpec h(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER<41]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, h, *pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, h, pkg1, { }));
|
||||
|
||||
PackageDepSpec i(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER<42]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, i, *pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, i, pkg1, { }));
|
||||
|
||||
PackageDepSpec j(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER<43]", &env, { }));
|
||||
TEST_CHECK(match_package(env, j, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, j, pkg1, { }));
|
||||
|
||||
PackageDepSpec k(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER>42]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, k, *pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, k, pkg1, { }));
|
||||
|
||||
PackageDepSpec l(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER>41]", &env, { }));
|
||||
TEST_CHECK(match_package(env, l, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, l, pkg1, { }));
|
||||
|
||||
PackageDepSpec m(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER?]", &env, { }));
|
||||
TEST_CHECK(match_package(env, m, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, m, pkg1, { }));
|
||||
|
||||
PackageDepSpec n(parse_user_package_dep_spec("cat/pkg1[.SPOON?]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, n, *pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, n, pkg1, { }));
|
||||
|
||||
PackageDepSpec o(parse_user_package_dep_spec("cat/pkg1[.$keywords<~a]", &env, { }));
|
||||
TEST_CHECK(match_package(env, o, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, o, *pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, o, *pkg3, { }));
|
||||
TEST_CHECK(match_package(env, o, pkg1, { }));
|
||||
TEST_CHECK(match_package(env, o, pkg2, { }));
|
||||
TEST_CHECK(! match_package(env, o, pkg3, { }));
|
||||
|
||||
PackageDepSpec p(parse_user_package_dep_spec("cat/pkg1[.::$format=fake]", &env, { }));
|
||||
TEST_CHECK(match_package(env, p, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, p, pkg1, { }));
|
||||
|
||||
PackageDepSpec q(parse_user_package_dep_spec("cat/pkg1[.::$format=e]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, q, *pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, q, pkg1, { }));
|
||||
|
||||
PackageDepSpec r(parse_user_package_dep_spec("cat/pkg1[.::format=fake]", &env, { }));
|
||||
TEST_CHECK(match_package(env, r, *pkg1, { }));
|
||||
TEST_CHECK(match_package(env, r, pkg1, { }));
|
||||
|
||||
PackageDepSpec s(parse_user_package_dep_spec("cat/pkg1[.::format=e]", &env, { }));
|
||||
TEST_CHECK(! match_package(env, s, *pkg1, { }));
|
||||
TEST_CHECK(! match_package(env, s, pkg1, { }));
|
||||
}
|
||||
} test_user_package_dep_spec_user_key_req;
|
||||
}
|
||||
|
@ -54,17 +54,17 @@ namespace environment
|
||||
std::shared_ptr<PackageID> pid(repo->add_version("cat", "pkg", "1.0"));
|
||||
e.package_database()->add_repository(0, repo);
|
||||
|
||||
bool PALUDIS_ATTRIBUTE((unused)) b2(e.accept_license("l", *pid));
|
||||
bool PALUDIS_ATTRIBUTE((unused)) b2(e.accept_license("l", pid));
|
||||
|
||||
std::shared_ptr<KeywordNameSet> kns(std::make_shared<KeywordNameSet>());
|
||||
kns->insert(KeywordName("keyword"));
|
||||
bool PALUDIS_ATTRIBUTE((unused)) b3(e.accept_keywords(kns, *pid));
|
||||
bool PALUDIS_ATTRIBUTE((unused)) b3(e.accept_keywords(kns, pid));
|
||||
|
||||
e.mask_for_breakage(*pid);
|
||||
e.mask_for_breakage(pid);
|
||||
|
||||
e.mask_for_user(*pid, false);
|
||||
e.mask_for_user(pid, false);
|
||||
|
||||
bool PALUDIS_ATTRIBUTE((unused)) b4(e.unmasked_by_user(*pid));
|
||||
bool PALUDIS_ATTRIBUTE((unused)) b4(e.unmasked_by_user(pid));
|
||||
|
||||
e.package_database();
|
||||
|
||||
|
@ -64,57 +64,57 @@ class EnvironmentImplementationWrapper :
|
||||
throw PythonMethodNotImplemented("EnvironmentImplementation", "populate_sets");
|
||||
}
|
||||
|
||||
virtual bool accept_license(const std::string & s, const PackageID & p) const
|
||||
virtual bool accept_license(const std::string & s, const std::shared_ptr<const PackageID> & p) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result))
|
||||
{
|
||||
Lock l(get_mutex());
|
||||
|
||||
if (bp::override f = get_override("accept_license"))
|
||||
return f(s, boost::cref(p));
|
||||
return f(s, p);
|
||||
else
|
||||
throw PythonMethodNotImplemented("EnvironmentImplementation", "accept_license");
|
||||
}
|
||||
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> & k, const PackageID & p) const
|
||||
virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> & k, const std::shared_ptr<const PackageID> & p) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result))
|
||||
{
|
||||
Lock l(get_mutex());
|
||||
|
||||
if (bp::override f = get_override("accept_keywords"))
|
||||
return f(k, boost::cref(p));
|
||||
return f(k, p);
|
||||
else
|
||||
throw PythonMethodNotImplemented("EnvironmentImplementation", "accept_keywords");
|
||||
}
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const PackageID & p) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_breakage(const std::shared_ptr<const PackageID> & p) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result))
|
||||
{
|
||||
Lock l(get_mutex());
|
||||
|
||||
if (bp::override f = get_override("mask_for_breakage"))
|
||||
return f(boost::cref(p));
|
||||
return f(p);
|
||||
else
|
||||
throw PythonMethodNotImplemented("EnvironmentImplementation", "mask_for_breakage");
|
||||
}
|
||||
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const PackageID & p, const bool b) const
|
||||
virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> & p, const bool b) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result))
|
||||
{
|
||||
Lock l(get_mutex());
|
||||
|
||||
if (bp::override f = get_override("mask_for_user"))
|
||||
return f(boost::cref(p), b);
|
||||
return f(p, b);
|
||||
else
|
||||
throw PythonMethodNotImplemented("EnvironmentImplementation", "mask_for_user");
|
||||
}
|
||||
|
||||
virtual bool unmasked_by_user(const PackageID & p) const
|
||||
virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> & p) const
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result))
|
||||
{
|
||||
Lock l(get_mutex());
|
||||
|
||||
if (bp::override f = get_override("unmasked_by_user"))
|
||||
return f(boost::cref(p));
|
||||
return f(p);
|
||||
else
|
||||
throw PythonMethodNotImplemented("EnvironmentImplementation", "unmasked_by_user");
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ namespace
|
||||
try
|
||||
{
|
||||
return value_to_environment(self)->accept_license(
|
||||
std::string(StringValuePtr(license)), *(value_to_package_id(p))) ? Qtrue : Qfalse;
|
||||
std::string(StringValuePtr(license)), (value_to_package_id(p))) ? Qtrue : Qfalse;
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
@ -151,7 +151,7 @@ namespace
|
||||
VALUE kw = rb_ary_entry(keywords, i);
|
||||
knc->insert(KeywordName(StringValuePtr(kw)));
|
||||
}
|
||||
return value_to_environment(self)->accept_keywords(knc, *value_to_package_id(p)) ? Qtrue : Qfalse;
|
||||
return value_to_environment(self)->accept_keywords(knc, value_to_package_id(p)) ? Qtrue : Qfalse;
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ namespace
|
||||
std::shared_ptr<const PackageDepSpec> spec = value_to_package_dep_spec(a);
|
||||
std::shared_ptr<const PackageID> target = value_to_package_id(t);
|
||||
MatchPackageOptions options(value_to_match_package_options(o));
|
||||
return match_package(*env, *spec, *target, options) ? Qtrue : Qfalse;
|
||||
return match_package(*env, *spec, target, options) ? Qtrue : Qfalse;
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
@ -118,7 +118,7 @@ namespace
|
||||
std::shared_ptr<const SetSpecTree> spec = value_to_dep_tree<SetSpecTree>(a);
|
||||
std::shared_ptr<const PackageID> target = value_to_package_id(t);
|
||||
MatchPackageOptions options(value_to_match_package_options(o));
|
||||
return match_package_in_set(*env, *spec, *target, options) ? Qtrue : Qfalse;
|
||||
return match_package_in_set(*env, *spec, target, options) ? Qtrue : Qfalse;
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
|
@ -317,7 +317,7 @@ namespace
|
||||
{
|
||||
const std::shared_ptr<const PackageID> maybe_id(id_for_decision_or_null(decision));
|
||||
if (maybe_id)
|
||||
return match_package(*env, spec, *maybe_id, { });
|
||||
return match_package(*env, spec, maybe_id, { });
|
||||
else
|
||||
{
|
||||
/* could also match slot here too */
|
||||
@ -1415,14 +1415,14 @@ namespace
|
||||
cout << fuc(fs_unable_unsuitable_did_not_meet(), fv<'s'>(s));
|
||||
|
||||
if ((*c)->spec().if_package() && (*c)->spec().if_package()->additional_requirements_ptr() &&
|
||||
(! match_package(*env, *(*c)->spec().if_package(), *u->package_id(), { })) &&
|
||||
match_package(*env, *(*c)->spec().if_package(), *u->package_id(), { mpo_ignore_additional_requirements }))
|
||||
(! match_package(*env, *(*c)->spec().if_package(), u->package_id(), { })) &&
|
||||
match_package(*env, *(*c)->spec().if_package(), u->package_id(), { mpo_ignore_additional_requirements }))
|
||||
{
|
||||
for (AdditionalPackageDepSpecRequirements::ConstIterator a((*c)->spec().if_package()->additional_requirements_ptr()->begin()),
|
||||
a_end((*c)->spec().if_package()->additional_requirements_ptr()->end()) ;
|
||||
a != a_end ; ++a)
|
||||
{
|
||||
const std::pair<bool, std::string> p((*a)->requirement_met(env.get(), 0, *u->package_id(), 0));
|
||||
const std::pair<bool, std::string> p((*a)->requirement_met(env.get(), 0, u->package_id(), 0));
|
||||
if (p.first)
|
||||
continue;
|
||||
|
||||
|
@ -192,7 +192,7 @@ FindCandidatesCommand::run_hosted(
|
||||
|
||||
for (auto m(matches.begin()), m_end(matches.end()) ;
|
||||
m != m_end ; ++m)
|
||||
if (match_package(*env, *m, **(*env)[selection::RequireExactlyOne(generator::Matches(
|
||||
if (match_package(*env, *m, *(*env)[selection::RequireExactlyOne(generator::Matches(
|
||||
parse_user_package_dep_spec(*s, env.get(), { }), { }))]->begin(), { }))
|
||||
{
|
||||
ok = true;
|
||||
|
@ -225,7 +225,7 @@ ReportCommand::run(
|
||||
cout << fuc(fs_package_origin_masked());
|
||||
}
|
||||
|
||||
if (insecurity && match_package_in_set(*env, *insecurity, *origin, { }))
|
||||
if (insecurity && match_package_in_set(*env, *insecurity, origin, { }))
|
||||
{
|
||||
need_heading_origin(done_heading, done_heading_origin, *i, origin);
|
||||
cout << fuc(fs_package_origin_insecure());
|
||||
|
@ -1766,7 +1766,7 @@ ConsoleInstallTask::on_additional_requirements_not_met_error(const AdditionalReq
|
||||
i_end(e.query().additional_requirements_ptr()->end()) ;
|
||||
i != i_end ; ++i)
|
||||
{
|
||||
const std::pair<bool, std::string> r((*i)->requirement_met(environment(), 0, *e.package_id(), 0));
|
||||
const std::pair<bool, std::string> r((*i)->requirement_met(environment(), 0, e.package_id(), 0));
|
||||
if (r.first)
|
||||
continue;
|
||||
output_stream() << " * " << r.second << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user