aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-18 20:10:45 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-18 20:10:45 +0100
commitbb06c0f5ac5e7fe01e5ab0a957bc310179eb5bab (patch)
treec929cf1b4e92d8d0ec0b63045dd260700f170ed9
parent537036d40b9142858d2cf863a5d143498e927640 (diff)
downloadpaludis-bb06c0f5ac5e7fe01e5ab0a957bc310179eb5bab.tar.gz
paludis-bb06c0f5ac5e7fe01e5ab0a957bc310179eb5bab.tar.xz
Don't hold versions, keys, choices in a sequence
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec.cc45
-rw-r--r--paludis/dep_spec.cc146
-rw-r--r--paludis/dep_spec.hh24
-rw-r--r--paludis/dep_spec_data.cc44
-rw-r--r--paludis/environments/portage/portage_environment.cc18
-rw-r--r--paludis/package_dep_spec_properties.hh16
-rw-r--r--paludis/paludislike_options_conf.cc17
-rw-r--r--paludis/repositories/e/Makefile.am2
-rw-r--r--paludis/repositories/e/split_pn_v.cc91
-rw-r--r--paludis/repositories/e/split_pn_v.hh39
-rw-r--r--paludis/repositories/e/vdb_repository.cc15
-rw-r--r--paludis/resolver/decider.cc52
-rw-r--r--paludis/user_dep_spec_TEST.cc83
-rw-r--r--python/dep_spec.cc27
-rwxr-xr-xsrc/clients/cave/cmd_display_resolution.cc27
-rw-r--r--src/clients/cave/resolve_common.cc19
16 files changed, 419 insertions, 246 deletions
diff --git a/doc/api/cplusplus/examples/example_dep_spec.cc b/doc/api/cplusplus/examples/example_dep_spec.cc
index 57fb2e5..3a2cc54 100644
--- a/doc/api/cplusplus/examples/example_dep_spec.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec.cc
@@ -68,36 +68,6 @@ int main(int argc, char * argv[])
if (spec.package_name_part_requirement())
cout << " " << left << setw(24) << "Package part:" << " " << spec.package_name_part_requirement()->name_part() << endl;
- if (spec.all_version_requirements() && ! spec.all_version_requirements()->empty())
- {
- cout << " " << left << setw(24) << "Version requirements:" << " ";
- bool need_join(false);
- for (auto r(spec.all_version_requirements()->begin()), r_end(spec.all_version_requirements()->end()) ;
- r != r_end ; ++r)
- {
- if (need_join)
- {
- switch ((*r)->combiner())
- {
- case vrc_and:
- cout << " and ";
- break;
-
- case vrc_or:
- cout << " or ";
- break;
-
- case last_vrc:
- throw InternalError(PALUDIS_HERE, "Bad version_requirements_mode");
- }
- }
-
- cout << (*r)->version_operator() << (*r)->version_spec();
- need_join = true;
- }
- cout << endl;
- }
-
if (spec.exact_slot_requirement())
cout << " " << left << setw(24) << "Slot:" << " " << spec.exact_slot_requirement()->name() << endl;
@@ -123,21 +93,6 @@ int main(int argc, char * argv[])
spec.installable_to_repository_requirement()->name() << ", " <<
spec.installable_to_repository_requirement()->include_masked() << endl;
- if (spec.all_choice_requirements() && ! spec.all_choice_requirements()->empty())
- {
- cout << " " << left << setw(24) << "Choice requirements:" << " ";
- bool need_join(false);
- for (auto u(spec.all_choice_requirements()->begin()), u_end(spec.all_choice_requirements()->end()) ; u != u_end ; ++u)
- {
- if (need_join)
- cout << " and ";
-
- cout << (*u)->as_raw_string() + " (meaning: " + (*u)->as_human_string(make_null_shared_ptr()) + ")";
- need_join = true;
- }
- cout << endl;
- }
-
/* And display packages matching that spec */
cout << " " << left << setw(24) << "Matches:" << " ";
std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsSorted(
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index e7c1f29..0d2260d 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -23,6 +23,7 @@
#include <paludis/version_spec.hh>
#include <paludis/dep_spec_data.hh>
#include <paludis/package_dep_spec_requirement.hh>
+#include <paludis/package_dep_spec_properties.hh>
#include <paludis/util/clone-impl.hh>
#include <paludis/util/log.hh>
@@ -537,20 +538,6 @@ LabelsDepSpec<T_>::add_label(const std::shared_ptr<const T_> & item)
namespace
{
- template <typename T_>
- struct Detect
- {
- bool visit(const T_ &) const
- {
- return true;
- }
-
- bool visit(const PackageDepSpecRequirement &) const
- {
- return false;
- }
- };
-
template <typename I_, typename P_>
I_ find_unique_if(I_ cur, I_ end, P_ pred)
{
@@ -576,35 +563,9 @@ namespace paludis
const std::shared_ptr<const PackageDepSpecData> data;
std::string text;
- std::shared_ptr<VersionRequirementSequence> all_versions;
- std::shared_ptr<KeyRequirementSequence> all_keys;
- std::shared_ptr<ChoiceRequirementSequence> all_choices;
-
Imp(const std::shared_ptr<const PackageDepSpecData> & d) :
data(d)
{
- for (auto u(data->requirements()->begin()), u_end(data->requirements()->end()) ;
- u != u_end ; ++u)
- {
- if ((*u)->accept_returning<bool>(Detect<VersionRequirement>()))
- {
- if (! all_versions)
- all_versions = std::make_shared<VersionRequirementSequence>();
- all_versions->push_back(std::static_pointer_cast<const VersionRequirement>(*u));
- }
- else if ((*u)->accept_returning<bool>(Detect<KeyRequirement>()))
- {
- if (! all_keys)
- all_keys = std::make_shared<KeyRequirementSequence>();
- all_keys->push_back(std::static_pointer_cast<const KeyRequirement>(*u));
- }
- else if ((*u)->accept_returning<bool>(Detect<ChoiceRequirement>()))
- {
- if (! all_choices)
- all_choices = std::make_shared<ChoiceRequirementSequence>();
- all_choices->push_back(std::static_pointer_cast<const ChoiceRequirement>(*u));
- }
- }
}
};
}
@@ -615,19 +576,46 @@ PackageDepSpec::PackageDepSpec(const std::shared_ptr<const PackageDepSpecData> &
{
std::ostringstream s;
- if (all_version_requirements())
+ std::shared_ptr<VersionRequirementSequence> all_versions;
+ std::shared_ptr<KeyRequirementSequence> all_keys;
+ std::shared_ptr<ChoiceRequirementSequence> all_choices;
+
+ for (auto u(_imp->data->requirements()->begin()), u_end(_imp->data->requirements()->end()) ;
+ u != u_end ; ++u)
{
- if (all_version_requirements()->begin() == all_version_requirements()->end())
+ if ((*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<VersionRequirement>()))
{
+ if (! all_versions)
+ all_versions = std::make_shared<VersionRequirementSequence>();
+ all_versions->push_back(std::static_pointer_cast<const VersionRequirement>(*u));
}
- else if (next(all_version_requirements()->begin()) == all_version_requirements()->end() &&
+ else if ((*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<KeyRequirement>()))
+ {
+ if (! all_keys)
+ all_keys = std::make_shared<KeyRequirementSequence>();
+ all_keys->push_back(std::static_pointer_cast<const KeyRequirement>(*u));
+ }
+ else if ((*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<ChoiceRequirement>()))
+ {
+ if (! all_choices)
+ all_choices = std::make_shared<ChoiceRequirementSequence>();
+ all_choices->push_back(std::static_pointer_cast<const ChoiceRequirement>(*u));
+ }
+ }
+
+ if (all_versions)
+ {
+ if (all_versions->begin() == all_versions->end())
+ {
+ }
+ else if (next(all_versions->begin()) == all_versions->end() &&
! _imp->data->options()[pdsdo_always_use_ranged_deps])
{
- if ((*all_version_requirements()->begin())->version_operator() == vo_stupid_equal_star ||
- (*all_version_requirements()->begin())->version_operator() == vo_nice_equal_star)
+ if ((*all_versions->begin())->version_operator() == vo_stupid_equal_star ||
+ (*all_versions->begin())->version_operator() == vo_nice_equal_star)
s << "=";
else
- s << (*all_version_requirements()->begin())->version_operator();
+ s << (*all_versions->begin())->version_operator();
}
}
@@ -648,17 +636,17 @@ PackageDepSpec::PackageDepSpec(const std::shared_ptr<const PackageDepSpecData> &
s << "*";
}
- if (all_version_requirements())
+ if (all_versions)
{
- if (all_version_requirements()->begin() == all_version_requirements()->end())
+ if (all_versions->begin() == all_versions->end())
{
}
- else if (next(all_version_requirements()->begin()) == all_version_requirements()->end() &&
+ else if (next(all_versions->begin()) == all_versions->end() &&
! _imp->data->options()[pdsdo_always_use_ranged_deps])
{
- s << "-" << (*all_version_requirements()->begin())->version_spec();
- if ((*all_version_requirements()->begin())->version_operator() == vo_stupid_equal_star ||
- (*all_version_requirements()->begin())->version_operator() == vo_nice_equal_star)
+ s << "-" << (*all_versions->begin())->version_spec();
+ if ((*all_versions->begin())->version_operator() == vo_stupid_equal_star ||
+ (*all_versions->begin())->version_operator() == vo_nice_equal_star)
s << "*";
}
}
@@ -733,12 +721,12 @@ PackageDepSpec::PackageDepSpec(const std::shared_ptr<const PackageDepSpecData> &
else if (! left.empty())
s << "::" << left << "->";
- if (all_version_requirements())
+ if (all_versions)
{
- if (all_version_requirements()->begin() == all_version_requirements()->end())
+ if (all_versions->begin() == all_versions->end())
{
}
- else if (next(all_version_requirements()->begin()) == all_version_requirements()->end() &&
+ else if (next(all_versions->begin()) == all_versions->end() &&
! _imp->data->options()[pdsdo_always_use_ranged_deps])
{
}
@@ -746,7 +734,7 @@ PackageDepSpec::PackageDepSpec(const std::shared_ptr<const PackageDepSpecData> &
{
bool need_op(false);
s << "[";
- for (auto r(all_version_requirements()->begin()), r_end(all_version_requirements()->end()) ; r != r_end ; ++r)
+ for (auto r(all_versions->begin()), r_end(all_versions->end()) ; r != r_end ; ++r)
{
if (need_op)
{
@@ -785,12 +773,12 @@ PackageDepSpec::PackageDepSpec(const std::shared_ptr<const PackageDepSpecData> &
}
}
- if (all_choice_requirements())
- for (auto u(all_choice_requirements()->begin()), u_end(all_choice_requirements()->end()) ; u != u_end ; ++u)
+ if (all_choices)
+ for (auto u(all_choices->begin()), u_end(all_choices->end()) ; u != u_end ; ++u)
s << (*u)->as_raw_string();
- if (all_key_requirements())
- for (auto u(all_key_requirements()->begin()), u_end(all_key_requirements()->end()) ; u != u_end ; ++u)
+ if (all_keys)
+ for (auto u(all_keys->begin()), u_end(all_keys->end()) ; u != u_end ; ++u)
s << (*u)->as_raw_string();
_imp->text = s.str();
@@ -818,7 +806,7 @@ PackageDepSpec::text() const
const std::shared_ptr<const NameRequirement>
PackageDepSpec::package_name_requirement() const
{
- Detect<NameRequirement> v;
+ DetectPackageDepSpecRequirement<NameRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -831,7 +819,7 @@ PackageDepSpec::package_name_requirement() const
const std::shared_ptr<const PackageNamePartRequirement>
PackageDepSpec::package_name_part_requirement() const
{
- Detect<PackageNamePartRequirement> v;
+ DetectPackageDepSpecRequirement<PackageNamePartRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -844,7 +832,7 @@ PackageDepSpec::package_name_part_requirement() const
const std::shared_ptr<const CategoryNamePartRequirement>
PackageDepSpec::category_name_part_requirement() const
{
- Detect<CategoryNamePartRequirement> v;
+ DetectPackageDepSpecRequirement<CategoryNamePartRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -854,16 +842,10 @@ PackageDepSpec::category_name_part_requirement() const
return make_null_shared_ptr();
}
-const std::shared_ptr<const VersionRequirementSequence>
-PackageDepSpec::all_version_requirements() const
-{
- return _imp->all_versions;
-}
-
const std::shared_ptr<const ExactSlotRequirement>
PackageDepSpec::exact_slot_requirement() const
{
- Detect<ExactSlotRequirement> v;
+ DetectPackageDepSpecRequirement<ExactSlotRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -876,7 +858,7 @@ PackageDepSpec::exact_slot_requirement() const
const std::shared_ptr<const AnySlotRequirement>
PackageDepSpec::any_slot_requirement() const
{
- Detect<AnySlotRequirement> v;
+ DetectPackageDepSpecRequirement<AnySlotRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -889,7 +871,7 @@ PackageDepSpec::any_slot_requirement() const
const std::shared_ptr<const InRepositoryRequirement>
PackageDepSpec::in_repository_requirement() const
{
- Detect<InRepositoryRequirement> v;
+ DetectPackageDepSpecRequirement<InRepositoryRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -902,7 +884,7 @@ PackageDepSpec::in_repository_requirement() const
const std::shared_ptr<const InstallableToRepositoryRequirement>
PackageDepSpec::installable_to_repository_requirement() const
{
- Detect<InstallableToRepositoryRequirement> v;
+ DetectPackageDepSpecRequirement<InstallableToRepositoryRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -915,7 +897,7 @@ PackageDepSpec::installable_to_repository_requirement() const
const std::shared_ptr<const FromRepositoryRequirement>
PackageDepSpec::from_repository_requirement() const
{
- Detect<FromRepositoryRequirement> v;
+ DetectPackageDepSpecRequirement<FromRepositoryRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -928,7 +910,7 @@ PackageDepSpec::from_repository_requirement() const
const std::shared_ptr<const InstalledAtPathRequirement>
PackageDepSpec::installed_at_path_requirement() const
{
- Detect<InstalledAtPathRequirement> v;
+ DetectPackageDepSpecRequirement<InstalledAtPathRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -941,7 +923,7 @@ PackageDepSpec::installed_at_path_requirement() const
const std::shared_ptr<const InstallableToPathRequirement>
PackageDepSpec::installable_to_path_requirement() const
{
- Detect<InstallableToPathRequirement> v;
+ DetectPackageDepSpecRequirement<InstallableToPathRequirement> v;
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
@@ -951,18 +933,6 @@ PackageDepSpec::installable_to_path_requirement() const
return make_null_shared_ptr();
}
-const std::shared_ptr<const KeyRequirementSequence>
-PackageDepSpec::all_key_requirements() const
-{
- return _imp->all_keys;
-}
-
-const std::shared_ptr<const ChoiceRequirementSequence>
-PackageDepSpec::all_choice_requirements() const
-{
- return _imp->all_choices;
-}
-
const std::shared_ptr<const PackageDepSpecRequirementSequence>
PackageDepSpec::requirements() const
{
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 88de186..c23115f 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -320,14 +320,6 @@ namespace paludis
const std::shared_ptr<const CategoryNamePartRequirement> category_name_part_requirement() const;
/**
- * Fetch all our VersionRequirements, if we have any, or
- * a null pointer otherwise.
- *
- * \since 0.61
- */
- const std::shared_ptr<const VersionRequirementSequence> all_version_requirements() const;
-
- /**
* Fetch the single ExactSlotRequirement, if we have one, or
* a null pointer otherwise.
*
@@ -381,22 +373,6 @@ namespace paludis
const std::shared_ptr<const InstallableToPathRequirement> installable_to_path_requirement() const;
/**
- * Fetch all our KeyRequirements, if we have any, or
- * a null pointer otherwise.
- *
- * \since 0.61
- */
- const std::shared_ptr<const KeyRequirementSequence> all_key_requirements() const;
-
- /**
- * Fetch all our ChoiceRequirements, if we have any, or
- * a null pointer otherwise.
- *
- * \since 0.61
- */
- const std::shared_ptr<const ChoiceRequirementSequence> all_choice_requirements() const;
-
- /**
* Fetch all our requirements.
*
* \since 0.61
diff --git a/paludis/dep_spec_data.cc b/paludis/dep_spec_data.cc
index 346524e..6176742 100644
--- a/paludis/dep_spec_data.cc
+++ b/paludis/dep_spec_data.cc
@@ -22,6 +22,7 @@
#include <paludis/dep_spec.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
+#include <paludis/package_dep_spec_properties.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/exception.hh>
@@ -90,23 +91,6 @@ PackageDepSpecData::options() const
return _imp->options;
}
-namespace
-{
- template <typename T_>
- struct Detect
- {
- bool visit(const T_ &) const
- {
- return true;
- }
-
- bool visit(const PackageDepSpecRequirement &) const
- {
- return false;
- }
- };
-}
-
MutablePackageDepSpecData::MutablePackageDepSpecData(const PackageDepSpecDataOptions & o) :
PackageDepSpecData(o)
{
@@ -137,7 +121,7 @@ MutablePackageDepSpecData::unrequire_package()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<NameRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<NameRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -157,7 +141,7 @@ MutablePackageDepSpecData::unrequire_package_name_part()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<PackageNamePartRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<PackageNamePartRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -177,7 +161,7 @@ MutablePackageDepSpecData::unrequire_category_name_part()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<CategoryNamePartRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<CategoryNamePartRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -199,7 +183,7 @@ MutablePackageDepSpecData::unrequire_versions()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<VersionRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<VersionRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -219,7 +203,7 @@ MutablePackageDepSpecData::unrequire_exact_slot()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<ExactSlotRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<ExactSlotRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -239,7 +223,7 @@ MutablePackageDepSpecData::unrequire_in_repository()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<InRepositoryRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<InRepositoryRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -259,7 +243,7 @@ MutablePackageDepSpecData::unrequire_installable_to_path()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<InstallableToPathRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<InstallableToPathRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -279,7 +263,7 @@ MutablePackageDepSpecData::unrequire_installable_to_repository()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<InstallableToRepositoryRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<InstallableToRepositoryRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -299,7 +283,7 @@ MutablePackageDepSpecData::unrequire_from_repository()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<FromRepositoryRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<FromRepositoryRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -319,7 +303,7 @@ MutablePackageDepSpecData::unrequire_installed_at_path()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<InstalledAtPathRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<InstalledAtPathRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -339,7 +323,7 @@ MutablePackageDepSpecData::unrequire_any_slot()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<AnySlotRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<AnySlotRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -360,7 +344,7 @@ MutablePackageDepSpecData::unrequire_choices()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<ChoiceRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<ChoiceRequirement>()))
r->push_back(*u);
_imp->requirements = r;
@@ -383,7 +367,7 @@ MutablePackageDepSpecData::unrequire_keys()
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
u != u_end ; ++u)
- if (! (*u)->accept_returning<bool>(Detect<KeyRequirement>()))
+ if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<KeyRequirement>()))
r->push_back(*u);
_imp->requirements = r;
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index b4345ed..dfdef86 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -57,6 +57,7 @@
#include <paludis/repository_factory.hh>
#include <paludis/choice.hh>
#include <paludis/dep_spec_data.hh>
+#include <paludis/package_dep_spec_properties.hh>
#include <functional>
#include <algorithm>
@@ -388,7 +389,22 @@ 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_choices && p->all_choice_requirements() && ! p->all_choice_requirements()->empty())
+ if (reject_choices && package_dep_spec_has_properties(*p, make_named_values<PackageDepSpecProperties>(
+ n::has_any_slot_requirement() = indeterminate,
+ n::has_category_name_part() = indeterminate,
+ n::has_choice_requirements() = true,
+ n::has_exact_slot_requirement() = indeterminate,
+ n::has_from_repository() = indeterminate,
+ n::has_in_repository() = indeterminate,
+ n::has_installable_to_path() = indeterminate,
+ n::has_installable_to_repository() = indeterminate,
+ n::has_installed_at_path() = indeterminate,
+ n::has_key_requirements() = indeterminate,
+ n::has_package() = indeterminate,
+ n::has_package_name_part() = indeterminate,
+ n::has_tag() = indeterminate,
+ n::has_version_requirements() = indeterminate
+ )))
{
Log::get_instance()->message("portage_environment.bad_spec", ll_warning, lc_context)
<< "Dependency specification '" << stringify(*p)
diff --git a/paludis/package_dep_spec_properties.hh b/paludis/package_dep_spec_properties.hh
index 093b584..bb0991d 100644
--- a/paludis/package_dep_spec_properties.hh
+++ b/paludis/package_dep_spec_properties.hh
@@ -21,6 +21,8 @@
#define PALUDIS_GUARD_PALUDIS_PACKAGE_DEP_SPEC_PROPERTIES_HH 1
#include <paludis/package_dep_spec_properties-fwd.hh>
+#include <paludis/package_dep_spec_requirement-fwd.hh>
+
#include <paludis/util/named_value.hh>
#include <paludis/util/tribool.hh>
@@ -67,6 +69,20 @@ namespace paludis
NamedValue<n::has_tag, Tribool> has_tag;
NamedValue<n::has_version_requirements, Tribool> has_version_requirements;
};
+
+ template <typename T_>
+ struct DetectPackageDepSpecRequirement
+ {
+ bool visit(const T_ &) const
+ {
+ return true;
+ }
+
+ bool visit(const PackageDepSpecRequirement &) const
+ {
+ return false;
+ }
+ };
}
#endif
diff --git a/paludis/paludislike_options_conf.cc b/paludis/paludislike_options_conf.cc
index 2b62a8e..c493de2 100644
--- a/paludis/paludislike_options_conf.cc
+++ b/paludis/paludislike_options_conf.cc
@@ -204,7 +204,22 @@ PaludisLikeOptionsConf::add_file(const FSPath & f)
tokens.at(0), _imp->params.environment(),
{ updso_allow_wildcards, updso_no_disambiguation, updso_throw_if_set })));
- if (d->all_choice_requirements() && ! d->all_choice_requirements()->empty())
+ if (package_dep_spec_has_properties(*d, make_named_values<PackageDepSpecProperties>(
+ n::has_any_slot_requirement() = indeterminate,
+ n::has_category_name_part() = indeterminate,
+ n::has_choice_requirements() = true,
+ n::has_exact_slot_requirement() = indeterminate,
+ n::has_from_repository() = indeterminate,
+ n::has_in_repository() = indeterminate,
+ n::has_installable_to_path() = indeterminate,
+ n::has_installable_to_repository() = indeterminate,
+ n::has_installed_at_path() = indeterminate,
+ n::has_key_requirements() = indeterminate,
+ n::has_package() = indeterminate,
+ n::has_package_name_part() = indeterminate,
+ n::has_tag() = indeterminate,
+ n::has_version_requirements() = indeterminate
+ )))
{
Log::get_instance()->message("paludislike_options_conf.bad_spec", ll_warning, lc_context)
<< "Dependency specification '" << stringify(*d)
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index 28dc795..a0d68e8 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -90,6 +90,7 @@ noinst_HEADERS = \
required_use_verifier.hh \
source_uri_finder.hh \
spec_tree_pretty_printer.hh \
+ split_pn_v.hh \
traditional_layout.hh \
traditional_mask_file.hh \
traditional_mask_store.hh \
@@ -170,6 +171,7 @@ libpaludiserepository_la_SOURCES = \
required_use_verifier.cc \
source_uri_finder.cc \
spec_tree_pretty_printer.cc \
+ split_pn_v.cc \
traditional_layout.cc \
traditional_mask_file.cc \
traditional_mask_store.cc \
diff --git a/paludis/repositories/e/split_pn_v.cc b/paludis/repositories/e/split_pn_v.cc
new file mode 100644
index 0000000..c9d6d55
--- /dev/null
+++ b/paludis/repositories/e/split_pn_v.cc
@@ -0,0 +1,91 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ */
+
+#include <paludis/repositories/e/split_pn_v.hh>
+
+#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/exception.hh>
+
+#include <paludis/user_dep_spec.hh>
+#include <paludis/package_dep_spec_requirement.hh>
+
+#include <algorithm>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace
+{
+ struct BitsFinder
+ {
+ std::pair<PackageNamePart, VersionSpec> result;
+ bool had_package, had_version;
+
+ BitsFinder() :
+ result(PackageNamePart("x"), VersionSpec("0", { })),
+ had_package(false),
+ had_version(false)
+ {
+ }
+
+ void visit(const PackageNamePartRequirement & r)
+ {
+ if (had_package)
+ throw InternalError(PALUDIS_HERE, "got multiple /p parts");
+ had_package = true;
+ result.first = r.name_part();
+ }
+
+ void visit(const VersionRequirement & r)
+ {
+ if (had_version)
+ throw InternalError(PALUDIS_HERE, "got multiple v parts");
+ had_version = true;
+ result.second = r.version_spec();
+ }
+
+ void visit(const CategoryNamePartRequirement &)
+ {
+ }
+
+ void visit(const PackageDepSpecRequirement &)
+ {
+ throw InternalError(PALUDIS_HERE, "got unexpected requirement");
+ }
+ };
+}
+
+std::pair<PackageNamePart, VersionSpec>
+paludis::erepository::split_pn_v(const Environment * const env, const std::string & s)
+{
+ PackageDepSpec spec(parse_user_package_dep_spec("=*/" + s, env, { updso_allow_wildcards }));
+ BitsFinder f;
+ std::for_each(indirect_iterator(spec.requirements()->begin()),
+ indirect_iterator(spec.requirements()->end()),
+ accept_visitor(f));
+
+ if (! (f.had_package && f.had_version))
+ throw InternalError(PALUDIS_HERE, "didn't get p/v");
+
+ return f.result;
+}
+
diff --git a/paludis/repositories/e/split_pn_v.hh b/paludis/repositories/e/split_pn_v.hh
new file mode 100644
index 0000000..87bbb84
--- /dev/null
+++ b/paludis/repositories/e/split_pn_v.hh
@@ -0,0 +1,39 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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_REPOSITORIES_E_SPLIT_PN_V_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_SPLIT_PN_V_HH 1
+
+#include <paludis/name.hh>
+#include <paludis/version_spec.hh>
+#include <paludis/environment-fwd.hh>
+
+#include <string>
+#include <utility>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ std::pair<PackageNamePart, VersionSpec> split_pn_v(
+ const Environment * const, const std::string &);
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index a300a77..20f7275 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -28,6 +28,7 @@
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/extra_distribution_data.hh>
#include <paludis/repositories/e/can_skip_phase.hh>
+#include <paludis/repositories/e/split_pn_v.hh>
#include <paludis/action.hh>
#include <paludis/util/config_file.hh>
@@ -1110,16 +1111,14 @@ VDBRepository::need_package_ids(const CategoryNamePart & c) const
if (std::string::npos == s.rfind('-'))
continue;
- PackageDepSpec p(parse_user_package_dep_spec("=" + stringify(c) + "/" + s, _imp->params.environment(), { }));
- q->insert(p.package_name_requirement()->name());
- IDMap::iterator i(_imp->ids.find(p.package_name_requirement()->name()));
+ auto pn_v(split_pn_v(_imp->params.environment(), s));
+ auto qpn(c + pn_v.first);
+ q->insert(qpn);
+ IDMap::iterator i(_imp->ids.find(qpn));
if (_imp->ids.end() == i)
- i = _imp->ids.insert(std::make_pair(p.package_name_requirement()->name(), std::make_shared<PackageIDSequence>())).first;
+ i = _imp->ids.insert(std::make_pair(qpn, std::make_shared<PackageIDSequence>())).first;
- if ((! bool(p.all_version_requirements())) || (std::distance(p.all_version_requirements()->begin(), p.all_version_requirements()->end()) != 1))
- throw InternalError(PALUDIS_HERE, "didn't get a single version requirement");
-
- i->second->push_back(make_id(p.package_name_requirement()->name(), (*p.all_version_requirements()->begin())->version_spec(), *d));
+ i->second->push_back(make_id(qpn, pn_v.second, *d));
}
catch (const InternalError &)
{
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index b68a2d8..3cdd4bf 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -73,6 +73,7 @@
#include <paludis/package_dep_spec_requirement.hh>
#include <paludis/version_operator.hh>
#include <paludis/dep_spec_data.hh>
+#include <paludis/package_dep_spec_properties.hh>
#include <paludis/util/pimp-impl.hh>
@@ -1185,15 +1186,21 @@ Decider::find_any_score(
// AnyDepSpecChildHandler::commit in satitised_dependencies.cc
// matches this logic
OperatorScore operator_bias(os_worse_than_worst);
- if (spec.all_version_requirements() && ! spec.all_version_requirements()->empty())
+ bool any_version_requirements(false);
+
{
OperatorScore score(os_worse_than_worst);
- for (auto v(spec.all_version_requirements()->begin()), v_end(spec.all_version_requirements()->end()) ;
+ for (auto v(spec.requirements()->begin()), v_end(spec.requirements()->end()) ;
v != v_end ; ++v)
{
+ auto v_ver(visitor_cast<const VersionRequirement>(**v));
+ if (! v_ver)
+ continue;
+ any_version_requirements = true;
+
OperatorScore local_score(os_worse_than_worst);
- switch ((*v)->version_operator().value())
+ switch (v_ver->version_operator().value())
{
case vo_greater:
case vo_greater_equal:
@@ -1221,7 +1228,7 @@ Decider::find_any_score(
if (score == os_worse_than_worst)
score = local_score;
else
- switch ((*v)->combiner())
+ switch (v_ver->combiner())
{
case vrc_and:
score = is_block ? std::max(score, local_score) : std::min(score, local_score);
@@ -1237,7 +1244,8 @@ Decider::find_any_score(
}
operator_bias = score;
}
- else
+
+ if (! any_version_requirements)
{
/* don't bias no operator over a >= operator, so || ( >=foo-2 bar )
* still likes foo. */
@@ -1782,8 +1790,22 @@ Decider::_find_id_for_from(
if (! (*c)->spec().if_package())
{
- if ((*c)->spec().if_block()->blocking().all_choice_requirements() &&
- ! (*c)->spec().if_block()->blocking().all_choice_requirements()->empty())
+ if (package_dep_spec_has_properties((*c)->spec().if_block()->blocking(), make_named_values<PackageDepSpecProperties>(
+ n::has_any_slot_requirement() = indeterminate,
+ n::has_category_name_part() = indeterminate,
+ n::has_choice_requirements() = true,
+ n::has_exact_slot_requirement() = indeterminate,
+ n::has_from_repository() = indeterminate,
+ n::has_in_repository() = indeterminate,
+ n::has_installable_to_path() = indeterminate,
+ n::has_installable_to_repository() = indeterminate,
+ n::has_installed_at_path() = indeterminate,
+ n::has_key_requirements() = indeterminate,
+ n::has_package() = indeterminate,
+ n::has_package_name_part() = indeterminate,
+ n::has_tag() = indeterminate,
+ n::has_version_requirements() = indeterminate
+ )))
{
/* too complicated for now */
ok = false;
@@ -1791,17 +1813,15 @@ Decider::_find_id_for_from(
break;
}
- if (! (*c)->spec().if_package()->all_choice_requirements())
- {
- /* no additional requirements, so no tinkering required */
- continue;
- }
-
- for (auto a((*c)->spec().if_package()->all_choice_requirements()->begin()),
- a_end((*c)->spec().if_package()->all_choice_requirements()->end()) ;
+ for (auto a((*c)->spec().if_package()->requirements()->begin()),
+ a_end((*c)->spec().if_package()->requirements()->end()) ;
a != a_end ; ++a)
{
- auto b((*a)->accumulate_changes_to_make_met(_imp->env,
+ auto a_choice(visitor_cast<const ChoiceRequirement>(**a));
+ if (! a_choice)
+ continue;
+
+ auto b(a_choice->accumulate_changes_to_make_met(_imp->env,
get_changed_choices_for(*c).get(), *i, (*c)->from_id(),
*why_changed_choices->changed_choices()));
if (b.is_false())
diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc
index 2a88bf4..8f265e1 100644
--- a/paludis/user_dep_spec_TEST.cc
+++ b/paludis/user_dep_spec_TEST.cc
@@ -33,6 +33,7 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/join.hh>
+#include <paludis/util/visitor_cast.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -126,21 +127,41 @@ UserDepSpecTest::check_spec(
if (! version_requirement_mode.empty())
{
- ASSERT_TRUE(bool(spec.all_version_requirements()));
- ASSERT_TRUE(! spec.all_version_requirements()->empty());
- for (auto v(next(spec.all_version_requirements()->begin())), v_end(spec.all_version_requirements()->end()) ;
+ int n(0);
+ for (auto v(spec.requirements()->begin()), v_end(spec.requirements()->end()) ;
v != v_end ; ++v)
- EXPECT_EQ(version_requirement_mode, stringify((*v)->combiner()));
+ {
+ auto v_ver(visitor_cast<const VersionRequirement>(**v));
+ if (! v_ver)
+ continue;
+ ++n;
+
+ if (1 != n)
+ EXPECT_EQ(version_requirement_mode, stringify(v_ver->combiner()));
+ }
+
+ EXPECT_GT(n, 0);
}
- if (version_requirements.empty())
- EXPECT_TRUE((! spec.all_version_requirements()) || spec.all_version_requirements()->empty());
- else
{
- ASSERT_TRUE(bool(spec.all_version_requirements()));
- EXPECT_EQ(version_requirements, stringify(join(
- indirect_iterator(spec.all_version_requirements()->begin()),
- indirect_iterator(spec.all_version_requirements()->end()), ", ", &dump_version_requirement)));
+ std::string v_str;
+
+ for (auto v(spec.requirements()->begin()), v_end(spec.requirements()->end()) ;
+ v != v_end ; ++v)
+ {
+ auto v_ver(visitor_cast<const VersionRequirement>(**v));
+ if (! v_ver)
+ continue;
+
+ if (! v_str.empty())
+ v_str.append(", ");
+ v_str.append(dump_version_requirement(*v_ver));
+ }
+
+ if (version_requirements.empty())
+ EXPECT_TRUE(v_str.empty());
+ else
+ EXPECT_EQ(version_requirements, v_str);
}
if (slot_requirement.empty())
@@ -167,21 +188,33 @@ UserDepSpecTest::check_spec(
EXPECT_EQ(in_repository, stringify(spec.in_repository_requirement()->name()));
}
- if (additional_requirement.empty())
- EXPECT_TRUE((! spec.all_choice_requirements()) || spec.all_choice_requirements()->empty());
- else
{
- ASSERT_TRUE(bool(spec.all_choice_requirements()) || bool(spec.all_key_requirements()));
- std::string x;
- if (spec.all_choice_requirements())
- x.append(stringify(join(
- indirect_iterator(spec.all_choice_requirements()->begin()),
- indirect_iterator(spec.all_choice_requirements()->end()), ", ", &stringify_choice_requirement)));
- if (spec.all_key_requirements())
- x.append(stringify(join(
- indirect_iterator(spec.all_key_requirements()->begin()),
- indirect_iterator(spec.all_key_requirements()->end()), ", ", &stringify_key_requirement)));
- EXPECT_EQ(additional_requirement, x);
+ std::string c_str;
+
+ for (auto v(spec.requirements()->begin()), v_end(spec.requirements()->end()) ;
+ v != v_end ; ++v)
+ {
+ auto v_choice(visitor_cast<const ChoiceRequirement>(**v));
+ if (v_choice)
+ {
+ if (! c_str.empty())
+ c_str.append(", ");
+ c_str.append(stringify_choice_requirement(*v_choice));
+ }
+
+ auto v_key(visitor_cast<const KeyRequirement>(**v));
+ if (v_key)
+ {
+ if (! c_str.empty())
+ c_str.append(", ");
+ c_str.append(stringify_key_requirement(*v_key));
+ }
+ }
+
+ if (additional_requirement.empty())
+ EXPECT_TRUE(c_str.empty());
+ else
+ EXPECT_EQ(additional_requirement, c_str);
}
if (installed_at_path.empty())
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 318fa91..20e6899 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -40,6 +40,7 @@
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/visitor_cast.hh>
#include <type_traits>
#include <list>
@@ -223,19 +224,39 @@ deep_copy(const std::shared_ptr<const T_> & x)
return std::shared_ptr<T_>();
}
+namespace
+{
+ template <typename T_>
+ std::shared_ptr<Sequence<std::shared_ptr<const T_> > > get_requirements(const std::shared_ptr<const PackageDepSpecRequirementSequence> & s)
+ {
+ auto result(std::make_shared<Sequence<std::shared_ptr<const T_> > >());
+ for (auto i(s->begin()), i_end(s->end()) ;
+ i != i_end ; ++i)
+ {
+ auto v(visitor_cast<const T_>(**i));
+ if (! v)
+ continue;
+
+ result->push_back(std::static_pointer_cast<const T_>(*i));
+ }
+
+ return result;
+ }
+}
+
PythonPackageDepSpec::PythonPackageDepSpec(const PackageDepSpec & p) :
PythonStringDepSpec(p.text()),
_imp(
p.package_name_requirement(),
p.category_name_part_requirement(),
p.package_name_part_requirement(),
- p.all_version_requirements(),
+ get_requirements<VersionRequirement>(p.requirements()),
p.any_slot_requirement(),
p.exact_slot_requirement(),
p.in_repository_requirement(),
p.from_repository_requirement(),
- p.all_key_requirements(),
- p.all_choice_requirements(),
+ get_requirements<KeyRequirement>(p.requirements()),
+ get_requirements<ChoiceRequirement>(p.requirements()),
stringify(p))
{
}
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index b7d9bc2..dcdc4ba 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -1418,15 +1418,34 @@ namespace
cout << fuc(fs_unable_unsuitable_did_not_meet(), fv<'s'>(s));
- if ((*c)->spec().if_package() && (*c)->spec().if_package()->all_choice_requirements() &&
+ if ((*c)->spec().if_package() && package_dep_spec_has_properties(*(*c)->spec().if_package(), make_named_values<PackageDepSpecProperties>(
+ n::has_any_slot_requirement() = indeterminate,
+ n::has_category_name_part() = indeterminate,
+ n::has_choice_requirements() = true,
+ n::has_exact_slot_requirement() = indeterminate,
+ n::has_from_repository() = indeterminate,
+ n::has_in_repository() = indeterminate,
+ n::has_installable_to_path() = indeterminate,
+ n::has_installable_to_repository() = indeterminate,
+ n::has_installed_at_path() = indeterminate,
+ n::has_key_requirements() = indeterminate,
+ n::has_package() = indeterminate,
+ n::has_package_name_part() = indeterminate,
+ n::has_tag() = indeterminate,
+ n::has_version_requirements() = indeterminate
+ )) &&
(! 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_choice_requirements }))
{
- for (auto a((*c)->spec().if_package()->all_choice_requirements()->begin()),
- a_end((*c)->spec().if_package()->all_choice_requirements()->end()) ;
+ for (auto a((*c)->spec().if_package()->requirements()->begin()),
+ a_end((*c)->spec().if_package()->requirements()->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));
+ auto a_choice(visitor_cast<const ChoiceRequirement>(**a));
+ if (! a_choice)
+ continue;
+
+ const std::pair<bool, std::string> p(a_choice->requirement_met(env.get(), 0, u->package_id(), (*c)->from_id(), 0));
if (p.first)
continue;
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index fde7884..e9356af 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -106,6 +106,7 @@
#include <paludis/generator.hh>
#include <paludis/selection.hh>
#include <paludis/elike_blocker.hh>
+#include <paludis/package_dep_spec_properties.hh>
#include <algorithm>
#include <iostream>
@@ -1124,7 +1125,23 @@ paludis::cave::resolve_common(
if ('!' != t->at(0) && std::string::npos != t->find('/'))
{
PackageDepSpec ts(parse_spec_with_nice_error(*t, env.get(), { }, filter::All()));
- if (ts.all_version_requirements() && ! ts.all_version_requirements()->empty())
+
+ if (package_dep_spec_has_properties(ts, make_named_values<PackageDepSpecProperties>(
+ 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() = indeterminate,
+ n::has_installable_to_path() = indeterminate,
+ n::has_installable_to_repository() = indeterminate,
+ n::has_installed_at_path() = indeterminate,
+ n::has_key_requirements() = indeterminate,
+ n::has_package() = indeterminate,
+ n::has_package_name_part() = indeterminate,
+ n::has_tag() = indeterminate,
+ n::has_version_requirements() = true
+ )))
{
confirm_helper.add_permit_downgrade_spec(ts);
confirm_helper.add_permit_old_version_spec(ts);