aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-04 08:19:18 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-04 08:33:00 +0100
commit6d8fa49055b5c43117d98c020187be9bfa4fb2c6 (patch)
tree1f8d90310bbac90838dce4f082fd4c8fa4e04942
parent508e7564e1d8d1de765d4d517bc899b7ef137716 (diff)
downloadpaludis-6d8fa49055b5c43117d98c020187be9bfa4fb2c6.tar.gz
paludis-6d8fa49055b5c43117d98c020187be9bfa4fb2c6.tar.xz
Use reqs to constraints
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec.cc7
-rw-r--r--paludis/additional_package_dep_spec_requirement-fwd.hh48
-rw-r--r--paludis/additional_package_dep_spec_requirement.cc38
-rw-r--r--paludis/additional_package_dep_spec_requirement.hh119
-rw-r--r--paludis/changed_choices.cc4
-rw-r--r--paludis/dep_spec.cc7
-rw-r--r--paludis/dep_spec.hh8
-rw-r--r--paludis/dep_spec_data.hh8
-rw-r--r--paludis/elike_package_dep_spec.cc3
-rw-r--r--paludis/elike_use_requirement-fwd.hh4
-rw-r--r--paludis/elike_use_requirement.cc22
-rw-r--r--paludis/elike_use_requirement_TEST.cc180
-rw-r--r--paludis/environments/portage/portage_environment.cc6
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/generator.cc2
-rw-r--r--paludis/match_package.cc7
-rw-r--r--paludis/package_dep_spec_constraint-fwd.hh4
-rw-r--r--paludis/package_dep_spec_constraint.cc5
-rw-r--r--paludis/package_dep_spec_constraint.hh76
-rw-r--r--paludis/package_dep_spec_properties.cc2
-rw-r--r--paludis/package_dep_spec_properties.hh4
-rw-r--r--paludis/paludislike_options_conf.cc4
-rw-r--r--paludis/partially_made_package_dep_spec.cc46
-rw-r--r--paludis/partially_made_package_dep_spec.hh14
-rw-r--r--paludis/resolver/decider.cc13
-rw-r--r--paludis/resolver/match_qpns.cc2
-rw-r--r--paludis/user_dep_spec.cc5
-rw-r--r--paludis/user_dep_spec_TEST.cc15
-rw-r--r--python/dep_spec.cc24
-rw-r--r--python/dep_spec.hh3
-rw-r--r--ruby/package_dep_spec_constraint.cc16
-rwxr-xr-xsrc/clients/cave/cmd_display_resolution.cc8
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc2
-rw-r--r--src/clients/cave/cmd_print_spec.cc8
34 files changed, 305 insertions, 410 deletions
diff --git a/doc/api/cplusplus/examples/example_dep_spec.cc b/doc/api/cplusplus/examples/example_dep_spec.cc
index 1c386ab..ba0f647 100644
--- a/doc/api/cplusplus/examples/example_dep_spec.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec.cc
@@ -123,12 +123,11 @@ int main(int argc, char * argv[])
spec.installable_to_repository_constraint()->name() << ", " <<
spec.installable_to_repository_constraint()->include_masked() << endl;
- if (spec.additional_requirements_ptr() && ! spec.additional_requirements_ptr()->empty())
+ if (spec.all_choice_constraints() && ! spec.all_choice_constraints()->empty())
{
- cout << " " << left << setw(24) << "Additional requirements:" << " ";
+ cout << " " << left << setw(24) << "Choice constraints:" << " ";
bool need_join(false);
- for (AdditionalPackageDepSpecRequirements::ConstIterator u(spec.additional_requirements_ptr()->begin()),
- u_end(spec.additional_requirements_ptr()->end()) ; u != u_end ; ++u)
+ for (auto u(spec.all_choice_constraints()->begin()), u_end(spec.all_choice_constraints()->end()) ; u != u_end ; ++u)
{
if (need_join)
cout << " and ";
diff --git a/paludis/additional_package_dep_spec_requirement-fwd.hh b/paludis/additional_package_dep_spec_requirement-fwd.hh
deleted file mode 100644
index d45db55..0000000
--- a/paludis/additional_package_dep_spec_requirement-fwd.hh
+++ /dev/null
@@ -1,48 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_FWD_HH 1
-
-#include <paludis/util/attributes.hh>
-#include <paludis/util/sequence-fwd.hh>
-#include <iosfwd>
-#include <memory>
-
-namespace paludis
-{
- class AdditionalPackageDepSpecRequirement;
-
- /**
- * An AdditionalPackageDepSpecRequirement can be written to an ostream.
- *
- * \ingroup g_dep_spec
- */
- std::ostream & operator<< (std::ostream &, const AdditionalPackageDepSpecRequirement &) PALUDIS_VISIBLE;
-
- /**
- * A collection of additional requirements for a PackageDepSpec.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- */
- typedef Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> > AdditionalPackageDepSpecRequirements;
-}
-
-#endif
diff --git a/paludis/additional_package_dep_spec_requirement.cc b/paludis/additional_package_dep_spec_requirement.cc
deleted file mode 100644
index e6d09a5..0000000
--- a/paludis/additional_package_dep_spec_requirement.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <paludis/additional_package_dep_spec_requirement.hh>
-#include <paludis/util/sequence-impl.hh>
-#include <paludis/util/wrapped_forward_iterator-impl.hh>
-#include <ostream>
-
-using namespace paludis;
-
-AdditionalPackageDepSpecRequirement::~AdditionalPackageDepSpecRequirement() = default;
-
-std::ostream &
-paludis::operator<< (std::ostream & s, const AdditionalPackageDepSpecRequirement & a)
-{
- s << a.as_raw_string();
- return s;
-}
-
-template class Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
-template class WrappedForwardIterator<AdditionalPackageDepSpecRequirements::ConstIteratorTag, const std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
-
diff --git a/paludis/additional_package_dep_spec_requirement.hh b/paludis/additional_package_dep_spec_requirement.hh
deleted file mode 100644
index 318e75d..0000000
--- a/paludis/additional_package_dep_spec_requirement.hh
+++ /dev/null
@@ -1,119 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_HH
-#define PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_HH 1
-
-#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/tribool-fwd.hh>
-#include <paludis/environment-fwd.hh>
-#include <paludis/changed_choices-fwd.hh>
-#include <paludis/package_id-fwd.hh>
-#include <utility>
-
-namespace paludis
-{
- /**
- * An additional requirement for a PackageDepSpec.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- */
- class PALUDIS_VISIBLE AdditionalPackageDepSpecRequirement
- {
- public:
- AdditionalPackageDepSpecRequirement() = default;
- virtual ~AdditionalPackageDepSpecRequirement();
-
- AdditionalPackageDepSpecRequirement(const AdditionalPackageDepSpecRequirement &) = delete;
- AdditionalPackageDepSpecRequirement & operator= (const AdditionalPackageDepSpecRequirement &) = delete;
-
- /**
- * Is our requirement met for a given PackageID?
- *
- * The string in the return type might be a description of why the
- * requirement was not met. Sometimes better messages can be given
- * than simply the return value of as_human_string() when the ID to
- * be matched is known. If the bool is false, the string is
- * meaningless.
- *
- * \param spec_id The PackageID the spec comes from. May be null. Used for
- * [use=] style dependencies.
- *
- * \since 0.44 returns pair<bool, std::string>
- * \since 0.51 takes optional ChangedChoices arguments
- * \since 0.58 takes id by shared_ptr
- * \since 0.58 takes spec_id
- */
- virtual const std::pair<bool, std::string> requirement_met(
- const Environment * const,
- const ChangedChoices * const maybe_changes_to_owner,
- const std::shared_ptr<const PackageID> & target_id,
- const std::shared_ptr<const PackageID> & spec_id,
- const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * If possible, indicate which choices to change to make our
- * requirement met for a particular ID.
- *
- * Verifies that the ID has the appropriate choice, and that that
- * choice isn't locked.
- *
- * Returns true for changes made, false for not possible,
- * indeterminate for nothing needs changing.
- *
- * \param spec_id The PackageID the spec comes from. May be null. Used for
- * [use=] style dependencies.
- *
- * \since 0.51
- * \since 0.55 returns Tribool
- * \since 0.58 takes spec_id
- */
- virtual Tribool accumulate_changes_to_make_met(
- const Environment * const,
- const ChangedChoices * const maybe_changes_to_owner,
- const std::shared_ptr<const PackageID> &,
- const std::shared_ptr<const PackageID> & spec_id,
- ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Return a human readable string representation of ourself.
- *
- * \param spec_id The PackageID the spec comes from. May be null. Used for
- * [use=] style dependencies.
- *
- * \since 0.58 takes spec_id
- */
- virtual const std::string as_human_string(
- const std::shared_ptr<const PackageID> & spec_id) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Return a raw string representation of ourself.
- */
- virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
- extern template class Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
- extern template class WrappedForwardIterator<AdditionalPackageDepSpecRequirements::ConstIteratorTag,
- const std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
-}
-
-#endif
diff --git a/paludis/changed_choices.cc b/paludis/changed_choices.cc
index cbad868..844346e 100644
--- a/paludis/changed_choices.cc
+++ b/paludis/changed_choices.cc
@@ -65,10 +65,10 @@ ChangedChoices::add_additional_requirements_to(PartiallyMadePackageDepSpec & spe
o != o_end ; ++o)
{
if (o->second)
- spec.additional_requirement(parse_elike_use_requirement("" + stringify(o->first) + "(-)",
+ spec.choice_constraint(parse_elike_use_requirement("" + stringify(o->first) + "(-)",
{ euro_allow_default_values }));
else
- spec.additional_requirement(parse_elike_use_requirement("-" + stringify(o->first) + "(-)",
+ spec.choice_constraint(parse_elike_use_requirement("-" + stringify(o->first) + "(-)",
{ euro_allow_default_values }));
}
}
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 47c95aa..25b60a1 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -33,7 +33,6 @@
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/options.hh>
-#include <paludis/additional_package_dep_spec_requirement.hh>
#include <paludis/dep_spec_data.hh>
#include <functional>
@@ -607,10 +606,10 @@ PackageDepSpec::installable_to_path_constraint() const
return _imp->data->installable_to_path_constraint();
}
-std::shared_ptr<const AdditionalPackageDepSpecRequirements>
-PackageDepSpec::additional_requirements_ptr() const
+const std::shared_ptr<const ChoiceConstraintSequence>
+PackageDepSpec::all_choice_constraints() const
{
- return _imp->data->additional_requirements_ptr();
+ return _imp->data->all_choice_constraints();
}
const std::shared_ptr<const KeyConstraintSequence>
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index bd7c4af..1c97f9e 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -35,7 +35,6 @@
#include <paludis/version_spec-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
-#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
#include <paludis/partially_made_package_dep_spec-fwd.hh>
#include <paludis/dep_spec_data-fwd.hh>
#include <paludis/dep_spec_annotations-fwd.hh>
@@ -408,9 +407,12 @@ namespace paludis
const std::shared_ptr<const KeyConstraintSequence> all_key_constraints() const;
/**
- * Fetch any additional requirements (may be a zero pointer).
+ * Fetch all our ChoiceConstraints, if we have any, or
+ * a null pointer otherwise.
+ *
+ * \since 0.61
*/
- std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const;
+ const std::shared_ptr<const ChoiceConstraintSequence> all_choice_constraints() const;
/**
* Access to our data.
diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh
index d3e6f68..1eb81cf 100644
--- a/paludis/dep_spec_data.hh
+++ b/paludis/dep_spec_data.hh
@@ -26,7 +26,6 @@
#include <paludis/changed_choices-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/version_operator-fwd.hh>
-#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/partially_made_package_dep_spec-fwd.hh>
#include <paludis/environment-fwd.hh>
@@ -208,9 +207,12 @@ namespace paludis
virtual const std::shared_ptr<const KeyConstraintSequence> all_key_constraints() const = 0;
/**
- * Fetch the additional requirements (may be a zero pointer).
+ * Fetch all our ChoiceConstraints, if we have any, or
+ * a null pointer otherwise.
+ *
+ * \since 0.61
*/
- virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const = 0;
+ virtual const std::shared_ptr<const ChoiceConstraintSequence> all_choice_constraints() const = 0;
/**
* Fetch options if we're being used to construct a new PartiallyMadePackageDepSpec.
diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc
index 2266317..35d47f5 100644
--- a/paludis/elike_package_dep_spec.cc
+++ b/paludis/elike_package_dep_spec.cc
@@ -179,8 +179,7 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial
if (options[epdso_strict_parsing])
euro += euro_strict_parsing;
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req(parse_elike_use_requirement(flag, euro));
- result.additional_requirement(req);
+ result.choice_constraint(parse_elike_use_requirement(flag, euro));
break;
};
diff --git a/paludis/elike_use_requirement-fwd.hh b/paludis/elike_use_requirement-fwd.hh
index abc7f7a..22c0260 100644
--- a/paludis/elike_use_requirement-fwd.hh
+++ b/paludis/elike_use_requirement-fwd.hh
@@ -24,7 +24,7 @@
#include <paludis/util/options-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
-#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
+#include <paludis/package_dep_spec_constraint-fwd.hh>
#include <iosfwd>
#include <string>
#include <memory>
@@ -37,7 +37,7 @@ namespace paludis
typedef Options<ELikeUseRequirementOption> ELikeUseRequirementOptions;
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> parse_elike_use_requirement(
+ std::shared_ptr<const ChoiceConstraint> parse_elike_use_requirement(
const std::string &, const ELikeUseRequirementOptions &)
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
}
diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc
index e2929fa..422baf1 100644
--- a/paludis/elike_use_requirement.cc
+++ b/paludis/elike_use_requirement.cc
@@ -18,13 +18,6 @@
*/
#include <paludis/elike_use_requirement.hh>
-#include <paludis/util/options.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/join.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/tribool.hh>
#include <paludis/dep_spec.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
@@ -32,7 +25,16 @@
#include <paludis/metadata_key.hh>
#include <paludis/choice.hh>
#include <paludis/changed_choices.hh>
-#include <paludis/additional_package_dep_spec_requirement.hh>
+#include <paludis/package_dep_spec_constraint.hh>
+
+#include <paludis/util/options.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/tribool.hh>
+
#include <vector>
#include <functional>
#include <algorithm>
@@ -498,7 +500,7 @@ namespace
};
class UseRequirements :
- public AdditionalPackageDepSpecRequirement
+ public ChoiceConstraint
{
private:
typedef std::vector<std::shared_ptr<const UseRequirement> > Reqs;
@@ -809,7 +811,7 @@ ELikeUseRequirementError::ELikeUseRequirementError(const std::string & s, const
{
}
-std::shared_ptr<const AdditionalPackageDepSpecRequirement>
+std::shared_ptr<const ChoiceConstraint>
paludis::parse_elike_use_requirement(const std::string & s,
const ELikeUseRequirementOptions & options)
{
diff --git a/paludis/elike_use_requirement_TEST.cc b/paludis/elike_use_requirement_TEST.cc
index f0872dd..ddfc7dd 100644
--- a/paludis/elike_use_requirement_TEST.cc
+++ b/paludis/elike_use_requirement_TEST.cc
@@ -21,7 +21,7 @@
#include <paludis/dep_spec.hh>
#include <paludis/elike_use_requirement.hh>
#include <paludis/choice.hh>
-#include <paludis/additional_package_dep_spec_requirement.hh>
+#include <paludis/package_dep_spec_constraint.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -68,25 +68,25 @@ TEST(ELikeUseRequirements, Simple)
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "enabled disabled");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("enabled", { euro_strict_parsing }));
EXPECT_EQ("[enabled]", req1->as_raw_string());
EXPECT_EQ("Flag 'enabled' enabled", req1->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(req1->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("disabled", { euro_strict_parsing }));
EXPECT_EQ("[disabled]", req2->as_raw_string());
EXPECT_EQ("Flag 'disabled' enabled", req2->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(! req2->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
+ std::shared_ptr<const ChoiceConstraint> req3(
parse_elike_use_requirement("-enabled", { euro_strict_parsing }));
EXPECT_EQ("[-enabled]", req3->as_raw_string());
EXPECT_EQ("Flag 'enabled' disabled", req3->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
+ std::shared_ptr<const ChoiceConstraint> req4(
parse_elike_use_requirement("-disabled", { euro_strict_parsing }));
EXPECT_EQ("[-disabled]", req4->as_raw_string());
EXPECT_EQ("Flag 'disabled' disabled", req4->as_human_string(make_null_shared_ptr()));
@@ -104,25 +104,25 @@ TEST(ELikeUseRequirements, Portage)
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "enabled disabled");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("enabled", { euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[enabled]", req1->as_raw_string());
EXPECT_EQ("Flag 'enabled' enabled", req1->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(req1->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("disabled", { euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[disabled]", req2->as_raw_string());
EXPECT_EQ("Flag 'disabled' enabled", req2->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(! req2->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
+ std::shared_ptr<const ChoiceConstraint> req3(
parse_elike_use_requirement("-enabled", { euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[-enabled]", req3->as_raw_string());
EXPECT_EQ("Flag 'enabled' disabled", req3->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
+ std::shared_ptr<const ChoiceConstraint> req4(
parse_elike_use_requirement("-disabled", { euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[-disabled]", req4->as_raw_string());
EXPECT_EQ("Flag 'disabled' disabled", req4->as_human_string(make_null_shared_ptr()));
@@ -140,31 +140,31 @@ TEST(ELikeUseRequirements, Multiple)
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "enabled disabled");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("enabled,-disabled", { euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[enabled,-disabled]", req1->as_raw_string());
EXPECT_EQ("Flag 'enabled' enabled; Flag 'disabled' disabled", req1->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(req1->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("enabled,disabled", { euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[enabled,disabled]", req2->as_raw_string());
EXPECT_EQ("Flag 'enabled' enabled; Flag 'disabled' enabled", req2->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(! req2->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
+ std::shared_ptr<const ChoiceConstraint> req3(
parse_elike_use_requirement("-enabled,-disabled", { euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[-enabled,-disabled]", req3->as_raw_string());
EXPECT_EQ("Flag 'enabled' disabled; Flag 'disabled' disabled", req3->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
+ std::shared_ptr<const ChoiceConstraint> req4(
parse_elike_use_requirement("enabled,-disabled,-enabled", { euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[enabled,-disabled,-enabled]", req4->as_raw_string());
EXPECT_EQ("Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' disabled", req4->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(! req4->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
+ std::shared_ptr<const ChoiceConstraint> req5(
parse_elike_use_requirement("enabled,-disabled,enabled", { euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[enabled,-disabled,enabled]", req5->as_raw_string());
EXPECT_EQ("Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' enabled", req5->as_human_string(make_null_shared_ptr()));
@@ -184,84 +184,84 @@ TEST(ELikeUseRequirements, Complex)
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
set_conditionals(id2, "pkgname");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
+ std::shared_ptr<const ChoiceConstraint> req3(
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[-pkgname?]", req3->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'", req3->as_human_string(id));
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req3->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
+ std::shared_ptr<const ChoiceConstraint> req4(
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[-pkgname?]", req4->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'", req4->as_human_string(id2));
EXPECT_TRUE(req4->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req4->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
+ std::shared_ptr<const ChoiceConstraint> req5(
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[pkgname!?]", req5->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'", req5->as_human_string(id));
EXPECT_TRUE(req5->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req5->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req6(
+ std::shared_ptr<const ChoiceConstraint> req6(
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[pkgname!?]", req6->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'", req6->as_human_string(id2));
EXPECT_TRUE(req6->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(! req6->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
+ std::shared_ptr<const ChoiceConstraint> req7(
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[-pkgname!?]", req7->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
+ std::shared_ptr<const ChoiceConstraint> req8(
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[-pkgname!?]", req8->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
+ std::shared_ptr<const ChoiceConstraint> req9(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
+ std::shared_ptr<const ChoiceConstraint> req10(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
+ std::shared_ptr<const ChoiceConstraint> req11(
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[pkgname!=]", req11->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
+ std::shared_ptr<const ChoiceConstraint> req12(
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_strict_parsing }));
EXPECT_EQ("[pkgname!=]", req12->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
@@ -282,56 +282,56 @@ TEST(ELikeUseRequirements, ComplexPortage)
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
set_conditionals(id2, "pkgname");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
+ std::shared_ptr<const ChoiceConstraint> req7(
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[!pkgname?]", req7->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
+ std::shared_ptr<const ChoiceConstraint> req8(
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[!pkgname?]", req8->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
+ std::shared_ptr<const ChoiceConstraint> req9(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
+ std::shared_ptr<const ChoiceConstraint> req10(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
+ std::shared_ptr<const ChoiceConstraint> req11(
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[!pkgname=]", req11->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
+ std::shared_ptr<const ChoiceConstraint> req12(
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
EXPECT_EQ("[!pkgname=]", req12->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
@@ -352,112 +352,112 @@ TEST(ELikeUseRequirements, Both)
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
set_conditionals(id2, "pkgname");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
+ std::shared_ptr<const ChoiceConstraint> req7(
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[!pkgname?]", req7->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
+ std::shared_ptr<const ChoiceConstraint> req8(
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[!pkgname?]", req8->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
+ std::shared_ptr<const ChoiceConstraint> req9(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
+ std::shared_ptr<const ChoiceConstraint> req10(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
+ std::shared_ptr<const ChoiceConstraint> req11(
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[!pkgname=]", req11->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
+ std::shared_ptr<const ChoiceConstraint> req12(
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[!pkgname=]", req12->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
EXPECT_TRUE(req12->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(! req12->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
+ std::shared_ptr<const ChoiceConstraint> req13(
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[-pkgname?]", req13->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'", req13->as_human_string(id));
EXPECT_TRUE(! req13->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req13->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
+ std::shared_ptr<const ChoiceConstraint> req14(
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[-pkgname?]", req14->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'", req14->as_human_string(id2));
EXPECT_TRUE(req14->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req14->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
+ std::shared_ptr<const ChoiceConstraint> req15(
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[pkgname!?]", req15->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'", req15->as_human_string(id));
EXPECT_TRUE(req15->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req15->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
+ std::shared_ptr<const ChoiceConstraint> req16(
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[pkgname!?]", req16->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'", req16->as_human_string(id2));
EXPECT_TRUE(req16->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(! req16->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
+ std::shared_ptr<const ChoiceConstraint> req17(
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[-pkgname!?]", req17->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req17->as_human_string(id));
EXPECT_TRUE(req17->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req17->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
+ std::shared_ptr<const ChoiceConstraint> req18(
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[-pkgname!?]", req18->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req18->as_human_string(id2));
EXPECT_TRUE(! req18->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req18->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
+ std::shared_ptr<const ChoiceConstraint> req19(
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[pkgname!=]", req19->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req19->as_human_string(id));
EXPECT_TRUE(! req19->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req19->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
+ std::shared_ptr<const ChoiceConstraint> req20(
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
EXPECT_EQ("[pkgname!=]", req20->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req20->as_human_string(id2));
@@ -556,112 +556,112 @@ TEST(ELikeUseRequirements, ComplexNonStrict)
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
set_conditionals(id2, "pkgname");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps }));
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps }));
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
+ std::shared_ptr<const ChoiceConstraint> req7(
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps }));
EXPECT_EQ("[!pkgname?]", req7->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
+ std::shared_ptr<const ChoiceConstraint> req8(
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps }));
EXPECT_EQ("[!pkgname?]", req8->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
+ std::shared_ptr<const ChoiceConstraint> req9(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps }));
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
+ std::shared_ptr<const ChoiceConstraint> req10(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps }));
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
+ std::shared_ptr<const ChoiceConstraint> req11(
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps }));
EXPECT_EQ("[!pkgname=]", req11->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
+ std::shared_ptr<const ChoiceConstraint> req12(
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps }));
EXPECT_EQ("[!pkgname=]", req12->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
EXPECT_TRUE(req12->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(! req12->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
+ std::shared_ptr<const ChoiceConstraint> req13(
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps }));
EXPECT_EQ("[-pkgname?]", req13->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'", req13->as_human_string(id));
EXPECT_TRUE(! req13->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req13->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
+ std::shared_ptr<const ChoiceConstraint> req14(
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps }));
EXPECT_EQ("[-pkgname?]", req14->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'", req14->as_human_string(id2));
EXPECT_TRUE(req14->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req14->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
+ std::shared_ptr<const ChoiceConstraint> req15(
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps }));
EXPECT_EQ("[pkgname!?]", req15->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'", req15->as_human_string(id));
EXPECT_TRUE(req15->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req15->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
+ std::shared_ptr<const ChoiceConstraint> req16(
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps }));
EXPECT_EQ("[pkgname!?]", req16->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'", req16->as_human_string(id2));
EXPECT_TRUE(req16->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(! req16->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
+ std::shared_ptr<const ChoiceConstraint> req17(
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps }));
EXPECT_EQ("[-pkgname!?]", req17->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req17->as_human_string(id));
EXPECT_TRUE(req17->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req17->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
+ std::shared_ptr<const ChoiceConstraint> req18(
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps }));
EXPECT_EQ("[-pkgname!?]", req18->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req18->as_human_string(id2));
EXPECT_TRUE(! req18->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req18->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
+ std::shared_ptr<const ChoiceConstraint> req19(
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps }));
EXPECT_EQ("[pkgname!=]", req19->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req19->as_human_string(id));
EXPECT_TRUE(! req19->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req19->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
+ std::shared_ptr<const ChoiceConstraint> req20(
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps }));
EXPECT_EQ("[pkgname!=]", req20->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req20->as_human_string(id2));
@@ -682,112 +682,112 @@ TEST(ELikeUseRequirements, PortageNonStrict)
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
set_conditionals(id2, "pkgname");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
+ std::shared_ptr<const ChoiceConstraint> req7(
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[!pkgname?]", req7->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
+ std::shared_ptr<const ChoiceConstraint> req8(
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[!pkgname?]", req8->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
+ std::shared_ptr<const ChoiceConstraint> req9(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
+ std::shared_ptr<const ChoiceConstraint> req10(
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
+ std::shared_ptr<const ChoiceConstraint> req11(
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[!pkgname=]", req11->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
+ std::shared_ptr<const ChoiceConstraint> req12(
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[!pkgname=]", req12->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
EXPECT_TRUE(req12->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(! req12->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
+ std::shared_ptr<const ChoiceConstraint> req13(
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[-pkgname?]", req13->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'", req13->as_human_string(id));
EXPECT_TRUE(! req13->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req13->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
+ std::shared_ptr<const ChoiceConstraint> req14(
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[-pkgname?]", req14->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'", req14->as_human_string(id2));
EXPECT_TRUE(req14->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req14->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
+ std::shared_ptr<const ChoiceConstraint> req15(
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[pkgname!?]", req15->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'", req15->as_human_string(id));
EXPECT_TRUE(req15->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req15->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
+ std::shared_ptr<const ChoiceConstraint> req16(
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[pkgname!?]", req16->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'", req16->as_human_string(id2));
EXPECT_TRUE(req16->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(! req16->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
+ std::shared_ptr<const ChoiceConstraint> req17(
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[-pkgname!?]", req17->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req17->as_human_string(id));
EXPECT_TRUE(req17->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req17->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
+ std::shared_ptr<const ChoiceConstraint> req18(
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[-pkgname!?]", req18->as_raw_string());
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req18->as_human_string(id2));
EXPECT_TRUE(! req18->requirement_met(&env, 0, id, id2, 0).first);
EXPECT_TRUE(req18->requirement_met(&env, 0, id2, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
+ std::shared_ptr<const ChoiceConstraint> req19(
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[pkgname!=]", req19->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req19->as_human_string(id));
EXPECT_TRUE(! req19->requirement_met(&env, 0, id, id, 0).first);
EXPECT_TRUE(req19->requirement_met(&env, 0, id2, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
+ std::shared_ptr<const ChoiceConstraint> req20(
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_portage_syntax }));
EXPECT_EQ("[pkgname!=]", req20->as_raw_string());
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req20->as_human_string(id2));
@@ -806,25 +806,25 @@ TEST(ELikeUseRequirements, Defaults)
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "enabled disabled");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("missing(+)", { euro_allow_default_values, euro_strict_parsing }));
EXPECT_EQ("[missing(+)]", req1->as_raw_string());
EXPECT_EQ("Flag 'missing' enabled, assuming enabled if missing", req1->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(req1->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("missing(-)", { euro_allow_default_values, euro_strict_parsing }));
EXPECT_EQ("[missing(-)]", req2->as_raw_string());
EXPECT_EQ("Flag 'missing' enabled, assuming disabled if missing", req2->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(! req2->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
+ std::shared_ptr<const ChoiceConstraint> req3(
parse_elike_use_requirement("-missing(+)", { euro_allow_default_values, euro_strict_parsing }));
EXPECT_EQ("[-missing(+)]", req3->as_raw_string());
EXPECT_EQ("Flag 'missing' disabled, assuming enabled if missing", req3->as_human_string(make_null_shared_ptr()));
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
+ std::shared_ptr<const ChoiceConstraint> req4(
parse_elike_use_requirement("-missing(-)", { euro_allow_default_values, euro_strict_parsing }));
EXPECT_EQ("[-missing(-)]", req4->as_raw_string());
EXPECT_EQ("Flag 'missing' disabled, assuming disabled if missing", req4->as_human_string(make_null_shared_ptr()));
@@ -842,12 +842,12 @@ TEST(ELikeUseRequirements, PrefixStar)
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
set_conditionals(id, "foo:enabled foo:disabled");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("foo:*", { euro_allow_default_values, euro_allow_self_deps }));
EXPECT_EQ("[foo:*]", req1->as_raw_string());
EXPECT_TRUE(! req1->requirement_met(&env, 0, id, id, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("foo:*=", { euro_allow_default_values, euro_allow_self_deps }));
EXPECT_EQ("[foo:*=]", req2->as_raw_string());
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id, 0).first);
@@ -868,13 +868,13 @@ TEST(ELikeUseRequirements, QuestionDefaults)
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "pkg2", "1"));
set_conditionals(id2, "foo:enabled foo:disabled bar:enabled bar:disabled");
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
+ std::shared_ptr<const ChoiceConstraint> req1(
parse_elike_use_requirement("foo:*(?)=", { euro_allow_default_values, euro_allow_self_deps, euro_allow_default_question_values }));
EXPECT_EQ("[foo:*(?)=]", req1->as_raw_string());
EXPECT_TRUE(req1->requirement_met(&env, 0, id2, id2, 0).first);
EXPECT_TRUE(req1->requirement_met(&env, 0, id1, id2, 0).first);
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
+ std::shared_ptr<const ChoiceConstraint> req2(
parse_elike_use_requirement("bar:*(?)=", { euro_allow_default_values, euro_allow_self_deps, euro_allow_default_question_values }));
EXPECT_EQ("[bar:*(?)=]", req2->as_raw_string());
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 414ad4c..d24557d 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -360,7 +360,7 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
template<typename I_>
void
-PortageEnvironment::_load_atom_file(const FSPath & f, I_ i, const std::string & def_value, const bool reject_additional)
+PortageEnvironment::_load_atom_file(const FSPath & f, I_ i, const std::string & def_value, const bool reject_choices)
{
using namespace std::placeholders;
@@ -372,7 +372,7 @@ PortageEnvironment::_load_atom_file(const FSPath & f, I_ i, const std::string &
if (f.stat().is_directory())
{
std::for_each(FSIterator(f, { }), FSIterator(), std::bind(
- &PortageEnvironment::_load_atom_file<I_>, this, _1, i, def_value, reject_additional));
+ &PortageEnvironment::_load_atom_file<I_>, this, _1, i, def_value, reject_choices));
}
else
{
@@ -388,7 +388,7 @@ PortageEnvironment::_load_atom_file(const FSPath & f, I_ i, const std::string &
std::shared_ptr<PackageDepSpec> p(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(
tokens.at(0), this, UserPackageDepSpecOptions() + updso_no_disambiguation)));
- if (reject_additional && p->additional_requirements_ptr())
+ if (reject_choices && p->all_choice_constraints() && ! p->all_choice_constraints()->empty())
{
Log::get_instance()->message("portage_environment.bad_spec", ll_warning, lc_context)
<< "Dependency specification '" << stringify(*p)
diff --git a/paludis/files.m4 b/paludis/files.m4
index ab86ca3..85b9213 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -12,7 +12,6 @@ add(`about', `hh', `gtest')
add(`about_metadata', `hh', `cc', `fwd')
add(`action', `hh', `cc', `fwd', `se')
add(`action_names', `hh', `cc', `fwd')
-add(`additional_package_dep_spec_requirement', `hh', `cc', `fwd')
add(`always_enabled_dependency_label', `hh', `cc', `fwd')
add(`broken_linkage_configuration', `hh', `cc', `gtest', `testscript')
add(`broken_linkage_finder', `hh', `cc')
diff --git a/paludis/generator.cc b/paludis/generator.cc
index 4f40639..bbee962 100644
--- a/paludis/generator.cc
+++ b/paludis/generator.cc
@@ -305,9 +305,9 @@ namespace
const RepositoryContentMayExcludes & x) const
{
if (package_dep_spec_has_properties(spec, make_named_values<PackageDepSpecProperties>(
- n::has_additional_requirements() = indeterminate,
n::has_any_slot_requirement() = indeterminate,
n::has_category_name_part() = indeterminate,
+ n::has_choice_requirements() = indeterminate,
n::has_exact_slot_requirement() = indeterminate,
n::has_from_repository() = indeterminate,
n::has_in_repository() = false,
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index 5b40768..2001ec4 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -25,7 +25,6 @@
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/repository.hh>
-#include <paludis/additional_package_dep_spec_requirement.hh>
#include <paludis/package_dep_spec_constraint.hh>
#include <paludis/contents.hh>
#include <paludis/version_operator.hh>
@@ -171,10 +170,10 @@ paludis::match_package_with_maybe_changes(
if (! options[mpo_ignore_additional_requirements])
{
- if (spec.additional_requirements_ptr())
+ if (spec.all_choice_constraints())
{
- for (AdditionalPackageDepSpecRequirements::ConstIterator u(spec.additional_requirements_ptr()->begin()),
- u_end(spec.additional_requirements_ptr()->end()) ; u != u_end ; ++u)
+ for (auto u(spec.all_choice_constraints()->begin()), u_end(spec.all_choice_constraints()->end()) ;
+ u != u_end ; ++u)
if (! (*u)->requirement_met(&env, maybe_changes_to_owner, id, from_id, maybe_changes_to_target).first)
return false;
}
diff --git a/paludis/package_dep_spec_constraint-fwd.hh b/paludis/package_dep_spec_constraint-fwd.hh
index 5dabea4..fecc8fa 100644
--- a/paludis/package_dep_spec_constraint-fwd.hh
+++ b/paludis/package_dep_spec_constraint-fwd.hh
@@ -69,6 +69,10 @@ namespace paludis
typedef Sequence<std::shared_ptr<const KeyConstraint> > KeyConstraintSequence;
+ class ChoiceConstraint;
+
+ typedef Sequence<std::shared_ptr<const ChoiceConstraint> > ChoiceConstraintSequence;
+
#include <paludis/package_dep_spec_constraint-se.hh>
}
diff --git a/paludis/package_dep_spec_constraint.cc b/paludis/package_dep_spec_constraint.cc
index 226da49..f147316 100644
--- a/paludis/package_dep_spec_constraint.cc
+++ b/paludis/package_dep_spec_constraint.cc
@@ -900,3 +900,8 @@ template const std::shared_ptr<const KeyConstraint> Pool<KeyConstraint>::create(
template class Sequence<std::shared_ptr<const KeyConstraint> >;
template class WrappedForwardIterator<Sequence<std::shared_ptr<const KeyConstraint> >::ConstIteratorTag, const std::shared_ptr<const KeyConstraint> >;
+ChoiceConstraint::ChoiceConstraint() = default;
+
+template class Sequence<std::shared_ptr<const ChoiceConstraint> >;
+template class WrappedForwardIterator<Sequence<std::shared_ptr<const ChoiceConstraint> >::ConstIteratorTag, const std::shared_ptr<const ChoiceConstraint> >;
+
diff --git a/paludis/package_dep_spec_constraint.hh b/paludis/package_dep_spec_constraint.hh
index 10bf96b..34519c7 100644
--- a/paludis/package_dep_spec_constraint.hh
+++ b/paludis/package_dep_spec_constraint.hh
@@ -26,6 +26,7 @@
#include <paludis/version_spec-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
+#include <paludis/changed_choices-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/pool.hh>
@@ -33,6 +34,7 @@
#include <paludis/util/type_list.hh>
#include <paludis/util/fs_path.hh>
#include <paludis/util/pimp.hh>
+#include <paludis/util/tribool-fwd.hh>
namespace paludis
{
@@ -49,7 +51,8 @@ namespace paludis
InstallableToRepositoryConstraint,
AnySlotConstraint,
ExactSlotConstraint,
- KeyConstraint
+ KeyConstraint,
+ ChoiceConstraint
>::Type>
{
public:
@@ -299,6 +302,77 @@ namespace paludis
const std::shared_ptr<const PackageID> & id) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class PALUDIS_VISIBLE ChoiceConstraint :
+ public PackageDepSpecConstraint,
+ public ImplementAcceptMethods<PackageDepSpecConstraint, ChoiceConstraint>
+ {
+ private:
+ ChoiceConstraint(const ChoiceConstraint &) = delete;
+
+ protected:
+ ChoiceConstraint();
+
+ public:
+ /**
+ * Is our requirement met for a given PackageID?
+ *
+ * The string in the return type might be a description of why the
+ * requirement was not met. Sometimes better messages can be given
+ * than simply the return value of as_human_string() when the ID to
+ * be matched is known. If the bool is false, the string is
+ * meaningless.
+ *
+ * \param spec_id The PackageID the spec comes from. May be null. Used for
+ * [use=] style dependencies.
+ *
+ * \since 0.61 is in ChoiceConstraint
+ */
+ virtual const std::pair<bool, std::string> requirement_met(
+ const Environment * const,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const std::shared_ptr<const PackageID> & target_id,
+ const std::shared_ptr<const PackageID> & spec_id,
+ const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * If possible, indicate which choices to change to make our
+ * requirement met for a particular ID.
+ *
+ * Verifies that the ID has the appropriate choice, and that that
+ * choice isn't locked.
+ *
+ * Returns true for changes made, false for not possible,
+ * indeterminate for nothing needs changing.
+ *
+ * \param spec_id The PackageID the spec comes from. May be null. Used for
+ * [use=] style dependencies.
+ *
+ * \since 0.61 is in ChoiceConstraint
+ */
+ virtual Tribool accumulate_changes_to_make_met(
+ const Environment * const,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const std::shared_ptr<const PackageID> &,
+ const std::shared_ptr<const PackageID> & spec_id,
+ ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Return a human readable string representation of ourself.
+ *
+ * \param spec_id The PackageID the spec comes from. May be null. Used for
+ * [use=] style dependencies.
+ *
+ * \since 0.61 is in ChoiceConstraint
+ */
+ virtual const std::string as_human_string(
+ const std::shared_ptr<const PackageID> & spec_id) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Return a raw string representation of ourself.
+ */
+ virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
extern template class Pool<NameConstraint>;
extern template class Pool<PackageNamePartConstraint>;
extern template class Pool<CategoryNamePartConstraint>;
diff --git a/paludis/package_dep_spec_properties.cc b/paludis/package_dep_spec_properties.cc
index 0c00363..62a8563 100644
--- a/paludis/package_dep_spec_properties.cc
+++ b/paludis/package_dep_spec_properties.cc
@@ -41,7 +41,7 @@ paludis::package_dep_spec_has_properties(const PackageDepSpec & spec, const Pack
{
bool result(true);
- result = result && check(bool(spec.additional_requirements_ptr()) && ! spec.additional_requirements_ptr()->empty(), properties.has_additional_requirements());
+ result = result && check(bool(spec.all_choice_constraints()) && ! spec.all_choice_constraints()->empty(), properties.has_choice_requirements());
result = result && check(bool(spec.category_name_part_constraint()), properties.has_category_name_part());
result = result && check(bool(spec.from_repository_constraint()), properties.has_from_repository());
result = result && check(bool(spec.all_key_constraints()) && ! spec.all_key_constraints()->empty(), properties.has_key_requirements());
diff --git a/paludis/package_dep_spec_properties.hh b/paludis/package_dep_spec_properties.hh
index 4e877b4..093b584 100644
--- a/paludis/package_dep_spec_properties.hh
+++ b/paludis/package_dep_spec_properties.hh
@@ -28,9 +28,9 @@ namespace paludis
{
namespace n
{
- typedef Name<struct name_has_additional_requirements> has_additional_requirements;
typedef Name<struct name_has_any_slot_requirement> has_any_slot_requirement;
typedef Name<struct name_has_category_name_part> has_category_name_part;
+ typedef Name<struct name_has_choice_requirements> has_choice_requirements;
typedef Name<struct name_has_exact_slot_requirement> has_exact_slot_requirement;
typedef Name<struct name_has_from_repository> has_from_repository;
typedef Name<struct name_has_in_repository> has_in_repository;
@@ -52,9 +52,9 @@ namespace paludis
*/
struct PackageDepSpecProperties
{
- NamedValue<n::has_additional_requirements, Tribool> has_additional_requirements;
NamedValue<n::has_any_slot_requirement, Tribool> has_any_slot_requirement;
NamedValue<n::has_category_name_part, Tribool> has_category_name_part;
+ NamedValue<n::has_choice_requirements, Tribool> has_choice_requirements;
NamedValue<n::has_exact_slot_requirement, Tribool> has_exact_slot_requirement;
NamedValue<n::has_from_repository, Tribool> has_from_repository;
NamedValue<n::has_in_repository, Tribool> has_in_repository;
diff --git a/paludis/paludislike_options_conf.cc b/paludis/paludislike_options_conf.cc
index 004a6e1..52b47d3 100644
--- a/paludis/paludislike_options_conf.cc
+++ b/paludis/paludislike_options_conf.cc
@@ -204,7 +204,7 @@ PaludisLikeOptionsConf::add_file(const FSPath & f)
tokens.at(0), _imp->params.environment(),
{ updso_allow_wildcards, updso_no_disambiguation, updso_throw_if_set })));
- if (d->additional_requirements_ptr())
+ if (d->all_choice_constraints() && ! d->all_choice_constraints()->empty())
{
Log::get_instance()->message("paludislike_options_conf.bad_spec", ll_warning, lc_context)
<< "Dependency specification '" << stringify(*d)
@@ -341,9 +341,9 @@ namespace
bool match_anything(const PackageDepSpec & spec)
{
return package_dep_spec_has_properties(spec, make_named_values<PackageDepSpecProperties>(
- n::has_additional_requirements() = false,
n::has_any_slot_requirement() = indeterminate,
n::has_category_name_part() = false,
+ n::has_choice_requirements() = false,
n::has_exact_slot_requirement() = false,
n::has_from_repository() = false,
n::has_in_repository() = false,
diff --git a/paludis/partially_made_package_dep_spec.cc b/paludis/partially_made_package_dep_spec.cc
index 2624564..1153a91 100644
--- a/paludis/partially_made_package_dep_spec.cc
+++ b/paludis/partially_made_package_dep_spec.cc
@@ -18,7 +18,6 @@
*/
#include <paludis/partially_made_package_dep_spec.hh>
-#include <paludis/additional_package_dep_spec_requirement.hh>
#include <paludis/dep_spec_data.hh>
#include <paludis/package_dep_spec_constraint.hh>
#include <paludis/version_operator.hh>
@@ -63,7 +62,7 @@ namespace
std::shared_ptr<const InstalledAtPathConstraint> installed_at_path;
std::shared_ptr<const InstallableToPathConstraint> installable_to_path;
std::shared_ptr<KeyConstraintSequence> all_keys;
- std::shared_ptr<AdditionalPackageDepSpecRequirements> additional_requirements;
+ std::shared_ptr<ChoiceConstraintSequence> all_choices;
PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec_v;
PartiallyMadePackageDepSpecData(const PartiallyMadePackageDepSpecOptions & o) :
@@ -86,7 +85,7 @@ namespace
installed_at_path(other.installed_at_path_constraint()),
installable_to_path(other.installable_to_path_constraint()),
all_keys(other.all_key_constraints() ? new KeyConstraintSequence : 0),
- additional_requirements(other.additional_requirements_ptr() ? new AdditionalPackageDepSpecRequirements : 0),
+ all_choices(other.all_choice_constraints() ? new ChoiceConstraintSequence : 0),
options_for_partially_made_package_dep_spec_v(other.options_for_partially_made_package_dep_spec())
{
if (all_versions)
@@ -97,9 +96,9 @@ namespace
std::copy(other.all_key_constraints()->begin(), other.all_key_constraints()->end(),
all_keys->back_inserter());
- if (additional_requirements)
- std::copy(other.additional_requirements_ptr()->begin(), other.additional_requirements_ptr()->end(),
- additional_requirements->back_inserter());
+ if (all_choices)
+ std::copy(other.all_choice_constraints()->begin(), other.all_choice_constraints()->end(),
+ all_choices->back_inserter());
}
PartiallyMadePackageDepSpecData(const PartiallyMadePackageDepSpecData & other) :
@@ -116,7 +115,7 @@ namespace
installed_at_path(other.installed_at_path),
installable_to_path(other.installable_to_path),
all_keys(other.all_keys),
- additional_requirements(other.additional_requirements),
+ all_choices(other.all_choices),
options_for_partially_made_package_dep_spec_v(other.options_for_partially_made_package_dep_spec_v)
{
}
@@ -295,9 +294,8 @@ namespace
}
}
- if (additional_requirements_ptr())
- for (AdditionalPackageDepSpecRequirements::ConstIterator u(additional_requirements_ptr()->begin()),
- u_end(additional_requirements_ptr()->end()) ; u != u_end ; ++u)
+ if (all_choice_constraints())
+ for (auto u(all_choice_constraints()->begin()), u_end(all_choice_constraints()->end()) ; u != u_end ; ++u)
s << (*u)->as_raw_string();
if (all_key_constraints())
@@ -377,14 +375,14 @@ namespace
return installable_to_path;
}
- virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const
+ virtual const std::shared_ptr<const KeyConstraintSequence> all_key_constraints() const
{
- return additional_requirements;
+ return all_keys;
}
- virtual const std::shared_ptr<const KeyConstraintSequence> all_key_constraints() const
+ virtual const std::shared_ptr<const ChoiceConstraintSequence> all_choice_constraints() const
{
- return all_keys;
+ return all_choices;
}
virtual const PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec() const
@@ -616,27 +614,27 @@ PartiallyMadePackageDepSpec::clear_version_requirements()
}
PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::additional_requirement(const std::shared_ptr<const AdditionalPackageDepSpecRequirement> & req)
+PartiallyMadePackageDepSpec::key_constraint(const std::string & k, const KeyConstraintOperation o, const std::string & p)
{
- if (! _imp->data->additional_requirements)
- _imp->data->additional_requirements = std::make_shared<AdditionalPackageDepSpecRequirements>();
- _imp->data->additional_requirements->push_back(req);
+ if (! _imp->data->all_keys)
+ _imp->data->all_keys = std::make_shared<KeyConstraintSequence>();
+ _imp->data->all_keys->push_back(KeyConstraintPool::get_instance()->create(k, o, p));
return *this;
}
PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::key_constraint(const std::string & k, const KeyConstraintOperation o, const std::string & p)
+PartiallyMadePackageDepSpec::choice_constraint(const std::shared_ptr<const ChoiceConstraint> & c)
{
- if (! _imp->data->all_keys)
- _imp->data->all_keys = std::make_shared<KeyConstraintSequence>();
- _imp->data->all_keys->push_back(KeyConstraintPool::get_instance()->create(k, o, p));
+ if (! _imp->data->all_choices)
+ _imp->data->all_choices = std::make_shared<ChoiceConstraintSequence>();
+ _imp->data->all_choices->push_back(c);
return *this;
}
PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_additional_requirements()
+PartiallyMadePackageDepSpec::clear_choice_requirements()
{
- _imp->data->additional_requirements.reset();
+ _imp->data->all_choices.reset();
return *this;
}
diff --git a/paludis/partially_made_package_dep_spec.hh b/paludis/partially_made_package_dep_spec.hh
index 686dc94..97f02e4 100644
--- a/paludis/partially_made_package_dep_spec.hh
+++ b/paludis/partially_made_package_dep_spec.hh
@@ -198,10 +198,12 @@ namespace paludis
PartiallyMadePackageDepSpec & clear_version_requirements();
/**
- * Add an additional requirement, return ourself.
+ * Add a choice constraint, return ourself.
+ *
+ * \since 0.61
*/
- PartiallyMadePackageDepSpec & additional_requirement(
- const std::shared_ptr<const AdditionalPackageDepSpecRequirement> &);
+ PartiallyMadePackageDepSpec & choice_constraint(
+ const std::shared_ptr<const ChoiceConstraint> &);
/**
* Add a key requirement, return ourself.
@@ -210,11 +212,11 @@ namespace paludis
const std::string & key, const KeyConstraintOperation, const std::string & pattern);
/**
- * Clear additional requirements, return ourself.
+ * Clear choice requirements, return ourself.
*
- * \since 0.41
+ * \since 0.61
*/
- PartiallyMadePackageDepSpec & clear_additional_requirements();
+ PartiallyMadePackageDepSpec & clear_choice_requirements();
/**
* Turn ourselves into a PackageDepSpec.
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 1960a97..75bc9c9 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -68,7 +68,6 @@
#include <paludis/action.hh>
#include <paludis/package_id.hh>
#include <paludis/changed_choices.hh>
-#include <paludis/additional_package_dep_spec_requirement.hh>
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/dep_spec_annotations.hh>
#include <paludis/package_dep_spec_constraint.hh>
@@ -1072,7 +1071,7 @@ Decider::_make_spec_for_preloading(const PackageDepSpec & spec,
/* we don't want to copy use deps from the constraint, since things like
* [foo?] start to get weird when there's no longer an associated ID. */
- result.clear_additional_requirements();
+ result.clear_choice_requirements();
/* but we do want to impose our own ChangedChoices if necessary. */
if (changed_choices)
@@ -1886,8 +1885,8 @@ Decider::_find_id_for_from(
if (! (*c)->spec().if_package())
{
- if ((*c)->spec().if_block()->blocking().additional_requirements_ptr() &&
- ! (*c)->spec().if_block()->blocking().additional_requirements_ptr()->empty())
+ if ((*c)->spec().if_block()->blocking().all_choice_constraints() &&
+ ! (*c)->spec().if_block()->blocking().all_choice_constraints()->empty())
{
/* too complicated for now */
ok = false;
@@ -1895,14 +1894,14 @@ Decider::_find_id_for_from(
break;
}
- if (! (*c)->spec().if_package()->additional_requirements_ptr())
+ if (! (*c)->spec().if_package()->all_choice_constraints())
{
/* no additional requirements, so no tinkering required */
continue;
}
- for (auto a((*c)->spec().if_package()->additional_requirements_ptr()->begin()),
- a_end((*c)->spec().if_package()->additional_requirements_ptr()->end()) ;
+ for (auto a((*c)->spec().if_package()->all_choice_constraints()->begin()),
+ a_end((*c)->spec().if_package()->all_choice_constraints()->end()) ;
a != a_end ; ++a)
{
auto b((*a)->accumulate_changes_to_make_met(_imp->env,
diff --git a/paludis/resolver/match_qpns.cc b/paludis/resolver/match_qpns.cc
index f1aa35f..bb9c98e 100644
--- a/paludis/resolver/match_qpns.cc
+++ b/paludis/resolver/match_qpns.cc
@@ -41,9 +41,9 @@ paludis::resolver::match_qpns(
* either can be wildcards (we could work for :slot too,
* but we're lazy) */
if (! package_dep_spec_has_properties(spec, make_named_values<PackageDepSpecProperties>(
- n::has_additional_requirements() = false,
n::has_any_slot_requirement() = false,
n::has_category_name_part() = indeterminate,
+ n::has_choice_requirements() = false,
n::has_exact_slot_requirement() = false,
n::has_from_repository() = false,
n::has_in_repository() = false,
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index ce9b015..d6122e5 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -165,10 +165,7 @@ namespace
break;
default:
- {
- std::shared_ptr<const AdditionalPackageDepSpecRequirement> req(parse_elike_use_requirement(flag, { }));
- result.additional_requirement(req);
- }
+ result.choice_constraint(parse_elike_use_requirement(flag, { }));
break;
};
diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc
index c76eed8..f3d1b78 100644
--- a/paludis/user_dep_spec_TEST.cc
+++ b/paludis/user_dep_spec_TEST.cc
@@ -69,6 +69,11 @@ namespace
return "[." + result + "]";
}
+ std::string stringify_choice_constraint(const ChoiceConstraint & k)
+ {
+ return k.as_raw_string();
+ }
+
class UserDepSpecTest :
public testing::Test
{
@@ -176,15 +181,15 @@ UserDepSpecTest::check_spec(
}
if (additional_requirement.empty())
- EXPECT_TRUE((! spec.additional_requirements_ptr()) || spec.additional_requirements_ptr()->empty());
+ EXPECT_TRUE((! spec.all_choice_constraints()) || spec.all_choice_constraints()->empty());
else
{
- ASSERT_TRUE(bool(spec.additional_requirements_ptr()) || bool(spec.all_key_constraints()));
+ ASSERT_TRUE(bool(spec.all_choice_constraints()) || bool(spec.all_key_constraints()));
std::string x;
- if (spec.additional_requirements_ptr())
+ if (spec.all_choice_constraints())
x.append(stringify(join(
- indirect_iterator(spec.additional_requirements_ptr()->begin()),
- indirect_iterator(spec.additional_requirements_ptr()->end()), ", ")));
+ indirect_iterator(spec.all_choice_constraints()->begin()),
+ indirect_iterator(spec.all_choice_constraints()->end()), ", ", &stringify_choice_constraint)));
if (spec.all_key_constraints())
x.append(stringify(join(
indirect_iterator(spec.all_key_constraints()->begin()),
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 939fbec..6f8c0ec 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -82,8 +82,8 @@ namespace paludis
std::shared_ptr<const ExactSlotConstraint> exact_slot;
std::shared_ptr<const InRepositoryConstraint> in_repository;
std::shared_ptr<const FromRepositoryConstraint> from_repository;
- std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements;
std::shared_ptr<const KeyConstraintSequence> all_keys;
+ std::shared_ptr<const ChoiceConstraintSequence> all_choices;
const std::string str;
Imp(
@@ -95,8 +95,8 @@ namespace paludis
const std::shared_ptr<const ExactSlotConstraint> & xs,
const std::shared_ptr<const InRepositoryConstraint> & ri,
const std::shared_ptr<const FromRepositoryConstraint> & rf,
- const std::shared_ptr<const AdditionalPackageDepSpecRequirements> & u,
const std::shared_ptr<const KeyConstraintSequence> & k,
+ const std::shared_ptr<const ChoiceConstraintSequence> & a,
const std::string & st) :
package_name_constraint(q),
category_name_part_constraint(c),
@@ -106,8 +106,8 @@ namespace paludis
exact_slot(xs),
in_repository(ri),
from_repository(rf),
- additional_requirements(u),
all_keys(k),
+ all_choices(a),
str(st)
{
}
@@ -235,8 +235,8 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PackageDepSpec & p) :
p.exact_slot_constraint(),
p.in_repository_constraint(),
p.from_repository_constraint(),
- p.additional_requirements_ptr(),
p.all_key_constraints(),
+ p.all_choice_constraints(),
stringify(p))
{
}
@@ -252,8 +252,8 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PythonPackageDepSpec & p) :
p.exact_slot_constraint(),
p.in_repository_constraint(),
p.from_repository_constraint(),
- p.additional_requirements_ptr(),
p.all_key_constraints(),
+ p.all_choice_constraints(),
p.py_str())
{
}
@@ -294,11 +294,11 @@ PythonPackageDepSpec::operator PackageDepSpec() const
if (from_repository_constraint())
p.from_repository(from_repository_constraint()->name());
- if (additional_requirements_ptr())
+ if (all_choice_constraints())
{
- for (AdditionalPackageDepSpecRequirements::ConstIterator i(additional_requirements_ptr()->begin()),
- i_end(additional_requirements_ptr()->end()) ; i != i_end ; ++i)
- p.additional_requirement(*i);
+ for (ChoiceConstraintSequence::ConstIterator i(all_choice_constraints()->begin()),
+ i_end(all_choice_constraints()->end()) ; i != i_end ; ++i)
+ p.choice_constraint(*i);
}
if (all_key_constraints())
@@ -365,10 +365,10 @@ PythonPackageDepSpec::from_repository_constraint() const
return _imp->from_repository;
}
-std::shared_ptr<const AdditionalPackageDepSpecRequirements>
-PythonPackageDepSpec::additional_requirements_ptr() const
+const std::shared_ptr<const ChoiceConstraintSequence>
+PythonPackageDepSpec::all_choice_constraints() const
{
- return _imp->additional_requirements;
+ return _imp->all_choices;
}
const std::shared_ptr<const KeyConstraintSequence>
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index 4c6b28f..ab1b30e 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -181,8 +181,7 @@ namespace paludis
const std::shared_ptr<const ExactSlotConstraint> exact_slot_constraint() const;
const std::shared_ptr<const AnySlotConstraint> any_slot_constraint() const;
const std::shared_ptr<const KeyConstraintSequence> all_key_constraints() const;
-
- std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const;
+ const std::shared_ptr<const ChoiceConstraintSequence> all_choice_constraints() const;
std::string py_str() const;
};
diff --git a/ruby/package_dep_spec_constraint.cc b/ruby/package_dep_spec_constraint.cc
index 4184b4f..e06e957 100644
--- a/ruby/package_dep_spec_constraint.cc
+++ b/ruby/package_dep_spec_constraint.cc
@@ -43,6 +43,7 @@ namespace
static VALUE c_any_slot_constraint;
static VALUE c_exact_slot_constraint;
static VALUE c_key_constraint;
+ static VALUE c_choice_constraint;
static VALUE c_key_constraint_operation;
@@ -127,6 +128,12 @@ namespace
value = Data_Wrap_Struct(c_key_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
new std::shared_ptr<const PackageDepSpecConstraint>(mm));
}
+
+ void visit(const ChoiceConstraint &)
+ {
+ value = Data_Wrap_Struct(c_choice_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
+ new std::shared_ptr<const PackageDepSpecConstraint>(mm));
+ }
};
/*
@@ -488,6 +495,15 @@ namespace
rb_define_const(c_key_constraint_operation, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
// cc_enum_special<paludis/package_dep_spec_constraint-se.hh, KeyConstraint, c_key_constraint_operation>
+
+ /*
+ * Document-class: Paludis::ChoiceConstraint
+ *
+ * Represents a [flag] constraint in a PackageDepSpec.
+ */
+ c_choice_constraint = rb_define_class_under(
+ paludis_module(), "KeyConstraint", c_package_dep_spec_constraint);
+ rb_funcall(c_choice_constraint, rb_intern("private_class_method"), 1, rb_str_new2("new"));
}
}
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 8ac3a3f..20c137d 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -79,7 +79,7 @@
#include <paludis/changed_choices.hh>
#include <paludis/mask_utils.hh>
#include <paludis/dep_spec_annotations.hh>
-#include <paludis/additional_package_dep_spec_requirement.hh>
+#include <paludis/package_dep_spec_constraint.hh>
#include <set>
#include <iterator>
@@ -1421,12 +1421,12 @@ namespace
cout << fuc(fs_unable_unsuitable_did_not_meet(), fv<'s'>(s));
- if ((*c)->spec().if_package() && (*c)->spec().if_package()->additional_requirements_ptr() &&
+ if ((*c)->spec().if_package() && (*c)->spec().if_package()->all_choice_constraints() &&
(! match_package(*env, *(*c)->spec().if_package(), u->package_id(), (*c)->from_id(), { })) &&
match_package(*env, *(*c)->spec().if_package(), u->package_id(), (*c)->from_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()) ;
+ for (auto a((*c)->spec().if_package()->all_choice_constraints()->begin()),
+ a_end((*c)->spec().if_package()->all_choice_constraints()->end()) ;
a != a_end ; ++a)
{
const std::pair<bool, std::string> p((*a)->requirement_met(env.get(), 0, u->package_id(), (*c)->from_id(), 0));
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index 2e63b19..ffbc61d 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -685,9 +685,9 @@ namespace
PackageDepSpec spec(parse_user_package_dep_spec(std::get<2>(p), env.get(), { updso_no_disambiguation }));
if (package_dep_spec_has_properties(spec, make_named_values<PackageDepSpecProperties>(
- n::has_additional_requirements() = false,
n::has_any_slot_requirement() = false,
n::has_category_name_part() = false,
+ n::has_choice_requirements() = false,
n::has_exact_slot_requirement() = false,
n::has_from_repository() = false,
n::has_in_repository() = false,
diff --git a/src/clients/cave/cmd_print_spec.cc b/src/clients/cave/cmd_print_spec.cc
index 6380a9d..ccf12b7 100644
--- a/src/clients/cave/cmd_print_spec.cc
+++ b/src/clients/cave/cmd_print_spec.cc
@@ -38,11 +38,11 @@
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/additional_package_dep_spec_requirement.hh>
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
+#include <paludis/elike_use_requirement.hh>
#include <iostream>
#include <algorithm>
@@ -253,15 +253,15 @@ namespace
if (cmdline.a_additional_requirement.specified())
{
- s.clear_additional_requirements();
+ s.clear_choice_requirements();
for (args::StringSetArg::ConstIterator a(cmdline.a_additional_requirement.begin_args()),
a_end(cmdline.a_additional_requirement.end_args()) ;
a != a_end ; ++a)
if (! a->empty())
{
- auto k(parse_user_key_constraint(*a));
- s.key_constraint(std::get<0>(k), std::get<1>(k), std::get<2>(k));
+ auto k(parse_elike_use_requirement(*a, { }));
+ s.choice_constraint(k);
}
}