aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-05 17:24:42 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-05 19:06:04 +0100
commit0a0afc97925e6c8df3cedd5a4c3dee60a9673785 (patch)
treeebfa071857b3aacd7a4db5dc9bd25c421f505088
parent975c0c94b62ff647c8aceab9c4ff62ca4e47142e (diff)
downloadpaludis-0a0afc97925e6c8df3cedd5a4c3dee60a9673785.tar.gz
paludis-0a0afc97925e6c8df3cedd5a4c3dee60a9673785.tar.xz
No need for fancy PackageDepSpecData subclassing
-rw-r--r--doc/api/cplusplus/examples/example_match_package.cc2
-rw-r--r--doc/api/cplusplus/examples/example_selection.cc8
-rw-r--r--paludis/changed_choices.cc14
-rw-r--r--paludis/changed_choices.hh4
-rw-r--r--paludis/common_sets.cc13
-rw-r--r--paludis/dep_spec.hh1
-rw-r--r--paludis/dep_spec_data-fwd.hh19
-rw-r--r--paludis/dep_spec_data.cc566
-rw-r--r--paludis/dep_spec_data.hh270
-rw-r--r--paludis/dep_spec_data.se19
-rw-r--r--paludis/elike_package_dep_spec-fwd.hh20
-rw-r--r--paludis/elike_package_dep_spec.cc59
-rw-r--r--paludis/elike_package_dep_spec.hh14
-rw-r--r--paludis/environment_implementation.cc4
-rw-r--r--paludis/environments/paludis/world.cc10
-rw-r--r--paludis/environments/paludis/world_TEST.cc6
-rw-r--r--paludis/environments/portage/portage_environment.cc7
-rw-r--r--paludis/environments/portage/portage_environment_TEST.cc6
-rw-r--r--paludis/files.m43
-rw-r--r--paludis/package_dep_spec_constraint.cc4
-rw-r--r--paludis/partially_made_package_dep_spec-fwd.hh53
-rw-r--r--paludis/partially_made_package_dep_spec.cc638
-rw-r--r--paludis/partially_made_package_dep_spec.hh235
-rw-r--r--paludis/partially_made_package_dep_spec.se19
-rw-r--r--paludis/partially_made_package_dep_spec_TEST.cc62
-rw-r--r--paludis/repositories/accounts/accounts_dep_key.cc12
-rw-r--r--paludis/repositories/e/e_repository_sets.cc18
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.cc11
-rw-r--r--paludis/repositories/e/vdb_repository.cc11
-rw-r--r--paludis/repositories/gemcutter/gemcutter_dependencies_key.cc11
-rw-r--r--paludis/repositories/virtuals/package_id.cc18
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc4
-rw-r--r--paludis/resolver/collect_depped_upon.cc11
-rw-r--r--paludis/resolver/decider.cc6
-rw-r--r--paludis/resolver/find_replacing_helper.cc1
-rw-r--r--paludis/resolver/get_constraints_for_dependent_helper.cc10
-rw-r--r--paludis/resolver/get_constraints_for_purge_helper.cc10
-rw-r--r--paludis/resolver/get_constraints_for_via_binary_helper.cc8
-rw-r--r--paludis/resolver/get_destination_types_for_blocker_helper.cc1
-rw-r--r--paludis/resolver/get_destination_types_for_error_helper.cc1
-rw-r--r--paludis/resolver/get_initial_constraints_for_helper.cc7
-rw-r--r--paludis/resolver/orderer.cc11
-rw-r--r--paludis/resolver/resolver_test.cc1
-rw-r--r--paludis/resolver/spec_rewriter.cc12
-rw-r--r--paludis/set_file.cc12
-rw-r--r--paludis/user_dep_spec.cc60
-rw-r--r--python/dep_spec.cc25
-rw-r--r--src/clients/cave/cmd_digest.cc4
-rw-r--r--src/clients/cave/cmd_fix_linkage.cc10
-rw-r--r--src/clients/cave/cmd_mirror.cc1
-rw-r--r--src/clients/cave/cmd_print_spec.cc89
-rw-r--r--src/clients/cave/cmd_report.cc8
-rw-r--r--src/clients/cave/cmd_show.cc35
53 files changed, 1159 insertions, 1305 deletions
diff --git a/doc/api/cplusplus/examples/example_match_package.cc b/doc/api/cplusplus/examples/example_match_package.cc
index c308f8d..0ff9e9f 100644
--- a/doc/api/cplusplus/examples/example_match_package.cc
+++ b/doc/api/cplusplus/examples/example_match_package.cc
@@ -54,7 +54,7 @@ int main(int argc, char * argv[])
i != i_end ; ++i)
{
/* Is it paludis? */
- if (match_package(*env, make_package_dep_spec({ }).package(
+ if (match_package(*env, MutablePackageDepSpecData({ }).constrain_package(
QualifiedPackageName("sys-apps/paludis")), *i, make_null_shared_ptr(), { }))
cout << left << setw(50) << (stringify(**i) + ":") << " " << "paludis" << endl;
diff --git a/doc/api/cplusplus/examples/example_selection.cc b/doc/api/cplusplus/examples/example_selection.cc
index ad60e36..0242dbd 100644
--- a/doc/api/cplusplus/examples/example_selection.cc
+++ b/doc/api/cplusplus/examples/example_selection.cc
@@ -62,13 +62,13 @@ int main(int argc, char * argv[])
* object used determines the number and ordering of results. In the
* simplest form, it takes a Generator as a parameter. */
show_selection(env, selection::AllVersionsSorted(
- generator::Matches(make_package_dep_spec({ }).package(
+ generator::Matches(MutablePackageDepSpecData({ }).constrain_package(
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { })));
/* Generators can be passed through a Filter. The Selection optimises
* the code internally to avoid doing excess work. */
show_selection(env, selection::AllVersionsSorted(
- generator::Matches(make_package_dep_spec({ }).package(
+ generator::Matches(MutablePackageDepSpecData({ }).constrain_package(
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) |
filter::InstalledAtSlash()));
@@ -76,7 +76,7 @@ int main(int argc, char * argv[])
* with filter::SupportsAction<InstallAction>, since installed packages
* aren't masked. */
show_selection(env, selection::AllVersionsSorted(
- generator::Matches(make_package_dep_spec({ }).package(
+ generator::Matches(MutablePackageDepSpecData({ }).constrain_package(
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) |
filter::SupportsAction<InstallAction>() |
filter::NotMasked()));
@@ -85,7 +85,7 @@ int main(int argc, char * argv[])
* is no metadata cache. Consider using other Selection objects if
* you only need the best matching or some arbitrary matching ID. */
show_selection(env, selection::BestVersionOnly(
- generator::Matches(make_package_dep_spec({ }).package(
+ generator::Matches(MutablePackageDepSpecData({ }).constrain_package(
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) |
filter::SupportsAction<InstallAction>() |
filter::NotMasked()));
diff --git a/paludis/changed_choices.cc b/paludis/changed_choices.cc
index 4ed5af0..cca3885 100644
--- a/paludis/changed_choices.cc
+++ b/paludis/changed_choices.cc
@@ -18,13 +18,15 @@
*/
#include <paludis/changed_choices.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/tribool.hh>
#include <paludis/choice.hh>
#include <paludis/serialise-impl.hh>
#include <paludis/elike_use_requirement-fwd.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
+
+#include <paludis/util/pimp-impl.hh>
+#include <paludis/util/tribool.hh>
+
#include <map>
using namespace paludis;
@@ -59,16 +61,16 @@ ChangedChoices::empty() const
}
void
-ChangedChoices::add_constraints_to(PartiallyMadePackageDepSpec & spec) const
+ChangedChoices::add_constraints_to(MutablePackageDepSpecData & spec) const
{
for (auto o(_imp->overrides.begin()), o_end(_imp->overrides.end()) ;
o != o_end ; ++o)
{
if (o->second)
- spec.choice_constraint(parse_elike_use_requirement("" + stringify(o->first) + "(-)",
+ spec.constrain_choice(parse_elike_use_requirement("" + stringify(o->first) + "(-)",
{ euro_allow_default_values }));
else
- spec.choice_constraint(parse_elike_use_requirement("-" + stringify(o->first) + "(-)",
+ spec.constrain_choice(parse_elike_use_requirement("-" + stringify(o->first) + "(-)",
{ euro_allow_default_values }));
}
}
diff --git a/paludis/changed_choices.hh b/paludis/changed_choices.hh
index 754c582..580ed80 100644
--- a/paludis/changed_choices.hh
+++ b/paludis/changed_choices.hh
@@ -27,7 +27,7 @@
#include <paludis/choice-fwd.hh>
#include <paludis/serialise-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
-#include <paludis/partially_made_package_dep_spec-fwd.hh>
+#include <paludis/dep_spec_data-fwd.hh>
#include <memory>
namespace paludis
@@ -47,7 +47,7 @@ namespace paludis
bool empty() const PALUDIS_ATTRIBUTE((warn_unused_result));
- void add_constraints_to(PartiallyMadePackageDepSpec &) const;
+ void add_constraints_to(MutablePackageDepSpecData &) const;
void serialise(Serialiser &) const;
diff --git a/paludis/common_sets.cc b/paludis/common_sets.cc
index 308e3b8..e2df523 100644
--- a/paludis/common_sets.cc
+++ b/paludis/common_sets.cc
@@ -27,7 +27,8 @@
#include <paludis/filtered_generator.hh>
#include <paludis/metadata_key.hh>
#include <paludis/package_id.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/stringify.hh>
@@ -56,14 +57,14 @@ namespace
i != i_end ; ++i)
if (slots && (*i)->slot_key())
result->top()->append(std::make_shared<PackageDepSpec>(
- make_package_dep_spec({ })
- .package((*i)->name())
- .exact_slot_constraint((*i)->slot_key()->value(), false)
+ MutablePackageDepSpecData({ })
+ .constrain_package((*i)->name())
+ .constrain_exact_slot((*i)->slot_key()->value(), false)
));
else
result->top()->append(std::make_shared<PackageDepSpec>(
- make_package_dep_spec({ })
- .package((*i)->name())
+ MutablePackageDepSpecData({ })
+ .constrain_package((*i)->name())
));
return result;
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index f9b000d..a9f4616 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/partially_made_package_dep_spec-fwd.hh>
#include <paludis/dep_spec_data-fwd.hh>
#include <paludis/dep_spec_annotations-fwd.hh>
#include <paludis/package_dep_spec_constraint-fwd.hh>
diff --git a/paludis/dep_spec_data-fwd.hh b/paludis/dep_spec_data-fwd.hh
index 1bbf447..90934e8 100644
--- a/paludis/dep_spec_data-fwd.hh
+++ b/paludis/dep_spec_data-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * 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
@@ -20,10 +20,27 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_SPEC_DATA_FWD_HH
#define PALUDIS_GUARD_PALUDIS_DEP_SPEC_DATA_FWD_HH 1
+#include <paludis/util/attributes.hh>
+#include <paludis/util/options-fwd.hh>
+
+#include <iosfwd>
+
namespace paludis
{
class PackageDepSpecData;
class ConditionalDepSpecData;
+
+#include <paludis/dep_spec_data-se.hh>
+
+ class MutablePackageDepSpecData;
+
+ /**
+ * Options for PackageDepSpecData.
+ *
+ * \ingroup g_dep_spec
+ * \since 0.61
+ */
+ typedef Options<PackageDepSpecDataOption> PackageDepSpecDataOptions;
}
#endif
diff --git a/paludis/dep_spec_data.cc b/paludis/dep_spec_data.cc
index 6a7a2da..8349265 100644
--- a/paludis/dep_spec_data.cc
+++ b/paludis/dep_spec_data.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * 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
@@ -18,10 +18,574 @@
*/
#include <paludis/dep_spec_data.hh>
+#include <paludis/package_dep_spec_constraint.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/version_operator.hh>
+#include <paludis/version_spec.hh>
+
+#include <paludis/util/stringify.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/pimp-impl.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/wrapped_output_iterator.hh>
+
+#include <istream>
+#include <ostream>
using namespace paludis;
+#include <paludis/dep_spec_data-se.cc>
+
ConditionalDepSpecData::~ConditionalDepSpecData() = default;
+namespace paludis
+{
+ template <>
+ struct Imp<PackageDepSpecData>
+ {
+ std::shared_ptr<const NameConstraint> package;
+ std::shared_ptr<const PackageNamePartConstraint> package_name_part;
+ std::shared_ptr<const CategoryNamePartConstraint> category_name_part;
+ std::shared_ptr<VersionConstraintSequence> all_versions;
+ std::shared_ptr<const AnySlotConstraint> any_slot;
+ 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 InstallableToRepositoryConstraint> installable_to_repository;
+ 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<ChoiceConstraintSequence> all_choices;
+ PackageDepSpecDataOptions options;
+
+ Imp(const PackageDepSpecDataOptions & o) :
+ options(o)
+ {
+ }
+
+ Imp(const PackageDepSpecData & other) :
+ package(other.package_name_constraint()),
+ package_name_part(other.package_name_part_constraint()),
+ category_name_part(other.category_name_part_constraint()),
+ all_versions(other.all_version_constraints() ? new VersionConstraintSequence : 0),
+ any_slot(other.any_slot_constraint()),
+ exact_slot(other.exact_slot_constraint()),
+ in_repository(other.in_repository_constraint()),
+ from_repository(other.from_repository_constraint()),
+ installable_to_repository(other.installable_to_repository_constraint()),
+ 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),
+ all_choices(other.all_choice_constraints() ? new ChoiceConstraintSequence : 0),
+ options(other.options())
+ {
+ if (all_versions)
+ std::copy(other.all_version_constraints()->begin(), other.all_version_constraints()->end(),
+ all_versions->back_inserter());
+
+ if (all_keys)
+ std::copy(other.all_key_constraints()->begin(), other.all_key_constraints()->end(),
+ all_keys->back_inserter());
+
+ if (all_choices)
+ std::copy(other.all_choice_constraints()->begin(), other.all_choice_constraints()->end(),
+ all_choices->back_inserter());
+ }
+ };
+}
+
+PackageDepSpecData::PackageDepSpecData(const PackageDepSpecDataOptions & o) :
+ _imp(o)
+{
+}
+
+PackageDepSpecData::PackageDepSpecData(const PackageDepSpecData & o) :
+ _imp(o)
+{
+}
+
PackageDepSpecData::~PackageDepSpecData() = default;
+const std::shared_ptr<const NameConstraint>
+PackageDepSpecData::package_name_constraint() const
+{
+ return _imp->package;
+}
+
+const std::shared_ptr<const PackageNamePartConstraint>
+PackageDepSpecData::package_name_part_constraint() const
+{
+ return _imp->package_name_part;
+}
+
+const std::shared_ptr<const CategoryNamePartConstraint>
+PackageDepSpecData::category_name_part_constraint() const
+{
+ return _imp->category_name_part;
+}
+
+const std::shared_ptr<const VersionConstraintSequence>
+PackageDepSpecData::all_version_constraints() const
+{
+ return _imp->all_versions;
+}
+
+const std::shared_ptr<const ExactSlotConstraint>
+PackageDepSpecData::exact_slot_constraint() const
+{
+ return _imp->exact_slot;
+}
+
+const std::shared_ptr<const AnySlotConstraint>
+PackageDepSpecData::any_slot_constraint() const
+{
+ return _imp->any_slot;
+}
+
+const std::shared_ptr<const InRepositoryConstraint>
+PackageDepSpecData::in_repository_constraint() const
+{
+ return _imp->in_repository;
+}
+
+const std::shared_ptr<const InstallableToRepositoryConstraint>
+PackageDepSpecData::installable_to_repository_constraint() const
+{
+ return _imp->installable_to_repository;
+}
+
+const std::shared_ptr<const FromRepositoryConstraint>
+PackageDepSpecData::from_repository_constraint() const
+{
+ return _imp->from_repository;
+}
+
+const std::shared_ptr<const InstalledAtPathConstraint>
+PackageDepSpecData::installed_at_path_constraint() const
+{
+ return _imp->installed_at_path;
+}
+
+const std::shared_ptr<const InstallableToPathConstraint>
+PackageDepSpecData::installable_to_path_constraint() const
+{
+ return _imp->installable_to_path;
+}
+
+const std::shared_ptr<const KeyConstraintSequence>
+PackageDepSpecData::all_key_constraints() const
+{
+ return _imp->all_keys;
+}
+
+const std::shared_ptr<const ChoiceConstraintSequence>
+PackageDepSpecData::all_choice_constraints() const
+{
+ return _imp->all_choices;
+}
+
+const PackageDepSpecDataOptions
+PackageDepSpecData::options() const
+{
+ return _imp->options;
+}
+
+std::string
+PackageDepSpecData::as_string() const
+{
+ std::ostringstream s;
+
+ if (all_version_constraints())
+ {
+ if (all_version_constraints()->begin() == all_version_constraints()->end())
+ {
+ }
+ else if (next(all_version_constraints()->begin()) == all_version_constraints()->end() &&
+ ! options()[pdsdo_always_use_ranged_deps])
+ {
+ if ((*all_version_constraints()->begin())->version_operator() == vo_stupid_equal_star ||
+ (*all_version_constraints()->begin())->version_operator() == vo_nice_equal_star)
+ s << "=";
+ else
+ s << (*all_version_constraints()->begin())->version_operator();
+ }
+ }
+
+ if (package_name_constraint())
+ s << package_name_constraint()->name();
+ else
+ {
+ if (category_name_part_constraint())
+ s << category_name_part_constraint()->name_part();
+ else
+ s << "*";
+
+ s << "/";
+
+ if (package_name_part_constraint())
+ s << package_name_part_constraint()->name_part();
+ else
+ s << "*";
+ }
+
+ if (all_version_constraints())
+ {
+ if (all_version_constraints()->begin() == all_version_constraints()->end())
+ {
+ }
+ else if (next(all_version_constraints()->begin()) == all_version_constraints()->end() &&
+ ! options()[pdsdo_always_use_ranged_deps])
+ {
+ s << "-" << (*all_version_constraints()->begin())->version_spec();
+ if ((*all_version_constraints()->begin())->version_operator() == vo_stupid_equal_star ||
+ (*all_version_constraints()->begin())->version_operator() == vo_nice_equal_star)
+ s << "*";
+ }
+ }
+
+ if (exact_slot_constraint())
+ {
+ if (exact_slot_constraint()->locked())
+ s << ":=";
+ else
+ s << ":";
+
+ s << stringify(exact_slot_constraint()->name());
+ }
+
+ if (any_slot_constraint())
+ {
+ if (any_slot_constraint()->locking())
+ s << ":=";
+ else
+ s << ":*";
+ }
+
+ std::string left, right;
+ bool need_arrow(false);
+
+ if (from_repository_constraint())
+ left = stringify(from_repository_constraint()->name());
+
+ if (in_repository_constraint())
+ right = stringify(in_repository_constraint()->name());
+
+ if (installed_at_path_constraint())
+ {
+ if (! right.empty())
+ {
+ need_arrow = true;
+ right.append("->");
+ }
+ right.append(stringify(installed_at_path_constraint()->path()));
+ }
+
+ if (installable_to_repository_constraint())
+ {
+ if (! right.empty())
+ {
+ need_arrow = true;
+ right.append("->");
+ }
+ if (installable_to_repository_constraint()->include_masked())
+ right.append(stringify(installable_to_repository_constraint()->name()) + "??");
+ else
+ right.append(stringify(installable_to_repository_constraint()->name()) + "?");
+ }
+
+ if (installable_to_path_constraint())
+ {
+ if (! right.empty())
+ {
+ need_arrow = true;
+ right.append("->");
+ }
+ if (installable_to_path_constraint()->include_masked())
+ right.append(stringify(installable_to_path_constraint()->path()) + "??");
+ else
+ right.append(stringify(installable_to_path_constraint()->path()) + "?");
+ }
+
+ if (need_arrow || ((! left.empty()) && (! right.empty())))
+ s << "::" << left << "->" << right;
+ else if (! right.empty())
+ s << "::" << right;
+ else if (! left.empty())
+ s << "::" << left << "->";
+
+ if (all_version_constraints())
+ {
+ if (all_version_constraints()->begin() == all_version_constraints()->end())
+ {
+ }
+ else if (next(all_version_constraints()->begin()) == all_version_constraints()->end() &&
+ ! options()[pdsdo_always_use_ranged_deps])
+ {
+ }
+ else
+ {
+ bool need_op(false);
+ s << "[";
+ for (auto r(all_version_constraints()->begin()), r_end(all_version_constraints()->end()) ; r != r_end ; ++r)
+ {
+ if (need_op)
+ {
+ do
+ {
+ switch ((*r)->combiner())
+ {
+ case vcc_and:
+ s << "&";
+ continue;
+
+ case vcc_or:
+ s << "|";
+ continue;
+
+ case last_vcc:
+ ;
+ }
+ throw InternalError(PALUDIS_HERE, "Bad version_requirements_mode");
+ } while (false);
+ }
+
+ if ((*r)->version_operator() == vo_stupid_equal_star || (*r)->version_operator() == vo_nice_equal_star)
+ s << "=";
+ else
+ s << (*r)->version_operator();
+
+ s << (*r)->version_spec();
+
+ if ((*r)->version_operator() == vo_stupid_equal_star || (*r)->version_operator() == vo_nice_equal_star)
+ s << "*";
+
+ need_op = true;
+ }
+ s << "]";
+ }
+ }
+
+ 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())
+ for (auto u(all_key_constraints()->begin()), u_end(all_key_constraints()->end()) ; u != u_end ; ++u)
+ s << (*u)->as_raw_string();
+
+ return s.str();
+}
+
+
+MutablePackageDepSpecData::MutablePackageDepSpecData(const PackageDepSpecDataOptions & o) :
+ PackageDepSpecData(o)
+{
+}
+
+MutablePackageDepSpecData::MutablePackageDepSpecData(const PackageDepSpecData & o) :
+ PackageDepSpecData(o)
+{
+}
+
+MutablePackageDepSpecData::MutablePackageDepSpecData(const MutablePackageDepSpecData & o) :
+ PackageDepSpecData(o)
+{
+}
+
+MutablePackageDepSpecData::~MutablePackageDepSpecData() = default;
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_package(const QualifiedPackageName & name)
+{
+ _imp->package = NameConstraintPool::get_instance()->create(name);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_package()
+{
+ _imp->package.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_package_name_part(const PackageNamePart & part)
+{
+ _imp->package_name_part = PackageNamePartConstraintPool::get_instance()->create(part);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_package_name_part()
+{
+ _imp->package_name_part.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_category_name_part(const CategoryNamePart & part)
+{
+ _imp->category_name_part = CategoryNamePartConstraintPool::get_instance()->create(part);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_category_name_part()
+{
+ _imp->category_name_part.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_version(const VersionConstraintCombiner vc, const VersionOperator & vo, const VersionSpec & vs)
+{
+ if (! _imp->all_versions)
+ _imp->all_versions = std::make_shared<VersionConstraintSequence>();
+ _imp->all_versions->push_back(std::make_shared<VersionConstraint>(vs, vo, vc));
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_versions()
+{
+ _imp->all_versions.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_exact_slot(const SlotName & n, const bool s)
+{
+ _imp->exact_slot = ExactSlotConstraintPool::get_instance()->create(n, s);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_exact_slot()
+{
+ _imp->exact_slot.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_in_repository(const RepositoryName & s)
+{
+ _imp->in_repository = InRepositoryConstraintPool::get_instance()->create(s);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_in_repository()
+{
+ _imp->in_repository.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_installable_to_path(const FSPath & s, const bool i)
+{
+ _imp->installable_to_path = InstallableToPathConstraintPool::get_instance()->create(s, i);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_installable_to_path()
+{
+ _imp->installable_to_path.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_installable_to_repository(const RepositoryName & n, const bool i)
+{
+ _imp->installable_to_repository = InstallableToRepositoryConstraintPool::get_instance()->create(n, i);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_installable_to_repository()
+{
+ _imp->installable_to_repository.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_from_repository(const RepositoryName & n)
+{
+ _imp->from_repository = FromRepositoryConstraintPool::get_instance()->create(n);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_from_repository()
+{
+ _imp->from_repository.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_installed_at_path(const FSPath & s)
+{
+ _imp->installed_at_path = InstalledAtPathConstraintPool::get_instance()->create(s);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_installed_at_path()
+{
+ _imp->installed_at_path.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_any_slot(const bool s)
+{
+ _imp->any_slot = AnySlotConstraintPool::get_instance()->create(s);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_any_slot()
+{
+ _imp->any_slot.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_choice(const std::shared_ptr<const ChoiceConstraint> & c)
+{
+ if (! _imp->all_choices)
+ _imp->all_choices = std::make_shared<ChoiceConstraintSequence>();
+ _imp->all_choices->push_back(c);
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_choices()
+{
+ _imp->all_choices.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::constrain_key(const KeyConstraintKeyType t, const std::string & k, const KeyConstraintOperation o, const std::string & p)
+{
+ if (! _imp->all_keys)
+ _imp->all_keys = std::make_shared<KeyConstraintSequence>();
+ _imp->all_keys->push_back(KeyConstraintPool::get_instance()->create(t, k, o, p));
+ return *this;
+}
+
+MutablePackageDepSpecData &
+MutablePackageDepSpecData::unconstrain_keys()
+{
+ _imp->all_keys.reset();
+ return *this;
+}
+
+MutablePackageDepSpecData::operator PackageDepSpec() const
+{
+ return PackageDepSpec(std::make_shared<MutablePackageDepSpecData>(*this));
+}
+
diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh
index 1eb81cf..173c4e4 100644
--- a/paludis/dep_spec_data.hh
+++ b/paludis/dep_spec_data.hh
@@ -21,16 +21,19 @@
#define PALUDIS_GUARD_PALUDIS_DEP_SPEC_DATA_HH 1
#include <paludis/dep_spec_data-fwd.hh>
-#include <paludis/util/attributes.hh>
-#include <paludis/util/fs_path-fwd.hh>
#include <paludis/changed_choices-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/version_operator-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
-#include <paludis/partially_made_package_dep_spec-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/package_dep_spec_constraint-fwd.hh>
+#include <paludis/version_spec-fwd.hh>
+
+#include <paludis/util/attributes.hh>
+#include <paludis/util/fs_path-fwd.hh>
+#include <paludis/util/pimp.hh>
+
#include <string>
#include <memory>
@@ -90,14 +93,22 @@ namespace paludis
* Data for a PackageDepSpec.
*
* \since 0.26
+ * \since 0.61 is not abstract
* \ingroup g_dep_spec
*/
class PALUDIS_VISIBLE PackageDepSpecData
{
+ protected:
+ Pimp<PackageDepSpecData> _imp;
+
+ PackageDepSpecData(const PackageDepSpecData &);
+
public:
///\name Basic operations
///\{
+ explicit PackageDepSpecData(const PackageDepSpecDataOptions &);
+
virtual ~PackageDepSpecData();
///\}
@@ -105,7 +116,7 @@ namespace paludis
/**
* Fetch ourself as a string.
*/
- virtual std::string as_string() const = 0;
+ std::string as_string() const;
/**
* Fetch the single NameConstraint, if we have one, or
@@ -113,8 +124,8 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const NameConstraint> package_name_constraint() const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ const std::shared_ptr<const NameConstraint> package_name_constraint() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch the single PackageNamePartConstraint, if we have one, or
@@ -122,8 +133,8 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const PackageNamePartConstraint> package_name_part_constraint() const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ const std::shared_ptr<const PackageNamePartConstraint> package_name_part_constraint() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch the single CategoryNamePartConstraint, if we have one, or
@@ -131,8 +142,8 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const CategoryNamePartConstraint> category_name_part_constraint() const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ const std::shared_ptr<const CategoryNamePartConstraint> category_name_part_constraint() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch all our VersionConstraints, if we have any, or
@@ -140,7 +151,7 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const VersionConstraintSequence> all_version_constraints() const = 0;
+ const std::shared_ptr<const VersionConstraintSequence> all_version_constraints() const;
/**
* Fetch the single ExactSlotConstraint, if we have one, or
@@ -148,7 +159,7 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const ExactSlotConstraint> exact_slot_constraint() const = 0;
+ const std::shared_ptr<const ExactSlotConstraint> exact_slot_constraint() const;
/**
* Fetch the single AnySlotConstraint, if we have one, or
@@ -156,7 +167,7 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const AnySlotConstraint> any_slot_constraint() const = 0;
+ const std::shared_ptr<const AnySlotConstraint> any_slot_constraint() const;
/**
* Fetch the single InRepositoryConstraint, if we have one, or
@@ -164,15 +175,15 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch the single InstallableToRepositoryConstraint, if we have one, or
*
* \since 0.61
*/
- virtual const std::shared_ptr<const InstallableToRepositoryConstraint> installable_to_repository_constraint() const = 0;
+ const std::shared_ptr<const InstallableToRepositoryConstraint> installable_to_repository_constraint() const;
/**
* Fetch the single FromRepositoryConstraint, if we have one, or
@@ -180,7 +191,7 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const FromRepositoryConstraint> from_repository_constraint() const = 0;
+ const std::shared_ptr<const FromRepositoryConstraint> from_repository_constraint() const;
/**
* Fetch the single InstalledAtPathConstraint, if we have one, or
@@ -188,7 +199,7 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const InstalledAtPathConstraint> installed_at_path_constraint() const = 0;
+ const std::shared_ptr<const InstalledAtPathConstraint> installed_at_path_constraint() const;
/**
* Fetch the single InstallableToPathConstraint, if we have one, or
@@ -196,7 +207,7 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const InstallableToPathConstraint> installable_to_path_constraint() const = 0;
+ const std::shared_ptr<const InstallableToPathConstraint> installable_to_path_constraint() const;
/**
* Fetch all our KeyConstraints, if we have any, or
@@ -204,7 +215,7 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const KeyConstraintSequence> all_key_constraints() const = 0;
+ const std::shared_ptr<const KeyConstraintSequence> all_key_constraints() const;
/**
* Fetch all our ChoiceConstraints, if we have any, or
@@ -212,14 +223,225 @@ namespace paludis
*
* \since 0.61
*/
- virtual const std::shared_ptr<const ChoiceConstraintSequence> all_choice_constraints() const = 0;
+ const std::shared_ptr<const ChoiceConstraintSequence> all_choice_constraints() const;
+
+ /**
+ * Our options.
+ *
+ * \since 0.61
+ */
+ const PackageDepSpecDataOptions options() const;
+ };
+
+ /**
+ * Partially constructed PackageDepSpecData, which can be used to build up a
+ * PackageDepSpec.
+ *
+ * \since 0.61
+ * \ingroup g_dep_spec
+ */
+ class PALUDIS_VISIBLE MutablePackageDepSpecData :
+ public PackageDepSpecData
+ {
+ public:
+ explicit MutablePackageDepSpecData(const PackageDepSpecDataOptions &);
+
+ MutablePackageDepSpecData(const PackageDepSpecData &);
+
+ MutablePackageDepSpecData(const MutablePackageDepSpecData &);
+
+ ~MutablePackageDepSpecData();
+
+ /**
+ * Add a package constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_package(const QualifiedPackageName &);
+
+ /**
+ * Clear any package constraints.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_package();
+
+ /**
+ * Add a package name part constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_package_name_part(const PackageNamePart &);
+
+ /**
+ * Clear any package name part constraints.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_package_name_part();
+
+ /**
+ * Add a category name part constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_category_name_part(const CategoryNamePart &);
+
+ /**
+ * Clear any category name part constraints.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_category_name_part();
+
+ /**
+ * Add a version constraint.
+ *
+ * The combiner must be vcc_and if this is the first version
+ * constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_version(const VersionConstraintCombiner, const VersionOperator &, const VersionSpec &);
+
+ /**
+ * Clear any version constraints.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_versions();
+
+ /**
+ * Add an exact slot constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_exact_slot(const SlotName &, const bool locked);
+
+ /**
+ * Clear any exact slot constraints.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_exact_slot();
/**
- * Fetch options if we're being used to construct a new PartiallyMadePackageDepSpec.
+ * Add an in repository constraint.
*
- * \since 0.38
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_in_repository(const RepositoryName &);
+
+ /**
+ * Clear any in repository constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_in_repository();
+
+ /**
+ * Add an installable to path constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_installable_to_path(const FSPath &, const bool);
+
+ /**
+ * Clear any installable to path constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_installable_to_path();
+
+ /**
+ * Add an installable to repository constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_installable_to_repository(const RepositoryName &, const bool);
+
+ /**
+ * Clear any installable to repository constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_installable_to_repository();
+
+ /**
+ * Add a from repository constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_from_repository(const RepositoryName &);
+
+ /**
+ * Clear any from repository constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_from_repository();
+
+ /**
+ * Add an installed at path constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_installed_at_path(const FSPath &);
+
+ /**
+ * Clear any installed at path constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_installed_at_path();
+
+ /**
+ * Add an any slot constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_any_slot(const bool);
+
+ /**
+ * Clear our AnySlotConstraint, if we have one.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_any_slot();
+
+ /**
+ * Add a choice constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_choice(const std::shared_ptr<const ChoiceConstraint> &);
+
+ /**
+ * Clear any choice constraints.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_choices();
+
+ /**
+ * Add a key constraint.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & constrain_key(
+ const KeyConstraintKeyType, const std::string &, const KeyConstraintOperation, const std::string &);
+
+ /**
+ * Clear any key constraints.
+ *
+ * \return *this
+ */
+ MutablePackageDepSpecData & unconstrain_keys();
+
+ /**
+ * Convert ourself to a PackageDepSpec.
*/
- virtual const PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec() const = 0;
+ operator PackageDepSpec() const;
};
}
diff --git a/paludis/dep_spec_data.se b/paludis/dep_spec_data.se
new file mode 100644
index 0000000..1fffbe8
--- /dev/null
+++ b/paludis/dep_spec_data.se
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_PackageDepSpecDataOption()
+{
+ prefix pdsdo
+
+ key pdsdo_always_use_ranged_deps "Always write [>=1] style dependencies"
+
+ doxygen_comment << "END"
+ /**
+ * Options for PackageDepSpecData.
+ *
+ * \ingroup g_dep_spec
+ * \since 0.61
+ */
+END
+}
+
diff --git a/paludis/elike_package_dep_spec-fwd.hh b/paludis/elike_package_dep_spec-fwd.hh
index 80309cc..03cb1f8 100644
--- a/paludis/elike_package_dep_spec-fwd.hh
+++ b/paludis/elike_package_dep_spec-fwd.hh
@@ -22,12 +22,14 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/options-fwd.hh>
+
#include <paludis/dep_spec-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/version_operator-fwd.hh>
#include <paludis/version_spec-fwd.hh>
#include <paludis/package_dep_spec_constraint-fwd.hh>
-#include <paludis/partially_made_package_dep_spec-fwd.hh>
+#include <paludis/dep_spec_data-fwd.hh>
+
#include <functional>
#include <iosfwd>
@@ -43,7 +45,7 @@ namespace paludis
PackageDepSpec parse_generic_elike_package_dep_spec(const std::string & ss, const GenericELikePackageDepSpecParseFunctions & fns)
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
- PartiallyMadePackageDepSpec partial_parse_generic_elike_package_dep_spec(const std::string & ss,
+ MutablePackageDepSpecData partial_parse_generic_elike_package_dep_spec(const std::string & ss,
const GenericELikePackageDepSpecParseFunctions & fns)
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
@@ -51,23 +53,23 @@ namespace paludis
const VersionSpecOptions &)
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
- PartiallyMadePackageDepSpec partial_parse_elike_package_dep_spec(const std::string & ss,
+ MutablePackageDepSpecData partial_parse_elike_package_dep_spec(const std::string & ss,
const ELikePackageDepSpecOptions &,
const VersionSpecOptions &)
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
void elike_check_sanity(const std::string & s) PALUDIS_VISIBLE;
- bool elike_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
+ bool elike_remove_trailing_square_bracket_if_exists(std::string & s, MutablePackageDepSpecData & result,
const ELikePackageDepSpecOptions & options,
const VersionSpecOptions & version_options,
bool & had_bracket_version_requirements,
bool & had_use_requirements) PALUDIS_VISIBLE;
- void elike_remove_trailing_repo_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
+ void elike_remove_trailing_repo_if_exists(std::string & s, MutablePackageDepSpecData & result,
const ELikePackageDepSpecOptions & options) PALUDIS_VISIBLE;
- void elike_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
+ void elike_remove_trailing_slot_if_exists(std::string & s, MutablePackageDepSpecData & result,
const ELikePackageDepSpecOptions & options) PALUDIS_VISIBLE;
bool elike_has_version_operator(const std::string & s, const bool had_bracket_version_requirements,
@@ -83,17 +85,17 @@ namespace paludis
const VersionSpec & spec,
const VersionOperator & op,
const VersionConstraintCombiner,
- PartiallyMadePackageDepSpec & result)
+ MutablePackageDepSpecData & result)
PALUDIS_VISIBLE;
void parse_elike_version_range(
const std::string &,
- PartiallyMadePackageDepSpec &,
+ MutablePackageDepSpecData &,
const ELikePackageDepSpecOptions & options,
const VersionSpecOptions & version_options,
bool & had_bracket_version_requirements) PALUDIS_VISIBLE;
- void elike_add_package_requirement(const std::string & s, PartiallyMadePackageDepSpec & result) PALUDIS_VISIBLE;
+ void elike_add_package_requirement(const std::string & s, MutablePackageDepSpecData & result) PALUDIS_VISIBLE;
}
#endif
diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc
index b3b186e..c899b85 100644
--- a/paludis/elike_package_dep_spec.cc
+++ b/paludis/elike_package_dep_spec.cc
@@ -23,12 +23,13 @@
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/util/options.hh>
#include <paludis/util/log.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/options.hh>
+#include <paludis/util/return_literal_function.hh>
#include <strings.h>
@@ -36,7 +37,7 @@ using namespace paludis;
#include <paludis/elike_package_dep_spec-se.cc>
-PartiallyMadePackageDepSpec
+MutablePackageDepSpecData
paludis::partial_parse_generic_elike_package_dep_spec(const std::string & ss, const GenericELikePackageDepSpecParseFunctions & fns)
{
Context context("When parsing generic package dep spec '" + ss + "':");
@@ -45,7 +46,7 @@ paludis::partial_parse_generic_elike_package_dep_spec(const std::string & ss, co
fns.check_sanity()(ss);
std::string s(ss);
- PartiallyMadePackageDepSpec result(fns.options_for_partially_made_package_dep_spec()());
+ MutablePackageDepSpecData result(fns.options_for_partially_made_package_dep_spec()());
/* Remove trailing [use], [version] etc parts. */
while (fns.remove_trailing_square_bracket_if_exists()(s, result))
@@ -87,7 +88,7 @@ paludis::elike_check_sanity(const std::string & s)
}
bool
-paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
+paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, MutablePackageDepSpecData & result,
const ELikePackageDepSpecOptions & options,
const VersionSpecOptions & version_options,
bool & had_bracket_version_requirements,
@@ -139,7 +140,7 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial
}
auto k(parse_user_key_constraint(flag.substr(1)));
- result.key_constraint(std::get<0>(k), std::get<1>(k), std::get<2>(k), std::get<3>(k));
+ result.constrain_key(std::get<0>(k), std::get<1>(k), std::get<2>(k), std::get<3>(k));
}
break;
@@ -179,7 +180,7 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial
if (options[epdso_strict_parsing])
euro += euro_strict_parsing;
- result.choice_constraint(parse_elike_use_requirement(flag, euro));
+ result.constrain_choice(parse_elike_use_requirement(flag, euro));
break;
};
@@ -190,7 +191,7 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial
}
void
-paludis::elike_remove_trailing_repo_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
+paludis::elike_remove_trailing_repo_if_exists(std::string & s, MutablePackageDepSpecData & result,
const ELikePackageDepSpecOptions & options)
{
std::string::size_type repo_p;
@@ -206,12 +207,12 @@ paludis::elike_remove_trailing_repo_if_exists(std::string & s, PartiallyMadePack
<< "Repository dependencies not safe for use here";
}
- result.in_repository(RepositoryName(s.substr(repo_p + 2)));
+ result.constrain_in_repository(RepositoryName(s.substr(repo_p + 2)));
s.erase(repo_p);
}
void
-paludis::elike_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
+paludis::elike_remove_trailing_slot_if_exists(std::string & s, MutablePackageDepSpecData & result,
const ELikePackageDepSpecOptions & options)
{
std::string::size_type slot_p;
@@ -232,7 +233,7 @@ paludis::elike_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePack
Log::get_instance()->message("e.package_dep_spec.slot_star_not_allowed", ll_warning, lc_context)
<< "Slot '*' dependencies not safe for use here";
}
- result.any_slot_constraint(false);
+ result.constrain_any_slot(false);
}
else if ('=' == match.at(0))
{
@@ -246,9 +247,9 @@ paludis::elike_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePack
}
if (1 == match.length())
- result.any_slot_constraint(true);
+ result.constrain_any_slot(true);
else
- result.exact_slot_constraint(SlotName(s.substr(slot_p + 2)), true);
+ result.constrain_exact_slot(SlotName(s.substr(slot_p + 2)), true);
}
else
{
@@ -260,7 +261,7 @@ paludis::elike_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePack
Log::get_instance()->message("e.package_dep_spec.slot_not_allowed", ll_warning, lc_context)
<< "Slot dependencies not safe for use here";
}
- result.exact_slot_constraint(SlotName(s.substr(slot_p + 1)), false);
+ result.constrain_exact_slot(SlotName(s.substr(slot_p + 1)), false);
}
s.erase(slot_p);
}
@@ -373,13 +374,13 @@ paludis::elike_add_version_requirement(
const VersionSpec & ver,
const VersionOperator & op,
const VersionConstraintCombiner vcc,
- PartiallyMadePackageDepSpec & result)
+ MutablePackageDepSpecData & result)
{
- result.version_constraint(ver, op, vcc);
+ result.constrain_version(vcc, op, ver);
}
void
-paludis::elike_add_package_requirement(const std::string & s, PartiallyMadePackageDepSpec & result)
+paludis::elike_add_package_requirement(const std::string & s, MutablePackageDepSpecData & result)
{
if (std::string::npos == s.find('/'))
throw PackageDepSpecError("No category/ found in '" + s + "' (cat/pkg is required, a simple pkg is not allowed here)");
@@ -389,27 +390,19 @@ paludis::elike_add_package_requirement(const std::string & s, PartiallyMadePacka
throw PackageDepSpecError("Wildcard '*' not allowed here");
if (0 != s.compare(s.length() - 2, 2, "/*"))
- result.package_name_part(PackageNamePart(s.substr(2)));
+ result.constrain_package_name_part(PackageNamePart(s.substr(2)));
}
else if (s.length() >= 3 && (0 == s.compare(s.length() - 2, 2, "/*")))
{
throw PackageDepSpecError("Wildcard '*' not allowed here");
- result.category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
+ result.constrain_category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
}
else
- result.package(QualifiedPackageName(s));
+ result.constrain_package(QualifiedPackageName(s));
}
-namespace
-{
- const PartiallyMadePackageDepSpecOptions fixed_options_for_partially_made_package_dep_spec(PartiallyMadePackageDepSpecOptions o)
- {
- return o;
- }
-}
-
-PartiallyMadePackageDepSpec
+MutablePackageDepSpecData
paludis::partial_parse_elike_package_dep_spec(
const std::string & ss, const ELikePackageDepSpecOptions & options,
const VersionSpecOptions & version_options)
@@ -420,9 +413,9 @@ paludis::partial_parse_elike_package_dep_spec(
bool had_bracket_version_requirements(false), had_use_requirements(false);
- PartiallyMadePackageDepSpecOptions o;
+ PackageDepSpecDataOptions o;
if (options[epdso_disallow_nonranged_deps])
- o += pmpdso_always_use_ranged_deps;
+ o += pdsdo_always_use_ranged_deps;
return partial_parse_generic_elike_package_dep_spec(ss, make_named_values<GenericELikePackageDepSpecParseFunctions>(
n::add_package_requirement() = std::bind(&elike_add_package_requirement, _1, _2),
@@ -432,7 +425,7 @@ paludis::partial_parse_elike_package_dep_spec(
n::get_remove_version_operator() = std::bind(&elike_get_remove_version_operator, _1, options),
n::has_version_operator() = std::bind(&elike_has_version_operator, _1,
std::cref(had_bracket_version_requirements), options),
- n::options_for_partially_made_package_dep_spec() = std::bind(&fixed_options_for_partially_made_package_dep_spec, std::cref(o)),
+ n::options_for_partially_made_package_dep_spec() = return_literal_function(o),
n::remove_trailing_repo_if_exists() = std::bind(&elike_remove_trailing_repo_if_exists, _1, _2, options),
n::remove_trailing_slot_if_exists() = std::bind(&elike_remove_trailing_slot_if_exists, _1, _2, options),
n::remove_trailing_square_bracket_if_exists() = std::bind(&elike_remove_trailing_square_bracket_if_exists,
@@ -450,7 +443,7 @@ paludis::parse_elike_package_dep_spec(const std::string & ss, const ELikePackage
void
paludis::parse_elike_version_range(
const std::string & s,
- PartiallyMadePackageDepSpec & result,
+ MutablePackageDepSpecData & result,
const ELikePackageDepSpecOptions & options,
const VersionSpecOptions & version_options,
bool & had_bracket_version_requirements)
@@ -506,7 +499,7 @@ paludis::parse_elike_version_range(
}
VersionSpec vs(ver, version_options);
- result.version_constraint(vs, vop, vcc);
+ result.constrain_version(vcc, vop, vs);
had_bracket_version_requirements = true;
vcc = next_vcc;
}
diff --git a/paludis/elike_package_dep_spec.hh b/paludis/elike_package_dep_spec.hh
index 9d7beb7..54d6478 100644
--- a/paludis/elike_package_dep_spec.hh
+++ b/paludis/elike_package_dep_spec.hh
@@ -21,6 +21,8 @@
#define PALUDIS_GUARD_PALUDIS_ELIKE_PACKAGE_DEP_SPEC_HH 1
#include <paludis/elike_package_dep_spec-fwd.hh>
+#include <paludis/dep_spec_data-fwd.hh>
+
#include <paludis/util/named_value.hh>
namespace paludis
@@ -41,20 +43,20 @@ namespace paludis
struct GenericELikePackageDepSpecParseFunctions
{
- NamedValue<n::add_package_requirement, std::function<void (const std::string &, PartiallyMadePackageDepSpec &)> > add_package_requirement;
+ NamedValue<n::add_package_requirement, std::function<void (const std::string &, MutablePackageDepSpecData &)> > add_package_requirement;
NamedValue<n::add_version_requirement, std::function<void (
const VersionSpec &,
const VersionOperator &,
const VersionConstraintCombiner,
- PartiallyMadePackageDepSpec &)> > add_version_requirement;
+ MutablePackageDepSpecData &)> > add_version_requirement;
NamedValue<n::check_sanity, std::function<void (const std::string &)> > check_sanity;
NamedValue<n::get_remove_trailing_version, std::function<VersionSpec (std::string &)> > get_remove_trailing_version;
NamedValue<n::get_remove_version_operator, std::function<VersionOperator (std::string &)> > get_remove_version_operator;
NamedValue<n::has_version_operator, std::function<bool (const std::string &)> > has_version_operator;
- NamedValue<n::options_for_partially_made_package_dep_spec, std::function<const PartiallyMadePackageDepSpecOptions ()> > options_for_partially_made_package_dep_spec;
- NamedValue<n::remove_trailing_repo_if_exists, std::function<void (std::string &, PartiallyMadePackageDepSpec &)> > remove_trailing_repo_if_exists;
- NamedValue<n::remove_trailing_slot_if_exists, std::function<void (std::string &, PartiallyMadePackageDepSpec &)> > remove_trailing_slot_if_exists;
- NamedValue<n::remove_trailing_square_bracket_if_exists, std::function<bool (std::string &, PartiallyMadePackageDepSpec &)> > remove_trailing_square_bracket_if_exists;
+ NamedValue<n::options_for_partially_made_package_dep_spec, std::function<const PackageDepSpecDataOptions ()> > options_for_partially_made_package_dep_spec;
+ NamedValue<n::remove_trailing_repo_if_exists, std::function<void (std::string &, MutablePackageDepSpecData &)> > remove_trailing_repo_if_exists;
+ NamedValue<n::remove_trailing_slot_if_exists, std::function<void (std::string &, MutablePackageDepSpecData &)> > remove_trailing_slot_if_exists;
+ NamedValue<n::remove_trailing_square_bracket_if_exists, std::function<bool (std::string &, MutablePackageDepSpecData &)> > remove_trailing_square_bracket_if_exists;
};
}
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index 910d278..cfcf7e1 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -28,7 +28,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/util/log.hh>
#include <paludis/util/save.hh>
@@ -516,7 +516,7 @@ EnvironmentImplementation::fetch_unique_qualified_package_name(const PackageName
std::set<std::pair<CategoryNamePart, RepositoryName>, CategoryRepositoryNamePairComparator> checked;
std::shared_ptr<const PackageIDSequence> pkgs((*this)[selection::AllVersionsUnsorted(
- generator::Matches(make_package_dep_spec({ }).package_name_part(p), make_null_shared_ptr(), { }) | f)]);
+ generator::Matches(MutablePackageDepSpecData({ }).constrain_package_name_part(p), make_null_shared_ptr(), { }) | f)]);
for (IndirectIterator<PackageIDSequence::ConstIterator> it(pkgs->begin()),
it_end(pkgs->end()); it_end != it; ++it)
diff --git a/paludis/environments/paludis/world.cc b/paludis/environments/paludis/world.cc
index b546d4f..a3de07a 100644
--- a/paludis/environments/paludis/world.cc
+++ b/paludis/environments/paludis/world.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/environments/paludis/world.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/stringify.hh>
@@ -25,9 +26,11 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/safe_ofstream.hh>
#include <paludis/util/fs_stat.hh>
+
#include <paludis/set_file.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <functional>
using namespace paludis;
@@ -166,7 +169,10 @@ void
World::update_config_files_for_package_move(const PackageDepSpec & s, const QualifiedPackageName & n) const
{
if (_remove_string_from_world(stringify(s)))
- _add_string_to_world(stringify(PartiallyMadePackageDepSpec(s).package(n)));
+ _add_string_to_world(stringify(
+ MutablePackageDepSpecData(*s.data())
+ .unconstrain_package()
+ .constrain_package(n)));
}
const std::shared_ptr<const SetSpecTree>
diff --git a/paludis/environments/paludis/world_TEST.cc b/paludis/environments/paludis/world_TEST.cc
index cbb2f7f..0b5d565 100644
--- a/paludis/environments/paludis/world_TEST.cc
+++ b/paludis/environments/paludis/world_TEST.cc
@@ -23,7 +23,7 @@
#include <paludis/util/safe_ifstream.hh>
#include <paludis/util/options.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <iterator>
#include <cstdlib>
@@ -39,8 +39,8 @@ TEST(World, Updates)
{
TestEnvironment env;
paludis_environment::World world(&env, w);
- world.update_config_files_for_package_move(make_package_dep_spec({ })
- .package(QualifiedPackageName("cat/before")),
+ world.update_config_files_for_package_move(MutablePackageDepSpecData({ })
+ .constrain_package(QualifiedPackageName("cat/before")),
QualifiedPackageName("cat/after"));
}
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index d24557d..0a86a28 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -56,7 +56,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/repository_factory.hh>
#include <paludis/choice.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <functional>
#include <algorithm>
@@ -939,7 +939,10 @@ void
PortageEnvironment::update_config_files_for_package_move(const PackageDepSpec & s, const QualifiedPackageName & n) const
{
if (_remove_string_from_world(stringify(s)))
- _add_string_to_world(stringify(PartiallyMadePackageDepSpec(s).package(n)));
+ _add_string_to_world(stringify(
+ MutablePackageDepSpecData(*s.data())
+ .unconstrain_package()
+ .constrain_package(n)));
}
void
diff --git a/paludis/environments/portage/portage_environment_TEST.cc b/paludis/environments/portage/portage_environment_TEST.cc
index 1f637f2..db06a6f 100644
--- a/paludis/environments/portage/portage_environment_TEST.cc
+++ b/paludis/environments/portage/portage_environment_TEST.cc
@@ -37,7 +37,7 @@
#include <paludis/selection.hh>
#include <paludis/metadata_key.hh>
#include <paludis/choice.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <gtest/gtest.h>
@@ -177,8 +177,8 @@ TEST(PortageEnvironment, World)
TestPortageEnvironment env("portage_environment_TEST_dir/world");
FSPath w(FSPath::cwd() / "portage_environment_TEST_dir" / "world" / "var" / "lib" / "portage" / "world");
- env.update_config_files_for_package_move(make_package_dep_spec({ })
- .package(QualifiedPackageName("cat/before")),
+ env.update_config_files_for_package_move(MutablePackageDepSpecData({ })
+ .constrain_package(QualifiedPackageName("cat/before")),
QualifiedPackageName("cat/after"));
SafeIFStream f(w);
diff --git a/paludis/files.m4 b/paludis/files.m4
index 85b9213..3a67ff2 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -28,7 +28,7 @@ add(`create_output_manager_info', `hh', `cc', `fwd', `se')
add(`dep_label', `hh', `cc', `fwd')
add(`dep_spec', `hh', `cc', `gtest', `fwd')
add(`dep_spec_annotations', `hh', `cc', `fwd', `se')
-add(`dep_spec_data', `hh', `cc', `fwd')
+add(`dep_spec_data', `hh', `cc', `fwd', `se')
add(`dep_spec_flattener', `hh', `cc')
add(`distribution', `hh', `cc', `impl', `fwd')
add(`elf_linkage_checker', `hh', `cc')
@@ -79,7 +79,6 @@ add(`package_dep_spec_properties', `hh', `cc', `fwd')
add(`package_id', `hh', `cc', `fwd', `se')
add(`paludis', `hh')
add(`paludislike_options_conf', `hh', `cc', `fwd')
-add(`partially_made_package_dep_spec', `hh', `cc', `fwd', `se', `gtest')
add(`permitted_choice_value_parameter_values', `hh', `cc', `fwd')
add(`pretty_print_options', `hh', `cc', `fwd', `se')
add(`pretty_printer', `hh', `cc', `fwd')
diff --git a/paludis/package_dep_spec_constraint.cc b/paludis/package_dep_spec_constraint.cc
index 68b1639..5a80529 100644
--- a/paludis/package_dep_spec_constraint.cc
+++ b/paludis/package_dep_spec_constraint.cc
@@ -36,6 +36,7 @@
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/set-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/wrapped_output_iterator-impl.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
@@ -152,6 +153,7 @@ VersionConstraint::combiner() const
template class Sequence<std::shared_ptr<const VersionConstraint> >;
template class WrappedForwardIterator<Sequence<std::shared_ptr<const VersionConstraint> >::ConstIteratorTag, const std::shared_ptr<const VersionConstraint> >;
+template class WrappedOutputIterator<Sequence<std::shared_ptr<const VersionConstraint> >::InserterTag, std::shared_ptr<const VersionConstraint> >;
template class Pimp<VersionConstraint>;
InRepositoryConstraint::InRepositoryConstraint(const RepositoryName & n) :
@@ -1137,10 +1139,12 @@ template class Singleton<Pool<KeyConstraint> >;
template const std::shared_ptr<const KeyConstraint> Pool<KeyConstraint>::create(
const KeyConstraintKeyType &, const std::string &, const KeyConstraintOperation &, const std::string &) const;
template class Sequence<std::shared_ptr<const KeyConstraint> >;
+template class WrappedOutputIterator<Sequence<std::shared_ptr<const KeyConstraint> >::InserterTag, 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> >;
+template class WrappedOutputIterator<Sequence<std::shared_ptr<const ChoiceConstraint> >::InserterTag, std::shared_ptr<const ChoiceConstraint> >;
diff --git a/paludis/partially_made_package_dep_spec-fwd.hh b/paludis/partially_made_package_dep_spec-fwd.hh
deleted file mode 100644
index 7a2a465..0000000
--- a/paludis/partially_made_package_dep_spec-fwd.hh
+++ /dev/null
@@ -1,53 +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_PARTIALLY_MADE_PACKAGE_DEP_SPEC_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_PARTIALLY_MADE_PACKAGE_DEP_SPEC_FWD_HH 1
-
-#include <paludis/util/attributes.hh>
-#include <paludis/util/options-fwd.hh>
-#include <iosfwd>
-
-namespace paludis
-{
-
-#include <paludis/partially_made_package_dep_spec-se.hh>
-
- /**
- * Options for PartiallyMadePackageDepSpec.
- *
- * \ingroup g_dep_spec
- * \since 0.38
- */
- typedef Options<PartiallyMadePackageDepSpecOption> PartiallyMadePackageDepSpecOptions;
-
- class PartiallyMadePackageDepSpec;
-
- /**
- * Create a PackageDepSpec from various rules.
- *
- * Note the return type is a PartiallyMadePackageDepSpec, which is implicitly convertible to
- * a PackageDepSpec.
- *
- * \ingroup g_dep_spec
- * \since 0.26
- */
- PartiallyMadePackageDepSpec make_package_dep_spec(const PartiallyMadePackageDepSpecOptions &) PALUDIS_VISIBLE;
-}
-
-#endif
diff --git a/paludis/partially_made_package_dep_spec.cc b/paludis/partially_made_package_dep_spec.cc
deleted file mode 100644
index 2dc71ff..0000000
--- a/paludis/partially_made_package_dep_spec.cc
+++ /dev/null
@@ -1,638 +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
- */
-
-#include <paludis/partially_made_package_dep_spec.hh>
-#include <paludis/dep_spec_data.hh>
-#include <paludis/package_dep_spec_constraint.hh>
-#include <paludis/version_operator.hh>
-#include <paludis/version_spec.hh>
-
-#include <paludis/util/stringify.hh>
-#include <paludis/util/exception.hh>
-#include <paludis/util/options.hh>
-#include <paludis/util/wrapped_output_iterator-impl.hh>
-#include <paludis/util/iterator_funcs.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/sequence-impl.hh>
-
-#include <iterator>
-#include <algorithm>
-#include <ostream>
-
-using namespace paludis;
-
-#include <paludis/partially_made_package_dep_spec-se.cc>
-
-PartiallyMadePackageDepSpec
-paludis::make_package_dep_spec(const PartiallyMadePackageDepSpecOptions & o)
-{
- return PartiallyMadePackageDepSpec(o);
-}
-
-namespace
-{
- struct PartiallyMadePackageDepSpecData :
- PackageDepSpecData
- {
- std::shared_ptr<const NameConstraint> package;
- std::shared_ptr<const PackageNamePartConstraint> package_name_part;
- std::shared_ptr<const CategoryNamePartConstraint> category_name_part;
- std::shared_ptr<VersionConstraintSequence> all_versions;
- std::shared_ptr<const AnySlotConstraint> any_slot;
- 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 InstallableToRepositoryConstraint> installable_to_repository;
- 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<ChoiceConstraintSequence> all_choices;
- PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec_v;
-
- PartiallyMadePackageDepSpecData(const PartiallyMadePackageDepSpecOptions & o) :
- PackageDepSpecData(),
- options_for_partially_made_package_dep_spec_v(o)
- {
- }
-
- PartiallyMadePackageDepSpecData(const PackageDepSpecData & other) :
- PackageDepSpecData(other),
- package(other.package_name_constraint()),
- package_name_part(other.package_name_part_constraint()),
- category_name_part(other.category_name_part_constraint()),
- all_versions(other.all_version_constraints() ? new VersionConstraintSequence : 0),
- any_slot(other.any_slot_constraint()),
- exact_slot(other.exact_slot_constraint()),
- in_repository(other.in_repository_constraint()),
- from_repository(other.from_repository_constraint()),
- installable_to_repository(other.installable_to_repository_constraint()),
- 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),
- 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)
- std::copy(other.all_version_constraints()->begin(), other.all_version_constraints()->end(),
- all_versions->back_inserter());
-
- if (all_keys)
- std::copy(other.all_key_constraints()->begin(), other.all_key_constraints()->end(),
- all_keys->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) :
- PackageDepSpecData(other),
- package(other.package),
- package_name_part(other.package_name_part),
- category_name_part(other.category_name_part),
- all_versions(other.all_versions),
- any_slot(other.any_slot),
- exact_slot(other.exact_slot),
- in_repository(other.in_repository),
- from_repository(other.from_repository),
- installable_to_repository(other.installable_to_repository),
- installed_at_path(other.installed_at_path),
- installable_to_path(other.installable_to_path),
- all_keys(other.all_keys),
- all_choices(other.all_choices),
- options_for_partially_made_package_dep_spec_v(other.options_for_partially_made_package_dep_spec_v)
- {
- }
-
- virtual std::string as_string() const
- {
- std::ostringstream s;
-
- if (all_version_constraints())
- {
- if (all_version_constraints()->begin() == all_version_constraints()->end())
- {
- }
- else if (next(all_version_constraints()->begin()) == all_version_constraints()->end() &&
- ! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
- {
- if ((*all_version_constraints()->begin())->version_operator() == vo_stupid_equal_star ||
- (*all_version_constraints()->begin())->version_operator() == vo_nice_equal_star)
- s << "=";
- else
- s << (*all_version_constraints()->begin())->version_operator();
- }
- }
-
- if (package_name_constraint())
- s << package_name_constraint()->name();
- else
- {
- if (category_name_part_constraint())
- s << category_name_part_constraint()->name_part();
- else
- s << "*";
-
- s << "/";
-
- if (package_name_part_constraint())
- s << package_name_part_constraint()->name_part();
- else
- s << "*";
- }
-
- if (all_version_constraints())
- {
- if (all_version_constraints()->begin() == all_version_constraints()->end())
- {
- }
- else if (next(all_version_constraints()->begin()) == all_version_constraints()->end() &&
- ! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
- {
- s << "-" << (*all_version_constraints()->begin())->version_spec();
- if ((*all_version_constraints()->begin())->version_operator() == vo_stupid_equal_star ||
- (*all_version_constraints()->begin())->version_operator() == vo_nice_equal_star)
- s << "*";
- }
- }
-
- if (exact_slot_constraint())
- {
- if (exact_slot_constraint()->locked())
- s << ":=";
- else
- s << ":";
-
- s << stringify(exact_slot_constraint()->name());
- }
-
- if (any_slot_constraint())
- {
- if (any_slot_constraint()->locking())
- s << ":=";
- else
- s << ":*";
- }
-
- std::string left, right;
- bool need_arrow(false);
-
- if (from_repository_constraint())
- left = stringify(from_repository_constraint()->name());
-
- if (in_repository_constraint())
- right = stringify(in_repository_constraint()->name());
-
- if (installed_at_path_constraint())
- {
- if (! right.empty())
- {
- need_arrow = true;
- right.append("->");
- }
- right.append(stringify(installed_at_path_constraint()->path()));
- }
-
- if (installable_to_repository_constraint())
- {
- if (! right.empty())
- {
- need_arrow = true;
- right.append("->");
- }
- if (installable_to_repository_constraint()->include_masked())
- right.append(stringify(installable_to_repository_constraint()->name()) + "??");
- else
- right.append(stringify(installable_to_repository_constraint()->name()) + "?");
- }
-
- if (installable_to_path_constraint())
- {
- if (! right.empty())
- {
- need_arrow = true;
- right.append("->");
- }
- if (installable_to_path_constraint()->include_masked())
- right.append(stringify(installable_to_path_constraint()->path()) + "??");
- else
- right.append(stringify(installable_to_path_constraint()->path()) + "?");
- }
-
- if (need_arrow || ((! left.empty()) && (! right.empty())))
- s << "::" << left << "->" << right;
- else if (! right.empty())
- s << "::" << right;
- else if (! left.empty())
- s << "::" << left << "->";
-
- if (all_version_constraints())
- {
- if (all_version_constraints()->begin() == all_version_constraints()->end())
- {
- }
- else if (next(all_version_constraints()->begin()) == all_version_constraints()->end() &&
- ! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
- {
- }
- else
- {
- bool need_op(false);
- s << "[";
- for (auto r(all_version_constraints()->begin()), r_end(all_version_constraints()->end()) ; r != r_end ; ++r)
- {
- if (need_op)
- {
- do
- {
- switch ((*r)->combiner())
- {
- case vcc_and:
- s << "&";
- continue;
-
- case vcc_or:
- s << "|";
- continue;
-
- case last_vcc:
- ;
- }
- throw InternalError(PALUDIS_HERE, "Bad version_requirements_mode");
- } while (false);
- }
-
- if ((*r)->version_operator() == vo_stupid_equal_star || (*r)->version_operator() == vo_nice_equal_star)
- s << "=";
- else
- s << (*r)->version_operator();
-
- s << (*r)->version_spec();
-
- if ((*r)->version_operator() == vo_stupid_equal_star || (*r)->version_operator() == vo_nice_equal_star)
- s << "*";
-
- need_op = true;
- }
- s << "]";
- }
- }
-
- 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())
- for (auto u(all_key_constraints()->begin()), u_end(all_key_constraints()->end()) ; u != u_end ; ++u)
- s << (*u)->as_raw_string();
-
- return s.str();
- }
-
- virtual const std::shared_ptr<const NameConstraint> package_name_constraint() const
- {
- return package;
- }
-
- virtual const std::shared_ptr<const PackageNamePartConstraint> package_name_part_constraint() const
- {
- return package_name_part;
- }
-
- virtual const std::shared_ptr<const CategoryNamePartConstraint> category_name_part_constraint() const
- {
- return category_name_part;
- }
-
- virtual const std::shared_ptr<const VersionConstraintSequence> all_version_constraints() const
- {
- return all_versions;
- }
-
- virtual const std::shared_ptr<const ExactSlotConstraint> exact_slot_constraint() const
- {
- return exact_slot;
- }
-
- virtual const std::shared_ptr<const AnySlotConstraint> any_slot_constraint() const
- {
- return any_slot;
- }
-
- virtual const std::shared_ptr<const InRepositoryConstraint> in_repository_constraint() const
- {
- return in_repository;
- }
-
- virtual const std::shared_ptr<const InstallableToRepositoryConstraint> installable_to_repository_constraint() const
- {
- return installable_to_repository;
- }
-
- virtual const std::shared_ptr<const FromRepositoryConstraint> from_repository_constraint() const
- {
- return from_repository;
- }
-
- virtual const std::shared_ptr<const InstalledAtPathConstraint> installed_at_path_constraint() const
- {
- return installed_at_path;
- }
-
- virtual const std::shared_ptr<const InstallableToPathConstraint> installable_to_path_constraint() const
- {
- return installable_to_path;
- }
-
- virtual const std::shared_ptr<const KeyConstraintSequence> all_key_constraints() const
- {
- return all_keys;
- }
-
- virtual const std::shared_ptr<const ChoiceConstraintSequence> all_choice_constraints() const
- {
- return all_choices;
- }
-
- virtual const PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec() const
- {
- return options_for_partially_made_package_dep_spec_v;
- }
- };
-}
-
-namespace paludis
-{
- template <>
- struct Imp<PartiallyMadePackageDepSpec>
- {
- std::shared_ptr<PartiallyMadePackageDepSpecData> data;
-
- Imp(const PartiallyMadePackageDepSpecOptions & o) :
- data(std::make_shared<PartiallyMadePackageDepSpecData>(o))
- {
- }
-
- Imp(const Imp & other) :
- data(std::make_shared<PartiallyMadePackageDepSpecData>(*other.data))
- {
- }
-
- Imp(const PackageDepSpec & other) :
- data(std::make_shared<PartiallyMadePackageDepSpecData>(*other.data()))
- {
- }
- };
-}
-
-PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpecOptions & o) :
- _imp(o)
-{
-}
-
-PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec & other) :
- _imp(*other._imp.get())
-{
-}
-
-PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PackageDepSpec & other) :
- _imp(other)
-{
-}
-
-PartiallyMadePackageDepSpec::~PartiallyMadePackageDepSpec()
-{
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::package(const QualifiedPackageName & name)
-{
- _imp->data->package_name_part.reset();
- _imp->data->category_name_part.reset();
- _imp->data->package = NameConstraintPool::get_instance()->create(name);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_package()
-{
- _imp->data->package.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::any_slot_constraint(const bool s)
-{
- _imp->data->any_slot = AnySlotConstraintPool::get_instance()->create(s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::exact_slot_constraint(const SlotName & n, const bool s)
-{
- _imp->data->exact_slot = ExactSlotConstraintPool::get_instance()->create(n, s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_exact_slot()
-{
- _imp->data->exact_slot.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_any_slot()
-{
- _imp->data->any_slot.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::in_repository(const RepositoryName & s)
-{
- _imp->data->in_repository = InRepositoryConstraintPool::get_instance()->create(s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_in_repository()
-{
- _imp->data->in_repository.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::from_repository(const RepositoryName & s)
-{
- _imp->data->from_repository = FromRepositoryConstraintPool::get_instance()->create(s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_from_repository()
-{
- _imp->data->from_repository.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::installable_to_repository(const RepositoryName & n, const bool i)
-{
- _imp->data->installable_to_repository = InstallableToRepositoryConstraintPool::get_instance()->create(n, i);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_installable_to_repository()
-{
- _imp->data->installable_to_repository.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::installed_at_path(const FSPath & s)
-{
- _imp->data->installed_at_path = InstalledAtPathConstraintPool::get_instance()->create(s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_installed_at_path()
-{
- _imp->data->installed_at_path.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::installable_to_path(const FSPath & s, const bool i)
-{
- _imp->data->installable_to_path = InstallableToPathConstraintPool::get_instance()->create(s, i);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_installable_to_path()
-{
- _imp->data->installable_to_path.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::package_name_part(const PackageNamePart & part)
-{
- _imp->data->package.reset();
- if (_imp->data->category_name_part)
- {
- _imp->data->package = NameConstraintPool::get_instance()->create(_imp->data->category_name_part->name_part() + part);
- _imp->data->category_name_part.reset();
- }
- else
- _imp->data->package_name_part = PackageNamePartConstraintPool::get_instance()->create(part);
-
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_package_name_part()
-{
- _imp->data->package_name_part.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::category_name_part(const CategoryNamePart & part)
-{
- _imp->data->category_name_part.reset();
- if (_imp->data->package_name_part)
- {
- _imp->data->package = NameConstraintPool::get_instance()->create(part + _imp->data->package_name_part->name_part());
- _imp->data->package_name_part.reset();
- }
- else
- _imp->data->category_name_part = CategoryNamePartConstraintPool::get_instance()->create(part);
-
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_category_name_part()
-{
- _imp->data->category_name_part.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::version_constraint(const VersionSpec & vs, const VersionOperator & vo, const VersionConstraintCombiner vc)
-{
- if (! _imp->data->all_versions)
- _imp->data->all_versions = std::make_shared<VersionConstraintSequence>();
-
- if (_imp->data->all_versions->empty() && vc != vcc_and)
- throw InternalError(PALUDIS_HERE, "First vc must be vcc_and");
-
- _imp->data->all_versions->push_back(std::make_shared<VersionConstraint>(vs, vo, vc));
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_version()
-{
- _imp->data->all_versions.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::key_constraint(const KeyConstraintKeyType t, const std::string & k, const KeyConstraintOperation o, const std::string & p)
-{
- if (! _imp->data->all_keys)
- _imp->data->all_keys = std::make_shared<KeyConstraintSequence>();
- _imp->data->all_keys->push_back(KeyConstraintPool::get_instance()->create(t, k, o, p));
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::choice_constraint(const std::shared_ptr<const ChoiceConstraint> & c)
-{
- 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_choices()
-{
- _imp->data->all_choices.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec::operator const PackageDepSpec() const
-{
- return PackageDepSpec(_imp->data);
-}
-
-const PackageDepSpec
-PartiallyMadePackageDepSpec::to_package_dep_spec() const
-{
- return operator const PackageDepSpec();
-}
-
-template class Pimp<PartiallyMadePackageDepSpec>;
-
diff --git a/paludis/partially_made_package_dep_spec.hh b/paludis/partially_made_package_dep_spec.hh
deleted file mode 100644
index 850cd94..0000000
--- a/paludis/partially_made_package_dep_spec.hh
+++ /dev/null
@@ -1,235 +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_PARTIALLY_MADE_PACKAGE_DEP_SPEC_HH
-#define PALUDIS_GUARD_PALUDIS_PARTIALLY_MADE_PACKAGE_DEP_SPEC_HH 1
-
-#include <paludis/partially_made_package_dep_spec-fwd.hh>
-#include <paludis/util/pimp.hh>
-#include <paludis/name-fwd.hh>
-#include <paludis/dep_spec.hh>
-
-namespace paludis
-{
- /**
- * A PartiallyMadePackageDepSpec is returned by make_package_dep_spec()
- * and is used to incrementally build a PackageDepSpec.
- *
- * \ingroup g_dep_spec
- * \since 0.26
- */
- class PALUDIS_VISIBLE PartiallyMadePackageDepSpec
- {
- private:
- Pimp<PartiallyMadePackageDepSpec> _imp;
-
- public:
- ///\name Basic operations
- ///\{
-
- PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpecOptions &);
- ~PartiallyMadePackageDepSpec();
- PartiallyMadePackageDepSpec(const PackageDepSpec &);
- PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec &);
-
- ///\}
-
- /**
- * Set our package constraints, return ourself.
- */
- PartiallyMadePackageDepSpec & package(const QualifiedPackageName &);
-
- /**
- * Clear our package constraints, return ourself.
- *
- * \since 0.55
- */
- PartiallyMadePackageDepSpec & clear_package();
-
- /**
- * Set our exact slot constraints, return ourself.
- *
- * \since 0.61
- */
- PartiallyMadePackageDepSpec & exact_slot_constraint(
- const SlotName &, const bool);
-
- /**
- * Set our locked slot constraints, return ourself.
- *
- * \since 0.61
- */
- PartiallyMadePackageDepSpec & any_slot_constraint(
- const bool);
-
- /**
- * Clear our exact slot constraints, return ourself.
- *
- * \since 0.61
- */
- PartiallyMadePackageDepSpec & clear_exact_slot();
-
- /**
- * Clear our any slot constraints, return ourself.
- *
- * \since 0.61
- */
- PartiallyMadePackageDepSpec & clear_any_slot();
-
- /**
- * Set our in-repository constraint, return ourself.
- */
- PartiallyMadePackageDepSpec & in_repository(const RepositoryName &);
-
- /**
- * Clear our in-repository constraint, return ourself.
- *
- * \since 0.55
- */
- PartiallyMadePackageDepSpec & clear_in_repository();
-
- /**
- * Set our from-repository constraint, return ourself.
- */
- PartiallyMadePackageDepSpec & from_repository(const RepositoryName &);
-
- /**
- * Clear our from-repository constraint, return ourself.
- *
- * \since 0.55
- */
- PartiallyMadePackageDepSpec & clear_from_repository();
-
- /**
- * Set our installable-to-repository constraint, return ourself.
- *
- * \since 0.61
- */
- PartiallyMadePackageDepSpec & installable_to_repository(const RepositoryName &, const bool);
-
- /**
- * Clear our installable-to-repository constraint, return ourself.
- *
- * \since 0.55
- */
- PartiallyMadePackageDepSpec & clear_installable_to_repository();
-
- /**
- * Set our installed-at-path constraint, return ourself.
- *
- * \since 0.32
- */
- PartiallyMadePackageDepSpec & installed_at_path(const FSPath &);
-
- /**
- * Clear our installed-at-path constraint, return ourself.
- *
- * \since 0.55
- */
- PartiallyMadePackageDepSpec & clear_installed_at_path();
-
- /**
- * Set our installable-to-path constraint, return ourself.
- *
- * \since 0.61
- */
- PartiallyMadePackageDepSpec & installable_to_path(const FSPath &, const bool include_masked);
-
- /**
- * Clear our installable-to-path constraint, return ourself.
- *
- * \since 0.55
- */
- PartiallyMadePackageDepSpec & clear_installable_to_path();
-
- /**
- * Set our package name part constraints, return ourself.
- */
- PartiallyMadePackageDepSpec & package_name_part(const PackageNamePart &);
-
- /**
- * Clear our package name part constraints, return ourself.
- *
- * \since 0.55
- */
- PartiallyMadePackageDepSpec & clear_package_name_part();
-
- /**
- * Set our category name part constraints, return ourself.
- */
- PartiallyMadePackageDepSpec & category_name_part(const CategoryNamePart &);
-
- /**
- * Clear our category name part constraints, return ourself.
- *
- * \since 0.55
- */
- PartiallyMadePackageDepSpec & clear_category_name_part();
-
- /**
- * Add a version constraint, return ourself.
- *
- * \since 0.61
- */
- PartiallyMadePackageDepSpec & version_constraint(
- const VersionSpec &, const VersionOperator &, const VersionConstraintCombiner);
-
- /**
- * Clear all version constraints, return ourself.
- *
- * \since 0.55
- */
- PartiallyMadePackageDepSpec & clear_version();
-
- /**
- * Add a choice constraint, return ourself.
- *
- * \since 0.61
- */
- PartiallyMadePackageDepSpec & choice_constraint(
- const std::shared_ptr<const ChoiceConstraint> &);
-
- /**
- * Add a key constraint, return ourself.
- */
- PartiallyMadePackageDepSpec & key_constraint(
- const KeyConstraintKeyType, const std::string & key, const KeyConstraintOperation, const std::string & pattern);
-
- /**
- * Clear choice constraints, return ourself.
- *
- * \since 0.61
- */
- PartiallyMadePackageDepSpec & clear_choices();
-
- /**
- * Turn ourselves into a PackageDepSpec.
- */
- operator const PackageDepSpec() const;
-
- /**
- * Explicitly turn ourselves into a PackageDepSpec.
- */
- const PackageDepSpec to_package_dep_spec() const;
- };
-
- extern template class Pimp<PartiallyMadePackageDepSpec>;
-}
-
-#endif
diff --git a/paludis/partially_made_package_dep_spec.se b/paludis/partially_made_package_dep_spec.se
deleted file mode 100644
index ed3550a..0000000
--- a/paludis/partially_made_package_dep_spec.se
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et ft=sh :
-
-make_enum_PartiallyMadePackageDepSpecOption()
-{
- prefix pmpdso
-
- key pmpdso_always_use_ranged_deps "Always write [>=1] style dependencies"
-
- doxygen_comment << "END"
- /**
- * Options for PartiallyMadePackageDepSpec.
- *
- * \ingroup g_dep_spec
- * \since 0.38
- */
-END
-}
-
diff --git a/paludis/partially_made_package_dep_spec_TEST.cc b/paludis/partially_made_package_dep_spec_TEST.cc
deleted file mode 100644
index 0685b38..0000000
--- a/paludis/partially_made_package_dep_spec_TEST.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/* 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/partially_made_package_dep_spec.hh>
-#include <paludis/package_dep_spec_constraint.hh>
-
-#include <paludis/util/stringify.hh>
-#include <paludis/util/options.hh>
-
-#include <gtest/gtest.h>
-
-using namespace paludis;
-
-TEST(PartiallyMadePackageDepSpec, CatAndPkgBecomesQPN)
-{
- PackageDepSpec p(make_package_dep_spec({ })
- .category_name_part(CategoryNamePart("cat"))
- .package_name_part(PackageNamePart("pkg"))
- );
-
- EXPECT_EQ("cat/pkg", stringify(p));
-
- ASSERT_TRUE(bool(p.package_name_constraint()));
- EXPECT_EQ("cat/pkg", stringify(p.package_name_constraint()->name()));
-
- EXPECT_FALSE(bool(p.category_name_part_constraint()));
- EXPECT_FALSE(bool(p.package_name_part_constraint()));
-}
-
-TEST(PartiallyMadePackageDepSpec, QPNClearsCatPkg)
-{
- PackageDepSpec p(make_package_dep_spec({ })
- .category_name_part(CategoryNamePart("cat"))
- .package_name_part(PackageNamePart("pkg"))
- .package(QualifiedPackageName("other/name"))
- );
-
- EXPECT_EQ("other/name", stringify(p));
-
- ASSERT_TRUE(bool(p.package_name_constraint()));
- EXPECT_EQ("other/name", stringify(p.package_name_constraint()->name()));
-
- EXPECT_FALSE(bool(p.category_name_part_constraint()));
- EXPECT_FALSE(bool(p.package_name_part_constraint()));
-}
-
diff --git a/paludis/repositories/accounts/accounts_dep_key.cc b/paludis/repositories/accounts/accounts_dep_key.cc
index 06b2f54..0d08a66 100644
--- a/paludis/repositories/accounts/accounts_dep_key.cc
+++ b/paludis/repositories/accounts/accounts_dep_key.cc
@@ -18,20 +18,23 @@
*/
#include <paludis/repositories/accounts/accounts_dep_key.hh>
+
#include <paludis/util/set-impl.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/return_literal_function.hh>
#include <paludis/util/singleton-impl.hh>
+#include <paludis/util/pimp-impl.hh>
+
#include <paludis/selection.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/always_enabled_dependency_label.hh>
#include <paludis/pretty_printer.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <sstream>
#include <list>
@@ -71,8 +74,9 @@ namespace paludis
for (Set<std::string>::ConstIterator i(s->begin()), i_end(s->end()) ;
i != i_end ; ++i)
{
- std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(make_package_dep_spec({ })
- .package(CategoryNamePart("group") + PackageNamePart(*i))));
+ std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(
+ MutablePackageDepSpecData({ })
+ .constrain_package(CategoryNamePart("group") + PackageNamePart(*i))));
specs->push_back(spec);
tree->top()->append(spec);
}
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index 2f57360..83e179c 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -32,11 +32,11 @@
#include <paludis/generator.hh>
#include <paludis/metadata_key.hh>
#include <paludis/package_id.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/selection.hh>
#include <paludis/set_file.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/version_operator.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/is_file_with_extension.hh>
@@ -293,10 +293,10 @@ ERepositorySets::security_set(bool insecurity) const
if (insecurity)
{
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(
- make_package_dep_spec({ })
- .package((*c)->name())
- .version_constraint((*c)->version(), vo_equal, vcc_and)
- .in_repository((*c)->repository_name())));
+ MutablePackageDepSpecData({ })
+ .constrain_package((*c)->name())
+ .constrain_version(vcc_and, vo_equal, (*c)->version())
+ .constrain_in_repository((*c)->repository_name())));
security_packages->top()->append(spec);
}
else
@@ -323,10 +323,10 @@ ERepositorySets::security_set(bool insecurity) const
continue;
}
- std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(make_package_dep_spec({ })
- .package((*r)->name())
- .version_constraint((*r)->version(), vo_equal, vcc_and)
- .in_repository((*r)->repository_name())));
+ std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(MutablePackageDepSpecData({ })
+ .constrain_package((*r)->name())
+ .constrain_version(vcc_and, vo_equal, (*r)->version())
+ .constrain_in_repository((*r)->repository_name())));
security_packages->top()->append(spec);
ok = true;
break;
diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc
index 1f952e2..db1864d 100644
--- a/paludis/repositories/e/fix_locked_dependencies.cc
+++ b/paludis/repositories/e/fix_locked_dependencies.cc
@@ -19,12 +19,14 @@
#include <paludis/repositories/e/fix_locked_dependencies.hh>
#include <paludis/repositories/e/eapi.hh>
+
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/options.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
+
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
@@ -33,8 +35,9 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/package_dep_spec_constraint.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <functional>
#include <algorithm>
#include <list>
@@ -109,9 +112,9 @@ namespace
if ((*matches->last())->slot_key())
{
- PackageDepSpec new_s(PartiallyMadePackageDepSpec(*node.spec())
- .clear_any_slot()
- .exact_slot_constraint((*matches->last())->slot_key()->value(), true));
+ PackageDepSpec new_s(MutablePackageDepSpecData(*node.spec()->data())
+ .unconstrain_any_slot()
+ .constrain_exact_slot((*matches->last())->slot_key()->value(), true));
c = std::make_shared<PackageDepSpec>(new_s);
}
} while (false);
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index a6b9a91..a9515c4 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -50,10 +50,10 @@
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
#include <paludis/output_manager.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/dep_spec_annotations.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <paludis/package_dep_spec_constraint.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/mutex.hh>
@@ -1275,8 +1275,9 @@ namespace
if (node.spec()->package_name_constraint() && rewrites.end() != rewrites.find(node.spec()->package_name_constraint()->name()))
{
changed = true;
- str << f.prettify(PartiallyMadePackageDepSpec(*node.spec())
- .package(rewrites.find(node.spec()->package_name_constraint()->name())->second)) << " ";
+ str << f.prettify(MutablePackageDepSpecData(*node.spec()->data())
+ .unconstrain_package()
+ .constrain_package(rewrites.find(node.spec()->package_name_constraint()->name())->second)) << " ";
}
else
str << f.prettify(*node.spec()) << " ";
@@ -1613,7 +1614,9 @@ VDBRepository::perform_updates()
for (DepRewrites::const_iterator i(dep_rewrites.begin()), i_end(dep_rewrites.end()) ;
i != i_end ; ++i)
_imp->params.environment()->update_config_files_for_package_move(
- make_package_dep_spec({ }).package(i->first),
+ MutablePackageDepSpecData({ })
+ .unconstrain_package()
+ .constrain_package(i->first),
i->second
);
}
diff --git a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc
index c5a77f8..757f4ab 100644
--- a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc
+++ b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/repositories/gemcutter/gemcutter_dependencies_key.hh>
+
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/pimp-impl.hh>
@@ -27,10 +28,10 @@
#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/make_named_values.hh>
+
#include <paludis/always_enabled_dependency_label.hh>
#include <paludis/spec_tree.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/environment.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
@@ -39,6 +40,8 @@
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
#include <paludis/pretty_printer.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <sstream>
#include <algorithm>
#include <vector>
@@ -172,9 +175,9 @@ namespace
VersionSpec ver(tokens[1], { });
- return make_shared_copy(PackageDepSpec(make_package_dep_spec({ pmpdso_always_use_ranged_deps })
- .package(QualifiedPackageName("gem/" + dep.name()))
- .version_constraint(ver, op, vcc_and)
+ return make_shared_copy(PackageDepSpec(MutablePackageDepSpecData({ pdsdo_always_use_ranged_deps })
+ .constrain_package(QualifiedPackageName("gem/" + dep.name()))
+ .constrain_version(vcc_and, op, ver)
));
}
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 253466e..f59ce46 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -20,6 +20,7 @@
#include <paludis/repositories/virtuals/package_id.hh>
#include <paludis/repositories/virtuals/installed_virtuals_repository.hh>
#include <paludis/repositories/virtuals/virtuals_repository.hh>
+
#include <paludis/util/stringify.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/mutex.hh>
@@ -28,6 +29,7 @@
#include <paludis/util/return_literal_function.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/singleton-impl.hh>
+
#include <paludis/name.hh>
#include <paludis/dep_spec.hh>
#include <paludis/version_spec.hh>
@@ -42,9 +44,9 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/always_enabled_dependency_label.hh>
#include <paludis/pretty_printer.hh>
+#include <paludis/dep_spec_data.hh>
using namespace paludis;
using namespace paludis::virtuals;
@@ -70,15 +72,15 @@ namespace paludis
labels(l),
spec(exact ?
std::make_shared<PackageDepSpec>(
- make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
- .package(v->name())
- .version_constraint(v->version(), vo_equal, vcc_and)
- .exact_slot_constraint(v->slot_key() ? v->slot_key()->value() : SlotName("UNKNOWN"), false)
- .in_repository(v->repository_name()))
+ MutablePackageDepSpecData({ })
+ .constrain_package(v->name())
+ .constrain_version(vcc_and, vo_equal, v->version())
+ .constrain_exact_slot(v->slot_key() ? v->slot_key()->value() : SlotName("UNKNOWN"), false)
+ .constrain_in_repository(v->repository_name()))
:
std::make_shared<PackageDepSpec>(
- make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
- .package(v->name())
+ MutablePackageDepSpecData({ })
+ .constrain_package(v->name())
)
),
raw_name(r),
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index 1aa80cc..62288ea 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -29,7 +29,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/hook.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/util/log.hh>
#include <paludis/util/operators.hh>
@@ -160,7 +160,7 @@ VirtualsRepository::need_names() const
for (RepositoryProvidesInterface::ProvidesSequence::ConstIterator p(provides->begin()),
p_end(provides->end()) ; p != p_end ; ++p)
_imp->names.push_back(std::make_pair((*p).virtual_name(), std::shared_ptr<const PackageDepSpec>(
- std::make_shared<PackageDepSpec>(make_package_dep_spec(PartiallyMadePackageDepSpecOptions()).package((*p).provided_by()->name())))));
+ std::make_shared<PackageDepSpec>(MutablePackageDepSpecData({ }).constrain_package((*p).provided_by()->name())))));
}
std::sort(_imp->names.begin(), _imp->names.end(), NamesSortComparator());
diff --git a/paludis/resolver/collect_depped_upon.cc b/paludis/resolver/collect_depped_upon.cc
index 257aae5..f8f6a1d 100644
--- a/paludis/resolver/collect_depped_upon.cc
+++ b/paludis/resolver/collect_depped_upon.cc
@@ -19,20 +19,23 @@
#include <paludis/resolver/collect_depped_upon.hh>
#include <paludis/resolver/change_by_resolvent.hh>
+
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+
#include <paludis/spec_tree.hh>
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/metadata_key.hh>
#include <paludis/match_package.hh>
#include <paludis/version_spec.hh>
#include <paludis/package_dep_spec_constraint.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <algorithm>
using namespace paludis;
@@ -115,8 +118,10 @@ namespace
best_eventual_id = best_eventual(env, *s.spec(), id_for_specs, not_changing_slots);
if (best_eventual_id && best_eventual_id->slot_key())
{
- PartiallyMadePackageDepSpec part_spec(*s.spec());
- part_spec.exact_slot_constraint(best_eventual_id->slot_key()->value(), false);
+ MutablePackageDepSpecData part_spec(*s.spec()->data());
+ part_spec
+ .unconstrain_exact_slot()
+ .constrain_exact_slot(best_eventual_id->slot_key()->value(), false);
spec = std::make_shared<PackageDepSpec>(part_spec);
}
}
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 6350514..374039e 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -68,10 +68,10 @@
#include <paludis/action.hh>
#include <paludis/package_id.hh>
#include <paludis/changed_choices.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/dep_spec_annotations.hh>
#include <paludis/package_dep_spec_constraint.hh>
#include <paludis/version_operator.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/util/pimp-impl.hh>
@@ -1067,11 +1067,11 @@ const PackageDepSpec
Decider::_make_spec_for_preloading(const PackageDepSpec & spec,
const std::shared_ptr<const ChangedChoices> & changed_choices) const
{
- PartiallyMadePackageDepSpec result(spec);
+ MutablePackageDepSpecData result(*spec.data());
/* 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_choices();
+ result.unconstrain_choices();
/* but we do want to impose our own ChangedChoices if necessary. */
if (changed_choices)
diff --git a/paludis/resolver/find_replacing_helper.cc b/paludis/resolver/find_replacing_helper.cc
index 42906b6..79aeedb 100644
--- a/paludis/resolver/find_replacing_helper.cc
+++ b/paludis/resolver/find_replacing_helper.cc
@@ -24,7 +24,6 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/stringify.hh>
#include <paludis/package_id.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/metadata_key.hh>
#include <paludis/repository.hh>
#include <paludis/environment.hh>
diff --git a/paludis/resolver/get_constraints_for_dependent_helper.cc b/paludis/resolver/get_constraints_for_dependent_helper.cc
index b725c58..825d287 100644
--- a/paludis/resolver/get_constraints_for_dependent_helper.cc
+++ b/paludis/resolver/get_constraints_for_dependent_helper.cc
@@ -24,17 +24,19 @@
#include <paludis/resolver/resolution.hh>
#include <paludis/resolver/decision.hh>
#include <paludis/resolver/make_uninstall_blocker.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/stringify.hh>
+
#include <paludis/dep_spec.hh>
#include <paludis/package_id.hh>
#include <paludis/package_dep_spec_collection.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/dep_spec_data.hh>
using namespace paludis;
using namespace paludis::resolver;
@@ -81,10 +83,10 @@ GetConstraintsForDependentHelper::operator() (
spec = make_shared_copy(id->uniquely_identifying_spec());
else
{
- PartiallyMadePackageDepSpec partial_spec({ });
- partial_spec.package(id->name());
+ MutablePackageDepSpecData partial_spec({ });
+ partial_spec.constrain_package(id->name());
if (id->slot_key())
- partial_spec.exact_slot_constraint(id->slot_key()->value(), false);
+ partial_spec.constrain_exact_slot(id->slot_key()->value(), false);
spec = std::make_shared<PackageDepSpec>(partial_spec);
}
diff --git a/paludis/resolver/get_constraints_for_purge_helper.cc b/paludis/resolver/get_constraints_for_purge_helper.cc
index eef5082..805ffbe 100644
--- a/paludis/resolver/get_constraints_for_purge_helper.cc
+++ b/paludis/resolver/get_constraints_for_purge_helper.cc
@@ -24,17 +24,19 @@
#include <paludis/resolver/resolution.hh>
#include <paludis/resolver/decision.hh>
#include <paludis/resolver/make_uninstall_blocker.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/stringify.hh>
+
#include <paludis/dep_spec.hh>
#include <paludis/package_id.hh>
#include <paludis/package_dep_spec_collection.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/dep_spec_data.hh>
using namespace paludis;
using namespace paludis::resolver;
@@ -76,10 +78,10 @@ GetConstraintsForPurgeHelper::operator() (
{
const std::shared_ptr<ConstraintSequence> result(std::make_shared<ConstraintSequence>());
- PartiallyMadePackageDepSpec partial_spec({ });
- partial_spec.package(id->name());
+ MutablePackageDepSpecData partial_spec({ });
+ partial_spec.constrain_package(id->name());
if (id->slot_key())
- partial_spec.exact_slot_constraint(id->slot_key()->value(), false);
+ partial_spec.constrain_exact_slot(id->slot_key()->value(), false);
PackageDepSpec spec(partial_spec);
const std::shared_ptr<WasUsedByReason> reason(std::make_shared<WasUsedByReason>(was_used_by_ids));
diff --git a/paludis/resolver/get_constraints_for_via_binary_helper.cc b/paludis/resolver/get_constraints_for_via_binary_helper.cc
index f2d8983..48edbd1 100644
--- a/paludis/resolver/get_constraints_for_via_binary_helper.cc
+++ b/paludis/resolver/get_constraints_for_via_binary_helper.cc
@@ -23,14 +23,16 @@
#include <paludis/resolver/resolvent.hh>
#include <paludis/resolver/resolution.hh>
#include <paludis/resolver/decision.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+
#include <paludis/dep_spec.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
using namespace paludis;
using namespace paludis::resolver;
@@ -63,8 +65,8 @@ GetConstraintsForViaBinaryHelper::operator() (
{
auto result(std::make_shared<ConstraintSequence>());
- PartiallyMadePackageDepSpec partial_spec({ });
- partial_spec.package(resolution->resolvent().package());
+ MutablePackageDepSpecData partial_spec({ });
+ partial_spec.constrain_package(resolution->resolvent().package());
PackageDepSpec spec(partial_spec);
auto reason(std::make_shared<ViaBinaryReason>(other_resolution->resolvent()));
diff --git a/paludis/resolver/get_destination_types_for_blocker_helper.cc b/paludis/resolver/get_destination_types_for_blocker_helper.cc
index 6dc2c30..899ec22 100644
--- a/paludis/resolver/get_destination_types_for_blocker_helper.cc
+++ b/paludis/resolver/get_destination_types_for_blocker_helper.cc
@@ -31,7 +31,6 @@
#include <paludis/dep_spec.hh>
#include <paludis/package_id.hh>
#include <paludis/package_dep_spec_collection.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/metadata_key.hh>
using namespace paludis;
diff --git a/paludis/resolver/get_destination_types_for_error_helper.cc b/paludis/resolver/get_destination_types_for_error_helper.cc
index a80aefa..6e1d7ce 100644
--- a/paludis/resolver/get_destination_types_for_error_helper.cc
+++ b/paludis/resolver/get_destination_types_for_error_helper.cc
@@ -31,7 +31,6 @@
#include <paludis/dep_spec.hh>
#include <paludis/package_id.hh>
#include <paludis/package_dep_spec_collection.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/metadata_key.hh>
using namespace paludis;
diff --git a/paludis/resolver/get_initial_constraints_for_helper.cc b/paludis/resolver/get_initial_constraints_for_helper.cc
index 734fa9f..7c288b2 100644
--- a/paludis/resolver/get_initial_constraints_for_helper.cc
+++ b/paludis/resolver/get_initial_constraints_for_helper.cc
@@ -26,6 +26,7 @@
#include <paludis/resolver/destination_utils.hh>
#include <paludis/resolver/match_qpns.hh>
#include <paludis/resolver/suggest_restart.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/make_shared_copy.hh>
@@ -35,6 +36,7 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/enum_iterator.hh>
+
#include <paludis/dep_spec.hh>
#include <paludis/package_id.hh>
#include <paludis/selection.hh>
@@ -44,7 +46,8 @@
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
#include <paludis/version_spec.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <list>
#include <unordered_map>
@@ -240,7 +243,7 @@ GetInitialConstraintsForHelper::_make_initial_constraints_for(
n::from_id() = make_null_shared_ptr(),
n::nothing_is_fine_too() = true,
n::reason() = std::make_shared<PresetReason>("is scm", make_null_shared_ptr()),
- n::spec() = make_package_dep_spec({ }).package(resolvent.package()),
+ n::spec() = MutablePackageDepSpecData({ }).constrain_package(resolvent.package()),
n::untaken() = false,
n::use_existing() = ue_only_if_transient
)));
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index 59ef7b8..38f3592 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -35,6 +35,7 @@
#include <paludis/resolver/orderer_notes.hh>
#include <paludis/resolver/change_by_resolvent.hh>
#include <paludis/resolver/labels_classifier.hh>
+
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
@@ -45,10 +46,12 @@
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/enum_iterator.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+
#include <paludis/environment.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/package_id.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
@@ -816,10 +819,12 @@ namespace
{
PackageDepSpec make_origin_spec(const ChangesToMakeDecision & changes_to_make_decision)
{
- PartiallyMadePackageDepSpec result(changes_to_make_decision.origin_id()->uniquely_identifying_spec());
+ MutablePackageDepSpecData result(*changes_to_make_decision.origin_id()->uniquely_identifying_spec().data());
if (changes_to_make_decision.if_via_new_binary_in())
- result.in_repository(*changes_to_make_decision.if_via_new_binary_in());
+ result
+ .unconstrain_in_repository()
+ .constrain_in_repository(*changes_to_make_decision.if_via_new_binary_in());
return result;
}
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index 2026885..3ef4d25 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -52,7 +52,6 @@
#include <paludis/filtered_generator.hh>
#include <paludis/generator.hh>
#include <paludis/selection.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
diff --git a/paludis/resolver/spec_rewriter.cc b/paludis/resolver/spec_rewriter.cc
index 06b16b4..0d8202b 100644
--- a/paludis/resolver/spec_rewriter.cc
+++ b/paludis/resolver/spec_rewriter.cc
@@ -27,6 +27,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+
#include <paludis/spec_tree.hh>
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
@@ -36,9 +37,10 @@
#include <paludis/filter.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/elike_blocker.hh>
#include <paludis/package_dep_spec_constraint.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <map>
#include <set>
@@ -109,7 +111,9 @@ SpecRewriter::rewrite_if_special(const PackageOrBlockDepSpec & s, const std::sha
for (std::set<QualifiedPackageName>::const_iterator n(r->second.begin()), n_end(r->second.end()) ;
n != n_end ; ++n)
- result->specs()->push_back(PackageOrBlockDepSpec(PartiallyMadePackageDepSpec(*s.if_package()).package(*n)));
+ result->specs()->push_back(PackageOrBlockDepSpec(MutablePackageDepSpecData(*s.if_package()->data())
+ .unconstrain_package()
+ .constrain_package(*n)));
return result;
}
@@ -133,7 +137,9 @@ SpecRewriter::rewrite_if_special(const PackageOrBlockDepSpec & s, const std::sha
if (maybe_our_resolvent && (*n == maybe_our_resolvent->package()))
continue;
- PackageDepSpec spec(PartiallyMadePackageDepSpec(s.if_block()->blocking()).package(*n));
+ PackageDepSpec spec(MutablePackageDepSpecData(*s.if_block()->blocking().data())
+ .unconstrain_package()
+ .constrain_package(*n));
auto p(split_elike_blocker(s.if_block()->text()));
BlockDepSpec b(std::get<1>(p) + stringify(spec), spec);
b.set_annotations(s.if_block()->maybe_annotations());
diff --git a/paludis/set_file.cc b/paludis/set_file.cc
index c5dc4c8..39afe44 100644
--- a/paludis/set_file.cc
+++ b/paludis/set_file.cc
@@ -37,9 +37,9 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/metadata_key.hh>
#include <paludis/package_dep_spec_constraint.hh>
+#include <paludis/dep_spec_data.hh>
#include <list>
#include <vector>
@@ -172,13 +172,13 @@ namespace
PackageDepSpec name_and_slot(const PackageDepSpec & spec)
{
if (spec.exact_slot_constraint())
- return make_package_dep_spec({ })
- .package(spec.package_name_constraint()->name())
- .exact_slot_constraint(spec.exact_slot_constraint()->name(), spec.exact_slot_constraint()->locked())
+ return MutablePackageDepSpecData({ })
+ .constrain_package(spec.package_name_constraint()->name())
+ .constrain_exact_slot(spec.exact_slot_constraint()->name(), spec.exact_slot_constraint()->locked())
;
else
- return make_package_dep_spec({ })
- .package(spec.package_name_constraint()->name());
+ return MutablePackageDepSpecData({ })
+ .constrain_package(spec.package_name_constraint()->name());
}
void
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 7f88873..399e965 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -27,9 +27,9 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/dep_label.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/contents.hh>
#include <paludis/repository.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/util/options.hh>
#include <paludis/util/log.hh>
@@ -43,6 +43,7 @@
#include <paludis/util/tribool.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/join.hh>
+#include <paludis/util/return_literal_function.hh>
#include <algorithm>
@@ -52,7 +53,7 @@ using namespace paludis;
namespace
{
- void user_add_package_requirement(const std::string & s, PartiallyMadePackageDepSpec & result,
+ void user_add_package_requirement(const std::string & s, MutablePackageDepSpecData & result,
const Environment * const env, const UserPackageDepSpecOptions & options,
const Filter & filter)
{
@@ -62,43 +63,43 @@ namespace
throw PackageDepSpecError("Wildcard '*' not allowed");
if (0 != s.compare(s.length() - 2, 2, "/*"))
- result.package_name_part(PackageNamePart(s.substr(2)));
+ result.constrain_package_name_part(PackageNamePart(s.substr(2)));
}
else if (s.length() >= 3 && (0 == s.compare(s.length() - 2, 2, "/*")))
{
if (! options[updso_allow_wildcards])
throw PackageDepSpecError("Wildcard '*' not allowed in '" + stringify(s) + "'");
- result.category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
+ result.constrain_category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
}
else if (s == "*")
throw PackageDepSpecError("Use '*/*' not '*' to match everything");
else if (std::string::npos != s.find('/'))
- result.package(QualifiedPackageName(s));
+ result.constrain_package(QualifiedPackageName(s));
else
{
if (options[updso_no_disambiguation])
throw PackageDepSpecError("Need an explicit category specified");
- result.package(env->fetch_unique_qualified_package_name(PackageNamePart(s),
+ result.constrain_package(env->fetch_unique_qualified_package_name(PackageNamePart(s),
filter::And(filter, filter::Matches(result, make_null_shared_ptr(), { }))));
}
}
- void envless_add_package_requirement(const std::string & s, PartiallyMadePackageDepSpec & result)
+ void envless_add_package_requirement(const std::string & s, MutablePackageDepSpecData & result)
{
if (s.length() >= 3 && (0 == s.compare(0, 2, "*/")))
{
if (0 != s.compare(s.length() - 2, 2, "/*"))
- result.package_name_part(PackageNamePart(s.substr(2)));
+ result.constrain_package_name_part(PackageNamePart(s.substr(2)));
}
else if (s.length() >= 3 && (0 == s.compare(s.length() - 2, 2, "/*")))
{
- result.category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
+ result.constrain_category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
}
else if (s == "*")
throw PackageDepSpecError("Use '*/*' not '*' to match everything");
else if (std::string::npos != s.find('/'))
- result.package(QualifiedPackageName(s));
+ result.constrain_package(QualifiedPackageName(s));
else
{
throw PackageDepSpecError("Need an explicit category specified");
@@ -129,7 +130,7 @@ namespace
throw PackageDepSpecError("Got empty dep spec");
}
- bool user_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
+ bool user_remove_trailing_square_bracket_if_exists(std::string & s, MutablePackageDepSpecData & result,
bool & had_bracket_version_requirements)
{
std::string::size_type use_group_p;
@@ -160,12 +161,12 @@ namespace
case '.':
{
auto k(parse_user_key_constraint(flag.substr(1)));
- result.key_constraint(std::get<0>(k), std::get<1>(k), std::get<2>(k), std::get<3>(k));
+ result.constrain_key(std::get<0>(k), std::get<1>(k), std::get<2>(k), std::get<3>(k));
}
break;
default:
- result.choice_constraint(parse_elike_use_requirement(flag, { }));
+ result.constrain_choice(parse_elike_use_requirement(flag, { }));
break;
};
@@ -175,18 +176,18 @@ namespace
}
void
- user_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePackageDepSpec & result)
+ user_remove_trailing_slot_if_exists(std::string & s, MutablePackageDepSpecData & result)
{
std::string::size_type slot_p(s.rfind(':'));
if (std::string::npos != slot_p)
{
- result.exact_slot_constraint(SlotName(s.substr(slot_p + 1)), false);
+ result.constrain_exact_slot(SlotName(s.substr(slot_p + 1)), false);
s.erase(slot_p);
}
}
void
- parse_rhs(PartiallyMadePackageDepSpec & reqs, const std::string & req)
+ parse_rhs(MutablePackageDepSpecData & reqs, const std::string & req)
{
if (req.empty())
throw PackageDepSpecError("Invalid empty :: requirement");
@@ -196,29 +197,29 @@ namespace
if ('?' == req.at(req.length() - 1))
{
if (req.length() >= 2 && '?' == req.at(req.length() - 2))
- reqs.installable_to_path(FSPath(req.substr(0, req.length() - 2)), true);
+ reqs.constrain_installable_to_path(FSPath(req.substr(0, req.length() - 2)), true);
else
- reqs.installable_to_path(FSPath(req.substr(0, req.length() - 1)), false);
+ reqs.constrain_installable_to_path(FSPath(req.substr(0, req.length() - 1)), false);
}
else
- reqs.installed_at_path(FSPath(req));
+ reqs.constrain_installed_at_path(FSPath(req));
}
else
{
if ('?' == req.at(req.length() - 1))
{
if (req.length() >= 3 && '?' == req.at(req.length() - 2))
- reqs.installable_to_repository(RepositoryName(req.substr(0, req.length() - 2)), true);
+ reqs.constrain_installable_to_repository(RepositoryName(req.substr(0, req.length() - 2)), true);
else
- reqs.installable_to_repository(RepositoryName(req.substr(0, req.length() - 1)), false);
+ reqs.constrain_installable_to_repository(RepositoryName(req.substr(0, req.length() - 1)), false);
}
else
- reqs.in_repository(RepositoryName(req));
+ reqs.constrain_in_repository(RepositoryName(req));
}
}
void
- user_remove_trailing_repo_if_exists(std::string & s, PartiallyMadePackageDepSpec & result)
+ user_remove_trailing_repo_if_exists(std::string & s, MutablePackageDepSpecData & result)
{
std::string::size_type repo_p;
if (std::string::npos == ((repo_p = s.rfind("::"))))
@@ -244,14 +245,9 @@ namespace
parse_rhs(result, right);
if (! left.empty())
- result.from_repository(RepositoryName(left));
+ result.constrain_from_repository(RepositoryName(left));
}
}
-
- const PartiallyMadePackageDepSpecOptions fixed_options_for_partially_made_package_dep_spec(PartiallyMadePackageDepSpecOptions o)
- {
- return o;
- }
}
PackageDepSpec
@@ -263,7 +259,6 @@ paludis::parse_user_package_dep_spec(const std::string & ss, const Environment *
Context context("When parsing user package dep spec '" + ss + "':");
bool had_bracket_version_requirements(false);
- PartiallyMadePackageDepSpecOptions o;
return partial_parse_generic_elike_package_dep_spec(ss, make_named_values<GenericELikePackageDepSpecParseFunctions>(
n::add_package_requirement() = std::bind(&user_add_package_requirement, _1, _2, env, options, filter),
@@ -275,7 +270,7 @@ paludis::parse_user_package_dep_spec(const std::string & ss, const Environment *
ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_nice_equal_star),
n::has_version_operator() = std::bind(&elike_has_version_operator, _1,
std::cref(had_bracket_version_requirements), ELikePackageDepSpecOptions()),
- n::options_for_partially_made_package_dep_spec() = std::bind(&fixed_options_for_partially_made_package_dep_spec, std::cref(o)),
+ n::options_for_partially_made_package_dep_spec() = return_literal_function(PackageDepSpecDataOptions()),
n::remove_trailing_repo_if_exists() = std::bind(&user_remove_trailing_repo_if_exists, _1, _2),
n::remove_trailing_slot_if_exists() = std::bind(&user_remove_trailing_slot_if_exists, _1, _2),
n::remove_trailing_square_bracket_if_exists() = std::bind(&user_remove_trailing_square_bracket_if_exists,
@@ -291,7 +286,6 @@ paludis::envless_parse_package_dep_spec_for_tests(const std::string & ss)
Context context("When parsing test package dep spec '" + ss + "':");
bool had_bracket_version_requirements(false);
- PartiallyMadePackageDepSpecOptions o;
return partial_parse_generic_elike_package_dep_spec(ss, make_named_values<GenericELikePackageDepSpecParseFunctions>(
n::add_package_requirement() = std::bind(&envless_add_package_requirement, _1, _2),
@@ -303,7 +297,7 @@ paludis::envless_parse_package_dep_spec_for_tests(const std::string & ss)
ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_nice_equal_star),
n::has_version_operator() = std::bind(&elike_has_version_operator, _1,
std::cref(had_bracket_version_requirements), ELikePackageDepSpecOptions()),
- n::options_for_partially_made_package_dep_spec() = std::bind(&fixed_options_for_partially_made_package_dep_spec, std::cref(o)),
+ n::options_for_partially_made_package_dep_spec() = return_literal_function(PackageDepSpecDataOptions()),
n::remove_trailing_repo_if_exists() = std::bind(&user_remove_trailing_repo_if_exists, _1, _2),
n::remove_trailing_slot_if_exists() = std::bind(&user_remove_trailing_slot_if_exists, _1, _2),
n::remove_trailing_square_bracket_if_exists() = std::bind(&user_remove_trailing_square_bracket_if_exists,
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 8d30f1e..4898d54 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -26,7 +26,6 @@
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/dep_spec_data.hh>
#include <paludis/package_dep_spec_constraint.hh>
#include <paludis/version_spec.hh>
@@ -264,51 +263,51 @@ PythonPackageDepSpec::~PythonPackageDepSpec()
PythonPackageDepSpec::operator PackageDepSpec() const
{
- PartiallyMadePackageDepSpec p((PartiallyMadePackageDepSpecOptions()));
+ MutablePackageDepSpecData p({ });
if (package_name_constraint())
- p.package(package_name_constraint()->name());
+ p.constrain_package(package_name_constraint()->name());
if (category_name_part_constraint())
- p.category_name_part(category_name_part_constraint()->name_part());
+ p.constrain_category_name_part(category_name_part_constraint()->name_part());
if (package_name_part_constraint())
- p.package_name_part(package_name_part_constraint()->name_part());
+ p.constrain_package_name_part(package_name_part_constraint()->name_part());
if (all_version_constraints())
{
for (auto i(all_version_constraints()->begin()), i_end(all_version_constraints()->end()) ;
i != i_end ; ++i)
- p.version_constraint((*i)->version_spec(), (*i)->version_operator(), (*i)->combiner());
+ p.constrain_version((*i)->combiner(), (*i)->version_operator(), (*i)->version_spec());
}
if (any_slot_constraint())
- p.any_slot_constraint(any_slot_constraint()->locking());
+ p.constrain_any_slot(any_slot_constraint()->locking());
if (exact_slot_constraint())
- p.exact_slot_constraint(exact_slot_constraint()->name(), exact_slot_constraint()->locked());
+ p.constrain_exact_slot(exact_slot_constraint()->name(), exact_slot_constraint()->locked());
if (in_repository_constraint())
- p.in_repository(in_repository_constraint()->name());
+ p.constrain_in_repository(in_repository_constraint()->name());
if (from_repository_constraint())
- p.from_repository(from_repository_constraint()->name());
+ p.constrain_from_repository(from_repository_constraint()->name());
if (all_choice_constraints())
{
for (ChoiceConstraintSequence::ConstIterator i(all_choice_constraints()->begin()),
i_end(all_choice_constraints()->end()) ; i != i_end ; ++i)
- p.choice_constraint(*i);
+ p.constrain_choice(*i);
}
if (all_key_constraints())
{
for (auto i(all_key_constraints()->begin()), i_end(all_key_constraints()->end()) ;
i != i_end ; ++i)
- p.key_constraint((*i)->key_type(), (*i)->key(), (*i)->operation(), (*i)->pattern());
+ p.constrain_key((*i)->key_type(), (*i)->key(), (*i)->operation(), (*i)->pattern());
}
- return p.to_package_dep_spec();
+ return PackageDepSpec(p);
}
diff --git a/src/clients/cave/cmd_digest.cc b/src/clients/cave/cmd_digest.cc
index 3c8ea88..dbfcd0f 100644
--- a/src/clients/cave/cmd_digest.cc
+++ b/src/clients/cave/cmd_digest.cc
@@ -47,7 +47,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/action.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <cstdlib>
#include <iostream>
@@ -116,7 +116,7 @@ DigestCommand::run(
throw args::DoHelp("digest takes exactly two parameters");
RepositoryName repo(*next(cmdline.begin_parameters()));
- Filter repo_filter(filter::Matches(make_package_dep_spec({ }).in_repository(repo), make_null_shared_ptr(), { }));
+ Filter repo_filter(filter::Matches(MutablePackageDepSpecData({ }).constrain_in_repository(repo), make_null_shared_ptr(), { }));
QualifiedPackageName pkg(std::string::npos == cmdline.begin_parameters()->find('/') ?
env->fetch_unique_qualified_package_name(PackageNamePart(*cmdline.begin_parameters()), repo_filter) :
QualifiedPackageName(*cmdline.begin_parameters()));
diff --git a/src/clients/cave/cmd_fix_linkage.cc b/src/clients/cave/cmd_fix_linkage.cc
index c12fcf0..dc340c5 100644
--- a/src/clients/cave/cmd_fix_linkage.cc
+++ b/src/clients/cave/cmd_fix_linkage.cc
@@ -37,8 +37,8 @@
#include <paludis/metadata_key.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/version_operator.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/version_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <iostream>
#include <set>
@@ -208,13 +208,13 @@ FixLinkageCommand::run(
cout << endl;
}
- PartiallyMadePackageDepSpec part_spec({ });
- part_spec.package((*pkg_it)->name());
+ MutablePackageDepSpecData part_spec({ });
+ part_spec.constrain_package((*pkg_it)->name());
if ((*pkg_it)->slot_key())
- part_spec.exact_slot_constraint((*pkg_it)->slot_key()->value(), false);
+ part_spec.constrain_exact_slot((*pkg_it)->slot_key()->value(), false);
if (cmdline.a_exact.specified())
- part_spec.version_constraint((*pkg_it)->version(), vo_equal, vcc_and);
+ part_spec.constrain_version(vcc_and, vo_equal, (*pkg_it)->version());
targets->push_back(std::make_pair(stringify(PackageDepSpec(part_spec)), join(broken_files.begin(), broken_files.end(), ", ")));
}
diff --git a/src/clients/cave/cmd_mirror.cc b/src/clients/cave/cmd_mirror.cc
index f515609..2d92677 100644
--- a/src/clients/cave/cmd_mirror.cc
+++ b/src/clients/cave/cmd_mirror.cc
@@ -48,7 +48,6 @@
#include <paludis/metadata_key.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/action.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <cstdlib>
#include <iostream>
diff --git a/src/clients/cave/cmd_print_spec.cc b/src/clients/cave/cmd_print_spec.cc
index ad6f360..03df202 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/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 <paludis/dep_spec_data.hh>
#include <iostream>
#include <algorithm>
@@ -122,51 +122,43 @@ namespace
const PrintSpecCommandLine & cmdline
)
{
- PartiallyMadePackageDepSpec s(spec);
+ MutablePackageDepSpecData s(*spec.data());
if (cmdline.a_package.specified())
{
- if (cmdline.a_package.argument().empty())
- s.clear_package();
- else
- s.package(QualifiedPackageName(cmdline.a_package.argument()));
+ s.unconstrain_package();
+ s.unconstrain_package_name_part();
+ s.unconstrain_category_name_part();
+ if (! cmdline.a_package.argument().empty())
+ s.constrain_package(QualifiedPackageName(cmdline.a_package.argument()));
}
if (cmdline.a_slot_requirement.specified())
{
- if (cmdline.a_slot_requirement.argument().empty())
- {
- s.clear_any_slot();
- s.clear_exact_slot();
- }
- else
- {
- s.clear_any_slot();
- s.exact_slot_constraint(SlotName(cmdline.a_slot_requirement.argument()), false);
- }
+ s.unconstrain_exact_slot();
+ s.unconstrain_any_slot();
+ if (! cmdline.a_slot_requirement.argument().empty())
+ s.constrain_exact_slot(SlotName(cmdline.a_slot_requirement.argument()), false);
}
if (cmdline.a_in_repository.specified())
{
- if (cmdline.a_in_repository.argument().empty())
- s.clear_in_repository();
- else
- s.in_repository(RepositoryName(cmdline.a_in_repository.argument()));
+ s.unconstrain_in_repository();
+ if (! cmdline.a_in_repository.argument().empty())
+ s.constrain_in_repository(RepositoryName(cmdline.a_in_repository.argument()));
}
if (cmdline.a_from_repository.specified())
{
- if (cmdline.a_from_repository.argument().empty())
- s.clear_from_repository();
- else
- s.from_repository(RepositoryName(cmdline.a_from_repository.argument()));
+ s.unconstrain_from_repository();
+ if (! cmdline.a_from_repository.argument().empty())
+ s.constrain_from_repository(RepositoryName(cmdline.a_from_repository.argument()));
}
if (cmdline.a_installable_to_repository.specified())
{
- if (cmdline.a_installable_to_repository.argument().empty())
- s.clear_installable_to_repository();
- else
+ s.unconstrain_installable_to_repository();
+ if (! cmdline.a_installable_to_repository.argument().empty())
{
std::string repo(cmdline.a_installable_to_repository.argument());
bool include_masked(false);
@@ -176,23 +168,21 @@ namespace
include_masked = true;
}
- s.installable_to_repository(RepositoryName(repo), include_masked);
+ s.constrain_installable_to_repository(RepositoryName(repo), include_masked);
}
}
if (cmdline.a_installed_at_path.specified())
{
- if (cmdline.a_installed_at_path.argument().empty())
- s.clear_installed_at_path();
- else
- s.installed_at_path(FSPath(cmdline.a_installed_at_path.argument()));
+ s.unconstrain_installed_at_path();
+ if (! cmdline.a_installed_at_path.argument().empty())
+ s.constrain_installed_at_path(FSPath(cmdline.a_installed_at_path.argument()));
}
if (cmdline.a_installable_to_path.specified())
{
- if (cmdline.a_installable_to_path.argument().empty())
- s.clear_installable_to_path();
- else
+ s.unconstrain_installable_to_path();
+ if (! cmdline.a_installable_to_path.argument().empty())
{
std::string path(cmdline.a_installable_to_path.argument());
bool include_masked(false);
@@ -202,24 +192,27 @@ namespace
include_masked = true;
}
- s.installable_to_path(FSPath(path), include_masked);
+ s.constrain_installable_to_path(FSPath(path), include_masked);
}
}
+ if (cmdline.a_package_part.specified() || cmdline.a_category_part.specified())
+ {
+ s.unconstrain_package();
+ s.unconstrain_package_name_part();
+ s.unconstrain_category_name_part();
+ }
+
if (cmdline.a_package_part.specified())
{
- if (cmdline.a_package_part.argument().empty())
- s.clear_package_name_part();
- else
- s.package_name_part(PackageNamePart(cmdline.a_package_part.argument()));
+ if (! cmdline.a_package_part.argument().empty())
+ s.constrain_package_name_part(PackageNamePart(cmdline.a_package_part.argument()));
}
if (cmdline.a_category_part.specified())
{
- if (cmdline.a_category_part.argument().empty())
- s.clear_category_name_part();
- else
- s.category_name_part(CategoryNamePart(cmdline.a_category_part.argument()));
+ if (! cmdline.a_category_part.argument().empty())
+ s.constrain_category_name_part(CategoryNamePart(cmdline.a_category_part.argument()));
}
VersionConstraintCombiner vcc(vcc_and);
@@ -235,7 +228,7 @@ namespace
if (cmdline.a_version_requirement.specified())
{
- s.clear_version();
+ s.unconstrain_versions();
for (args::StringSetArg::ConstIterator a(cmdline.a_version_requirement.begin_args()),
a_end(cmdline.a_version_requirement.end_args()) ;
@@ -247,13 +240,13 @@ namespace
throw args::DoHelp("--" + cmdline.a_version_requirement.long_name() + " arguments should be in the form =1.23");
std::string op(a->substr(0, p)), ver(a->substr(p));
- s.version_constraint(VersionSpec(ver, {}), VersionOperator(op), vcc);
+ s.constrain_version(vcc, VersionOperator(op), VersionSpec(ver, {}));
}
}
if (cmdline.a_additional_requirement.specified())
{
- s.clear_choices();
+ s.unconstrain_choices();
for (args::StringSetArg::ConstIterator a(cmdline.a_additional_requirement.begin_args()),
a_end(cmdline.a_additional_requirement.end_args()) ;
@@ -261,7 +254,7 @@ namespace
if (! a->empty())
{
auto k(parse_elike_use_requirement(*a, { }));
- s.choice_constraint(k);
+ s.constrain_choice(k);
}
}
diff --git a/src/clients/cave/cmd_report.cc b/src/clients/cave/cmd_report.cc
index ff6e639..78c75c7 100644
--- a/src/clients/cave/cmd_report.cc
+++ b/src/clients/cave/cmd_report.cc
@@ -37,9 +37,9 @@
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
#include <paludis/match_package.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/action.hh>
#include <paludis/version_operator.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -106,9 +106,9 @@ namespace
{
auto ids((*env)[selection::BestVersionOnly((
generator::InRepository(RepositoryName(*r)) &
- generator::Matches(make_package_dep_spec({ })
- .package(id->name())
- .version_constraint(id->version(), vo_equal, vcc_and),
+ generator::Matches(MutablePackageDepSpecData({ })
+ .constrain_package(id->name())
+ .constrain_version(vcc_and, vo_equal, id->version()),
make_null_shared_ptr(), { })) |
filter::SupportsAction<InstallAction>())]);
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index a74421c..11c1974 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -25,8 +25,20 @@
#include "format_user_config.hh"
#include "parse_spec_with_nice_error.hh"
+#include <paludis/util/set.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/pretty_print.hh>
+#include <paludis/util/timestamp.hh>
+#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
+
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
+
#include <paludis/name.hh>
#include <paludis/environment.hh>
#include <paludis/repository.hh>
@@ -37,23 +49,14 @@
#include <paludis/selection.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/visitor_cast.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/pretty_print.hh>
-#include <paludis/util/timestamp.hh>
-#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/join.hh>
#include <paludis/action.hh>
#include <paludis/mask.hh>
#include <paludis/choice.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/mask_utils.hh>
#include <paludis/permitted_choice_value_parameter_values.hh>
#include <paludis/contents.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <cstdlib>
#include <iostream>
#include <algorithm>
@@ -239,7 +242,7 @@ namespace
for (PackageIDSequence::ConstIterator i(names->begin()), i_end(names->end()) ;
i != i_end ; ++i)
{
- PackageDepSpec name_spec(make_package_dep_spec({ }).package((*i)->name()));
+ PackageDepSpec name_spec(MutablePackageDepSpecData({ }).constrain_package((*i)->name()));
cout << fuc(select_format_for_spec(env, name_spec, make_null_shared_ptr(),
fs_wildcard_spec_installed(),
fs_wildcard_spec_installable(),
@@ -1323,7 +1326,9 @@ namespace
for (auto r(repos.begin()), r_end(repos.end()) ; r != r_end ; ++r)
{
auto r_ids((*env)[selection::AllVersionsGroupedBySlot(generator::Matches(
- PartiallyMadePackageDepSpec(s).in_repository(*r), make_null_shared_ptr(), { }))]);
+ MutablePackageDepSpecData(*s.data())
+ .unconstrain_in_repository()
+ .constrain_in_repository(*r), make_null_shared_ptr(), { }))]);
if (! r_ids->empty())
do_one_package_with_ids(cmdline, env, basic_ppos, s, r_ids, cout, rest_out);
}
@@ -1350,7 +1355,9 @@ namespace
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
- do_one_package(cmdline, env, basic_ppos, PartiallyMadePackageDepSpec(s).package((*i)->name()));
+ do_one_package(cmdline, env, basic_ppos, MutablePackageDepSpecData(*s.data())
+ .unconstrain_package()
+ .constrain_package((*i)->name()));
}
}