aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-05 13:02:32 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-05 13:02:32 +0100
commit114f10ee61097f4a3209947018f6a950e9aea40f (patch)
treee2e793ce09e906d5ce8c6eb2adcaeb4ba719ecf9
parent82bcc1129b96fa14a395b93e724bcd5f77074f01 (diff)
parentb529d1a7bf2ed27cc106a7294fd6d8d4ad6e0cce (diff)
downloadpaludis-114f10ee61097f4a3209947018f6a950e9aea40f.tar.gz
paludis-114f10ee61097f4a3209947018f6a950e9aea40f.tar.xz
Merge branch 'changed-choices'
-rw-r--r--doc/api/cplusplus/examples/example_contents.cc1
-rw-r--r--paludis/additional_package_dep_spec_requirement-fwd.hh48
-rw-r--r--paludis/additional_package_dep_spec_requirement.cc38
-rw-r--r--paludis/additional_package_dep_spec_requirement.hh97
-rw-r--r--paludis/changed_choices-fwd.hh28
-rw-r--r--paludis/changed_choices.cc119
-rw-r--r--paludis/changed_choices.hh59
-rw-r--r--paludis/comma_separated_dep_printer.cc2
-rw-r--r--paludis/common_sets.cc1
-rw-r--r--paludis/dep_list.cc1
-rw-r--r--paludis/dep_spec-fwd.hh54
-rw-r--r--paludis/dep_spec.cc506
-rw-r--r--paludis/dep_spec.hh296
-rw-r--r--paludis/dep_spec_data-fwd.hh29
-rw-r--r--paludis/dep_spec_data.cc27
-rw-r--r--paludis/dep_spec_data.hh179
-rw-r--r--paludis/dep_spec_flattener.cc1
-rw-r--r--paludis/elike_conditional_dep_spec.cc19
-rw-r--r--paludis/elike_package_dep_spec-fwd.hh3
-rw-r--r--paludis/elike_package_dep_spec.cc1
-rw-r--r--paludis/elike_package_dep_spec.se1
-rw-r--r--paludis/elike_use_requirement-fwd.hh5
-rw-r--r--paludis/elike_use_requirement.cc176
-rw-r--r--paludis/elike_use_requirement.se1
-rw-r--r--paludis/elike_use_requirement_TEST.cc319
-rw-r--r--paludis/environments/paludis/world.cc1
-rw-r--r--paludis/environments/paludis/world_TEST.cc1
-rw-r--r--paludis/environments/portage/portage_environment.cc1
-rw-r--r--paludis/environments/portage/portage_environment_TEST.cc1
-rw-r--r--paludis/files.m4208
-rw-r--r--paludis/install_task.cc1
-rw-r--r--paludis/match_package.cc17
-rw-r--r--paludis/match_package.hh21
-rw-r--r--paludis/ndbam.cc1
-rw-r--r--paludis/package_database.cc1
-rw-r--r--paludis/partially_made_package_dep_spec-fwd.hh53
-rw-r--r--paludis/partially_made_package_dep_spec.cc512
-rw-r--r--paludis/partially_made_package_dep_spec.hh146
-rw-r--r--paludis/partially_made_package_dep_spec.se (renamed from paludis/dep_spec.se)0
-rw-r--r--paludis/range_rewriter.cc1
-rw-r--r--paludis/range_rewriter_TEST.cc1
-rw-r--r--paludis/report_task.cc1
-rw-r--r--paludis/repositories/accounts/accounts_dep_key.cc1
-rw-r--r--paludis/repositories/cran/dep_spec_pretty_printer.cc2
-rw-r--r--paludis/repositories/cran/package_dep_spec.cc1
-rw-r--r--paludis/repositories/e/can_skip_phase.cc3
-rw-r--r--paludis/repositories/e/dep_parser.cc44
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.cc1
-rw-r--r--paludis/repositories/e/dependencies_rewriter.cc2
-rw-r--r--paludis/repositories/e/e_choices_key.cc1
-rw-r--r--paludis/repositories/e/e_key.cc1
-rw-r--r--paludis/repositories/e/e_repository.cc1
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc1
-rw-r--r--paludis/repositories/e/e_repository_sets.cc39
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf3
-rw-r--r--paludis/repositories/e/ebuild_id.cc2
-rw-r--r--paludis/repositories/e/fetch_visitor.cc2
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.cc2
-rw-r--r--paludis/repositories/e/myoptions_requirements_verifier.cc1
-rw-r--r--paludis/repositories/e/pretend_fetch_visitor.cc2
-rw-r--r--paludis/repositories/e/vdb_repository.cc4
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc3
-rw-r--r--paludis/repositories/fake/dep_parser_TEST.cc3
-rw-r--r--paludis/repositories/fake/fake_package_id.cc2
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc3
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.cc2
-rw-r--r--paludis/repositories/virtuals/package_id.cc1
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc1
-rw-r--r--paludis/resolver/decider.cc300
-rw-r--r--paludis/resolver/decider.hh22
-rw-r--r--paludis/resolver/decision.cc15
-rw-r--r--paludis/resolver/decision.hh8
-rw-r--r--paludis/resolver/orderer.cc2
-rw-r--r--paludis/resolver/reason.cc15
-rw-r--r--paludis/resolver/reason.hh3
-rw-r--r--paludis/resolver/required_confirmations-fwd.hh1
-rw-r--r--paludis/resolver/required_confirmations.cc16
-rw-r--r--paludis/resolver/required_confirmations.hh14
-rw-r--r--paludis/resolver/resolver.cc4
-rw-r--r--paludis/resolver/resolver_functions.hh6
-rw-r--r--paludis/resolver/resolver_test.cc3
-rw-r--r--paludis/resolver/sanitised_dependencies.cc43
-rw-r--r--paludis/resolver/sanitised_dependencies.hh4
-rw-r--r--paludis/resolver/spec_rewriter.cc1
-rw-r--r--paludis/set_file.cc1
-rw-r--r--paludis/set_file_TEST.cc15
-rw-r--r--paludis/show_suggest_visitor.cc2
-rw-r--r--paludis/spec_tree.cc2
-rw-r--r--paludis/spec_tree.hh5
-rw-r--r--paludis/uninstall_task.cc2
-rw-r--r--paludis/user_dep_spec.cc14
-rw-r--r--paludis/user_dep_spec.hh10
-rw-r--r--python/dep_spec.cc5
-rw-r--r--ruby/dep_spec.cc2
-rw-r--r--src/clients/adjutrix/downgrade_check.cc1
-rw-r--r--src/clients/adjutrix/find_insecure_packages.cc1
-rw-r--r--src/clients/adjutrix/find_reverse_deps.cc1
-rw-r--r--src/clients/adjutrix/keywords_graph.cc2
-rw-r--r--src/clients/appareo/appareo.cc1
-rw-r--r--src/clients/cave/cmd_display_resolution.cc27
-rw-r--r--src/clients/cave/cmd_fix_linkage.cc1
-rw-r--r--src/clients/cave/cmd_match.cc1
-rw-r--r--src/clients/cave/cmd_print_set.cc1
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.cc4
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.hh1
-rw-r--r--src/clients/cave/cmd_show.cc2
-rw-r--r--src/clients/cave/cmd_uninstall.cc1
-rw-r--r--src/clients/cave/executables_common.cc1
-rw-r--r--src/clients/cave/resolve_common.cc60
-rw-r--r--src/clients/inquisitio/do_search.cc1
-rw-r--r--src/clients/inquisitio/key_extractor.cc1
-rw-r--r--src/clients/instruo/instruo.cc2
-rw-r--r--src/clients/paludis/info.cc1
-rw-r--r--src/clients/paludis/query.cc7
-rw-r--r--src/clients/reconcilio/fix_linkage.cc1
-rw-r--r--src/output/console_install_task.cc3
-rw-r--r--src/output/console_query_task.cc2
117 files changed, 2446 insertions, 1298 deletions
diff --git a/doc/api/cplusplus/examples/example_contents.cc b/doc/api/cplusplus/examples/example_contents.cc
index 58e910c..7c52266 100644
--- a/doc/api/cplusplus/examples/example_contents.cc
+++ b/doc/api/cplusplus/examples/example_contents.cc
@@ -17,6 +17,7 @@
#include "example_command_line.hh"
#include <iostream>
#include <iomanip>
+#include <algorithm>
using namespace paludis;
using namespace examples;
diff --git a/paludis/additional_package_dep_spec_requirement-fwd.hh b/paludis/additional_package_dep_spec_requirement-fwd.hh
new file mode 100644
index 0000000..d45db55
--- /dev/null
+++ b/paludis/additional_package_dep_spec_requirement-fwd.hh
@@ -0,0 +1,48 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/util/sequence-fwd.hh>
+#include <iosfwd>
+#include <memory>
+
+namespace paludis
+{
+ class AdditionalPackageDepSpecRequirement;
+
+ /**
+ * An AdditionalPackageDepSpecRequirement can be written to an ostream.
+ *
+ * \ingroup g_dep_spec
+ */
+ std::ostream & operator<< (std::ostream &, const AdditionalPackageDepSpecRequirement &) PALUDIS_VISIBLE;
+
+ /**
+ * A collection of additional requirements for a PackageDepSpec.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ */
+ typedef Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> > AdditionalPackageDepSpecRequirements;
+}
+
+#endif
diff --git a/paludis/additional_package_dep_spec_requirement.cc b/paludis/additional_package_dep_spec_requirement.cc
new file mode 100644
index 0000000..e6d09a5
--- /dev/null
+++ b/paludis/additional_package_dep_spec_requirement.cc
@@ -0,0 +1,38 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/additional_package_dep_spec_requirement.hh>
+#include <paludis/util/sequence-impl.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <ostream>
+
+using namespace paludis;
+
+AdditionalPackageDepSpecRequirement::~AdditionalPackageDepSpecRequirement() = default;
+
+std::ostream &
+paludis::operator<< (std::ostream & s, const AdditionalPackageDepSpecRequirement & a)
+{
+ s << a.as_raw_string();
+ return s;
+}
+
+template class Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
+template class WrappedForwardIterator<AdditionalPackageDepSpecRequirements::ConstIteratorTag, const std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
+
diff --git a/paludis/additional_package_dep_spec_requirement.hh b/paludis/additional_package_dep_spec_requirement.hh
new file mode 100644
index 0000000..05232b7
--- /dev/null
+++ b/paludis/additional_package_dep_spec_requirement.hh
@@ -0,0 +1,97 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_HH
+#define PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_HH 1
+
+#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/changed_choices-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <utility>
+
+namespace paludis
+{
+ /**
+ * An additional requirement for a PackageDepSpec.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ */
+ class PALUDIS_VISIBLE AdditionalPackageDepSpecRequirement
+ {
+ public:
+ AdditionalPackageDepSpecRequirement() = default;
+ virtual ~AdditionalPackageDepSpecRequirement();
+
+ AdditionalPackageDepSpecRequirement(const AdditionalPackageDepSpecRequirement &) = delete;
+ AdditionalPackageDepSpecRequirement & operator= (const AdditionalPackageDepSpecRequirement &) = delete;
+
+ /**
+ * Is our requirement met for a given PackageID?
+ *
+ * The string in the return type might be a description of why the
+ * requirement was not met. Sometimes better messages can be given
+ * than simply the return value of as_human_string() when the ID to
+ * be matched is known. If the bool is false, the string is
+ * meaningless.
+ *
+ * \since 0.44 returns pair<bool, std::string>
+ * \since 0.51 takes optional ChangedChoices arguments
+ */
+ virtual const std::pair<bool, std::string> requirement_met(
+ const Environment * const,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID &,
+ const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * If possible, indicate which choices to change to make our
+ * requirement met for a particular ID.
+ *
+ * Verifies that the ID has the appropriate choice, and that that
+ * choice isn't locked.
+ *
+ * \since 0.51
+ */
+ virtual bool accumulate_changes_to_make_met(
+ const Environment * const,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const std::shared_ptr<const PackageID> &,
+ ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Return a human readable string representation of ourself.
+ */
+ virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Return a raw string representation of ourself.
+ */
+ virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
+ extern template class Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
+ extern template class WrappedForwardIterator<AdditionalPackageDepSpecRequirements::ConstIteratorTag,
+ const std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
+}
+
+#endif
diff --git a/paludis/changed_choices-fwd.hh b/paludis/changed_choices-fwd.hh
new file mode 100644
index 0000000..71c551a
--- /dev/null
+++ b/paludis/changed_choices-fwd.hh
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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_CHANGED_CHOICES_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_CHANGED_CHOICES_FWD_HH 1
+
+namespace paludis
+{
+ struct ChangedChoices;
+}
+
+#endif
diff --git a/paludis/changed_choices.cc b/paludis/changed_choices.cc
new file mode 100644
index 0000000..cd8fb8e
--- /dev/null
+++ b/paludis/changed_choices.cc
@@ -0,0 +1,119 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/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 <map>
+
+using namespace paludis;
+
+namespace paludis
+{
+ template <>
+ struct Imp<ChangedChoices>
+ {
+ std::map<ChoiceNameWithPrefix, bool> overrides;
+ };
+}
+
+ChangedChoices::ChangedChoices() :
+ Pimp<ChangedChoices>()
+{
+}
+
+ChangedChoices::~ChangedChoices() = default;
+
+bool
+ChangedChoices::add_override_if_possible(const ChoiceNameWithPrefix & c, const bool v)
+{
+ auto r(_imp->overrides.insert(std::make_pair(c, v)));
+ return r.second || (r.first->second == v);
+}
+
+bool
+ChangedChoices::empty() const
+{
+ return _imp->overrides.empty();
+}
+
+void
+ChangedChoices::add_additional_requirements_to(PartiallyMadePackageDepSpec & spec) const
+{
+ for (auto o(_imp->overrides.begin()), o_end(_imp->overrides.end()) ;
+ o != o_end ; ++o)
+ {
+ if (o->second)
+ spec.additional_requirement(parse_elike_use_requirement("" + stringify(o->first) + "(-)",
+ make_null_shared_ptr(), { euro_allow_default_values }));
+ else
+ spec.additional_requirement(parse_elike_use_requirement("-" + stringify(o->first) + "(-)",
+ make_null_shared_ptr(), { euro_allow_default_values }));
+ }
+}
+
+Tribool
+ChangedChoices::overridden_value(const ChoiceNameWithPrefix & c) const
+{
+ auto i(_imp->overrides.find(c));
+ if (i == _imp->overrides.end())
+ return Tribool(indeterminate);
+ else
+ return Tribool(i->second);
+}
+
+void
+ChangedChoices::serialise(Serialiser & s) const
+{
+ auto ss(s.object("ChangedChoices"));
+
+ ss.member(SerialiserFlags<>(), "count", stringify(_imp->overrides.size()));
+
+ int n(0);
+ for (auto o(_imp->overrides.begin()), o_end(_imp->overrides.end()) ;
+ o != o_end ; ++o)
+ {
+ ++n;
+ ss.member(SerialiserFlags<>(), stringify(n) + "a" , stringify(o->first));
+ ss.member(SerialiserFlags<>(), stringify(n) + "b" , stringify(o->second));
+ }
+}
+
+const std::shared_ptr<ChangedChoices>
+ChangedChoices::deserialise(Deserialisation & d)
+{
+ Deserialisator v(d, "ChangedChoices");
+ auto result(std::make_shared<ChangedChoices>());
+
+ for (int n(1), n_end(v.member<int>("count") + 1) ; n != n_end ; ++n)
+ result->add_override_if_possible(
+ ChoiceNameWithPrefix(v.member<std::string>(stringify(n) + "a")),
+ v.member<bool>(stringify(n) + "b")
+ );
+
+ return result;
+}
+
+template class Pimp<ChangedChoices>;
+
diff --git a/paludis/changed_choices.hh b/paludis/changed_choices.hh
new file mode 100644
index 0000000..2f5fe4e
--- /dev/null
+++ b/paludis/changed_choices.hh
@@ -0,0 +1,59 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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_CHANGED_CHOICES_HH
+#define PALUDIS_GUARD_PALUDIS_CHANGED_CHOICES_HH 1
+
+#include <paludis/changed_choices-fwd.hh>
+#include <paludis/util/pimp.hh>
+#include <paludis/util/tribool-fwd.hh>
+#include <paludis/util/attributes.hh>
+#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 <memory>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE ChangedChoices :
+ private Pimp<ChangedChoices>
+ {
+ public:
+ ChangedChoices();
+ ~ChangedChoices();
+
+ bool add_override_if_possible(const ChoiceNameWithPrefix &, const bool);
+
+ Tribool overridden_value(const ChoiceNameWithPrefix &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool empty() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void add_additional_requirements_to(PartiallyMadePackageDepSpec &) const;
+
+ void serialise(Serialiser &) const;
+
+ static const std::shared_ptr<ChangedChoices> deserialise(
+ Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ extern template class Pimp<ChangedChoices>;
+}
+
+#endif
diff --git a/paludis/comma_separated_dep_printer.cc b/paludis/comma_separated_dep_printer.cc
index a75d938..b8a483b 100644
--- a/paludis/comma_separated_dep_printer.cc
+++ b/paludis/comma_separated_dep_printer.cc
@@ -22,12 +22,14 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/options.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/environment.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/action.hh>
+#include <algorithm>
#include <sstream>
using namespace paludis;
diff --git a/paludis/common_sets.cc b/paludis/common_sets.cc
index 1fb5fe1..f5871fa 100644
--- a/paludis/common_sets.cc
+++ b/paludis/common_sets.cc
@@ -28,6 +28,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/package_id.hh>
#include <paludis/elike_slot_requirement.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/stringify.hh>
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 253475c..c6a0552 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -40,6 +40,7 @@
#include <paludis/choice.hh>
#include <paludis/package_dep_spec_properties.hh>
#include <paludis/notifier_callback.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/util/join.hh>
#include <paludis/util/log.hh>
diff --git a/paludis/dep_spec-fwd.hh b/paludis/dep_spec-fwd.hh
index c2552a9..4bc9409 100644
--- a/paludis/dep_spec-fwd.hh
+++ b/paludis/dep_spec-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
+ * 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
@@ -20,15 +20,9 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_SPEC_FWD_HH
#define PALUDIS_GUARD_PALUDIS_DEP_SPEC_FWD_HH 1
-#include <iosfwd>
-#include <string>
-#include <paludis/dep_label-fwd.hh>
-#include <paludis/dep_spec-fwd.hh>
-#include <paludis/formatter-fwd.hh>
#include <paludis/util/attributes.hh>
-#include <paludis/util/sequence-fwd.hh>
-#include <paludis/util/options-fwd.hh>
-#include <memory>
+#include <paludis/dep_label-fwd.hh>
+#include <iosfwd>
/** \file
* Forward declarations for paludis/dep_spec.hh .
@@ -53,16 +47,6 @@ namespace paludis
class PlainTextLabelDepSpec;
template <typename T_> class LabelsDepSpec;
-#include <paludis/dep_spec-se.hh>
-
- /**
- * Options for PartiallyMadePackageDepSpec.
- *
- * \ingroup g_dep_spec
- * \since 0.38
- */
- typedef Options<PartiallyMadePackageDepSpecOption> PartiallyMadePackageDepSpecOptions;
-
/**
* A URILabelsDepSpec represents labels in a FetchableURISpecTree.
*
@@ -79,42 +63,10 @@ namespace paludis
*/
typedef LabelsDepSpec<DependenciesLabel> DependenciesLabelsDepSpec;
- class PackageDepSpecData;
- class PartiallyMadePackageDepSpec;
- class ConditionalDepSpecData;
-
- class AdditionalPackageDepSpecRequirement;
-
struct InstallableToRepository;
struct InstallableToPath;
/**
- * An AdditionalPackageDepSpecRequirement can be written to an ostream.
- *
- * \ingroup g_dep_spec
- */
- std::ostream & operator<< (std::ostream &, const AdditionalPackageDepSpecRequirement &) PALUDIS_VISIBLE;
-
- /**
- * A collection of additional requirements for a PackageDepSpec.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- */
- typedef Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> > AdditionalPackageDepSpecRequirements;
-
- /**
- * 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;
-
- /**
* A PlainTextDepSpec can be written to an ostream.
*
* \ingroup g_dep_spec
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 6a0e8e2..12616b7 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -36,6 +36,9 @@
#include <paludis/util/options.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/additional_package_dep_spec_requirement.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <functional>
#include <algorithm>
#include <list>
@@ -43,8 +46,6 @@
using namespace paludis;
-#include <paludis/dep_spec-se.cc>
-
namespace paludis
{
template <>
@@ -198,6 +199,12 @@ ConditionalDepSpec::condition_met() const
}
bool
+ConditionalDepSpec::condition_would_be_met_when(const ChangedChoices & c) const
+{
+ return _imp->data->condition_would_be_met_when(c);
+}
+
+bool
ConditionalDepSpec::condition_meetable() const
{
return _imp->data->condition_meetable();
@@ -215,10 +222,6 @@ ConditionalDepSpec::_as_string() const
return _imp->data->as_string();
}
-ConditionalDepSpecData::~ConditionalDepSpecData()
-{
-}
-
std::string
StringDepSpec::text() const
{
@@ -592,10 +595,6 @@ LabelsDepSpec<T_>::need_keys_added() const
{
}
-PackageDepSpecData::~PackageDepSpecData()
-{
-}
-
namespace paludis
{
template <>
@@ -736,499 +735,12 @@ PackageDepSpec::need_keys_added() const
{
}
-AdditionalPackageDepSpecRequirement::~AdditionalPackageDepSpecRequirement()
-{
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & s, const AdditionalPackageDepSpecRequirement & a)
-{
- s << a.as_raw_string();
- return s;
-}
-
-PartiallyMadePackageDepSpec
-paludis::make_package_dep_spec(const PartiallyMadePackageDepSpecOptions & o)
-{
- return PartiallyMadePackageDepSpec(o);
-}
-
-namespace
-{
- struct PartiallyMadePackageDepSpecData :
- PackageDepSpecData
- {
- std::shared_ptr<const QualifiedPackageName> package;
- std::shared_ptr<const PackageNamePart> package_name_part;
- std::shared_ptr<const CategoryNamePart> category_name_part;
- std::shared_ptr<VersionRequirements> version_requirements;
- VersionRequirementsMode version_requirements_mode_v;
- std::shared_ptr<const SlotRequirement> slot;
- std::shared_ptr<const RepositoryName> in_repository;
- std::shared_ptr<const RepositoryName> from_repository;
- std::shared_ptr<const InstallableToRepository> installable_to_repository;
- std::shared_ptr<const FSEntry> installed_at_path;
- std::shared_ptr<const InstallableToPath> installable_to_path;
- std::shared_ptr<AdditionalPackageDepSpecRequirements> additional_requirements;
- std::shared_ptr<const MetadataSectionKey> annotations;
- PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec_v;
-
- PartiallyMadePackageDepSpecData(const PartiallyMadePackageDepSpecOptions & o) :
- PackageDepSpecData(),
- version_requirements_mode_v(vr_and),
- options_for_partially_made_package_dep_spec_v(o)
- {
- }
-
- PartiallyMadePackageDepSpecData(const PackageDepSpecData & other) :
- PackageDepSpecData(other),
- package(other.package_ptr()),
- package_name_part(other.package_name_part_ptr()),
- category_name_part(other.category_name_part_ptr()),
- version_requirements(other.version_requirements_ptr() ? new VersionRequirements : 0),
- version_requirements_mode_v(other.version_requirements_mode()),
- slot(other.slot_requirement_ptr()),
- in_repository(other.in_repository_ptr()),
- from_repository(other.from_repository_ptr()),
- installable_to_repository(other.installable_to_repository_ptr()),
- installed_at_path(other.installed_at_path_ptr()),
- installable_to_path(other.installable_to_path_ptr()),
- additional_requirements(other.additional_requirements_ptr() ? new AdditionalPackageDepSpecRequirements : 0),
- annotations(other.annotations_key()),
- options_for_partially_made_package_dep_spec_v(other.options_for_partially_made_package_dep_spec())
- {
- if (version_requirements)
- std::copy(other.version_requirements_ptr()->begin(), other.version_requirements_ptr()->end(),
- version_requirements->back_inserter());
-
- if (additional_requirements)
- std::copy(other.additional_requirements_ptr()->begin(), other.additional_requirements_ptr()->end(),
- additional_requirements->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),
- version_requirements(other.version_requirements),
- version_requirements_mode_v(other.version_requirements_mode_v),
- slot(other.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),
- additional_requirements(other.additional_requirements),
- annotations(other.annotations),
- 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 (version_requirements_ptr())
- {
- if (version_requirements_ptr()->begin() == version_requirements_ptr()->end())
- {
- }
- else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end() &&
- ! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
- {
- if (version_requirements_ptr()->begin()->version_operator() == vo_stupid_equal_star || version_requirements_ptr()->begin()->version_operator() == vo_nice_equal_star)
- s << "=";
- else
- s << version_requirements_ptr()->begin()->version_operator();
- }
- }
-
- if (package_ptr())
- s << *package_ptr();
- else
- {
- if (category_name_part_ptr())
- s << *category_name_part_ptr();
- else
- s << "*";
-
- s << "/";
-
- if (package_name_part_ptr())
- s << *package_name_part_ptr();
- else
- s << "*";
- }
-
- if (version_requirements_ptr())
- {
- if (version_requirements_ptr()->begin() == version_requirements_ptr()->end())
- {
- }
- else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end() &&
- ! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
- {
- s << "-" << version_requirements_ptr()->begin()->version_spec();
- if (version_requirements_ptr()->begin()->version_operator() == vo_stupid_equal_star || version_requirements_ptr()->begin()->version_operator() == vo_nice_equal_star)
- s << "*";
- }
- }
-
- if (slot_requirement_ptr())
- s << stringify(*slot_requirement_ptr());
-
- std::string left, right;
- bool need_arrow(false);
-
- if (from_repository_ptr())
- left = stringify(*from_repository_ptr());
-
- if (in_repository_ptr())
- right = stringify(*in_repository_ptr());
-
- if (installed_at_path_ptr())
- {
- if (! right.empty())
- {
- need_arrow = true;
- right.append("->");
- }
- right.append(stringify(*installed_at_path_ptr()));
- }
-
- if (installable_to_repository_ptr())
- {
- if (! right.empty())
- {
- need_arrow = true;
- right.append("->");
- }
- if (installable_to_repository_ptr()->include_masked())
- right.append(stringify(installable_to_repository_ptr()->repository()) + "??");
- else
- right.append(stringify(installable_to_repository_ptr()->repository()) + "?");
- }
-
- if (installable_to_path_ptr())
- {
- if (! right.empty())
- {
- need_arrow = true;
- right.append("->");
- }
- if (installable_to_path_ptr()->include_masked())
- right.append(stringify(installable_to_path_ptr()->path()) + "??");
- else
- right.append(stringify(installable_to_path_ptr()->path()) + "?");
- }
-
- if (need_arrow || ((! left.empty()) && (! right.empty())))
- s << "::" << left << "->" << right;
- else if (! right.empty())
- s << "::" << right;
- else if (! left.empty())
- s << "::" << left << "->";
-
- if (version_requirements_ptr())
- {
- if (version_requirements_ptr()->begin() == version_requirements_ptr()->end())
- {
- }
- else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end() &&
- ! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
- {
- }
- else
- {
- bool need_op(false);
- s << "[";
- for (VersionRequirements::ConstIterator r(version_requirements_ptr()->begin()),
- r_end(version_requirements_ptr()->end()) ; r != r_end ; ++r)
- {
- if (need_op)
- {
- do
- {
- switch (version_requirements_mode())
- {
- case vr_and:
- s << "&";
- continue;
-
- case vr_or:
- s << "|";
- continue;
-
- case last_vr:
- ;
- }
- 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 (additional_requirements_ptr())
- for (AdditionalPackageDepSpecRequirements::ConstIterator u(additional_requirements_ptr()->begin()),
- u_end(additional_requirements_ptr()->end()) ; u != u_end ; ++u)
- s << (*u)->as_raw_string();
-
- return s.str();
- }
-
- virtual std::shared_ptr<const QualifiedPackageName> package_ptr() const
- {
- return package;
- }
-
- virtual std::shared_ptr<const PackageNamePart> package_name_part_ptr() const
- {
- return package_name_part;
- }
-
- virtual std::shared_ptr<const CategoryNamePart> category_name_part_ptr() const
- {
- return category_name_part;
- }
-
- virtual std::shared_ptr<const VersionRequirements> version_requirements_ptr() const
- {
- return version_requirements;
- }
-
- virtual VersionRequirementsMode version_requirements_mode() const
- {
- return version_requirements_mode_v;
- }
-
- virtual std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const
- {
- return slot;
- }
-
- virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const
- {
- return in_repository;
- }
-
- virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const
- {
- return installable_to_repository;
- }
-
- virtual std::shared_ptr<const RepositoryName> from_repository_ptr() const
- {
- return from_repository;
- }
-
- virtual std::shared_ptr<const FSEntry> installed_at_path_ptr() const
- {
- return installed_at_path;
- }
-
- virtual std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const
- {
- return installable_to_path;
- }
-
- virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const
- {
- return additional_requirements;
- }
-
- virtual std::shared_ptr<const MetadataSectionKey> annotations_key() const
- {
- return annotations;
- }
-
- 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) :
- Pimp<PartiallyMadePackageDepSpec>(o)
-{
-}
-
-PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec & other) :
- Pimp<PartiallyMadePackageDepSpec>(*other._imp.get())
-{
-}
-
-PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PackageDepSpec & other) :
- Pimp<PartiallyMadePackageDepSpec>(other)
-{
-}
-
-PartiallyMadePackageDepSpec::~PartiallyMadePackageDepSpec()
-{
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::package(const QualifiedPackageName & name)
-{
- _imp->data->package = std::make_shared<QualifiedPackageName>(name);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::slot_requirement(const std::shared_ptr<const SlotRequirement> & s)
-{
- _imp->data->slot = s;
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::in_repository(const RepositoryName & s)
-{
- _imp->data->in_repository = std::make_shared<RepositoryName>(s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::from_repository(const RepositoryName & s)
-{
- _imp->data->from_repository = std::make_shared<RepositoryName>(s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::installable_to_repository(const InstallableToRepository & s)
-{
- _imp->data->installable_to_repository = std::make_shared<InstallableToRepository>(s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::installed_at_path(const FSEntry & s)
-{
- _imp->data->installed_at_path = std::make_shared<FSEntry>(s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::installable_to_path(const InstallableToPath & s)
-{
- _imp->data->installable_to_path = std::make_shared<InstallableToPath>(s);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::package_name_part(const PackageNamePart & part)
-{
- _imp->data->package_name_part = std::make_shared<PackageNamePart>(part);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::category_name_part(const CategoryNamePart & part)
-{
- _imp->data->category_name_part = std::make_shared<CategoryNamePart>(part);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::version_requirement(const VersionRequirement & req)
-{
- if (! _imp->data->version_requirements)
- _imp->data->version_requirements = std::make_shared<VersionRequirements>();
- _imp->data->version_requirements->push_back(req);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::version_requirements_mode(const VersionRequirementsMode & mode)
-{
- _imp->data->version_requirements_mode_v = mode;
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::additional_requirement(const std::shared_ptr<const AdditionalPackageDepSpecRequirement> & req)
-{
- if (! _imp->data->additional_requirements)
- _imp->data->additional_requirements = std::make_shared<AdditionalPackageDepSpecRequirements>();
- _imp->data->additional_requirements->push_back(req);
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::clear_additional_requirements()
-{
- _imp->data->additional_requirements.reset();
- return *this;
-}
-
-PartiallyMadePackageDepSpec &
-PartiallyMadePackageDepSpec::annotations(const std::shared_ptr<const MetadataSectionKey> & a)
-{
- _imp->data->annotations = a;
- 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 LabelsDepSpec<URILabel>;
template class LabelsDepSpec<DependenciesLabel>;
-template class Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
-template class WrappedForwardIterator<AdditionalPackageDepSpecRequirements::ConstIteratorTag, const std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
-
template class Cloneable<DepSpec>;
template class Pimp<ConditionalDepSpec>;
template class CloneUsingThis<DepSpec, ConditionalDepSpec>;
-template class Pimp<PartiallyMadePackageDepSpec>;
template class Pimp<PackageDepSpec>;
template class CloneUsingThis<DepSpec, PackageDepSpec>;
template class Pimp<URILabelsDepSpec>;
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 30bf6bd..f62c4cd 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -27,6 +27,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/named_value.hh>
+#include <paludis/changed_choices-fwd.hh>
#include <paludis/dep_label.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/dep_tag-fwd.hh>
@@ -38,9 +39,11 @@
#include <paludis/slot_requirement-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
+#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
+#include <paludis/partially_made_package_dep_spec-fwd.hh>
+#include <paludis/dep_spec_data-fwd.hh>
#include <memory>
-#include <functional>
/** \file
* Declarations for dependency spec classes.
@@ -190,6 +193,11 @@ namespace paludis
bool condition_met() const PALUDIS_ATTRIBUTE((warn_unused_result));
/**
+ * Would our condition met, if certain choices were changed?
+ */
+ bool condition_would_be_met_when(const ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
* Is our condition meetable?
*
* This takes into account inverses, masks, forces etc.
@@ -206,39 +214,6 @@ namespace paludis
};
/**
- * Data for a ConditionalDepSpec.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- */
- class PALUDIS_VISIBLE ConditionalDepSpecData :
- public MetadataKeyHolder
- {
- public:
- ///\name Basic operations
- ///\{
-
- virtual ~ConditionalDepSpecData();
-
- ///\}
-
- /**
- * Fetch ourself as a string.
- */
- virtual std::string as_string() const = 0;
-
- /**
- * Fetch the result for condition_met.
- */
- virtual bool condition_met() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Fetch the result for condition_meetable.
- */
- virtual bool condition_meetable() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
- /**
* A StringDepSpec represents a dep spec with an associated piece of text.
*
* \ingroup g_dep_spec
@@ -272,46 +247,6 @@ namespace paludis
std::string text() const;
};
- /**
- * An additional requirement for a PackageDepSpec.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- */
- class PALUDIS_VISIBLE AdditionalPackageDepSpecRequirement
- {
- public:
- AdditionalPackageDepSpecRequirement() = default;
- virtual ~AdditionalPackageDepSpecRequirement();
-
- AdditionalPackageDepSpecRequirement(const AdditionalPackageDepSpecRequirement &) = delete;
- AdditionalPackageDepSpecRequirement & operator= (const AdditionalPackageDepSpecRequirement &) = delete;
-
- /**
- * Is our requirement met for a given PackageID?
- *
- * The string in the return type might be a description of why the
- * requirement was not met. Sometimes better messages can be given
- * than simply the return value of as_human_string() when the ID to
- * be matched is known. If the bool is false, the string is
- * meaningless.
- *
- * \since 0.44 returns pair<bool, std::string>
- */
- virtual const std::pair<bool, std::string> requirement_met(
- const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Return a human readable string representation of ourself.
- */
- virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Return a raw string representation of ourself.
- */
- virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
namespace n
{
typedef Name<struct include_masked_name> include_masked;
@@ -344,118 +279,6 @@ 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>
- {
- public:
- ///\name Basic operations
- ///\{
-
- PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpecOptions &);
- ~PartiallyMadePackageDepSpec();
- PartiallyMadePackageDepSpec(const PackageDepSpec &);
- PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec &);
-
- ///\}
-
- /**
- * Set our package requirements, return ourself.
- */
- PartiallyMadePackageDepSpec & package(const QualifiedPackageName &);
-
- /**
- * Set our slot requirements, return ourself.
- */
- PartiallyMadePackageDepSpec & slot_requirement(const std::shared_ptr<const SlotRequirement> &);
-
- /**
- * Set our in-repository requirement, return ourself.
- */
- PartiallyMadePackageDepSpec & in_repository(const RepositoryName &);
-
- /**
- * Set our from-repository requirement, return ourself.
- */
- PartiallyMadePackageDepSpec & from_repository(const RepositoryName &);
-
- /**
- * Set our installable-to-repository requirement, return ourself.
- *
- * \since 0.32
- */
- PartiallyMadePackageDepSpec & installable_to_repository(const InstallableToRepository &);
-
- /**
- * Set our installed-at-path requirement, return ourself.
- *
- * \since 0.32
- */
- PartiallyMadePackageDepSpec & installed_at_path(const FSEntry &);
-
- /**
- * Set our installable-to-path requirement, return ourself.
- *
- * \since 0.32
- */
- PartiallyMadePackageDepSpec & installable_to_path(const InstallableToPath &);
-
- /**
- * Set our package name part requirements, return ourself.
- */
- PartiallyMadePackageDepSpec & package_name_part(const PackageNamePart &);
-
- /**
- * Set our category name part requirements, return ourself.
- */
- PartiallyMadePackageDepSpec & category_name_part(const CategoryNamePart &);
-
- /**
- * Add a version requirement, return ourself.
- */
- PartiallyMadePackageDepSpec & version_requirement(const VersionRequirement &);
-
- /**
- * Set our version requirements mode, return ourself.
- */
- PartiallyMadePackageDepSpec & version_requirements_mode(const VersionRequirementsMode &);
-
- /**
- * Add an additional requirement, return ourself.
- */
- PartiallyMadePackageDepSpec & additional_requirement(
- const std::shared_ptr<const AdditionalPackageDepSpecRequirement> &);
-
- /**
- * Clear additional requirements, return ourself.
- *
- * \since 0.41
- */
- PartiallyMadePackageDepSpec & clear_additional_requirements();
-
- /**
- * Add annotations
- */
- PartiallyMadePackageDepSpec & annotations(
- const std::shared_ptr<const MetadataSectionKey> &);
-
- /**
- * Turn ourselves into a PackageDepSpec.
- */
- operator const PackageDepSpec() const;
-
- /**
- * Explicitly turn ourselves into a PackageDepSpec.
- */
- const PackageDepSpec to_package_dep_spec() const;
- };
-
- /**
* A PackageDepSpec represents a package name (for example,
* 'app-editors/vim'), possibly with associated version and SLOT
* restrictions.
@@ -593,106 +416,6 @@ namespace paludis
};
/**
- * Data for a PackageDepSpec.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- */
- class PALUDIS_VISIBLE PackageDepSpecData
- {
- public:
- ///\name Basic operations
- ///\{
-
- virtual ~PackageDepSpecData();
-
- ///\}
-
- /**
- * Fetch ourself as a string.
- */
- virtual std::string as_string() const = 0;
-
- /**
- * Fetch the package name (may be a zero pointer).
- */
- virtual std::shared_ptr<const QualifiedPackageName> package_ptr() const = 0;
-
- /**
- * Fetch the package name part, if wildcarded, or a zero pointer otherwise.
- */
- virtual std::shared_ptr<const PackageNamePart> package_name_part_ptr() const = 0;
-
- /**
- * Fetch the category name part, if wildcarded, or a zero pointer otherwise.
- */
- virtual std::shared_ptr<const CategoryNamePart> category_name_part_ptr() const = 0;
-
- /**
- * Fetch the version requirements (may be a zero pointer).
- */
- virtual std::shared_ptr<const VersionRequirements> version_requirements_ptr() const = 0;
-
- /**
- * Fetch the version requirements mode.
- */
- virtual VersionRequirementsMode version_requirements_mode() const = 0;
-
- /**
- * Fetch the slot name (may be a zero pointer).
- */
- virtual std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const = 0;
-
- /**
- * Fetch the from-repository requirement (may be a zero pointer).
- */
- virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const = 0;
-
- /**
- * Fetch the installable-to-repository requirement (may be a zero pointer).
- *
- * \since 0.32
- */
- virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const = 0;
-
- /**
- * Fetch the from-repository requirement (may be a zero pointer).
- */
- virtual std::shared_ptr<const RepositoryName> from_repository_ptr() const = 0;
-
- /**
- * Fetch the installed-at-path requirement (may be a zero pointer).
- *
- * \since 0.32
- */
- virtual std::shared_ptr<const FSEntry> installed_at_path_ptr() const = 0;
-
- /**
- * Fetch the installable-to-path requirement (may be a zero pointer).
- *
- * \since 0.32
- */
- virtual std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const = 0;
-
- /**
- * Fetch the additional requirements (may be a zero pointer).
- */
- virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const = 0;
-
- /**
- * Fetch the annotations (may be a zero pointer).
- */
- virtual std::shared_ptr<const MetadataSectionKey> annotations_key() const = 0;
-
- /**
- * Fetch options if we're being used to construct a new PartiallyMadePackageDepSpec.
- *
- * \since 0.38
- */
- virtual const PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec() const = 0;
- };
-
- /**
* A PlainTextDepSpec represents a plain text entry.
*
* \ingroup g_dep_spec
@@ -977,7 +700,6 @@ namespace paludis
extern template class Cloneable<DepSpec>;
extern template class Pimp<ConditionalDepSpec>;
extern template class CloneUsingThis<DepSpec, ConditionalDepSpec>;
- extern template class Pimp<PartiallyMadePackageDepSpec>;
extern template class Pimp<PackageDepSpec>;
extern template class CloneUsingThis<DepSpec, PackageDepSpec>;
extern template class Pimp<DependenciesLabelsDepSpec>;
diff --git a/paludis/dep_spec_data-fwd.hh b/paludis/dep_spec_data-fwd.hh
new file mode 100644
index 0000000..1bbf447
--- /dev/null
+++ b/paludis/dep_spec_data-fwd.hh
@@ -0,0 +1,29 @@
+/* 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_DEP_SPEC_DATA_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_DEP_SPEC_DATA_FWD_HH 1
+
+namespace paludis
+{
+ class PackageDepSpecData;
+ class ConditionalDepSpecData;
+}
+
+#endif
diff --git a/paludis/dep_spec_data.cc b/paludis/dep_spec_data.cc
new file mode 100644
index 0000000..6a7a2da
--- /dev/null
+++ b/paludis/dep_spec_data.cc
@@ -0,0 +1,27 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/dep_spec_data.hh>
+
+using namespace paludis;
+
+ConditionalDepSpecData::~ConditionalDepSpecData() = default;
+
+PackageDepSpecData::~PackageDepSpecData() = default;
+
diff --git a/paludis/dep_spec_data.hh b/paludis/dep_spec_data.hh
new file mode 100644
index 0000000..a4a81fd
--- /dev/null
+++ b/paludis/dep_spec_data.hh
@@ -0,0 +1,179 @@
+/* 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_DEP_SPEC_DATA_HH
+#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_entry-fwd.hh>
+#include <paludis/changed_choices-fwd.hh>
+#include <paludis/name-fwd.hh>
+#include <paludis/version_operator-fwd.hh>
+#include <paludis/version_requirements-fwd.hh>
+#include <paludis/slot_requirement-fwd.hh>
+#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/partially_made_package_dep_spec-fwd.hh>
+#include <paludis/metadata_key_holder.hh>
+#include <string>
+#include <memory>
+
+namespace paludis
+{
+ /**
+ * Data for a ConditionalDepSpec.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ */
+ class PALUDIS_VISIBLE ConditionalDepSpecData :
+ public MetadataKeyHolder
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ virtual ~ConditionalDepSpecData();
+
+ ///\}
+
+ /**
+ * Fetch ourself as a string.
+ */
+ virtual std::string as_string() const = 0;
+
+ /**
+ * Fetch the result for condition_met.
+ */
+ virtual bool condition_met() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Fetch the result for condition_would_be_met_when.
+ */
+ virtual bool condition_would_be_met_when(const ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Fetch the result for condition_meetable.
+ */
+ virtual bool condition_meetable() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
+ /**
+ * Data for a PackageDepSpec.
+ *
+ * \since 0.26
+ * \ingroup g_dep_spec
+ */
+ class PALUDIS_VISIBLE PackageDepSpecData
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ virtual ~PackageDepSpecData();
+
+ ///\}
+
+ /**
+ * Fetch ourself as a string.
+ */
+ virtual std::string as_string() const = 0;
+
+ /**
+ * Fetch the package name (may be a zero pointer).
+ */
+ virtual std::shared_ptr<const QualifiedPackageName> package_ptr() const = 0;
+
+ /**
+ * Fetch the package name part, if wildcarded, or a zero pointer otherwise.
+ */
+ virtual std::shared_ptr<const PackageNamePart> package_name_part_ptr() const = 0;
+
+ /**
+ * Fetch the category name part, if wildcarded, or a zero pointer otherwise.
+ */
+ virtual std::shared_ptr<const CategoryNamePart> category_name_part_ptr() const = 0;
+
+ /**
+ * Fetch the version requirements (may be a zero pointer).
+ */
+ virtual std::shared_ptr<const VersionRequirements> version_requirements_ptr() const = 0;
+
+ /**
+ * Fetch the version requirements mode.
+ */
+ virtual VersionRequirementsMode version_requirements_mode() const = 0;
+
+ /**
+ * Fetch the slot name (may be a zero pointer).
+ */
+ virtual std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const = 0;
+
+ /**
+ * Fetch the from-repository requirement (may be a zero pointer).
+ */
+ virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const = 0;
+
+ /**
+ * Fetch the installable-to-repository requirement (may be a zero pointer).
+ *
+ * \since 0.32
+ */
+ virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const = 0;
+
+ /**
+ * Fetch the from-repository requirement (may be a zero pointer).
+ */
+ virtual std::shared_ptr<const RepositoryName> from_repository_ptr() const = 0;
+
+ /**
+ * Fetch the installed-at-path requirement (may be a zero pointer).
+ *
+ * \since 0.32
+ */
+ virtual std::shared_ptr<const FSEntry> installed_at_path_ptr() const = 0;
+
+ /**
+ * Fetch the installable-to-path requirement (may be a zero pointer).
+ *
+ * \since 0.32
+ */
+ virtual std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const = 0;
+
+ /**
+ * Fetch the additional requirements (may be a zero pointer).
+ */
+ virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const = 0;
+
+ /**
+ * Fetch the annotations (may be a zero pointer).
+ */
+ virtual std::shared_ptr<const MetadataSectionKey> annotations_key() const = 0;
+
+ /**
+ * Fetch options if we're being used to construct a new PartiallyMadePackageDepSpec.
+ *
+ * \since 0.38
+ */
+ virtual const PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec() const = 0;
+ };
+}
+
+#endif
diff --git a/paludis/dep_spec_flattener.cc b/paludis/dep_spec_flattener.cc
index 603b014..bf9835b 100644
--- a/paludis/dep_spec_flattener.cc
+++ b/paludis/dep_spec_flattener.cc
@@ -25,6 +25,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/repository.hh>
#include <list>
#include <algorithm>
diff --git a/paludis/elike_conditional_dep_spec.cc b/paludis/elike_conditional_dep_spec.cc
index 70cac0f..7134dac 100644
--- a/paludis/elike_conditional_dep_spec.cc
+++ b/paludis/elike_conditional_dep_spec.cc
@@ -23,14 +23,17 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/destringify.hh>
+#include <paludis/util/tribool.hh>
#include <paludis/util/log.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/changed_choices.hh>
#include <paludis/name.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
#include <paludis/choice.hh>
+#include <paludis/dep_spec_data.hh>
#include <ostream>
#include <string>
@@ -58,7 +61,7 @@ namespace
if (! no_warning_for_unlisted)
if (! id.choices_key()->value()->has_matching_contains_every_value_prefix(f))
- Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
+ Log::get_instance()->message("elike_conditional_dep_spec.query", ll_warning, lc_context) <<
"ID '" << id << "' has no flag named '" << f << "'";
return false;
}
@@ -78,7 +81,7 @@ namespace
if (! no_warning_for_unlisted)
if (! id.choices_key()->value()->has_matching_contains_every_value_prefix(f))
- Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
+ Log::get_instance()->message("elike_conditional_dep_spec.query", ll_warning, lc_context) <<
"ID '" << id << "' has no flag named '" << f << "'";
return false;
}
@@ -138,6 +141,18 @@ namespace
return condition_met() || ! icky_use_query_locked(flag, *id, no_warning_for_unlisted);
}
+ virtual bool condition_would_be_met_when(const ChangedChoices & changes) const
+ {
+ Tribool overridden(changes.overridden_value(flag));
+
+ if (overridden.is_indeterminate())
+ return condition_met();
+ else if (! condition_meetable())
+ return condition_met();
+ else
+ return overridden.is_true() ^ inverse;
+ }
+
virtual void need_keys_added() const
{
}
diff --git a/paludis/elike_package_dep_spec-fwd.hh b/paludis/elike_package_dep_spec-fwd.hh
index bdbb09f..345c257 100644
--- a/paludis/elike_package_dep_spec-fwd.hh
+++ b/paludis/elike_package_dep_spec-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 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
@@ -26,6 +26,7 @@
#include <paludis/package_id-fwd.hh>
#include <paludis/version_operator-fwd.hh>
#include <paludis/version_spec-fwd.hh>
+#include <paludis/partially_made_package_dep_spec-fwd.hh>
#include <functional>
#include <iosfwd>
diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc
index af9a802..8d2c841 100644
--- a/paludis/elike_package_dep_spec.cc
+++ b/paludis/elike_package_dep_spec.cc
@@ -28,6 +28,7 @@
#include <paludis/version_spec.hh>
#include <paludis/version_requirements.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <strings.h>
using namespace paludis;
diff --git a/paludis/elike_package_dep_spec.se b/paludis/elike_package_dep_spec.se
index 3746241..ad244d1 100644
--- a/paludis/elike_package_dep_spec.se
+++ b/paludis/elike_package_dep_spec.se
@@ -14,6 +14,7 @@ make_enum_ELikePackageDepSpecOption()
key epdso_allow_use_deps_portage "Allow [use] deps with Portage syntax"
key epdso_allow_use_dep_defaults "Allow [use(+)] and [use(-)] deps"
key epdso_allow_use_dep_question_defaults "Allow [use(?)] deps"
+ key epdso_missing_use_deps_is_qa "Missing [use] flags with no default is a QA violation"
key epdso_allow_ranged_deps "Allow [op version] deps"
key epdso_allow_tilde_greater_deps "Allow ~> deps"
key epdso_disallow_nonranged_deps "Disallow >=foo/bar-1 deps"
diff --git a/paludis/elike_use_requirement-fwd.hh b/paludis/elike_use_requirement-fwd.hh
index 47abd0e..8df88aa 100644
--- a/paludis/elike_use_requirement-fwd.hh
+++ b/paludis/elike_use_requirement-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -24,9 +24,10 @@
#include <paludis/util/options-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
+#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
#include <iosfwd>
#include <string>
-#include <functional>
+#include <memory>
namespace paludis
{
diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc
index 1134561..dbf6253 100644
--- a/paludis/elike_use_requirement.cc
+++ b/paludis/elike_use_requirement.cc
@@ -31,6 +31,8 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/choice.hh>
+#include <paludis/changed_choices.hh>
+#include <paludis/additional_package_dep_spec_requirement.hh>
#include <vector>
#include <functional>
#include <algorithm>
@@ -39,7 +41,12 @@ using namespace paludis;
namespace
{
- bool icky_use_query(const ChoiceNameWithPrefix & f, const PackageID & id, Tribool default_value = Tribool(indeterminate))
+ bool icky_use_query(
+ const ELikeUseRequirementOptions & options,
+ const ChoiceNameWithPrefix & f,
+ const PackageID & id,
+ const ChangedChoices * const changed_choices,
+ Tribool default_value = Tribool(indeterminate))
{
if (! id.choices_key())
{
@@ -48,12 +55,20 @@ namespace
return false;
}
+ if (changed_choices)
+ {
+ auto c(changed_choices->overridden_value(f));
+ if (! c.is_indeterminate())
+ return c.is_true();
+ }
+
const std::shared_ptr<const ChoiceValue> v(id.choices_key()->value()->find_by_name_with_prefix(f));
if (v)
return v->enabled();
- if (default_value.is_indeterminate() && ! id.choices_key()->value()->has_matching_contains_every_value_prefix(f))
- Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
+ if (default_value.is_indeterminate() && ! id.choices_key()->value()->has_matching_contains_every_value_prefix(f) &&
+ options[euro_missing_is_qa])
+ Log::get_instance()->message("elike_use_requirement.query", ll_qa, lc_context) <<
"ID '" << id << "' has no flag named '" << f << "'";
return default_value.is_true();
}
@@ -63,18 +78,20 @@ namespace
private:
const std::string _flags;
const std::shared_ptr<const PackageID> _id;
- const ELikeUseRequirementOptions _options;
const Tribool _default_value;
const bool _ignore_if_no_such_group;
+ protected:
+ const ELikeUseRequirementOptions _options;
+
public:
UseRequirement(const std::string & n, const std::shared_ptr<const PackageID> & i,
const ELikeUseRequirementOptions & o, Tribool d, const bool g) :
_flags(n),
_id(i),
- _options(o),
_default_value(d),
- _ignore_if_no_such_group(g)
+ _ignore_if_no_such_group(g),
+ _options(o)
{
}
@@ -85,12 +102,16 @@ namespace
virtual bool one_requirement_met_base(
const Environment * const,
const ChoiceNameWithPrefix &,
- const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ const ChangedChoices * const,
+ const PackageID &,
+ const ChangedChoices * const) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
bool one_requirement_met(
const Environment * const env,
const ChoiceNameWithPrefix & c,
- const PackageID & id) const PALUDIS_ATTRIBUTE((warn_unused_result))
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID & id,
+ const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result))
{
if (_ignore_if_no_such_group)
{
@@ -105,7 +126,7 @@ namespace
return true;
}
- return one_requirement_met_base(env, c, id);
+ return one_requirement_met_base(env, c, maybe_changes_to_owner, id, maybe_changes_to_target);
}
virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
@@ -120,7 +141,11 @@ namespace
return _id;
}
- const std::pair<bool, std::string> requirement_met(const Environment * const env, const PackageID & i) const
+ const std::pair<bool, std::string> requirement_met(
+ const Environment * const env,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID & i,
+ const ChangedChoices * const maybe_changes_to_target) const
{
if (_flags.length() >= 2 && ":*" == _flags.substr(_flags.length() - 2))
{
@@ -145,7 +170,7 @@ namespace
std::pair<bool, std::string> result(true, "");
for (Choice::ConstIterator v((*cc)->begin()), v_end((*cc)->end()) ;
v != v_end ; ++v)
- if (! one_requirement_met(env, (*v)->name_with_prefix(), i))
+ if (! one_requirement_met(env, (*v)->name_with_prefix(), maybe_changes_to_owner, i, maybe_changes_to_target))
{
if (! result.first)
result.second.append(", ");
@@ -161,7 +186,7 @@ namespace
}
}
else
- if (! one_requirement_met(env, ChoiceNameWithPrefix(_flags), i))
+ if (! one_requirement_met(env, ChoiceNameWithPrefix(_flags), maybe_changes_to_owner, i, maybe_changes_to_target))
return std::make_pair(false, as_human_string());
return std::make_pair(true, as_human_string());
@@ -185,6 +210,69 @@ namespace
return result;
}
+
+ bool accumulate_changes_to_make_met(
+ const Environment * const env,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const std::shared_ptr<const PackageID> & id,
+ ChangedChoices & changed_choices) const
+ {
+ if (requirement_met(env, maybe_changes_to_owner, *id, &changed_choices).first)
+ return true;
+
+ if (_flags.length() >= 2 && ":*" == _flags.substr(_flags.length() - 2))
+ {
+ if ((! _options[euro_allow_self_deps]) || (! _id) || (! _id->choices_key()))
+ throw ELikeUseRequirementError(_flags, "[prefix:*] not allowed here");
+ if (_options[euro_portage_syntax] && ! _options[euro_both_syntaxes])
+ {
+ if (_options[euro_strict_parsing])
+ throw ELikeUseRequirementError(_flags, "[prefix:*] not allowed here");
+ else
+ Log::get_instance()->message("elike_use_requirement.prefix_star_not_allowed", ll_warning, lc_context)
+ << "[prefix:*] not safe for use here";
+ }
+
+ ChoicePrefixName prefix(_flags.substr(0, _flags.length() - 2));
+ Choices::ConstIterator cc(_id->choices_key()->value()->find(prefix));
+ if (cc == _id->choices_key()->value()->end())
+ Log::get_instance()->message("elike_use_requirement.prefix_star_unmatching", ll_warning, lc_context) <<
+ "ID '" << *_id << "' uses requirement '" << _flags << "' but has no choice prefix '" << prefix << "'";
+ else
+ {
+ for (Choice::ConstIterator v((*cc)->begin()), v_end((*cc)->end()) ;
+ v != v_end ; ++v)
+ if (! one_accumulate_changes_to_make_met(env, maybe_changes_to_owner, id, changed_choices, (*v)->name_with_prefix()))
+ return false;
+ }
+ }
+ else
+ if (! one_accumulate_changes_to_make_met(env, maybe_changes_to_owner, id, changed_choices, ChoiceNameWithPrefix(_flags)))
+ return false;
+
+ return true;
+ }
+
+ bool one_accumulate_changes_to_make_met(
+ const Environment * const,
+ const ChangedChoices * const,
+ const std::shared_ptr<const PackageID> & id,
+ ChangedChoices & changed_choices,
+ const ChoiceNameWithPrefix & flag) const
+ {
+ const std::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(flag));
+
+ if (! v)
+ {
+ /* warning messages get done elsewhere, no need here */
+ return false;
+ }
+
+ if (v->locked() || ! v->explicitly_listed())
+ return false;
+
+ return changed_choices.add_override_if_possible(flag, ! v->enabled());;
+ }
};
class PALUDIS_VISIBLE EnabledUseRequirement :
@@ -199,10 +287,10 @@ namespace
{
}
- virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag, const ChangedChoices * const,
+ const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, pkg, default_value());
+ return icky_use_query(_options, flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -223,10 +311,10 @@ namespace
{
}
- virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag, const ChangedChoices * const,
+ const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return ! icky_use_query(flag, pkg, default_value());
+ return ! icky_use_query(_options, flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -262,9 +350,10 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return ! icky_use_query(flag, *package_id()) || icky_use_query(flag, pkg, default_value());
+ return ! icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner) ||
+ icky_use_query(_options, flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -287,9 +376,10 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, *package_id()) || icky_use_query(flag, pkg, default_value());
+ return icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner) ||
+ icky_use_query(_options, flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -312,9 +402,10 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return ! icky_use_query(flag, *package_id()) || ! icky_use_query(flag, pkg, default_value());
+ return ! icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner) ||
+ ! icky_use_query(_options, flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -337,9 +428,10 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, *package_id()) || ! icky_use_query(flag, pkg, default_value());
+ return icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner) ||
+ ! icky_use_query(_options, flag, pkg, changed_choices, default_value());
}
virtual const std::string as_human_string() const
@@ -362,9 +454,10 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, pkg, default_value()) == icky_use_query(flag, *package_id());
+ return icky_use_query(_options, flag, pkg, changed_choices, default_value()) ==
+ icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner);
}
virtual const std::string as_human_string() const
@@ -387,9 +480,10 @@ namespace
}
virtual bool one_requirement_met_base(const Environment * const, const ChoiceNameWithPrefix & flag,
- const PackageID & pkg) const
+ const ChangedChoices * const maybe_changes_to_owner, const PackageID & pkg, const ChangedChoices * const changed_choices) const
{
- return icky_use_query(flag, pkg, default_value()) != icky_use_query(flag, *package_id());
+ return icky_use_query(_options, flag, pkg, changed_choices, default_value()) !=
+ icky_use_query(_options, flag, *package_id(), maybe_changes_to_owner);
}
virtual const std::string as_human_string() const
@@ -414,7 +508,11 @@ namespace
{
}
- virtual const std::pair<bool, std::string> requirement_met(const Environment * const env, const PackageID & id) const
+ virtual const std::pair<bool, std::string> requirement_met(
+ const Environment * const env,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID & id,
+ const ChangedChoices * const maybe_changes_to_target) const
{
using namespace std::placeholders;
@@ -422,7 +520,7 @@ namespace
for (Reqs::const_iterator r(_reqs.begin()), r_end(_reqs.end()) ;
r != r_end ; ++r)
{
- std::pair<bool, std::string> r_result((*r)->requirement_met(env, id));
+ std::pair<bool, std::string> r_result((*r)->requirement_met(env, maybe_changes_to_owner, id, maybe_changes_to_target));
if (! r_result.first)
{
if (! result.first)
@@ -449,6 +547,20 @@ namespace
{
_reqs.push_back(req);
}
+
+ virtual bool accumulate_changes_to_make_met(
+ const Environment * const env,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const std::shared_ptr<const PackageID> & id,
+ ChangedChoices & changed_choices) const
+ {
+ for (auto r(_reqs.begin()), r_end(_reqs.end()) ;
+ r != r_end ; ++r)
+ if (! (*r)->accumulate_changes_to_make_met(env, maybe_changes_to_owner, id, changed_choices))
+ return false;
+
+ return true;
+ }
};
template <typename T_>
diff --git a/paludis/elike_use_requirement.se b/paludis/elike_use_requirement.se
index 6099b88..c0c9d54 100644
--- a/paludis/elike_use_requirement.se
+++ b/paludis/elike_use_requirement.se
@@ -12,5 +12,6 @@ make_enum_ELikeUseRequirementOption()
key euro_portage_syntax "Parse using Portage syntax"
key euro_both_syntaxes "Accept both Portage and Paludis syntax"
key euro_strict_parsing "Error rather than warn for violations"
+ key euro_missing_is_qa "Missing flags with no default value is a QA violation"
}
diff --git a/paludis/elike_use_requirement_TEST.cc b/paludis/elike_use_requirement_TEST.cc
index 4726ff9..4ee3fcb 100644
--- a/paludis/elike_use_requirement_TEST.cc
+++ b/paludis/elike_use_requirement_TEST.cc
@@ -26,6 +26,7 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/choice.hh>
+#include <paludis/additional_package_dep_spec_requirement.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <list>
@@ -73,25 +74,25 @@ namespace test_cases
parse_elike_use_requirement("enabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("disabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[disabled]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'disabled' enabled");
- TEST_CHECK(! req2->requirement_met(&env, *id).first);
+ TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-enabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-disabled", std::shared_ptr<const PackageID>(), { euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-disabled]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'disabled' disabled");
- TEST_CHECK(req4->requirement_met(&env, *id).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
}
} test_simple_use_requirements;
@@ -114,25 +115,25 @@ namespace test_cases
parse_elike_use_requirement("enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[disabled]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'disabled' enabled");
- TEST_CHECK(! req2->requirement_met(&env, *id).first);
+ TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-disabled]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'disabled' disabled");
- TEST_CHECK(req4->requirement_met(&env, *id).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
}
} test_simple_use_requirements_portage_syntax;
@@ -155,31 +156,31 @@ namespace test_cases
parse_elike_use_requirement("enabled,-disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[enabled,-disabled]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("enabled,disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[enabled,disabled]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' enabled");
- TEST_CHECK(! req2->requirement_met(&env, *id).first);
+ TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-enabled,-disabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-enabled,-disabled]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'enabled' disabled; Flag 'disabled' disabled");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("enabled,-disabled,-enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[enabled,-disabled,-enabled]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' disabled");
- TEST_CHECK(! req4->requirement_met(&env, *id).first);
+ TEST_CHECK(! req4->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
parse_elike_use_requirement("enabled,-disabled,enabled", std::shared_ptr<const PackageID>(), { euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req5->as_raw_string(), "[enabled,-disabled,enabled]");
TEST_CHECK_EQUAL(req5->as_human_string(), "Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' enabled");
- TEST_CHECK(req5->requirement_met(&env, *id).first);
+ TEST_CHECK(req5->requirement_met(&env, 0, *id, 0).first);
}
} test_multiple_use_requirements_portage_syntax;
@@ -204,85 +205,85 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
- TEST_CHECK(req3->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req3->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req4->requirement_met(&env, *id).first);
- TEST_CHECK(req4->requirement_met(&env, *id2).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req5->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req5->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req5->requirement_met(&env, *id).first);
- TEST_CHECK(req5->requirement_met(&env, *id2).first);
+ TEST_CHECK(req5->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req5->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req6(
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req6->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req6->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req6->requirement_met(&env, *id).first);
- TEST_CHECK(! req6->requirement_met(&env, *id2).first);
+ TEST_CHECK(req6->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req6->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps, euro_strict_parsing }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements;
@@ -307,57 +308,57 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements_portage_syntax;
@@ -382,113 +383,113 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req13->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req13->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req13->requirement_met(&env, *id).first);
- TEST_CHECK(req13->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req13->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req13->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req14->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req14->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req14->requirement_met(&env, *id).first);
- TEST_CHECK(req14->requirement_met(&env, *id2).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req15->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req15->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req15->requirement_met(&env, *id).first);
- TEST_CHECK(req15->requirement_met(&env, *id2).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req16->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req16->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req16->requirement_met(&env, *id).first);
- TEST_CHECK(! req16->requirement_met(&env, *id2).first);
+ TEST_CHECK(req16->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req16->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req17->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req17->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req17->requirement_met(&env, *id).first);
- TEST_CHECK(req17->requirement_met(&env, *id2).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req18->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req18->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req18->requirement_met(&env, *id).first);
- TEST_CHECK(req18->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req18->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req18->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req19->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req19->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req19->requirement_met(&env, *id).first);
- TEST_CHECK(req19->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req19->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req19->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
TEST_CHECK_EQUAL(req20->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req20->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req20->requirement_met(&env, *id).first);
- TEST_CHECK(! req20->requirement_met(&env, *id2).first);
+ TEST_CHECK(req20->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req20->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements_both_syntaxes;
@@ -606,113 +607,113 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req13->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req13->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req13->requirement_met(&env, *id).first);
- TEST_CHECK(req13->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req13->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req13->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req14->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req14->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req14->requirement_met(&env, *id).first);
- TEST_CHECK(req14->requirement_met(&env, *id2).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req15->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req15->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req15->requirement_met(&env, *id).first);
- TEST_CHECK(req15->requirement_met(&env, *id2).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req16->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req16->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req16->requirement_met(&env, *id).first);
- TEST_CHECK(! req16->requirement_met(&env, *id2).first);
+ TEST_CHECK(req16->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req16->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req17->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req17->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req17->requirement_met(&env, *id).first);
- TEST_CHECK(req17->requirement_met(&env, *id2).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req18->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req18->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req18->requirement_met(&env, *id).first);
- TEST_CHECK(req18->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req18->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req18->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req19->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req19->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req19->requirement_met(&env, *id).first);
- TEST_CHECK(req19->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req19->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req19->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps }));
TEST_CHECK_EQUAL(req20->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req20->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req20->requirement_met(&env, *id).first);
- TEST_CHECK(! req20->requirement_met(&env, *id2).first);
+ TEST_CHECK(req20->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req20->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements_nonstrict;
@@ -737,113 +738,113 @@ namespace test_cases
parse_elike_use_requirement("pkgname?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
- TEST_CHECK(! req1->requirement_met(&env, *id2).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[pkgname?]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
parse_elike_use_requirement("!pkgname?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req7->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req7->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req7->requirement_met(&env, *id).first);
- TEST_CHECK(req7->requirement_met(&env, *id2).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req7->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
parse_elike_use_requirement("!pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req8->as_raw_string(), "[!pkgname?]");
TEST_CHECK_EQUAL(req8->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req8->requirement_met(&env, *id).first);
- TEST_CHECK(req8->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req8->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req8->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
parse_elike_use_requirement("pkgname=", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req9->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req9->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req9->requirement_met(&env, *id).first);
- TEST_CHECK(! req9->requirement_met(&env, *id2).first);
+ TEST_CHECK(req9->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req9->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
parse_elike_use_requirement("pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req10->as_raw_string(), "[pkgname=]");
TEST_CHECK_EQUAL(req10->as_human_string(), "Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req10->requirement_met(&env, *id).first);
- TEST_CHECK(req10->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req10->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req10->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
parse_elike_use_requirement("!pkgname=", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req11->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req11->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req11->requirement_met(&env, *id).first);
- TEST_CHECK(req11->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req11->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req11->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
parse_elike_use_requirement("!pkgname=", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req12->as_raw_string(), "[!pkgname=]");
TEST_CHECK_EQUAL(req12->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req12->requirement_met(&env, *id).first);
- TEST_CHECK(! req12->requirement_met(&env, *id2).first);
+ TEST_CHECK(req12->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req12->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
parse_elike_use_requirement("-pkgname?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req13->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req13->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req13->requirement_met(&env, *id).first);
- TEST_CHECK(req13->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req13->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req13->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
parse_elike_use_requirement("-pkgname?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req14->as_raw_string(), "[-pkgname?]");
TEST_CHECK_EQUAL(req14->as_human_string(), "Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req14->requirement_met(&env, *id).first);
- TEST_CHECK(req14->requirement_met(&env, *id2).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req14->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
parse_elike_use_requirement("pkgname!?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req15->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req15->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req15->requirement_met(&env, *id).first);
- TEST_CHECK(req15->requirement_met(&env, *id2).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req15->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
parse_elike_use_requirement("pkgname!?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req16->as_raw_string(), "[pkgname!?]");
TEST_CHECK_EQUAL(req16->as_human_string(), "Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req16->requirement_met(&env, *id).first);
- TEST_CHECK(! req16->requirement_met(&env, *id2).first);
+ TEST_CHECK(req16->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req16->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
parse_elike_use_requirement("-pkgname!?", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req17->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req17->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'");
- TEST_CHECK(req17->requirement_met(&env, *id).first);
- TEST_CHECK(req17->requirement_met(&env, *id2).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req17->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
parse_elike_use_requirement("-pkgname!?", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req18->as_raw_string(), "[-pkgname!?]");
TEST_CHECK_EQUAL(req18->as_human_string(), "Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'");
- TEST_CHECK(! req18->requirement_met(&env, *id).first);
- TEST_CHECK(req18->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req18->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req18->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
parse_elike_use_requirement("pkgname!=", id, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req19->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req19->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'");
- TEST_CHECK(! req19->requirement_met(&env, *id).first);
- TEST_CHECK(req19->requirement_met(&env, *id2).first);
+ TEST_CHECK(! req19->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(req19->requirement_met(&env, 0, *id2, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
parse_elike_use_requirement("pkgname!=", id2, { euro_allow_self_deps, euro_portage_syntax }));
TEST_CHECK_EQUAL(req20->as_raw_string(), "[pkgname!=]");
TEST_CHECK_EQUAL(req20->as_human_string(), "Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'");
- TEST_CHECK(req20->requirement_met(&env, *id).first);
- TEST_CHECK(! req20->requirement_met(&env, *id2).first);
+ TEST_CHECK(req20->requirement_met(&env, 0, *id, 0).first);
+ TEST_CHECK(! req20->requirement_met(&env, 0, *id2, 0).first);
}
} test_complex_use_requirements_portage_syntax_nonstrict;
@@ -866,25 +867,25 @@ namespace test_cases
parse_elike_use_requirement("missing(+)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[missing(+)]");
TEST_CHECK_EQUAL(req1->as_human_string(), "Flag 'missing' enabled, assuming enabled if missing");
- TEST_CHECK(req1->requirement_met(&env, *id).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("missing(-)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[missing(-)]");
TEST_CHECK_EQUAL(req2->as_human_string(), "Flag 'missing' enabled, assuming disabled if missing");
- TEST_CHECK(! req2->requirement_met(&env, *id).first);
+ TEST_CHECK(! req2->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
parse_elike_use_requirement("-missing(+)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
TEST_CHECK_EQUAL(req3->as_raw_string(), "[-missing(+)]");
TEST_CHECK_EQUAL(req3->as_human_string(), "Flag 'missing' disabled, assuming enabled if missing");
- TEST_CHECK(! req3->requirement_met(&env, *id).first);
+ TEST_CHECK(! req3->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
parse_elike_use_requirement("-missing(-)", std::shared_ptr<const PackageID>(), { euro_allow_default_values, euro_strict_parsing }));
TEST_CHECK_EQUAL(req4->as_raw_string(), "[-missing(-)]");
TEST_CHECK_EQUAL(req4->as_human_string(), "Flag 'missing' disabled, assuming disabled if missing");
- TEST_CHECK(req4->requirement_met(&env, *id).first);
+ TEST_CHECK(req4->requirement_met(&env, 0, *id, 0).first);
}
} test_use_requirements_with_defaults;
@@ -907,13 +908,13 @@ namespace test_cases
parse_elike_use_requirement("foo:*", id,
{ euro_allow_default_values, euro_allow_self_deps }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[foo:*]");
- TEST_CHECK(! req1->requirement_met(&env, *id).first);
+ TEST_CHECK(! req1->requirement_met(&env, 0, *id, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("foo:*=", id,
{ euro_allow_default_values, euro_allow_self_deps }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[foo:*=]");
- TEST_CHECK(req2->requirement_met(&env, *id).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id, 0).first);
}
} test_prefix_star_use_requirements;
@@ -941,16 +942,16 @@ namespace test_cases
{ euro_allow_default_values, euro_allow_self_deps,
euro_allow_default_question_values }));
TEST_CHECK_EQUAL(req1->as_raw_string(), "[foo:*(?)=]");
- TEST_CHECK(req1->requirement_met(&env, *id2).first);
- TEST_CHECK(req1->requirement_met(&env, *id1).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id2, 0).first);
+ TEST_CHECK(req1->requirement_met(&env, 0, *id1, 0).first);
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
parse_elike_use_requirement("bar:*(?)=", id2,
{ euro_allow_default_values, euro_allow_self_deps,
euro_allow_default_question_values }));
TEST_CHECK_EQUAL(req2->as_raw_string(), "[bar:*(?)=]");
- TEST_CHECK(req2->requirement_met(&env, *id2).first);
- TEST_CHECK(req2->requirement_met(&env, *id1).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id2, 0).first);
+ TEST_CHECK(req2->requirement_met(&env, 0, *id1, 0).first);
}
} test_question_default_requirements;
}
diff --git a/paludis/environments/paludis/world.cc b/paludis/environments/paludis/world.cc
index 3304a33..714f185 100644
--- a/paludis/environments/paludis/world.cc
+++ b/paludis/environments/paludis/world.cc
@@ -28,6 +28,7 @@
#include <paludis/set_file.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/dep_tag.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <functional>
using namespace paludis;
diff --git a/paludis/environments/paludis/world_TEST.cc b/paludis/environments/paludis/world_TEST.cc
index 64ea589..181f3bb 100644
--- a/paludis/environments/paludis/world_TEST.cc
+++ b/paludis/environments/paludis/world_TEST.cc
@@ -22,6 +22,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/safe_ifstream.hh>
#include <paludis/util/options.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <iterator>
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index c376dc5..1221bc2 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -51,6 +51,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 <functional>
#include <algorithm>
#include <set>
diff --git a/paludis/environments/portage/portage_environment_TEST.cc b/paludis/environments/portage/portage_environment_TEST.cc
index c18ca1f..b8e8067 100644
--- a/paludis/environments/portage/portage_environment_TEST.cc
+++ b/paludis/environments/portage/portage_environment_TEST.cc
@@ -35,6 +35,7 @@
#include <paludis/selection.hh>
#include <paludis/metadata_key.hh>
#include <paludis/choice.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
diff --git a/paludis/files.m4 b/paludis/files.m4
index d152924..5f01e02 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -8,106 +8,110 @@ dnl the base filename with no extension; later parameters can be `hh', `cc',
dnl `test', `impl', `testscript'. Note that there isn't much error checking done
dnl on this file at present...
-add(`about', `hh', `test')
-add(`about_metadata', `hh', `cc', `fwd')
-add(`action', `hh', `cc', `fwd', `se')
-add(`action_names', `hh', `cc', `fwd')
-add(`broken_linkage_configuration', `hh', `cc', `test', `testscript')
-add(`broken_linkage_finder', `hh', `cc')
-add(`buffer_output_manager', `hh', `cc', `fwd')
-add(`choice', `hh', `cc', `fwd')
-add(`comma_separated_dep_parser', `hh', `cc', `test')
-add(`comma_separated_dep_printer', `hh', `cc')
-add(`common_sets', `hh', `cc', `fwd')
-add(`contents', `hh', `cc', `fwd')
-add(`create_output_manager_info', `hh', `cc', `fwd', `se')
-add(`dep_label', `hh', `cc', `fwd')
-add(`dep_list', `hh', `cc', `fwd', `test')
-add(`dep_list_exceptions', `hh', `cc')
-add(`dep_list_options', `hh', `cc', `se')
-add(`dep_spec', `hh', `cc', `test', `fwd', `se')
-add(`dep_spec_flattener', `hh', `cc')
-add(`dep_tag', `hh', `cc', `fwd')
-add(`distribution', `hh', `cc', `impl', `fwd')
-add(`elf_linkage_checker', `hh', `cc')
-add(`elike_annotations', `hh', `cc', `fwd')
-add(`elike_choices', `hh', `cc', `fwd')
-add(`elike_dep_parser', `hh', `cc', `fwd', `test')
-add(`elike_conditional_dep_spec', `hh', `cc', `fwd')
-add(`elike_package_dep_spec', `hh', `cc', `fwd', `se')
-add(`elike_slot_requirement', `hh', `cc', `fwd')
-add(`elike_use_requirement', `hh', `cc', `fwd', `se', `test')
-add(`environment', `hh', `fwd', `cc')
-add(`environment_factory', `hh', `fwd', `cc')
-add(`environment_implementation', `hh', `cc')
-add(`file_output_manager', `hh', `cc', `fwd')
-add(`filter', `hh', `cc', `fwd', `test')
-add(`filter_handler', `hh', `cc', `fwd')
-add(`filtered_generator', `hh', `cc', `fwd', `test')
-add(`find_unused_packages_task', `hh', `cc')
-add(`format_messages_output_manager', `hh', `fwd', `cc')
-add(`formatter', `hh', `fwd', `cc')
-add(`forward_at_finish_output_manager', `hh', `fwd', `cc')
-add(`fs_merger', `hh', `cc', `fwd', `se', `test', `testscript')
-add(`fuzzy_finder', `hh', `cc', `test')
-add(`generator', `hh', `cc', `fwd', `test')
-add(`generator_handler', `hh', `cc', `fwd')
-add(`handled_information', `hh', `fwd', `cc')
-add(`hook', `hh', `cc', `fwd', `se')
-add(`hooker', `hh', `cc', `test', `testscript')
-add(`install_task', `hh', `cc', `se')
-add(`ipc_output_manager', `hh', `cc', `fwd')
-add(`libtool_linkage_checker', `hh', `cc')
-add(`linkage_checker', `hh', `cc')
-add(`literal_metadata_key', `hh', `cc')
-add(`mask', `hh', `cc', `fwd', `se')
-add(`match_package', `hh', `cc', `se', `fwd')
-add(`merger', `hh', `cc', `se', `fwd')
-add(`merger_entry_type', `hh', `cc', `se')
-add(`metadata_key', `hh', `cc', `se', `fwd')
-add(`metadata_key_holder', `hh', `cc', `fwd')
-add(`name', `hh', `cc', `fwd', `test')
-add(`ndbam', `hh', `cc', `fwd')
-add(`ndbam_merger', `hh', `cc')
-add(`ndbam_unmerger', `hh', `cc')
-add(`notifier_callback', `hh', `cc', `fwd')
-add(`output_manager', `hh', `fwd', `cc', `se')
-add(`output_manager_factory', `hh', `fwd', `cc')
-add(`output_manager_from_environment', `hh', `fwd', `cc')
-add(`override_functions', `hh', `cc')
-add(`package_database', `hh', `cc', `fwd', `test')
-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(`query_visitor', `hh', `cc')
-add(`range_rewriter', `hh', `cc', `test')
-add(`report_task', `hh', `cc')
-add(`repository', `hh', `fwd', `cc')
-add(`repository_factory', `hh', `fwd', `cc')
-add(`repository_name_cache', `hh', `cc', `test', `testscript')
-add(`selection', `hh', `cc', `fwd', `test')
-add(`selection_cache', `hh', `cc', `fwd')
-add(`selection_handler', `hh', `cc', `fwd')
-add(`serialise', `hh', `cc', `fwd', `impl')
-add(`set_file', `hh', `cc', `se', `test', `testscript')
-add(`show_suggest_visitor', `hh', `cc')
-add(`slot_requirement', `hh', `fwd', `cc')
-add(`spec_tree', `hh', `fwd', `cc')
-add(`standard_output_manager', `hh', `cc', `fwd')
-add(`stringify_formatter', `hh', `cc', `fwd', `impl', `test')
-add(`stripper', `hh', `cc', `fwd', `test', `testscript')
-add(`syncer', `hh', `cc')
-add(`sync_task', `hh', `cc')
-add(`tar_merger', `hh', `cc', `fwd', `test', `testscript', `se')
-add(`tasks_exceptions', `hh', `cc')
-add(`tee_output_manager', `hh', `cc', `fwd')
-add(`unchoices_key', `hh', `cc', `fwd')
-add(`uninstall_list', `hh', `cc', `se', `test')
-add(`uninstall_task', `hh', `cc')
-add(`unmerger', `hh', `cc')
-add(`user_dep_spec', `hh', `cc', `se', `fwd', `test')
-add(`version_operator', `hh', `cc', `fwd', `se', `test')
-add(`version_requirements', `hh', `cc', `fwd')
-add(`version_spec', `hh', `cc', `se', `fwd', `test')
+add(`about', `hh', `test')
+add(`about_metadata', `hh', `cc', `fwd')
+add(`action', `hh', `cc', `fwd', `se')
+add(`action_names', `hh', `cc', `fwd')
+add(`additional_package_dep_spec_requirement', `hh', `cc', `fwd')
+add(`broken_linkage_configuration', `hh', `cc', `test', `testscript')
+add(`broken_linkage_finder', `hh', `cc')
+add(`buffer_output_manager', `hh', `cc', `fwd')
+add(`changed_choices', `hh', `cc', `fwd')
+add(`choice', `hh', `cc', `fwd')
+add(`comma_separated_dep_parser', `hh', `cc', `test')
+add(`comma_separated_dep_printer', `hh', `cc')
+add(`common_sets', `hh', `cc', `fwd')
+add(`contents', `hh', `cc', `fwd')
+add(`create_output_manager_info', `hh', `cc', `fwd', `se')
+add(`dep_label', `hh', `cc', `fwd')
+add(`dep_list', `hh', `cc', `fwd', `test')
+add(`dep_list_exceptions', `hh', `cc')
+add(`dep_list_options', `hh', `cc', `se')
+add(`dep_spec', `hh', `cc', `test', `fwd')
+add(`dep_spec_data', `hh', `cc', `fwd')
+add(`dep_spec_flattener', `hh', `cc')
+add(`dep_tag', `hh', `cc', `fwd')
+add(`distribution', `hh', `cc', `impl', `fwd')
+add(`elf_linkage_checker', `hh', `cc')
+add(`elike_annotations', `hh', `cc', `fwd')
+add(`elike_choices', `hh', `cc', `fwd')
+add(`elike_dep_parser', `hh', `cc', `fwd', `test')
+add(`elike_conditional_dep_spec', `hh', `cc', `fwd')
+add(`elike_package_dep_spec', `hh', `cc', `fwd', `se')
+add(`elike_slot_requirement', `hh', `cc', `fwd')
+add(`elike_use_requirement', `hh', `cc', `fwd', `se', `test')
+add(`environment', `hh', `fwd', `cc')
+add(`environment_factory', `hh', `fwd', `cc')
+add(`environment_implementation', `hh', `cc')
+add(`file_output_manager', `hh', `cc', `fwd')
+add(`filter', `hh', `cc', `fwd', `test')
+add(`filter_handler', `hh', `cc', `fwd')
+add(`filtered_generator', `hh', `cc', `fwd', `test')
+add(`find_unused_packages_task', `hh', `cc')
+add(`format_messages_output_manager', `hh', `fwd', `cc')
+add(`formatter', `hh', `fwd', `cc')
+add(`forward_at_finish_output_manager', `hh', `fwd', `cc')
+add(`fs_merger', `hh', `cc', `fwd', `se', `test', `testscript')
+add(`fuzzy_finder', `hh', `cc', `test')
+add(`generator', `hh', `cc', `fwd', `test')
+add(`generator_handler', `hh', `cc', `fwd')
+add(`handled_information', `hh', `fwd', `cc')
+add(`hook', `hh', `cc', `fwd', `se')
+add(`hooker', `hh', `cc', `test', `testscript')
+add(`install_task', `hh', `cc', `se')
+add(`ipc_output_manager', `hh', `cc', `fwd')
+add(`libtool_linkage_checker', `hh', `cc')
+add(`linkage_checker', `hh', `cc')
+add(`literal_metadata_key', `hh', `cc')
+add(`mask', `hh', `cc', `fwd', `se')
+add(`match_package', `hh', `cc', `se', `fwd')
+add(`merger', `hh', `cc', `se', `fwd')
+add(`merger_entry_type', `hh', `cc', `se')
+add(`metadata_key', `hh', `cc', `se', `fwd')
+add(`metadata_key_holder', `hh', `cc', `fwd')
+add(`name', `hh', `cc', `fwd', `test')
+add(`ndbam', `hh', `cc', `fwd')
+add(`ndbam_merger', `hh', `cc')
+add(`ndbam_unmerger', `hh', `cc')
+add(`notifier_callback', `hh', `cc', `fwd')
+add(`output_manager', `hh', `fwd', `cc', `se')
+add(`output_manager_factory', `hh', `fwd', `cc')
+add(`output_manager_from_environment', `hh', `fwd', `cc')
+add(`override_functions', `hh', `cc')
+add(`package_database', `hh', `cc', `fwd', `test')
+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')
+add(`query_visitor', `hh', `cc')
+add(`range_rewriter', `hh', `cc', `test')
+add(`report_task', `hh', `cc')
+add(`repository', `hh', `fwd', `cc')
+add(`repository_factory', `hh', `fwd', `cc')
+add(`repository_name_cache', `hh', `cc', `test', `testscript')
+add(`selection', `hh', `cc', `fwd', `test')
+add(`selection_cache', `hh', `cc', `fwd')
+add(`selection_handler', `hh', `cc', `fwd')
+add(`serialise', `hh', `cc', `fwd', `impl')
+add(`set_file', `hh', `cc', `se', `test', `testscript')
+add(`show_suggest_visitor', `hh', `cc')
+add(`slot_requirement', `hh', `fwd', `cc')
+add(`spec_tree', `hh', `fwd', `cc')
+add(`standard_output_manager', `hh', `cc', `fwd')
+add(`stringify_formatter', `hh', `cc', `fwd', `impl', `test')
+add(`stripper', `hh', `cc', `fwd', `test', `testscript')
+add(`syncer', `hh', `cc')
+add(`sync_task', `hh', `cc')
+add(`tar_merger', `hh', `cc', `fwd', `test', `testscript', `se')
+add(`tasks_exceptions', `hh', `cc')
+add(`tee_output_manager', `hh', `cc', `fwd')
+add(`unchoices_key', `hh', `cc', `fwd')
+add(`uninstall_list', `hh', `cc', `se', `test')
+add(`uninstall_task', `hh', `cc')
+add(`unmerger', `hh', `cc')
+add(`user_dep_spec', `hh', `cc', `se', `fwd', `test')
+add(`version_operator', `hh', `cc', `fwd', `se', `test')
+add(`version_requirements', `hh', `cc', `fwd')
+add(`version_spec', `hh', `cc', `se', `fwd', `test')
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 5957fa9..35d40ef 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -36,6 +36,7 @@
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/package_dep_spec_properties.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/set-impl.hh>
#include <paludis/util/log.hh>
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index b80eb74..429f680 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -33,6 +33,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/action.hh>
#include <paludis/repository.hh>
+#include <paludis/additional_package_dep_spec_requirement.hh>
#include <paludis/util/indirect_iterator-impl.hh>
@@ -76,10 +77,12 @@ namespace
}
bool
-paludis::match_package(
+paludis::match_package_with_maybe_changes(
const Environment & env,
const PackageDepSpec & spec,
+ const ChangedChoices * const maybe_changes_to_owner,
const PackageID & entry,
+ const ChangedChoices * const maybe_changes_to_target,
const MatchPackageOptions & options)
{
if (spec.package_ptr() && *spec.package_ptr() != entry.name())
@@ -203,7 +206,7 @@ paludis::match_package(
{
for (AdditionalPackageDepSpecRequirements::ConstIterator u(spec.additional_requirements_ptr()->begin()),
u_end(spec.additional_requirements_ptr()->end()) ; u != u_end ; ++u)
- if (! (*u)->requirement_met(&env, entry).first)
+ if (! (*u)->requirement_met(&env, maybe_changes_to_owner, entry, maybe_changes_to_target).first)
return false;
}
}
@@ -212,6 +215,16 @@ paludis::match_package(
}
bool
+paludis::match_package(
+ const Environment & env,
+ const PackageDepSpec & spec,
+ const PackageID & target,
+ const MatchPackageOptions & options)
+{
+ return match_package_with_maybe_changes(env, spec, 0, target, 0, options);
+}
+
+bool
paludis::match_package_in_set(
const Environment & env,
const SetSpecTree & target,
diff --git a/paludis/match_package.hh b/paludis/match_package.hh
index 25d691e..4ecae6d 100644
--- a/paludis/match_package.hh
+++ b/paludis/match_package.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -36,7 +36,7 @@
#include <paludis/spec_tree-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
-#include <memory>
+#include <paludis/changed_choices-fwd.hh>
namespace paludis
{
@@ -54,6 +54,23 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
/**
+ * Return whether the specified PackageID matches the specified
+ * PackageDepSpec, with the specified ChangedChoices applied to the target
+ * and the ID from which the dep came.
+ *
+ * \ingroup g_query
+ * \since 0.51
+ */
+ bool match_package_with_maybe_changes(
+ const Environment & env,
+ const PackageDepSpec & spec,
+ const ChangedChoices * const maybe_changes_to_owner,
+ const PackageID & target,
+ const ChangedChoices * const maybe_changes_to_target,
+ const MatchPackageOptions & options)
+ PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
+
+ /**
* Return whether the specified PackageID matches any of the items in the
* specified set.
*
diff --git a/paludis/ndbam.cc b/paludis/ndbam.cc
index 687f392..2dc6da0 100644
--- a/paludis/ndbam.cc
+++ b/paludis/ndbam.cc
@@ -36,6 +36,7 @@
#include <paludis/name.hh>
#include <paludis/contents.hh>
#include <paludis/literal_metadata_key.hh>
+#include <algorithm>
#include <unordered_map>
#include <functional>
#include <vector>
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 1ed1316..262e369 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -26,6 +26,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/util/log.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/stringify.hh>
diff --git a/paludis/partially_made_package_dep_spec-fwd.hh b/paludis/partially_made_package_dep_spec-fwd.hh
new file mode 100644
index 0000000..7a2a465
--- /dev/null
+++ b/paludis/partially_made_package_dep_spec-fwd.hh
@@ -0,0 +1,53 @@
+/* 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
new file mode 100644
index 0000000..fe015d3
--- /dev/null
+++ b/paludis/partially_made_package_dep_spec.cc
@@ -0,0 +1,512 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/partially_made_package_dep_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 <paludis/version_requirements.hh>
+#include <paludis/additional_package_dep_spec_requirement.hh>
+#include <paludis/dep_spec_data.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 QualifiedPackageName> package;
+ std::shared_ptr<const PackageNamePart> package_name_part;
+ std::shared_ptr<const CategoryNamePart> category_name_part;
+ std::shared_ptr<VersionRequirements> version_requirements;
+ VersionRequirementsMode version_requirements_mode_v;
+ std::shared_ptr<const SlotRequirement> slot;
+ std::shared_ptr<const RepositoryName> in_repository;
+ std::shared_ptr<const RepositoryName> from_repository;
+ std::shared_ptr<const InstallableToRepository> installable_to_repository;
+ std::shared_ptr<const FSEntry> installed_at_path;
+ std::shared_ptr<const InstallableToPath> installable_to_path;
+ std::shared_ptr<AdditionalPackageDepSpecRequirements> additional_requirements;
+ std::shared_ptr<const MetadataSectionKey> annotations;
+ PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec_v;
+
+ PartiallyMadePackageDepSpecData(const PartiallyMadePackageDepSpecOptions & o) :
+ PackageDepSpecData(),
+ version_requirements_mode_v(vr_and),
+ options_for_partially_made_package_dep_spec_v(o)
+ {
+ }
+
+ PartiallyMadePackageDepSpecData(const PackageDepSpecData & other) :
+ PackageDepSpecData(other),
+ package(other.package_ptr()),
+ package_name_part(other.package_name_part_ptr()),
+ category_name_part(other.category_name_part_ptr()),
+ version_requirements(other.version_requirements_ptr() ? new VersionRequirements : 0),
+ version_requirements_mode_v(other.version_requirements_mode()),
+ slot(other.slot_requirement_ptr()),
+ in_repository(other.in_repository_ptr()),
+ from_repository(other.from_repository_ptr()),
+ installable_to_repository(other.installable_to_repository_ptr()),
+ installed_at_path(other.installed_at_path_ptr()),
+ installable_to_path(other.installable_to_path_ptr()),
+ additional_requirements(other.additional_requirements_ptr() ? new AdditionalPackageDepSpecRequirements : 0),
+ annotations(other.annotations_key()),
+ options_for_partially_made_package_dep_spec_v(other.options_for_partially_made_package_dep_spec())
+ {
+ if (version_requirements)
+ std::copy(other.version_requirements_ptr()->begin(), other.version_requirements_ptr()->end(),
+ version_requirements->back_inserter());
+
+ if (additional_requirements)
+ std::copy(other.additional_requirements_ptr()->begin(), other.additional_requirements_ptr()->end(),
+ additional_requirements->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),
+ version_requirements(other.version_requirements),
+ version_requirements_mode_v(other.version_requirements_mode_v),
+ slot(other.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),
+ additional_requirements(other.additional_requirements),
+ annotations(other.annotations),
+ 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 (version_requirements_ptr())
+ {
+ if (version_requirements_ptr()->begin() == version_requirements_ptr()->end())
+ {
+ }
+ else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end() &&
+ ! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
+ {
+ if (version_requirements_ptr()->begin()->version_operator() == vo_stupid_equal_star || version_requirements_ptr()->begin()->version_operator() == vo_nice_equal_star)
+ s << "=";
+ else
+ s << version_requirements_ptr()->begin()->version_operator();
+ }
+ }
+
+ if (package_ptr())
+ s << *package_ptr();
+ else
+ {
+ if (category_name_part_ptr())
+ s << *category_name_part_ptr();
+ else
+ s << "*";
+
+ s << "/";
+
+ if (package_name_part_ptr())
+ s << *package_name_part_ptr();
+ else
+ s << "*";
+ }
+
+ if (version_requirements_ptr())
+ {
+ if (version_requirements_ptr()->begin() == version_requirements_ptr()->end())
+ {
+ }
+ else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end() &&
+ ! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
+ {
+ s << "-" << version_requirements_ptr()->begin()->version_spec();
+ if (version_requirements_ptr()->begin()->version_operator() == vo_stupid_equal_star || version_requirements_ptr()->begin()->version_operator() == vo_nice_equal_star)
+ s << "*";
+ }
+ }
+
+ if (slot_requirement_ptr())
+ s << stringify(*slot_requirement_ptr());
+
+ std::string left, right;
+ bool need_arrow(false);
+
+ if (from_repository_ptr())
+ left = stringify(*from_repository_ptr());
+
+ if (in_repository_ptr())
+ right = stringify(*in_repository_ptr());
+
+ if (installed_at_path_ptr())
+ {
+ if (! right.empty())
+ {
+ need_arrow = true;
+ right.append("->");
+ }
+ right.append(stringify(*installed_at_path_ptr()));
+ }
+
+ if (installable_to_repository_ptr())
+ {
+ if (! right.empty())
+ {
+ need_arrow = true;
+ right.append("->");
+ }
+ if (installable_to_repository_ptr()->include_masked())
+ right.append(stringify(installable_to_repository_ptr()->repository()) + "??");
+ else
+ right.append(stringify(installable_to_repository_ptr()->repository()) + "?");
+ }
+
+ if (installable_to_path_ptr())
+ {
+ if (! right.empty())
+ {
+ need_arrow = true;
+ right.append("->");
+ }
+ if (installable_to_path_ptr()->include_masked())
+ right.append(stringify(installable_to_path_ptr()->path()) + "??");
+ else
+ right.append(stringify(installable_to_path_ptr()->path()) + "?");
+ }
+
+ if (need_arrow || ((! left.empty()) && (! right.empty())))
+ s << "::" << left << "->" << right;
+ else if (! right.empty())
+ s << "::" << right;
+ else if (! left.empty())
+ s << "::" << left << "->";
+
+ if (version_requirements_ptr())
+ {
+ if (version_requirements_ptr()->begin() == version_requirements_ptr()->end())
+ {
+ }
+ else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end() &&
+ ! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
+ {
+ }
+ else
+ {
+ bool need_op(false);
+ s << "[";
+ for (VersionRequirements::ConstIterator r(version_requirements_ptr()->begin()),
+ r_end(version_requirements_ptr()->end()) ; r != r_end ; ++r)
+ {
+ if (need_op)
+ {
+ do
+ {
+ switch (version_requirements_mode())
+ {
+ case vr_and:
+ s << "&";
+ continue;
+
+ case vr_or:
+ s << "|";
+ continue;
+
+ case last_vr:
+ ;
+ }
+ 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 (additional_requirements_ptr())
+ for (AdditionalPackageDepSpecRequirements::ConstIterator u(additional_requirements_ptr()->begin()),
+ u_end(additional_requirements_ptr()->end()) ; u != u_end ; ++u)
+ s << (*u)->as_raw_string();
+
+ return s.str();
+ }
+
+ virtual std::shared_ptr<const QualifiedPackageName> package_ptr() const
+ {
+ return package;
+ }
+
+ virtual std::shared_ptr<const PackageNamePart> package_name_part_ptr() const
+ {
+ return package_name_part;
+ }
+
+ virtual std::shared_ptr<const CategoryNamePart> category_name_part_ptr() const
+ {
+ return category_name_part;
+ }
+
+ virtual std::shared_ptr<const VersionRequirements> version_requirements_ptr() const
+ {
+ return version_requirements;
+ }
+
+ virtual VersionRequirementsMode version_requirements_mode() const
+ {
+ return version_requirements_mode_v;
+ }
+
+ virtual std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const
+ {
+ return slot;
+ }
+
+ virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const
+ {
+ return in_repository;
+ }
+
+ virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const
+ {
+ return installable_to_repository;
+ }
+
+ virtual std::shared_ptr<const RepositoryName> from_repository_ptr() const
+ {
+ return from_repository;
+ }
+
+ virtual std::shared_ptr<const FSEntry> installed_at_path_ptr() const
+ {
+ return installed_at_path;
+ }
+
+ virtual std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const
+ {
+ return installable_to_path;
+ }
+
+ virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const
+ {
+ return additional_requirements;
+ }
+
+ virtual std::shared_ptr<const MetadataSectionKey> annotations_key() const
+ {
+ return annotations;
+ }
+
+ 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) :
+ Pimp<PartiallyMadePackageDepSpec>(o)
+{
+}
+
+PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec & other) :
+ Pimp<PartiallyMadePackageDepSpec>(*other._imp.get())
+{
+}
+
+PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PackageDepSpec & other) :
+ Pimp<PartiallyMadePackageDepSpec>(other)
+{
+}
+
+PartiallyMadePackageDepSpec::~PartiallyMadePackageDepSpec()
+{
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::package(const QualifiedPackageName & name)
+{
+ _imp->data->package = std::make_shared<QualifiedPackageName>(name);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::slot_requirement(const std::shared_ptr<const SlotRequirement> & s)
+{
+ _imp->data->slot = s;
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::in_repository(const RepositoryName & s)
+{
+ _imp->data->in_repository = std::make_shared<RepositoryName>(s);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::from_repository(const RepositoryName & s)
+{
+ _imp->data->from_repository = std::make_shared<RepositoryName>(s);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::installable_to_repository(const InstallableToRepository & s)
+{
+ _imp->data->installable_to_repository = std::make_shared<InstallableToRepository>(s);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::installed_at_path(const FSEntry & s)
+{
+ _imp->data->installed_at_path = std::make_shared<FSEntry>(s);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::installable_to_path(const InstallableToPath & s)
+{
+ _imp->data->installable_to_path = std::make_shared<InstallableToPath>(s);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::package_name_part(const PackageNamePart & part)
+{
+ _imp->data->package_name_part = std::make_shared<PackageNamePart>(part);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::category_name_part(const CategoryNamePart & part)
+{
+ _imp->data->category_name_part = std::make_shared<CategoryNamePart>(part);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::version_requirement(const VersionRequirement & req)
+{
+ if (! _imp->data->version_requirements)
+ _imp->data->version_requirements = std::make_shared<VersionRequirements>();
+ _imp->data->version_requirements->push_back(req);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::version_requirements_mode(const VersionRequirementsMode & mode)
+{
+ _imp->data->version_requirements_mode_v = mode;
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::additional_requirement(const std::shared_ptr<const AdditionalPackageDepSpecRequirement> & req)
+{
+ if (! _imp->data->additional_requirements)
+ _imp->data->additional_requirements = std::make_shared<AdditionalPackageDepSpecRequirements>();
+ _imp->data->additional_requirements->push_back(req);
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::clear_additional_requirements()
+{
+ _imp->data->additional_requirements.reset();
+ return *this;
+}
+
+PartiallyMadePackageDepSpec &
+PartiallyMadePackageDepSpec::annotations(const std::shared_ptr<const MetadataSectionKey> & a)
+{
+ _imp->data->annotations = a;
+ 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
new file mode 100644
index 0000000..e3376e3
--- /dev/null
+++ b/paludis/partially_made_package_dep_spec.hh
@@ -0,0 +1,146 @@
+/* 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_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/util/fs_entry-fwd.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>
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpecOptions &);
+ ~PartiallyMadePackageDepSpec();
+ PartiallyMadePackageDepSpec(const PackageDepSpec &);
+ PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec &);
+
+ ///\}
+
+ /**
+ * Set our package requirements, return ourself.
+ */
+ PartiallyMadePackageDepSpec & package(const QualifiedPackageName &);
+
+ /**
+ * Set our slot requirements, return ourself.
+ */
+ PartiallyMadePackageDepSpec & slot_requirement(const std::shared_ptr<const SlotRequirement> &);
+
+ /**
+ * Set our in-repository requirement, return ourself.
+ */
+ PartiallyMadePackageDepSpec & in_repository(const RepositoryName &);
+
+ /**
+ * Set our from-repository requirement, return ourself.
+ */
+ PartiallyMadePackageDepSpec & from_repository(const RepositoryName &);
+
+ /**
+ * Set our installable-to-repository requirement, return ourself.
+ *
+ * \since 0.32
+ */
+ PartiallyMadePackageDepSpec & installable_to_repository(const InstallableToRepository &);
+
+ /**
+ * Set our installed-at-path requirement, return ourself.
+ *
+ * \since 0.32
+ */
+ PartiallyMadePackageDepSpec & installed_at_path(const FSEntry &);
+
+ /**
+ * Set our installable-to-path requirement, return ourself.
+ *
+ * \since 0.32
+ */
+ PartiallyMadePackageDepSpec & installable_to_path(const InstallableToPath &);
+
+ /**
+ * Set our package name part requirements, return ourself.
+ */
+ PartiallyMadePackageDepSpec & package_name_part(const PackageNamePart &);
+
+ /**
+ * Set our category name part requirements, return ourself.
+ */
+ PartiallyMadePackageDepSpec & category_name_part(const CategoryNamePart &);
+
+ /**
+ * Add a version requirement, return ourself.
+ */
+ PartiallyMadePackageDepSpec & version_requirement(const VersionRequirement &);
+
+ /**
+ * Set our version requirements mode, return ourself.
+ */
+ PartiallyMadePackageDepSpec & version_requirements_mode(const VersionRequirementsMode &);
+
+ /**
+ * Add an additional requirement, return ourself.
+ */
+ PartiallyMadePackageDepSpec & additional_requirement(
+ const std::shared_ptr<const AdditionalPackageDepSpecRequirement> &);
+
+ /**
+ * Clear additional requirements, return ourself.
+ *
+ * \since 0.41
+ */
+ PartiallyMadePackageDepSpec & clear_additional_requirements();
+
+ /**
+ * Add annotations
+ */
+ PartiallyMadePackageDepSpec & annotations(
+ const std::shared_ptr<const MetadataSectionKey> &);
+
+ /**
+ * 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/dep_spec.se b/paludis/partially_made_package_dep_spec.se
index ed3550a..ed3550a 100644
--- a/paludis/dep_spec.se
+++ b/paludis/partially_made_package_dep_spec.se
diff --git a/paludis/range_rewriter.cc b/paludis/range_rewriter.cc
index f5e7b8a..4f99074 100644
--- a/paludis/range_rewriter.cc
+++ b/paludis/range_rewriter.cc
@@ -30,6 +30,7 @@
#include <paludis/util/options.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <list>
#include <sstream>
#include <algorithm>
diff --git a/paludis/range_rewriter_TEST.cc b/paludis/range_rewriter_TEST.cc
index 9feb7ad..b2f6181 100644
--- a/paludis/range_rewriter_TEST.cc
+++ b/paludis/range_rewriter_TEST.cc
@@ -22,6 +22,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/util/options.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/environments/test/test_environment.hh>
#include <test/test_runner.hh>
diff --git a/paludis/report_task.cc b/paludis/report_task.cc
index 941f6ec..2515e94 100644
--- a/paludis/report_task.cc
+++ b/paludis/report_task.cc
@@ -38,6 +38,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/package_database.hh>
#include <paludis/version_requirements.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <algorithm>
#include <set>
#include <map>
diff --git a/paludis/repositories/accounts/accounts_dep_key.cc b/paludis/repositories/accounts/accounts_dep_key.cc
index 5074531..3b3d15a 100644
--- a/paludis/repositories/accounts/accounts_dep_key.cc
+++ b/paludis/repositories/accounts/accounts_dep_key.cc
@@ -29,6 +29,7 @@
#include <paludis/formatter.hh>
#include <paludis/environment.hh>
#include <paludis/util/pimp-impl.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <sstream>
#include <list>
diff --git a/paludis/repositories/cran/dep_spec_pretty_printer.cc b/paludis/repositories/cran/dep_spec_pretty_printer.cc
index 1520937..de4b349 100644
--- a/paludis/repositories/cran/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/cran/dep_spec_pretty_printer.cc
@@ -23,12 +23,14 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/options.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/environment.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/action-fwd.hh>
+#include <algorithm>
#include <ostream>
#include <sstream>
diff --git a/paludis/repositories/cran/package_dep_spec.cc b/paludis/repositories/cran/package_dep_spec.cc
index 89ddbdc..8928b5e 100644
--- a/paludis/repositories/cran/package_dep_spec.cc
+++ b/paludis/repositories/cran/package_dep_spec.cc
@@ -27,6 +27,7 @@
#include <paludis/util/options.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
#include <paludis/version_requirements.hh>
diff --git a/paludis/repositories/e/can_skip_phase.cc b/paludis/repositories/e/can_skip_phase.cc
index b0d8daf..d526312 100644
--- a/paludis/repositories/e/can_skip_phase.cc
+++ b/paludis/repositories/e/can_skip_phase.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 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
@@ -22,6 +22,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/metadata_key.hh>
#include <paludis/dep_spec.hh>
#include <paludis/spec_tree.hh>
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index ab225ac..5f083cc 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -262,10 +262,12 @@ namespace
typename ParseStackTypes<T_>::Stack & stack,
const std::string & u,
const Environment * const env,
- const std::shared_ptr<const PackageID> & id)
+ const std::shared_ptr<const PackageID> & id,
+ const EAPI & eapi)
{
std::shared_ptr<ConditionalDepSpec> spec(std::make_shared<ConditionalDepSpec>(parse_elike_conditional_dep_spec(
- u, env, id, bool(id->repository()->installed_root_key()))));
+ u, env, id,
+ bool(id->repository()->installed_root_key()) || ! eapi.supported()->package_dep_spec_parse_options()[epdso_missing_use_deps_is_qa])));
stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
n::item() = stack.begin()->item()->append(spec),
n::spec() = spec
@@ -339,7 +341,7 @@ paludis::erepository::parse_depend(const std::string & s,
std::ref(stack),
ParseStackTypes<DependencySpecTree>::AnnotationsGoHere(std::bind(
&set_thing_to_annotate, std::ref(thing_to_annotate), _1)),
- id, _1, eapi),
+ id, _1, std::cref(eapi)),
n::on_pop() = std::bind(&pop_handler<DependencySpecTree>, std::ref(stack),
ParseStackTypes<DependencySpecTree>::AnnotationsGoHere(std::bind(
&set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s),
@@ -347,8 +349,8 @@ paludis::erepository::parse_depend(const std::string & s,
n::on_string() = std::bind(&package_or_block_dep_spec_string_handler<DependencySpecTree>, std::ref(stack),
ParseStackTypes<DependencySpecTree>::AnnotationsGoHere(std::bind(
&set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1, eapi, id),
- n::on_use() = std::bind(&use_handler<DependencySpecTree>, std::ref(stack), _1, env, id),
- n::on_use_under_any() = std::bind(&use_under_any_handler, s, eapi)
+ n::on_use() = std::bind(&use_handler<DependencySpecTree>, std::ref(stack), _1, env, id, std::cref(eapi)),
+ n::on_use_under_any() = std::bind(&use_under_any_handler, s, std::cref(eapi))
));
parse_elike_dependencies(s, callbacks);
@@ -385,9 +387,9 @@ paludis::erepository::parse_provide(const std::string & s,
n::on_should_be_empty() = std::bind(&should_be_empty_handler<ProvideSpecTree>, std::ref(stack), s),
n::on_string() = std::bind(&package_dep_spec_string_handler<ProvideSpecTree>, std::ref(stack),
ParseStackTypes<DependencySpecTree>::AnnotationsGoHere(std::bind(
- &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1, eapi, id),
- n::on_use() = std::bind(&use_handler<ProvideSpecTree>, std::ref(stack), _1, env, id),
- n::on_use_under_any() = std::bind(&use_under_any_handler, s, eapi)
+ &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1, std::cref(eapi), id),
+ n::on_use() = std::bind(&use_handler<ProvideSpecTree>, std::ref(stack), _1, env, id, std::cref(eapi)),
+ n::on_use_under_any() = std::bind(&use_under_any_handler, s, std::cref(eapi))
));
parse_elike_dependencies(s, callbacks);
@@ -417,20 +419,20 @@ paludis::erepository::parse_fetchable_uri(const std::string & s,
n::on_any() = std::bind(&any_not_allowed_handler, s),
n::on_arrow() = std::bind(&arrow_handler<FetchableURISpecTree>, std::ref(stack),
ParseStackTypes<FetchableURISpecTree>::AnnotationsGoHere(std::bind(
- &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s, _1, _2, eapi),
+ &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s, _1, _2, std::cref(eapi)),
n::on_error() = std::bind(&error_handler, s, _1),
n::on_label() = std::bind(&fetchable_label_handler<FetchableURISpecTree>, std::ref(stack),
ParseStackTypes<FetchableURISpecTree>::AnnotationsGoHere(std::bind(
- &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1, eapi),
+ &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1, std::cref(eapi)),
n::on_pop() = std::bind(&pop_handler<FetchableURISpecTree>, std::ref(stack),
ParseStackTypes<FetchableURISpecTree>::AnnotationsGoHere(std::bind(
&set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s),
n::on_should_be_empty() = std::bind(&should_be_empty_handler<FetchableURISpecTree>, std::ref(stack), s),
n::on_string() = std::bind(&arrow_handler<FetchableURISpecTree>, std::ref(stack),
ParseStackTypes<FetchableURISpecTree>::AnnotationsGoHere(std::bind(
- &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s, _1, "", eapi),
- n::on_use() = std::bind(&use_handler<FetchableURISpecTree>, std::ref(stack), _1, env, id),
- n::on_use_under_any() = std::bind(&use_under_any_handler, s, eapi)
+ &set_thing_to_annotate, std::ref(thing_to_annotate), _1)), s, _1, "", std::cref(eapi)),
+ n::on_use() = std::bind(&use_handler<FetchableURISpecTree>, std::ref(stack), _1, env, id, std::cref(eapi)),
+ n::on_use_under_any() = std::bind(&use_under_any_handler, s, std::cref(eapi))
));
parse_elike_dependencies(s, callbacks);
@@ -440,7 +442,7 @@ paludis::erepository::parse_fetchable_uri(const std::string & s,
std::shared_ptr<SimpleURISpecTree>
paludis::erepository::parse_simple_uri(const std::string & s,
- const Environment * const env, const std::shared_ptr<const PackageID> & id, const EAPI &)
+ const Environment * const env, const std::shared_ptr<const PackageID> & id, const EAPI & eapi)
{
using namespace std::placeholders;
@@ -468,7 +470,7 @@ paludis::erepository::parse_simple_uri(const std::string & s,
n::on_string() = std::bind(&simple_uri_handler<SimpleURISpecTree>, std::ref(stack),
ParseStackTypes<SimpleURISpecTree>::AnnotationsGoHere(std::bind(
&set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1),
- n::on_use() = std::bind(&use_handler<SimpleURISpecTree>, std::ref(stack), _1, env, id),
+ n::on_use() = std::bind(&use_handler<SimpleURISpecTree>, std::ref(stack), _1, env, id, std::cref(eapi)),
n::on_use_under_any() = &do_nothing
));
@@ -507,8 +509,8 @@ paludis::erepository::parse_license(const std::string & s,
n::on_string() = std::bind(&license_handler<LicenseSpecTree>, std::ref(stack),
ParseStackTypes<LicenseSpecTree>::AnnotationsGoHere(std::bind(
&set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1),
- n::on_use() = std::bind(&use_handler<LicenseSpecTree>, std::ref(stack), _1, env, id),
- n::on_use_under_any() = std::bind(&use_under_any_handler, s, eapi)
+ n::on_use() = std::bind(&use_handler<LicenseSpecTree>, std::ref(stack), _1, env, id, std::cref(eapi)),
+ n::on_use_under_any() = std::bind(&use_under_any_handler, s, std::cref(eapi))
));
parse_elike_dependencies(s, callbacks);
@@ -518,7 +520,7 @@ paludis::erepository::parse_license(const std::string & s,
std::shared_ptr<PlainTextSpecTree>
paludis::erepository::parse_plain_text(const std::string & s,
- const Environment * const env, const std::shared_ptr<const PackageID> & id, const EAPI &)
+ const Environment * const env, const std::shared_ptr<const PackageID> & id, const EAPI & eapi)
{
using namespace std::placeholders;
@@ -546,7 +548,7 @@ paludis::erepository::parse_plain_text(const std::string & s,
n::on_string() = std::bind(&plain_text_handler<PlainTextSpecTree>, std::ref(stack),
ParseStackTypes<PlainTextSpecTree>::AnnotationsGoHere(std::bind(
&set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1),
- n::on_use() = std::bind(&use_handler<PlainTextSpecTree>, std::ref(stack), _1, env, id),
+ n::on_use() = std::bind(&use_handler<PlainTextSpecTree>, std::ref(stack), _1, env, id, std::cref(eapi)),
n::on_use_under_any() = &do_nothing
));
@@ -557,7 +559,7 @@ paludis::erepository::parse_plain_text(const std::string & s,
std::shared_ptr<PlainTextSpecTree>
paludis::erepository::parse_myoptions(const std::string & s,
- const Environment * const env, const std::shared_ptr<const PackageID> & id, const EAPI &)
+ const Environment * const env, const std::shared_ptr<const PackageID> & id, const EAPI & eapi)
{
using namespace std::placeholders;
@@ -587,7 +589,7 @@ paludis::erepository::parse_myoptions(const std::string & s,
n::on_string() = std::bind(&plain_text_handler<PlainTextSpecTree>, std::ref(stack),
ParseStackTypes<PlainTextSpecTree>::AnnotationsGoHere(std::bind(
&set_thing_to_annotate, std::ref(thing_to_annotate), _1)), _1),
- n::on_use() = std::bind(&use_handler<PlainTextSpecTree>, std::ref(stack), _1, env, id),
+ n::on_use() = std::bind(&use_handler<PlainTextSpecTree>, std::ref(stack), _1, env, id, std::cref(eapi)),
n::on_use_under_any() = &do_nothing
));
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.cc b/paludis/repositories/e/dep_spec_pretty_printer.cc
index fb1feab..f4fe2cf 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer.cc
@@ -29,6 +29,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/options.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/environment.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
diff --git a/paludis/repositories/e/dependencies_rewriter.cc b/paludis/repositories/e/dependencies_rewriter.cc
index 95543ca..8bd7c4b 100644
--- a/paludis/repositories/e/dependencies_rewriter.cc
+++ b/paludis/repositories/e/dependencies_rewriter.cc
@@ -28,8 +28,10 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/metadata_key.hh>
#include <list>
+#include <algorithm>
using namespace paludis;
using namespace paludis::erepository;
diff --git a/paludis/repositories/e/e_choices_key.cc b/paludis/repositories/e/e_choices_key.cc
index 395249d..90054b6 100644
--- a/paludis/repositories/e/e_choices_key.cc
+++ b/paludis/repositories/e/e_choices_key.cc
@@ -39,6 +39,7 @@
#include <paludis/util/set-impl.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/environment.hh>
#include <paludis/stringify_formatter-impl.hh>
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 0e46838..389b024 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -51,6 +51,7 @@
#include <paludis/dep_spec_flattener.hh>
#include <paludis/literal_metadata_key.hh>
+#include <algorithm>
#include <functional>
#include <list>
#include <vector>
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 8c5c04e..8af0369 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -63,6 +63,7 @@
#include <paludis/repository_name_cache.hh>
#include <paludis/syncer.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/util/cookie.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/create_iterator-impl.hh>
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 836b18a..919b2da 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -50,6 +50,7 @@
#include <test/test_framework.hh>
#include <test/test_runner.hh>
+#include <algorithm>
#include <functional>
#include <set>
#include <string>
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index f32abff..dd4cede 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -24,34 +24,37 @@
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/environment.hh>
-#include <paludis/util/config_file.hh>
-#include <paludis/set_file.hh>
+#include <paludis/action-fwd.hh>
+#include <paludis/dep_spec.hh>
#include <paludis/dep_tag.hh>
+#include <paludis/elike_slot_requirement.hh>
+#include <paludis/environment.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#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/version_requirements.hh>
-#include <paludis/user_dep_spec.hh>
+
+#include <paludis/util/config_file.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/log.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/strip.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/sequence.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/dep_spec.hh>
-#include <paludis/elike_slot_requirement.hh>
-#include <paludis/selection.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/action-fwd.hh>
-#include <paludis/metadata_key.hh>
+#include <paludis/util/pimp-impl.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/strip.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+
#include <functional>
#include <algorithm>
#include <list>
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 44a8914..96e8e24 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -9,7 +9,8 @@ is_pbin = false
package_dep_spec_parse_options = allow_slot_deps allow_use_deps \
allow_ranged_deps allow_tilde_greater_deps strict_parsing \
allow_slot_equal_deps allow_slot_star_deps allow_use_dep_defaults \
- nice_equal_star disallow_nonranged_deps allow_use_dep_question_defaults
+ nice_equal_star disallow_nonranged_deps allow_use_dep_question_defaults \
+ missing_use_deps_is_qa
dependency_spec_tree_parse_options = disallow_any_use uri_supports_arrow single_bang_block_is_hard
iuse_flag_parse_options = strict_parsing
version_spec_options = flexible_dashes flexible_dots ignore_case \
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 6b6b75c..692be43 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -56,9 +56,11 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/singleton-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <set>
#include <iterator>
+#include <algorithm>
using namespace paludis;
using namespace paludis::erepository;
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
index e85d4b7..b39c1bc 100644
--- a/paludis/repositories/e/fetch_visitor.cc
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -35,7 +35,9 @@
#include <paludis/util/join.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/output_manager.hh>
+#include <algorithm>
#include <list>
using namespace paludis;
diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc
index e4a517f..4cfa73f 100644
--- a/paludis/repositories/e/fix_locked_dependencies.cc
+++ b/paludis/repositories/e/fix_locked_dependencies.cc
@@ -25,6 +25,7 @@
#include <paludis/util/fs_entry.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_database.hh>
@@ -35,6 +36,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <functional>
#include <algorithm>
#include <list>
diff --git a/paludis/repositories/e/myoptions_requirements_verifier.cc b/paludis/repositories/e/myoptions_requirements_verifier.cc
index b40473c..5925b48 100644
--- a/paludis/repositories/e/myoptions_requirements_verifier.cc
+++ b/paludis/repositories/e/myoptions_requirements_verifier.cc
@@ -29,6 +29,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/choice.hh>
#include <paludis/metadata_key.hh>
#include <algorithm>
diff --git a/paludis/repositories/e/pretend_fetch_visitor.cc b/paludis/repositories/e/pretend_fetch_visitor.cc
index 48e46f1..9b1f319 100644
--- a/paludis/repositories/e/pretend_fetch_visitor.cc
+++ b/paludis/repositories/e/pretend_fetch_visitor.cc
@@ -30,6 +30,8 @@
#include <paludis/util/log.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <algorithm>
#include <list>
#include <set>
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 77cef49..51138c9 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -54,7 +54,10 @@
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
+#include <paludis/output_manager.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/fast_unique_copy.hh>
#include <paludis/util/mutex.hh>
@@ -73,7 +76,6 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/wrapped_output_iterator.hh>
-#include <paludis/output_manager.hh>
#include <paludis/util/safe_ifstream.hh>
#include <paludis/util/safe_ofstream.hh>
#include <paludis/util/timestamp.hh>
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index 9b9e4c2..9975974 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -27,8 +27,9 @@
#include <paludis/util/options.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/make_named_values.hh>
-#include <paludis/standard_output_manager.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/util/safe_ifstream.hh>
+#include <paludis/standard_output_manager.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
diff --git a/paludis/repositories/fake/dep_parser_TEST.cc b/paludis/repositories/fake/dep_parser_TEST.cc
index 2bbc646..ff738d0 100644
--- a/paludis/repositories/fake/dep_parser_TEST.cc
+++ b/paludis/repositories/fake/dep_parser_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 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
@@ -20,6 +20,7 @@
#include <paludis/repositories/fake/dep_parser.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <sstream>
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 81f6071..03ce38c 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -43,9 +43,11 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/return_literal_function.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <map>
#include <list>
#include <sstream>
+#include <algorithm>
using namespace paludis;
using namespace paludis::fakerepository;
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index 21219a6..5372c63 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -29,11 +29,12 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
+#include <paludis/standard_output_manager.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/join.hh>
#include <paludis/util/options.hh>
#include <paludis/util/make_named_values.hh>
-#include <paludis/standard_output_manager.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <test/test_framework.hh>
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc
index 9eb04f4..261345a 100644
--- a/paludis/repositories/unwritten/unwritten_repository_file.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_file.cc
@@ -27,6 +27,7 @@
#include <paludis/util/join.hh>
#include <paludis/util/safe_ifstream.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/literal_metadata_key.hh>
@@ -41,6 +42,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <list>
+#include <algorithm>
using namespace paludis;
using namespace paludis::unwritten_repository;
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index f6f6c8f..709a549 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -43,6 +43,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
using namespace paludis;
using namespace paludis::virtuals;
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index 2adc86b..e93014e 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -30,6 +30,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/hook.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/util/log.hh>
#include <paludis/util/operators.hh>
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 09db9a2..5f5e874 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -44,6 +44,7 @@
#include <paludis/util/log.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/environment.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/repository.hh>
@@ -60,6 +61,10 @@
#include <paludis/action.hh>
#include <paludis/elike_slot_requirement.hh>
#include <paludis/dep_spec_flattener.hh>
+#include <paludis/package_id.hh>
+#include <paludis/changed_choices.hh>
+#include <paludis/additional_package_dep_spec_requirement.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/util/pimp-impl.hh>
@@ -641,6 +646,12 @@ Decider::_make_unmaskable_filter(const std::shared_ptr<const Resolution> & resol
return _imp->fns.make_unmaskable_filter_fn()(resolution);
}
+bool
+Decider::_allow_choice_changes_for(const std::shared_ptr<const Resolution> & resolution) const
+{
+ return _imp->fns.allow_choice_changes_fn()(resolution);
+}
+
const std::shared_ptr<const PackageIDSequence>
Decider::_find_replacing(
const std::shared_ptr<const PackageID> & id,
@@ -817,25 +828,31 @@ namespace
struct CheckConstraintVisitor
{
const Environment * const env;
+ const std::shared_ptr<const ChangedChoices> changed_choices_for_constraint;
const Constraint constraint;
- CheckConstraintVisitor(const Environment * const e, const Constraint & c) :
+ CheckConstraintVisitor(const Environment * const e,
+ const std::shared_ptr<const ChangedChoices> & h,
+ const Constraint & c) :
env(e),
+ changed_choices_for_constraint(h),
constraint(c)
{
}
- bool ok(const std::shared_ptr<const PackageID> & chosen_id) const
+ bool ok(const std::shared_ptr<const PackageID> & chosen_id,
+ const std::shared_ptr<const ChangedChoices> & changed_choices) const
{
if (constraint.spec().if_package())
{
- if (! match_package(*env, *constraint.spec().if_package(), *chosen_id, { }))
+ if (! match_package_with_maybe_changes(*env, *constraint.spec().if_package(),
+ changed_choices_for_constraint.get(), *chosen_id, changed_choices.get(), { }))
return false;
}
else
{
- if (match_package(*env, constraint.spec().if_block()->blocking(),
- *chosen_id, { }))
+ if (match_package_with_maybe_changes(*env, constraint.spec().if_block()->blocking(),
+ changed_choices_for_constraint.get(), *chosen_id, changed_choices.get(), { }))
return false;
}
@@ -844,12 +861,12 @@ namespace
bool visit(const ChangesToMakeDecision & decision) const
{
- return ok(decision.origin_id());
+ return ok(decision.origin_id(), decision.if_changed_choices());
}
bool visit(const ExistingNoChangeDecision & decision) const
{
- return ok(decision.existing_id());
+ return ok(decision.existing_id(), make_null_shared_ptr());
}
bool visit(const NothingNoChangeDecision &) const
@@ -937,6 +954,94 @@ namespace
return true;
}
};
+
+ struct GetConstraintChangedChoices
+ {
+ const std::shared_ptr<const ChangedChoices> visit(const TargetReason &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const DependentReason &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const PresetReason &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const DependencyReason & r) const
+ {
+ return r.from_id_changed_choices();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const ViaBinaryReason &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const WasUsedByReason &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const LikeOtherDestinationTypeReason &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const SetReason & r) const
+ {
+ return r.reason_for_set()->accept_returning<std::shared_ptr<const ChangedChoices> >(*this);
+ }
+ };
+
+ std::shared_ptr<const ChangedChoices> get_changed_choices_for(
+ const std::shared_ptr<const Constraint> & constraint)
+ {
+ return constraint->reason()->accept_returning<std::shared_ptr<const ChangedChoices> >(GetConstraintChangedChoices());
+ }
+
+ struct GetDecisionChangedChoices
+ {
+ const std::shared_ptr<const ChangedChoices> visit(const ChangesToMakeDecision & d) const
+ {
+ return d.if_changed_choices();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const ExistingNoChangeDecision &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const NothingNoChangeDecision &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const UnableToMakeDecision &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const RemoveDecision &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::shared_ptr<const ChangedChoices> visit(const BreakDecision &) const
+ {
+ return make_null_shared_ptr();
+ }
+ };
+
+ std::shared_ptr<const ChangedChoices> get_changed_choices_for(
+ const std::shared_ptr<const Decision> & decision)
+ {
+ return decision->accept_returning<std::shared_ptr<const ChangedChoices> >(GetDecisionChangedChoices());
+ }
}
bool
@@ -944,7 +1049,7 @@ Decider::_check_constraint(
const std::shared_ptr<const Constraint> & constraint,
const std::shared_ptr<const Decision> & decision) const
{
- if (! decision->accept_returning<bool>(CheckConstraintVisitor(_imp->env, *constraint)))
+ if (! decision->accept_returning<bool>(CheckConstraintVisitor(_imp->env, get_changed_choices_for(constraint), *constraint)))
return false;
if (! decision->accept_returning<bool>(CheckUseExistingVisitor(constraint)))
@@ -1019,7 +1124,8 @@ Decider::_made_wrong_decision(
std::shared_ptr<Resolution> adapted_resolution(std::make_shared<Resolution>(*resolution));
adapted_resolution->constraints()->add(constraint);
- const std::shared_ptr<Decision> decision(_try_to_find_decision_for(adapted_resolution, true, false));
+ const std::shared_ptr<Decision> decision(_try_to_find_decision_for(
+ adapted_resolution, _allow_choice_changes_for(resolution), false, true, false));
if (decision)
{
resolution->decision()->accept(WrongDecisionVisitor(std::bind(
@@ -1042,7 +1148,7 @@ Decider::_suggest_restart_with(
const std::shared_ptr<const Constraint>
Decider::_make_constraint_for_preloading(
- const std::shared_ptr<const Decision> &,
+ const std::shared_ptr<const Decision> & decision,
const std::shared_ptr<const Constraint> & c) const
{
const std::shared_ptr<Constraint> result(std::make_shared<Constraint>(*c));
@@ -1050,14 +1156,16 @@ Decider::_make_constraint_for_preloading(
const std::shared_ptr<PresetReason> reason(std::make_shared<PresetReason>("restarted because of", c->reason()));
result->reason() = reason;
+ const std::shared_ptr<const ChangedChoices> changed_choices(get_changed_choices_for(decision));
+
if (result->spec().if_package())
{
- PackageDepSpec s(_make_spec_for_preloading(*result->spec().if_package()));
+ PackageDepSpec s(_make_spec_for_preloading(*result->spec().if_package(), changed_choices));
result->spec().if_package() = std::make_shared<PackageDepSpec>(s);
}
else
{
- PackageDepSpec s(_make_spec_for_preloading(result->spec().if_block()->blocking()));
+ PackageDepSpec s(_make_spec_for_preloading(result->spec().if_block()->blocking(), changed_choices));
result->spec().if_block() = std::make_shared<BlockDepSpec>(
"!" + stringify(s),
s,
@@ -1068,7 +1176,8 @@ Decider::_make_constraint_for_preloading(
}
const PackageDepSpec
-Decider::_make_spec_for_preloading(const PackageDepSpec & spec) const
+Decider::_make_spec_for_preloading(const PackageDepSpec & spec,
+ const std::shared_ptr<const ChangedChoices> & changed_choices) const
{
PartiallyMadePackageDepSpec result(spec);
@@ -1076,6 +1185,10 @@ Decider::_make_spec_for_preloading(const PackageDepSpec & spec) const
* [foo?] start to get weird when there's no longer an associated ID. */
result.clear_additional_requirements();
+ /* but we do want to impose our own ChangedChoices if necessary. */
+ if (changed_choices)
+ changed_choices->add_additional_requirements_to(result);
+
return result;
}
@@ -1086,7 +1199,8 @@ Decider::_decide(const std::shared_ptr<Resolution> & resolution)
_copy_other_destination_constraints(resolution);
- std::shared_ptr<Decision> decision(_try_to_find_decision_for(resolution, true, false));
+ std::shared_ptr<Decision> decision(_try_to_find_decision_for(
+ resolution, _allow_choice_changes_for(resolution), false, true, false));
if (decision)
resolution->decision() = decision;
else
@@ -1126,40 +1240,40 @@ namespace
{
struct DependenciesNecessityVisitor
{
- const std::shared_ptr<const PackageID> visit(const NothingNoChangeDecision &) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(const NothingNoChangeDecision &) const
{
- return make_null_shared_ptr();
+ return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
- const std::shared_ptr<const PackageID> visit(const RemoveDecision &) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(const RemoveDecision &) const
{
- return make_null_shared_ptr();
+ return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
- const std::shared_ptr<const PackageID> visit(const UnableToMakeDecision &) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(const UnableToMakeDecision &) const
{
- return make_null_shared_ptr();
+ return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
- const std::shared_ptr<const PackageID> visit(const ExistingNoChangeDecision & decision) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(const ExistingNoChangeDecision & decision) const
{
if (decision.taken())
- return decision.existing_id();
+ return std::make_pair(decision.existing_id(), make_null_shared_ptr());
else
- return make_null_shared_ptr();
+ return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
- const std::shared_ptr<const PackageID> visit(const ChangesToMakeDecision & decision) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(const ChangesToMakeDecision & decision) const
{
if (decision.taken())
- return decision.origin_id();
+ return std::make_pair(decision.origin_id(), decision.if_changed_choices());
else
- return make_null_shared_ptr();
+ return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
- const std::shared_ptr<const PackageID> visit(const BreakDecision &) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(const BreakDecision &) const
{
- return make_null_shared_ptr();
+ return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
};
}
@@ -1168,9 +1282,11 @@ void
Decider::_add_dependencies_if_necessary(
const std::shared_ptr<Resolution> & our_resolution)
{
- const std::shared_ptr<const PackageID> package_id(
- our_resolution->decision()->accept_returning<std::shared_ptr<const PackageID> >(
- DependenciesNecessityVisitor()));
+ std::shared_ptr<const PackageID> package_id;
+ std::shared_ptr<const ChangedChoices> changed_choices;
+ std::tie(package_id, changed_choices) = our_resolution->decision()->accept_returning<
+ std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > >(DependenciesNecessityVisitor());
+
if (! package_id)
return;
@@ -1178,7 +1294,7 @@ Decider::_add_dependencies_if_necessary(
+ stringify(*package_id) + "':");
const std::shared_ptr<SanitisedDependencies> deps(std::make_shared<SanitisedDependencies>());
- deps->populate(_imp->env, *this, our_resolution, package_id);
+ deps->populate(_imp->env, *this, our_resolution, package_id, changed_choices);
for (SanitisedDependencies::ConstIterator s(deps->begin()), s_end(deps->end()) ;
s != s_end ; ++s)
@@ -1199,7 +1315,7 @@ Decider::_add_dependencies_if_necessary(
}
const std::shared_ptr<DependencyReason> reason(std::make_shared<DependencyReason>(
- package_id, our_resolution->resolvent(), *s, _already_met(*s)));
+ package_id, changed_choices, our_resolution->resolvent(), *s, _already_met(*s)));
std::shared_ptr<const Resolvents> resolvents;
@@ -1360,7 +1476,7 @@ Decider::find_any_score(
}
const std::shared_ptr<DependencyReason> reason(std::make_shared<DependencyReason>(
- our_id, our_resolution->resolvent(), dep, _already_met(dep)));
+ our_id, make_null_shared_ptr(), our_resolution->resolvent(), dep, _already_met(dep)));
const std::shared_ptr<const Resolvents> resolvents(_get_resolvents_for(spec, reason));
/* next: will already be installing */
@@ -1387,7 +1503,7 @@ Decider::find_any_score(
for (ConstraintSequence::ConstIterator c(constraints->begin()), c_end(constraints->end()) ;
c != c_end ; ++c)
resolution->constraints()->add(*c);
- const std::shared_ptr<Decision> decision(_try_to_find_decision_for(resolution, false, false));
+ const std::shared_ptr<Decision> decision(_try_to_find_decision_for(resolution, false, false, false, false));
if (decision)
return std::make_pair(acs_could_install, operator_bias);
}
@@ -1523,13 +1639,17 @@ Decider::_get_error_resolvents_for(
const std::shared_ptr<Decision>
Decider::_try_to_find_decision_for(
const std::shared_ptr<const Resolution> & resolution,
+ const bool also_try_option_changes,
+ const bool try_option_changes_this_time,
const bool also_try_masked,
const bool try_masked_this_time) const
{
const std::shared_ptr<const PackageID> existing_id(_find_existing_id_for(resolution));
- std::pair<const std::shared_ptr<const PackageID>, bool> installable_id_best(_find_installable_id_for(resolution, try_masked_this_time));
- const std::shared_ptr<const PackageID> installable_id(installable_id_best.first);
- bool best(installable_id_best.second);
+
+ std::shared_ptr<const PackageID> installable_id;
+ std::shared_ptr<const ChangedChoices> changed_choices;
+ bool best;
+ std::tie(installable_id, changed_choices, best) = _find_installable_id_for(resolution, try_option_changes_this_time, try_masked_this_time);
if (resolution->constraints()->nothing_is_fine_too())
{
@@ -1550,6 +1670,7 @@ Decider::_try_to_find_decision_for(
return std::make_shared<ChangesToMakeDecision>(
resolution->resolvent(),
installable_id,
+ changed_choices,
best,
last_ct,
! resolution->constraints()->all_untaken(),
@@ -1602,8 +1723,10 @@ Decider::_try_to_find_decision_for(
_installed_ids(resolution),
! resolution->constraints()->all_untaken()
);
+ else if (also_try_option_changes && ! try_option_changes_this_time)
+ return _try_to_find_decision_for(resolution, true, true, also_try_masked, try_masked_this_time);
else if (also_try_masked && ! try_masked_this_time)
- return _try_to_find_decision_for(resolution, true, true);
+ return _try_to_find_decision_for(resolution, also_try_option_changes, try_option_changes_this_time, true, true);
else
return make_null_shared_ptr();
}
@@ -1677,6 +1800,7 @@ Decider::_try_to_find_decision_for(
const std::shared_ptr<Decision> changes_to_make(std::make_shared<ChangesToMakeDecision>(
resolution->resolvent(),
installable_id,
+ changed_choices,
best,
last_ct,
! resolution->constraints()->all_untaken(),
@@ -1751,7 +1875,7 @@ const std::shared_ptr<const PackageID>
Decider::_find_existing_id_for(const std::shared_ptr<const Resolution> & resolution) const
{
const std::shared_ptr<const PackageIDSequence> ids(_installed_ids(resolution));
- return _find_id_for_from(resolution, ids).first;
+ return std::get<0>(_find_id_for_from(resolution, ids, false, false));
}
bool
@@ -1803,17 +1927,25 @@ Decider::_find_installable_id_candidates_for(
)];
}
-const std::pair<const std::shared_ptr<const PackageID>, bool>
-Decider::_find_installable_id_for(const std::shared_ptr<const Resolution> & resolution, const bool include_unmaskable) const
+const Decider::FoundID
+Decider::_find_installable_id_for(const std::shared_ptr<const Resolution> & resolution,
+ const bool include_option_changes,
+ const bool include_unmaskable) const
{
- return _find_id_for_from(resolution, _find_installable_id_candidates_for(resolution, false, include_unmaskable));
+ return _find_id_for_from(resolution, _find_installable_id_candidates_for(resolution, false, include_unmaskable), include_option_changes, false);
}
-const std::pair<const std::shared_ptr<const PackageID>, bool>
+const Decider::FoundID
Decider::_find_id_for_from(
const std::shared_ptr<const Resolution> & resolution,
- const std::shared_ptr<const PackageIDSequence> & ids) const
+ const std::shared_ptr<const PackageIDSequence> & ids,
+ const bool try_changing_choices,
+ const bool trying_changing_choices) const
{
+ MatchPackageOptions opts;
+ if (trying_changing_choices)
+ opts += mpo_ignore_additional_requirements;
+
std::shared_ptr<const PackageID> best_version;
for (PackageIDSequence::ReverseConstIterator i(ids->rbegin()), i_end(ids->rend()) ;
i != i_end ; ++i)
@@ -1827,19 +1959,81 @@ Decider::_find_id_for_from(
c != c_end ; ++c)
{
if ((*c)->spec().if_package())
- ok = ok && match_package(*_imp->env, *(*c)->spec().if_package(), **i, { });
+ ok = ok && match_package(*_imp->env, *(*c)->spec().if_package(), **i, opts);
else
- ok = ok && ! match_package(*_imp->env, (*c)->spec().if_block()->blocking(), **i, { });
+ ok = ok && ! match_package(*_imp->env, (*c)->spec().if_block()->blocking(), **i, opts);
if (! ok)
break;
}
if (ok)
- return std::make_pair(*i, (*i)->version() == best_version->version());
+ {
+ std::shared_ptr<ChangedChoices> changed_choices(std::make_shared<ChangedChoices>());
+ if (trying_changing_choices)
+ {
+ for (Constraints::ConstIterator c(resolution->constraints()->begin()),
+ c_end(resolution->constraints()->end()) ;
+ c != c_end ; ++c)
+ {
+ if (! ok)
+ break;
+
+ if (! (*c)->spec().if_package())
+ {
+ if ((*c)->spec().if_block()->blocking().additional_requirements_ptr() &&
+ ! (*c)->spec().if_block()->blocking().additional_requirements_ptr()->empty())
+ {
+ /* too complicated for now */
+ ok = false;
+ }
+ break;
+ }
+
+ if (! (*c)->spec().if_package()->additional_requirements_ptr())
+ {
+ /* no additional requirements, so no tinkering required */
+ continue;
+ }
+
+ for (auto a((*c)->spec().if_package()->additional_requirements_ptr()->begin()),
+ a_end((*c)->spec().if_package()->additional_requirements_ptr()->end()) ;
+ a != a_end ; ++a)
+ if (! (*a)->accumulate_changes_to_make_met(_imp->env,
+ get_changed_choices_for(*c).get(), *i, *changed_choices))
+ {
+ ok = false;
+ break;
+ }
+ }
+ }
+
+ /* might have an early requirement of [x], and a later [-x], and
+ * chosen to change because of the latter */
+ for (Constraints::ConstIterator c(resolution->constraints()->begin()),
+ c_end(resolution->constraints()->end()) ;
+ c != c_end ; ++c)
+ {
+ if (! ok)
+ break;
+
+ if ((*c)->spec().if_package())
+ ok = ok && match_package_with_maybe_changes(*_imp->env, *(*c)->spec().if_package(),
+ get_changed_choices_for(*c).get(), **i, changed_choices.get(), { });
+ else
+ ok = ok && ! match_package_with_maybe_changes(*_imp->env, (*c)->spec().if_block()->blocking(),
+ get_changed_choices_for(*c).get(), **i, changed_choices.get(), { });
+ }
+
+ if (ok)
+ return FoundID(*i, changed_choices->empty() ? make_null_shared_ptr() : changed_choices, (*i)->version() == best_version->version());
+ }
}
- return std::make_pair(make_null_shared_ptr(), false);
+ if (try_changing_choices && ! trying_changing_choices)
+ return _find_id_for_from(resolution, ids, true, true);
+ else
+ return FoundID(make_null_shared_ptr(), make_null_shared_ptr(), false);
}
const std::shared_ptr<const Constraints>
@@ -1873,6 +2067,7 @@ Decider::_get_unmatching_constraints(
decision = std::make_shared<ChangesToMakeDecision>(
resolution->resolvent(),
id,
+ make_null_shared_ptr(),
false,
last_ct,
! (*c)->untaken(),
@@ -2114,6 +2309,13 @@ namespace
if (! fns.confirm_fn()(resolution, c))
changes_to_make_decision.add_required_confirmation(c);
}
+
+ if (changes_to_make_decision.if_changed_choices())
+ {
+ auto c(std::make_shared<ChangedChoicesConfirmation>());
+ if (! fns.confirm_fn()(resolution, c))
+ changes_to_make_decision.add_required_confirmation(c);
+ }
}
void visit(BreakDecision & break_decision) const
diff --git a/paludis/resolver/decider.hh b/paludis/resolver/decider.hh
index 17a2d82..90299c8 100644
--- a/paludis/resolver/decider.hh
+++ b/paludis/resolver/decider.hh
@@ -46,6 +46,8 @@
#include <paludis/repository-fwd.hh>
#include <paludis/filtered_generator-fwd.hh>
#include <paludis/generator-fwd.hh>
+#include <paludis/changed_choices-fwd.hh>
+#include <tuple>
namespace paludis
{
@@ -55,6 +57,8 @@ namespace paludis
private Pimp<Decider>
{
private:
+ typedef std::tuple<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices>, bool> FoundID;
+
const std::shared_ptr<Resolution> _create_resolution_for_resolvent(const Resolvent &) const;
const std::shared_ptr<Resolution> _resolution_for_resolvent(const Resolvent &, const Tribool);
@@ -134,7 +138,9 @@ namespace paludis
const std::shared_ptr<const Decision> & d,
const std::shared_ptr<const Constraint> & c) const;
- const PackageDepSpec _make_spec_for_preloading(const PackageDepSpec & spec) const;
+ const PackageDepSpec _make_spec_for_preloading(
+ const PackageDepSpec & spec,
+ const std::shared_ptr<const ChangedChoices> &) const;
const std::shared_ptr<const PackageIDSequence> _find_replacing(
const std::shared_ptr<const PackageID> &,
@@ -177,11 +183,16 @@ namespace paludis
Filter _make_unmaskable_filter(
const std::shared_ptr<const Resolution> &) const;
+ bool _allow_choice_changes_for(
+ const std::shared_ptr<const Resolution> &) const;
+
void _decide(const std::shared_ptr<Resolution> & resolution);
void _copy_other_destination_constraints(const std::shared_ptr<Resolution> & resolution);
const std::shared_ptr<Decision> _try_to_find_decision_for(
const std::shared_ptr<const Resolution> & resolution,
+ const bool also_try_option_changes,
+ const bool try_option_changes_this_time,
const bool also_try_masked,
const bool try_masked_this_time) const;
@@ -206,12 +217,15 @@ namespace paludis
const std::shared_ptr<const Resolution> &,
const bool include_errors,
const bool include_unmaskable) const;
- const std::pair<const std::shared_ptr<const PackageID>, bool> _find_installable_id_for(
+ const FoundID _find_installable_id_for(
const std::shared_ptr<const Resolution> &,
+ const bool include_option_changes,
const bool include_unmaskable) const;
- const std::pair<const std::shared_ptr<const PackageID>, bool> _find_id_for_from(
+ const FoundID _find_id_for_from(
const std::shared_ptr<const Resolution> &,
- const std::shared_ptr<const PackageIDSequence> &) const;
+ const std::shared_ptr<const PackageIDSequence> &,
+ const bool try_changing_choices,
+ const bool trying_changing_choices) const;
const std::shared_ptr<const Constraints> _get_unmatching_constraints(
const std::shared_ptr<const Resolution> &,
diff --git a/paludis/resolver/decision.cc b/paludis/resolver/decision.cc
index 118c381..842de00 100644
--- a/paludis/resolver/decision.cc
+++ b/paludis/resolver/decision.cc
@@ -30,6 +30,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/serialise-impl.hh>
+#include <paludis/changed_choices.hh>
#include <sstream>
using namespace paludis;
@@ -121,6 +122,7 @@ ChangesToMakeDecision::deserialise(Deserialisation & d)
std::shared_ptr<ChangesToMakeDecision> result(std::make_shared<ChangesToMakeDecision>(
v.member<Resolvent>("resolvent"),
v.member<std::shared_ptr<const PackageID> >("origin_id"),
+ v.member<std::shared_ptr<const ChangedChoices> >("if_changed_choices"),
v.member<bool>("best"),
destringify<ChangeType>(v.member<std::string>("change_type")),
v.member<bool>("taken"),
@@ -329,6 +331,7 @@ namespace paludis
{
const Resolvent resolvent;
const std::shared_ptr<const PackageID> origin_id;
+ const std::shared_ptr<const ChangedChoices> changed_choices;
const bool best;
ChangeType change_type;
const bool taken;
@@ -339,12 +342,14 @@ namespace paludis
Imp(
const Resolvent & l,
const std::shared_ptr<const PackageID> & o,
+ const std::shared_ptr<const ChangedChoices> & h,
const bool b,
const ChangeType c,
const bool t,
const std::shared_ptr<const Destination> & d) :
resolvent(l),
origin_id(o),
+ changed_choices(h),
best(b),
change_type(c),
taken(t),
@@ -357,12 +362,13 @@ namespace paludis
ChangesToMakeDecision::ChangesToMakeDecision(
const Resolvent & r,
const std::shared_ptr<const PackageID> & o,
+ const std::shared_ptr<const ChangedChoices> & h,
const bool b,
const ChangeType c,
const bool t,
const std::shared_ptr<const Destination> & d,
const std::function<void (ChangesToMakeDecision &)> & f) :
- Pimp<ChangesToMakeDecision>(r, o, b, c, t, d)
+ Pimp<ChangesToMakeDecision>(r, o, h, b, c, t, d)
{
if (f)
f(*this);
@@ -402,6 +408,12 @@ ChangesToMakeDecision::origin_id() const
return _imp->origin_id;
}
+const std::shared_ptr<const ChangedChoices>
+ChangesToMakeDecision::if_changed_choices() const
+{
+ return _imp->changed_choices;
+}
+
ChangeType
ChangesToMakeDecision::change_type() const
{
@@ -450,6 +462,7 @@ ChangesToMakeDecision::serialise(Serialiser & s) const
s.object("ChangesToMakeDecision")
.member(SerialiserFlags<>(), "resolvent", resolvent())
.member(SerialiserFlags<serialise::might_be_null>(), "origin_id", origin_id())
+ .member(SerialiserFlags<serialise::might_be_null>(), "if_changed_choices", if_changed_choices())
.member(SerialiserFlags<>(), "best", best())
.member(SerialiserFlags<>(), "change_type", stringify(change_type()))
.member(SerialiserFlags<serialise::might_be_null>(), "destination", destination())
diff --git a/paludis/resolver/decision.hh b/paludis/resolver/decision.hh
index dbabf68..eab8fee 100644
--- a/paludis/resolver/decision.hh
+++ b/paludis/resolver/decision.hh
@@ -30,7 +30,9 @@
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/type_list.hh>
#include <paludis/serialise-fwd.hh>
-#include <paludis/package_id.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/changed_choices-fwd.hh>
+#include <paludis/name-fwd.hh>
namespace paludis
{
@@ -150,6 +152,7 @@ namespace paludis
ChangesToMakeDecision(
const Resolvent &,
const std::shared_ptr<const PackageID> &,
+ const std::shared_ptr<const ChangedChoices> &,
const bool best,
const ChangeType,
const bool taken,
@@ -167,6 +170,9 @@ namespace paludis
const std::shared_ptr<const PackageID> origin_id() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::shared_ptr<const ChangedChoices> if_changed_choices() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
const std::shared_ptr<const RepositoryName> if_via_new_binary_in() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index 2e98cdb..cd66363 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -45,8 +45,10 @@
#include <paludis/util/simple_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 <unordered_set>
#include <unordered_map>
#include <algorithm>
diff --git a/paludis/resolver/reason.cc b/paludis/resolver/reason.cc
index bf999b2..94057d7 100644
--- a/paludis/resolver/reason.cc
+++ b/paludis/resolver/reason.cc
@@ -24,6 +24,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/serialise-impl.hh>
+#include <paludis/changed_choices.hh>
using namespace paludis;
using namespace paludis::resolver;
@@ -75,13 +76,16 @@ namespace paludis
struct Imp<DependencyReason>
{
const std::shared_ptr<const PackageID> from_id;
+ const std::shared_ptr<const ChangedChoices> changed_choices;
const Resolvent from_resolvent;
const SanitisedDependency dep;
const bool already_met;
Imp(const std::shared_ptr<const PackageID> & i,
+ const std::shared_ptr<const ChangedChoices> & c,
const Resolvent & r, const SanitisedDependency & d, const bool a) :
from_id(i),
+ changed_choices(c),
from_resolvent(r),
dep(d),
already_met(a)
@@ -91,10 +95,11 @@ namespace paludis
}
DependencyReason::DependencyReason(const std::shared_ptr<const PackageID> & i,
+ const std::shared_ptr<const ChangedChoices> & c,
const Resolvent & r,
const SanitisedDependency & d,
const bool a) :
- Pimp<DependencyReason>(i, r, d, a)
+ Pimp<DependencyReason>(i, c, r, d, a)
{
}
@@ -108,6 +113,12 @@ DependencyReason::from_id() const
return _imp->from_id;
}
+const std::shared_ptr<const ChangedChoices>
+DependencyReason::from_id_changed_choices() const
+{
+ return _imp->changed_choices;
+}
+
const Resolvent
DependencyReason::from_resolvent() const
{
@@ -132,6 +143,7 @@ DependencyReason::serialise(Serialiser & s) const
s.object("DependencyReason")
.member(SerialiserFlags<>(), "already_met", already_met())
.member(SerialiserFlags<serialise::might_be_null>(), "from_id", from_id())
+ .member(SerialiserFlags<serialise::might_be_null>(), "from_id_changed_choices", from_id_changed_choices())
.member(SerialiserFlags<>(), "from_resolvent", from_resolvent())
.member(SerialiserFlags<>(), "sanitised_dependency", sanitised_dependency())
;
@@ -416,6 +428,7 @@ Reason::deserialise(Deserialisation & d)
const std::shared_ptr<const PackageID> from_id(v.member<std::shared_ptr<const PackageID> >("from_id"));
return std::make_shared<DependencyReason>(
from_id,
+ v.member<std::shared_ptr<const ChangedChoices> >("from_id_changed_choices"),
v.member<Resolvent>("from_resolvent"),
SanitisedDependency::deserialise(*v.find_remove_member("sanitised_dependency"), from_id),
v.member<bool>("already_met")
diff --git a/paludis/resolver/reason.hh b/paludis/resolver/reason.hh
index 91565f2..f91d5c3 100644
--- a/paludis/resolver/reason.hh
+++ b/paludis/resolver/reason.hh
@@ -30,6 +30,7 @@
#include <paludis/name-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/serialise-fwd.hh>
+#include <paludis/changed_choices-fwd.hh>
#include <memory>
namespace paludis
@@ -72,6 +73,7 @@ namespace paludis
public:
DependencyReason(
const std::shared_ptr<const PackageID> & id,
+ const std::shared_ptr<const ChangedChoices> &,
const Resolvent &,
const SanitisedDependency & s,
const bool already_met);
@@ -79,6 +81,7 @@ namespace paludis
~DependencyReason();
const std::shared_ptr<const PackageID> from_id() const;
+ const std::shared_ptr<const ChangedChoices> from_id_changed_choices() const;
const Resolvent from_resolvent() const;
const SanitisedDependency & sanitised_dependency() const;
bool already_met() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/resolver/required_confirmations-fwd.hh b/paludis/resolver/required_confirmations-fwd.hh
index 80ccd41..a30fd59 100644
--- a/paludis/resolver/required_confirmations-fwd.hh
+++ b/paludis/resolver/required_confirmations-fwd.hh
@@ -33,6 +33,7 @@ namespace paludis
struct BreakConfirmation;
struct RemoveSystemPackageConfirmation;
struct MaskedConfirmation;
+ struct ChangedChoicesConfirmation;
typedef Sequence<std::shared_ptr<const RequiredConfirmation> > RequiredConfirmations;
}
diff --git a/paludis/resolver/required_confirmations.cc b/paludis/resolver/required_confirmations.cc
index 95585c8..3ca1046 100644
--- a/paludis/resolver/required_confirmations.cc
+++ b/paludis/resolver/required_confirmations.cc
@@ -40,6 +40,8 @@ RequiredConfirmation::deserialise(Deserialisation & d)
return RemoveSystemPackageConfirmation::deserialise(d);
else if (d.class_name() == "MaskedConfirmation")
return MaskedConfirmation::deserialise(d);
+ else if (d.class_name() == "ChangedChoicesConfirmation")
+ return ChangedChoicesConfirmation::deserialise(d);
else
throw InternalError(PALUDIS_HERE, "unknown class '" + stringify(d.class_name()) + "'");
@@ -116,6 +118,20 @@ MaskedConfirmation::serialise(Serialiser & s) const
;
}
+const std::shared_ptr<ChangedChoicesConfirmation>
+ChangedChoicesConfirmation::deserialise(Deserialisation & d)
+{
+ Deserialisator v(d, "ChangedChoicesConfirmation");
+ return std::make_shared<ChangedChoicesConfirmation>();
+}
+
+void
+ChangedChoicesConfirmation::serialise(Serialiser & s) const
+{
+ s.object("ChangedChoicesConfirmation")
+ ;
+}
+
template class Sequence<std::shared_ptr<const RequiredConfirmation> >;
template class WrappedForwardIterator<RequiredConfirmations::ConstIteratorTag, const std::shared_ptr<const RequiredConfirmation> >;
diff --git a/paludis/resolver/required_confirmations.hh b/paludis/resolver/required_confirmations.hh
index 4520561..622ec56 100644
--- a/paludis/resolver/required_confirmations.hh
+++ b/paludis/resolver/required_confirmations.hh
@@ -32,7 +32,8 @@ namespace paludis
{
class PALUDIS_VISIBLE RequiredConfirmation :
public virtual DeclareAbstractAcceptMethods<RequiredConfirmation, MakeTypeList<
- DowngradeConfirmation, NotBestConfirmation, BreakConfirmation, RemoveSystemPackageConfirmation, MaskedConfirmation>::Type>
+ DowngradeConfirmation, NotBestConfirmation, BreakConfirmation, RemoveSystemPackageConfirmation,
+ MaskedConfirmation, ChangedChoicesConfirmation>::Type>
{
public:
virtual void serialise(Serialiser &) const = 0;
@@ -95,6 +96,17 @@ namespace paludis
virtual void serialise(Serialiser &) const;
};
+
+ class PALUDIS_VISIBLE ChangedChoicesConfirmation :
+ public RequiredConfirmation,
+ public ImplementAcceptMethods<RequiredConfirmation, ChangedChoicesConfirmation>
+ {
+ public:
+ static const std::shared_ptr<ChangedChoicesConfirmation> deserialise(
+ Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void serialise(Serialiser &) const;
+ };
}
}
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index 59a83b3..52e4b6f 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -35,12 +35,14 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/pimp-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/environment.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/spec_tree.hh>
#include <paludis/repository.hh>
-#include <paludis/util/pimp-impl.hh>
+#include <algorithm>
#include <set>
using namespace paludis;
diff --git a/paludis/resolver/resolver_functions.hh b/paludis/resolver/resolver_functions.hh
index 5993efa..e129256 100644
--- a/paludis/resolver/resolver_functions.hh
+++ b/paludis/resolver/resolver_functions.hh
@@ -46,6 +46,7 @@ namespace paludis
{
namespace n
{
+ typedef Name<struct allow_choice_changes_fn_name> allow_choice_changes_fn;
typedef Name<struct allowed_to_remove_fn_name> allowed_to_remove_fn;
typedef Name<struct always_via_binary_fn_name> always_via_binary_fn;
typedef Name<struct can_use_fn_name> can_use_fn;
@@ -70,6 +71,10 @@ namespace paludis
namespace resolver
{
typedef std::function<bool (
+ const std::shared_ptr<const Resolution> &
+ )> AllowChoiceChangesFunction;
+
+ typedef std::function<bool (
const std::shared_ptr<const Resolution> &,
const std::shared_ptr<const PackageID> &
)> AllowedToRemoveFunction;
@@ -163,6 +168,7 @@ namespace paludis
struct ResolverFunctions
{
+ NamedValue<n::allow_choice_changes_fn, AllowChoiceChangesFunction> allow_choice_changes_fn;
NamedValue<n::allowed_to_remove_fn, AllowedToRemoveFunction> allowed_to_remove_fn;
NamedValue<n::always_via_binary_fn, AlwaysViaBinaryFunction> always_via_binary_fn;
NamedValue<n::can_use_fn, CanUseFunction> can_use_fn;
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index 53cd7ef..5bd0ad2 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -39,6 +39,7 @@
#include <paludis/util/set-impl.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/return_literal_function.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repository_factory.hh>
#include <paludis/package_database.hh>
@@ -48,6 +49,7 @@
#include <paludis/generator.hh>
#include <paludis/selection.hh>
#include <paludis/elike_slot_requirement.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
@@ -393,6 +395,7 @@ ResolverFunctions
ResolverTestCase::get_resolver_functions(InitialConstraints & initial_constraints)
{
return make_named_values<ResolverFunctions>(
+ n::allow_choice_changes_fn() = std::bind(return_literal_function(true)),
n::allowed_to_remove_fn() = std::bind(&allowed_to_remove_fn,
allowed_to_remove_names, std::placeholders::_1, std::placeholders::_2),
n::always_via_binary_fn() = &always_via_binary_fn,
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index 7cd60af..d88b1bd 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -34,6 +34,7 @@
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/log.hh>
#include <paludis/util/map.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/spec_tree.hh>
#include <paludis/slot_requirement.hh>
#include <paludis/metadata_key.hh>
@@ -43,6 +44,7 @@
#include <paludis/serialise-impl.hh>
#include <paludis/environment.hh>
#include <paludis/repository.hh>
+#include <algorithm>
#include <set>
#include <list>
@@ -60,6 +62,7 @@ namespace
struct MakeAnyOfStringVisitor
{
std::string result;
+ const std::shared_ptr<const ChangedChoices> changed_choices;
void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & s)
{
@@ -83,9 +86,9 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (changed_choices ? node.spec()->condition_would_be_met_when(*changed_choices) : node.spec()->condition_met())
{
- MakeAnyOfStringVisitor v;
+ MakeAnyOfStringVisitor v{"", changed_choices};
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
result.append(" " + stringify(*node.spec()) + " (" + v.result + " )");
}
@@ -93,14 +96,14 @@ namespace
void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
{
- MakeAnyOfStringVisitor v;
+ MakeAnyOfStringVisitor v{"", changed_choices};
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
result.append(" || (" + v.result + " )");
}
void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
{
- MakeAnyOfStringVisitor v;
+ MakeAnyOfStringVisitor v{"", changed_choices};
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
result.append(" (" + v.result + " )");
}
@@ -111,6 +114,7 @@ namespace
const Decider & decider;
const std::shared_ptr<const Resolution> our_resolution;
const std::shared_ptr<const PackageID> our_id;
+ const std::shared_ptr<const ChangedChoices> changed_choices;
const std::function<SanitisedDependency (const PackageOrBlockDepSpec &)> parent_make_sanitised;
bool super_complicated, nested;
@@ -122,10 +126,12 @@ namespace
AnyDepSpecChildHandler(const Decider & r, const std::shared_ptr<const Resolution> & q,
const std::shared_ptr<const PackageID> & o,
+ const std::shared_ptr<const ChangedChoices> & c,
const std::function<SanitisedDependency (const PackageOrBlockDepSpec &)> & f) :
decider(r),
our_resolution(q),
our_id(o),
+ changed_choices(c),
parent_make_sanitised(f),
super_complicated(false),
nested(false),
@@ -183,7 +189,7 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (changed_choices ? node.spec()->condition_would_be_met_when(*changed_choices) : node.spec()->condition_met())
{
nested = true;
@@ -214,7 +220,7 @@ namespace
void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
{
- AnyDepSpecChildHandler h(decider, our_resolution, our_id, parent_make_sanitised);
+ AnyDepSpecChildHandler h(decider, our_resolution, our_id, changed_choices, parent_make_sanitised);
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(h));
std::list<SanitisedDependency> l;
h.commit(
@@ -302,6 +308,7 @@ namespace
const Decider & decider;
const std::shared_ptr<const Resolution> our_resolution;
const std::shared_ptr<const PackageID> & our_id;
+ const std::shared_ptr<const ChangedChoices> & changed_choices;
SanitisedDependencies & sanitised_dependencies;
const std::string raw_name;
const std::string human_name;
@@ -313,6 +320,7 @@ namespace
const Decider & r,
const std::shared_ptr<const Resolution> & q,
const std::shared_ptr<const PackageID> & f,
+ const std::shared_ptr<const ChangedChoices> & c,
SanitisedDependencies & s,
const std::shared_ptr<const DependenciesLabelSequence> & l,
const std::string & rn,
@@ -322,6 +330,7 @@ namespace
decider(r),
our_resolution(q),
our_id(f),
+ changed_choices(c),
sanitised_dependencies(s),
raw_name(rn),
human_name(hn),
@@ -371,7 +380,7 @@ namespace
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (node.spec()->condition_met())
+ if (changed_choices ? node.spec()->condition_would_be_met_when(*changed_choices) : node.spec()->condition_met())
{
labels_stack.push_front(*labels_stack.begin());
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
@@ -391,12 +400,12 @@ namespace
Save<std::string> save_original_specs_as_string(&original_specs_as_string);
{
- MakeAnyOfStringVisitor v;
+ MakeAnyOfStringVisitor v{"", changed_choices};
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
original_specs_as_string = "|| (" + v.result + " )";
}
- AnyDepSpecChildHandler h(decider, our_resolution, our_id,
+ AnyDepSpecChildHandler h(decider, our_resolution, our_id, changed_choices,
std::bind(&Finder::make_sanitised, this, std::placeholders::_1));
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(h));
h.commit(
@@ -453,12 +462,13 @@ SanitisedDependencies::_populate_one(
const Decider & decider,
const std::shared_ptr<const Resolution> & resolution,
const std::shared_ptr<const PackageID> & id,
+ const std::shared_ptr<const ChangedChoices> & changed,
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > (PackageID::* const pmf) () const
)
{
Context context("When finding dependencies for '" + stringify(*id) + "' from key '" + ((*id).*pmf)()->raw_name() + "':");
- Finder f(env, decider, resolution, id, *this, ((*id).*pmf)()->initial_labels(), ((*id).*pmf)()->raw_name(),
+ Finder f(env, decider, resolution, id, changed, *this, ((*id).*pmf)()->initial_labels(), ((*id).*pmf)()->raw_name(),
((*id).*pmf)()->human_name(), "");
((*id).*pmf)()->value()->root()->accept(f);
}
@@ -468,22 +478,23 @@ SanitisedDependencies::populate(
const Environment * const env,
const Decider & decider,
const std::shared_ptr<const Resolution> & resolution,
- const std::shared_ptr<const PackageID> & id)
+ const std::shared_ptr<const PackageID> & id,
+ const std::shared_ptr<const ChangedChoices> & changed)
{
Context context("When finding dependencies for '" + stringify(*id) + "':");
if (id->dependencies_key())
- _populate_one(env, decider, resolution, id, &PackageID::dependencies_key);
+ _populate_one(env, decider, resolution, id, changed, &PackageID::dependencies_key);
else
{
if (id->build_dependencies_key())
- _populate_one(env, decider, resolution, id, &PackageID::build_dependencies_key);
+ _populate_one(env, decider, resolution, id, changed, &PackageID::build_dependencies_key);
if (id->run_dependencies_key())
- _populate_one(env, decider, resolution, id, &PackageID::run_dependencies_key);
+ _populate_one(env, decider, resolution, id, changed, &PackageID::run_dependencies_key);
if (id->post_dependencies_key())
- _populate_one(env, decider, resolution, id, &PackageID::post_dependencies_key);
+ _populate_one(env, decider, resolution, id, changed, &PackageID::post_dependencies_key);
if (id->suggested_dependencies_key())
- _populate_one(env, decider, resolution, id, &PackageID::suggested_dependencies_key);
+ _populate_one(env, decider, resolution, id, changed, &PackageID::suggested_dependencies_key);
}
}
diff --git a/paludis/resolver/sanitised_dependencies.hh b/paludis/resolver/sanitised_dependencies.hh
index 57e8c6c..a81ae62 100644
--- a/paludis/resolver/sanitised_dependencies.hh
+++ b/paludis/resolver/sanitised_dependencies.hh
@@ -70,6 +70,7 @@ namespace paludis
const Decider &,
const std::shared_ptr<const Resolution> &,
const std::shared_ptr<const PackageID> &,
+ const std::shared_ptr<const ChangedChoices> &,
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > (PackageID::* const) () const
);
@@ -81,7 +82,8 @@ namespace paludis
const Environment * const,
const Decider &,
const std::shared_ptr<const Resolution> &,
- const std::shared_ptr<const PackageID> &);
+ const std::shared_ptr<const PackageID> &,
+ const std::shared_ptr<const ChangedChoices> &);
void add(const SanitisedDependency & d);
diff --git a/paludis/resolver/spec_rewriter.cc b/paludis/resolver/spec_rewriter.cc
index 3496243..3213764 100644
--- a/paludis/resolver/spec_rewriter.cc
+++ b/paludis/resolver/spec_rewriter.cc
@@ -36,6 +36,7 @@
#include <paludis/filter.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <map>
#include <set>
diff --git a/paludis/set_file.cc b/paludis/set_file.cc
index 1b4bdd6..b944c32 100644
--- a/paludis/set_file.cc
+++ b/paludis/set_file.cc
@@ -34,6 +34,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <list>
#include <vector>
#include <algorithm>
diff --git a/paludis/set_file_TEST.cc b/paludis/set_file_TEST.cc
index 084cdd9..6fe81a4 100644
--- a/paludis/set_file_TEST.cc
+++ b/paludis/set_file_TEST.cc
@@ -17,17 +17,20 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "set_file.hh"
-#include <test/test_runner.hh>
-#include <test/test_framework.hh>
+#include <paludis/set_file.hh>
+#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/safe_ifstream.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/dep_spec.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/environments/test/test_environment.hh>
-#include <paludis/util/safe_ifstream.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
+#include <test/test_runner.hh>
+#include <test/test_framework.hh>
+
+#include <algorithm>
using namespace test;
using namespace paludis;
diff --git a/paludis/show_suggest_visitor.cc b/paludis/show_suggest_visitor.cc
index c8155d3..9348669 100644
--- a/paludis/show_suggest_visitor.cc
+++ b/paludis/show_suggest_visitor.cc
@@ -33,6 +33,8 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/join.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <algorithm>
#include <functional>
#include <set>
#include <list>
diff --git a/paludis/spec_tree.cc b/paludis/spec_tree.cc
index 6fb47ad..cf25e29 100644
--- a/paludis/spec_tree.cc
+++ b/paludis/spec_tree.cc
@@ -21,6 +21,8 @@
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <algorithm>
using namespace paludis;
using namespace paludis::spec_tree_internals;
diff --git a/paludis/spec_tree.hh b/paludis/spec_tree.hh
index 9e7b2ad..ab36c10 100644
--- a/paludis/spec_tree.hh
+++ b/paludis/spec_tree.hh
@@ -24,11 +24,8 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/select.hh>
#include <paludis/util/simple_visitor.hh>
-#include <paludis/util/sequence-fwd.hh>
-
#include <paludis/util/sequence.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <algorithm>
+#include <paludis/formatter.hh>
namespace paludis
{
diff --git a/paludis/uninstall_task.cc b/paludis/uninstall_task.cc
index 7dcd3ca..73edda5 100644
--- a/paludis/uninstall_task.cc
+++ b/paludis/uninstall_task.cc
@@ -37,12 +37,14 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/package_database.hh>
#include <paludis/hook.hh>
#include <paludis/dep_tag.hh>
#include <paludis/repository.hh>
#include <paludis/output_manager_from_environment.hh>
#include <paludis/output_manager.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <map>
#include <set>
#include <list>
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 2a24214..327cea5 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -29,6 +29,7 @@
#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/util/options.hh>
#include <paludis/util/log.hh>
#include <paludis/util/make_named_values.hh>
@@ -38,6 +39,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/timestamp.hh>
#include <paludis/util/destringify.hh>
+#include <paludis/util/accept_visitor.hh>
#include <algorithm>
using namespace paludis;
@@ -749,7 +751,7 @@ namespace
}
const std::pair<bool, std::string>
-UserKeyRequirement::requirement_met(const Environment * const, const PackageID & id) const
+UserKeyRequirement::requirement_met(const Environment * const, const ChangedChoices * const, const PackageID & id, const ChangedChoices * const) const
{
Context context("When working out whether '" + stringify(id) + "' matches " + as_raw_string() + ":");
@@ -783,6 +785,16 @@ UserKeyRequirement::as_raw_string() const
return "[." + _imp->key + std::string(1, _imp->op) + _imp->value + "]";
}
+bool
+UserKeyRequirement::accumulate_changes_to_make_met(
+ const Environment * const,
+ const ChangedChoices * const,
+ const std::shared_ptr<const PackageID> &,
+ ChangedChoices &) const
+{
+ return false;
+}
+
VersionSpecOptions
paludis::user_version_spec_options()
{
diff --git a/paludis/user_dep_spec.hh b/paludis/user_dep_spec.hh
index 041e90d..d248e6a 100644
--- a/paludis/user_dep_spec.hh
+++ b/paludis/user_dep_spec.hh
@@ -24,6 +24,7 @@
#include <paludis/dep_spec.hh>
#include <paludis/slot_requirement.hh>
#include <paludis/filter.hh>
+#include <paludis/additional_package_dep_spec_requirement.hh>
#include <paludis/util/pimp.hh>
namespace paludis
@@ -78,9 +79,16 @@ namespace paludis
///\}
virtual const std::pair<bool, std::string> requirement_met(
- const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const Environment * const, const ChangedChoices *,
+ const PackageID &, const ChangedChoices * const) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool accumulate_changes_to_make_met(
+ const Environment * const,
+ const ChangedChoices * const,
+ const std::shared_ptr<const PackageID> &,
+ ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
extern template class Pimp<UserKeyRequirement>;
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index c7a3493..91c1bd4 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -28,15 +28,18 @@
#include <paludis/environment.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/version_requirements.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <paludis/util/save.hh>
#include <paludis/util/stringify.hh>
-
#include <paludis/util/clone-impl.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/wrapped_output_iterator-impl.hh>
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <type_traits>
#include <list>
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 65daf6b..b16ae4b 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -30,6 +30,8 @@
#include <paludis/util/member_iterator-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <algorithm>
#include <list>
#include <ruby.h>
diff --git a/src/clients/adjutrix/downgrade_check.cc b/src/clients/adjutrix/downgrade_check.cc
index 29b83ef..e2822be 100644
--- a/src/clients/adjutrix/downgrade_check.cc
+++ b/src/clients/adjutrix/downgrade_check.cc
@@ -35,6 +35,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <iostream>
#include <vector>
#include <map>
diff --git a/src/clients/adjutrix/find_insecure_packages.cc b/src/clients/adjutrix/find_insecure_packages.cc
index 925858b..6f6d580 100644
--- a/src/clients/adjutrix/find_insecure_packages.cc
+++ b/src/clients/adjutrix/find_insecure_packages.cc
@@ -32,6 +32,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <set>
#include <map>
diff --git a/src/clients/adjutrix/find_reverse_deps.cc b/src/clients/adjutrix/find_reverse_deps.cc
index 8ba03b6..e2c2ac9 100644
--- a/src/clients/adjutrix/find_reverse_deps.cc
+++ b/src/clients/adjutrix/find_reverse_deps.cc
@@ -27,6 +27,7 @@
#include <paludis/util/sequence.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/user_dep_spec.hh>
#include <paludis/package_id.hh>
diff --git a/src/clients/adjutrix/keywords_graph.cc b/src/clients/adjutrix/keywords_graph.cc
index 7a1f643..9f9bb76 100644
--- a/src/clients/adjutrix/keywords_graph.cc
+++ b/src/clients/adjutrix/keywords_graph.cc
@@ -36,6 +36,8 @@
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
#include <paludis/choice.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
+
#include <functional>
#include <set>
#include <map>
diff --git a/src/clients/appareo/appareo.cc b/src/clients/appareo/appareo.cc
index 9113c5a..60582ef 100644
--- a/src/clients/appareo/appareo.cc
+++ b/src/clients/appareo/appareo.cc
@@ -41,6 +41,7 @@
#include <paludis/util/set.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/package_database.hh>
+#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 0c81a18..7b6f74e 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -75,6 +75,7 @@
#include <paludis/action.hh>
#include <paludis/output_manager_from_environment.hh>
#include <paludis/output_manager.hh>
+#include <paludis/changed_choices.hh>
#include <set>
#include <iterator>
@@ -512,6 +513,7 @@ namespace
const std::shared_ptr<Environment> &,
const DisplayResolutionCommandLine & cmdline,
const std::shared_ptr<const PackageID> & id,
+ const std::shared_ptr<const ChangedChoices> & changed_choices,
const std::shared_ptr<const PackageID> & old_id,
ChoicesToExplain & choices_to_explain
)
@@ -555,8 +557,12 @@ namespace
if (! s.empty())
s.append(" ");
+ Tribool changed_state(indeterminate);
+ if (changed_choices)
+ changed_state = changed_choices->overridden_value((*i)->name_with_prefix());
+
std::string t;
- if ((*i)->enabled())
+ if ((changed_state.is_indeterminate() && (*i)->enabled()) || (changed_state.is_true()))
{
if ((*i)->locked())
t = formatter.format(**i, format::Forced());
@@ -597,6 +603,9 @@ namespace
t = formatter.decorate(**i, t, format::Added());
}
+ if (! changed_state.is_indeterminate())
+ t = t + c::bold_red() + " (!)" + c::normal();
+
s.append(t);
bool show_description;
@@ -623,7 +632,10 @@ namespace
if (s.empty())
return;
- cout << " " << s << endl;
+ if (changed_choices)
+ cout << " " << c::bold_red() << "Changes needed: " << c::normal() << s << endl;
+ else
+ cout << " " << s << endl;
}
void display_reasons(
@@ -710,6 +722,11 @@ namespace
{
return "being unmasked";
}
+
+ std::string visit(const ChangedChoicesConfirmation &) const
+ {
+ return "being reconfigured";
+ }
};
std::string stringify_confirmation(const RequiredConfirmation & c)
@@ -1073,7 +1090,7 @@ namespace
if (! decision.best())
x = "-" + x;
- if (decision.origin_id()->masked())
+ if (decision.origin_id()->masked() || decision.if_changed_choices())
c = c::red();
else
do
@@ -1187,7 +1204,7 @@ namespace
old_id = *decision.destination()->replacing()->begin();
display_one_description(env, cmdline, decision.origin_id(), ! old_id);
- display_choices(env, cmdline, decision.origin_id(), old_id, choices_to_explain);
+ display_choices(env, cmdline, decision.origin_id(), decision.if_changed_choices(), old_id, choices_to_explain);
display_reasons(resolution, more_annotations);
display_masks(env, decision);
if (maybe_totals)
@@ -1306,7 +1323,7 @@ namespace
a_end((*c)->spec().if_package()->additional_requirements_ptr()->end()) ;
a != a_end ; ++a)
{
- const std::pair<bool, std::string> p((*a)->requirement_met(env.get(), *u->package_id()));
+ const std::pair<bool, std::string> p((*a)->requirement_met(env.get(), 0, *u->package_id(), 0));
if (p.first)
continue;
diff --git a/src/clients/cave/cmd_fix_linkage.cc b/src/clients/cave/cmd_fix_linkage.cc
index 412a8c8..9c9f679 100644
--- a/src/clients/cave/cmd_fix_linkage.cc
+++ b/src/clients/cave/cmd_fix_linkage.cc
@@ -36,6 +36,7 @@
#include <paludis/notifier_callback.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_requirements.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <iostream>
#include <set>
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index 881be22..8b40512 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -31,6 +31,7 @@
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/singleton-impl.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
diff --git a/src/clients/cave/cmd_print_set.cc b/src/clients/cave/cmd_print_set.cc
index c336811..af9a12f 100644
--- a/src/clients/cave/cmd_print_set.cc
+++ b/src/clients/cave/cmd_print_set.cc
@@ -32,6 +32,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/map.hh>
+#include <paludis/util/accept_visitor.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc
index c1438c2..1a4f6f7 100644
--- a/src/clients/cave/cmd_resolve_cmdline.cc
+++ b/src/clients/cave/cmd_resolve_cmdline.cc
@@ -73,6 +73,10 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A
a_no_override_masks(&g_resolution_options, "no-override-masks", '\0',
"If otherwise unable to make a decision, unless this option is specified the resolver "
"will try packages that are weakly masked too.", true),
+ a_no_override_flags(&g_resolution_options, "no-override-flags", '\0',
+ "If otherwise unable to make a decision, unless this option is specified the resolver "
+ "will try selecting packages using different options to the ones specified in the user's "
+ "configuration.", true),
g_dependent_options(this, "Dependent Options", "Dependent options. A package is dependent if it "
"requires (or looks like it might require) a package which is being removed. By default, "
diff --git a/src/clients/cave/cmd_resolve_cmdline.hh b/src/clients/cave/cmd_resolve_cmdline.hh
index a2adadb..079414d 100644
--- a/src/clients/cave/cmd_resolve_cmdline.hh
+++ b/src/clients/cave/cmd_resolve_cmdline.hh
@@ -49,6 +49,7 @@ namespace paludis
args::StringSetArg a_permit_old_version;
args::StringSetArg a_purge;
args::SwitchArg a_no_override_masks;
+ args::SwitchArg a_no_override_flags;
args::ArgsGroup g_dependent_options;
args::StringSetArg a_uninstalls_may_break;
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index f2f9f71..1b58fef 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -44,9 +44,11 @@
#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/action.hh>
#include <paludis/mask.hh>
#include <paludis/choice.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <cstdlib>
#include <iostream>
#include <algorithm>
diff --git a/src/clients/cave/cmd_uninstall.cc b/src/clients/cave/cmd_uninstall.cc
index 80d889e..72e19f3 100644
--- a/src/clients/cave/cmd_uninstall.cc
+++ b/src/clients/cave/cmd_uninstall.cc
@@ -35,6 +35,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <algorithm>
#include <iostream>
#include <set>
#include <cstdlib>
diff --git a/src/clients/cave/executables_common.cc b/src/clients/cave/executables_common.cc
index a1e52b0..b3ce920 100644
--- a/src/clients/cave/executables_common.cc
+++ b/src/clients/cave/executables_common.cc
@@ -33,6 +33,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/system.hh>
#include <paludis/util/tokeniser.hh>
+#include <paludis/util/accept_visitor.hh>
#include <algorithm>
#include <set>
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index 8f369d7..6d4dbdd 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -44,6 +44,7 @@
#include <paludis/util/set-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/return_literal_function.hh>
#include <paludis/args/do_help.hh>
#include <paludis/args/escape.hh>
#include <paludis/resolver/resolver.hh>
@@ -77,6 +78,8 @@
#include <paludis/selection_cache.hh>
#include <paludis/package_dep_spec_properties.hh>
#include <paludis/elike_slot_requirement.hh>
+#include <paludis/package_id.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <algorithm>
#include <iostream>
@@ -1158,34 +1161,40 @@ namespace
struct ChosenIDVisitor
{
- const std::shared_ptr<const PackageID> visit(const ChangesToMakeDecision & decision) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(
+ const ChangesToMakeDecision & decision) const
{
- return decision.origin_id();
+ return std::make_pair(decision.origin_id(), decision.if_changed_choices());
}
- const std::shared_ptr<const PackageID> visit(const BreakDecision & decision) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(
+ const BreakDecision & decision) const
{
- return decision.existing_id();
+ return std::make_pair(decision.existing_id(), make_null_shared_ptr());
}
- const std::shared_ptr<const PackageID> visit(const ExistingNoChangeDecision & decision) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(
+ const ExistingNoChangeDecision & decision) const
{
- return decision.existing_id();
+ return std::make_pair(decision.existing_id(), make_null_shared_ptr());
}
- const std::shared_ptr<const PackageID> visit(const NothingNoChangeDecision &) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(
+ const NothingNoChangeDecision &) const
{
- return make_null_shared_ptr();
+ return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
- const std::shared_ptr<const PackageID> visit(const RemoveDecision &) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(
+ const RemoveDecision &) const
{
- return make_null_shared_ptr();
+ return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
- const std::shared_ptr<const PackageID> visit(const UnableToMakeDecision &) const
+ const std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > visit(
+ const UnableToMakeDecision &) const
{
- return make_null_shared_ptr();
+ return std::make_pair(make_null_shared_ptr(), make_null_shared_ptr());
}
};
@@ -1196,8 +1205,9 @@ namespace
const PackageDepSpecList & late,
const std::shared_ptr<const Resolution> & r)
{
- const std::shared_ptr<const PackageID> id(r->decision()->accept_returning<std::shared_ptr<const PackageID> >(
- ChosenIDVisitor()));
+ const std::shared_ptr<const PackageID> id(
+ r->decision()->accept_returning<std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > >(
+ ChosenIDVisitor()).first);
if (id)
{
if (match_any(env, early, id))
@@ -1284,6 +1294,11 @@ namespace
{
return false;
}
+
+ bool visit(const ChangedChoicesConfirmation &) const
+ {
+ return false;
+ }
};
bool confirm_fn(
@@ -1298,7 +1313,8 @@ namespace
{
return c->accept_returning<bool>(ConfirmFnVisitor(env, resolution_options, permit_downgrade, permit_old_version,
allowed_to_break_specs, allowed_to_break_system,
- r->decision()->accept_returning<std::shared_ptr<const PackageID> >(ChosenIDVisitor())
+ r->decision()->accept_returning<std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > >(
+ ChosenIDVisitor()).first
));
}
@@ -1691,12 +1707,16 @@ namespace
std::cout << "* " << r->resolvent() << std::endl;
std::cout << " Had decided upon ";
- const std::shared_ptr<const PackageID> id(r->previous_decision()->accept_returning<
- std::shared_ptr<const PackageID> >(ChosenIDVisitor()));
- if (id)
- std::cout << *id;
+ auto c(r->previous_decision()->accept_returning<std::pair<std::shared_ptr<const PackageID>, std::shared_ptr<const ChangedChoices> > >(
+ ChosenIDVisitor()));
+ if (c.first)
+ std::cout << *c.first;
else
std::cout << r->previous_decision()->accept_returning<std::string>(KindNameVisitor());
+
+ if (c.second)
+ std::cout << " (with changed choices)";
+
std::cout << std::endl;
std::cout << " Which did not satisfy " << r->problematic_constraint()->spec()
@@ -1922,6 +1942,8 @@ paludis::cave::resolve_common(
using std::placeholders::_4;
ResolverFunctions resolver_functions(make_named_values<ResolverFunctions>(
+ n::allow_choice_changes_fn() = std::bind(return_literal_function(
+ ! resolution_options.a_no_override_flags.specified())),
n::allowed_to_remove_fn() = std::bind(&allowed_to_remove_fn,
env.get(), std::cref(allowed_to_remove_specs), _1, _2),
n::always_via_binary_fn() = std::bind(&always_via_binary_fn,
diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc
index cb30866..cd90526 100644
--- a/src/clients/inquisitio/do_search.cc
+++ b/src/clients/inquisitio/do_search.cc
@@ -31,6 +31,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/notifier_callback.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/create_iterator-impl.hh>
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index 4914867..d5af664 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -27,6 +27,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/timestamp.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/stringify_formatter.hh>
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 285120b..430c597 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -43,9 +43,11 @@
#include <paludis/util/pretty_print.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/timestamp.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
+#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 10d47c0..fbbdc57 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -31,6 +31,7 @@
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/timestamp.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/package_database.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc
index ba2ca1e..08c7b2a 100644
--- a/src/clients/paludis/query.cc
+++ b/src/clients/paludis/query.cc
@@ -20,13 +20,14 @@
#include <src/output/colour.hh>
#include "query.hh"
#include <src/output/console_query_task.hh>
-#include <functional>
-#include <iomanip>
-#include <iostream>
#include <paludis/paludis.hh>
#include <paludis/fuzzy_finder.hh>
#include <paludis/filter.hh>
#include <string>
+#include <functional>
+#include <iomanip>
+#include <iostream>
+#include <algorithm>
/** \file
* Handle the --query action for the main paludis program.
diff --git a/src/clients/reconcilio/fix_linkage.cc b/src/clients/reconcilio/fix_linkage.cc
index 56666a8..0114893 100644
--- a/src/clients/reconcilio/fix_linkage.cc
+++ b/src/clients/reconcilio/fix_linkage.cc
@@ -35,6 +35,7 @@
#include <paludis/package_id.hh>
#include <paludis/version_requirements.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <src/output/colour.hh>
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index feb9b49..cd895df 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -53,6 +53,7 @@
#include <paludis/output_manager.hh>
#include <paludis/dep_list.hh>
#include <paludis/notifier_callback.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <functional>
#include <algorithm>
@@ -1766,7 +1767,7 @@ ConsoleInstallTask::on_additional_requirements_not_met_error(const AdditionalReq
i_end(e.query().additional_requirements_ptr()->end()) ;
i != i_end ; ++i)
{
- const std::pair<bool, std::string> r((*i)->requirement_met(environment(), *e.package_id()));
+ const std::pair<bool, std::string> r((*i)->requirement_met(environment(), 0, *e.package_id(), 0));
if (r.first)
continue;
output_stream() << " * " << r.second << endl;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index a110a19..38ee187 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -33,6 +33,7 @@
#include <paludis/util/pretty_print.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/timestamp.hh>
+#include <paludis/util/accept_visitor.hh>
#include <paludis/package_dep_spec_properties.hh>
#include <paludis/mask.hh>
#include <paludis/metadata_key.hh>
@@ -44,6 +45,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/choice.hh>
+#include <paludis/partially_made_package_dep_spec.hh>
#include <list>
#include <algorithm>