aboutsummaryrefslogtreecommitdiff
path: root/paludis/resolver
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-12 14:28:03 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-12 14:45:22 +0100
commit120c58323950219e16d8fe22693af221d2887f9b (patch)
tree2df48534abea1af807750dbbd0ce3ac9922bd44b /paludis/resolver
parent271074eb112e276d5ba25f91785431911ee3443f (diff)
downloadpaludis-120c58323950219e16d8fe22693af221d2887f9b.tar.gz
paludis-120c58323950219e16d8fe22693af221d2887f9b.tar.xz
MetadataKey value -> parse_value
Diffstat (limited to 'paludis/resolver')
-rw-r--r--paludis/resolver/Makefile.am2
-rw-r--r--paludis/resolver/collect_depped_upon.cc32
-rw-r--r--paludis/resolver/collect_installed.cc2
-rw-r--r--paludis/resolver/collect_provided.cc2
-rw-r--r--paludis/resolver/decider.cc45
-rw-r--r--paludis/resolver/destination_utils.cc13
-rw-r--r--paludis/resolver/find_replacing_helper.cc2
-rw-r--r--paludis/resolver/find_repository_for_helper.cc6
-rw-r--r--paludis/resolver/get_constraints_for_dependent_helper.cc2
-rw-r--r--paludis/resolver/get_constraints_for_purge_helper.cc2
-rw-r--r--paludis/resolver/get_initial_constraints_for_helper.cc2
-rw-r--r--paludis/resolver/get_resolvents_for_helper.cc4
-rw-r--r--paludis/resolver/has_behaviour-fwd.hh35
-rw-r--r--paludis/resolver/has_behaviour.cc39
-rw-r--r--paludis/resolver/has_behaviour.hh25
-rw-r--r--paludis/resolver/interest_in_spec_helper.cc4
-rw-r--r--paludis/resolver/resolvent.cc2
-rw-r--r--paludis/resolver/same_slot.cc4
-rw-r--r--paludis/resolver/sanitised_dependencies.cc2
-rw-r--r--paludis/resolver/spec_rewriter.cc2
20 files changed, 165 insertions, 62 deletions
diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am
index 9f19ca853..db3a1a5ce 100644
--- a/paludis/resolver/Makefile.am
+++ b/paludis/resolver/Makefile.am
@@ -61,6 +61,7 @@ noinst_HEADERS = \
get_initial_constraints_for_helper.hh get_initial_constraints_for_helper-fwd.hh \
get_resolvents_for_helper.hh get_resolvents_for_helper-fwd.hh \
get_use_existing_nothing_helper.hh get_use_existing_nothing_helper-fwd.hh \
+ has_behaviour.hh has_behaviour-fwd.hh \
interest_in_spec_helper.hh interest_in_spec_helper-fwd.hh \
job.hh job-fwd.hh \
job_list.hh job_list-fwd.hh \
@@ -134,6 +135,7 @@ libpaludisresolver_a_SOURCES = \
get_initial_constraints_for_helper.cc \
get_resolvents_for_helper.cc \
get_use_existing_nothing_helper.cc \
+ has_behaviour.cc \
interest_in_spec_helper.cc \
job.cc \
job_list.cc \
diff --git a/paludis/resolver/collect_depped_upon.cc b/paludis/resolver/collect_depped_upon.cc
index 3d97cdc2b..04a558072 100644
--- a/paludis/resolver/collect_depped_upon.cc
+++ b/paludis/resolver/collect_depped_upon.cc
@@ -121,7 +121,7 @@ namespace
MutablePackageDepSpecData part_spec(*s.spec()->data());
part_spec
.unrequire_exact_slot()
- .require_exact_slot(best_eventual_id->slot_key()->value(), false);
+ .require_exact_slot(best_eventual_id->slot_key()->parse_value(), false);
spec = std::make_shared<PackageDepSpec>(part_spec);
}
}
@@ -184,17 +184,17 @@ paludis::resolver::dependent_upon(
{
DependentChecker<ChangeByResolventSequence> c(env, id, going_away, staying, not_changing_slots);
if (id->dependencies_key())
- id->dependencies_key()->value()->top()->accept(c);
+ id->dependencies_key()->parse_value()->top()->accept(c);
else
{
if (id->build_dependencies_key())
- id->build_dependencies_key()->value()->top()->accept(c);
+ id->build_dependencies_key()->parse_value()->top()->accept(c);
if (id->run_dependencies_key())
- id->run_dependencies_key()->value()->top()->accept(c);
+ id->run_dependencies_key()->parse_value()->top()->accept(c);
if (id->post_dependencies_key())
- id->post_dependencies_key()->value()->top()->accept(c);
+ id->post_dependencies_key()->parse_value()->top()->accept(c);
if (id->suggested_dependencies_key())
- id->suggested_dependencies_key()->value()->top()->accept(c);
+ id->suggested_dependencies_key()->parse_value()->top()->accept(c);
}
return c.result;
@@ -209,17 +209,17 @@ paludis::resolver::collect_depped_upon(
{
DependentChecker<PackageIDSequence> c(env, id, candidates, std::make_shared<PackageIDSequence>(), not_changing_slots);
if (id->dependencies_key())
- id->dependencies_key()->value()->top()->accept(c);
+ id->dependencies_key()->parse_value()->top()->accept(c);
else
{
if (id->build_dependencies_key())
- id->build_dependencies_key()->value()->top()->accept(c);
+ id->build_dependencies_key()->parse_value()->top()->accept(c);
if (id->run_dependencies_key())
- id->run_dependencies_key()->value()->top()->accept(c);
+ id->run_dependencies_key()->parse_value()->top()->accept(c);
if (id->post_dependencies_key())
- id->post_dependencies_key()->value()->top()->accept(c);
+ id->post_dependencies_key()->parse_value()->top()->accept(c);
if (id->suggested_dependencies_key())
- id->suggested_dependencies_key()->value()->top()->accept(c);
+ id->suggested_dependencies_key()->parse_value()->top()->accept(c);
}
const std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>());
@@ -245,17 +245,17 @@ paludis::resolver::collect_dependents(
std::make_shared<PackageIDSequence>(), std::make_shared<PackageIDSequence>());
if ((*i)->dependencies_key())
- (*i)->dependencies_key()->value()->top()->accept(c);
+ (*i)->dependencies_key()->parse_value()->top()->accept(c);
else
{
if ((*i)->build_dependencies_key())
- (*i)->build_dependencies_key()->value()->top()->accept(c);
+ (*i)->build_dependencies_key()->parse_value()->top()->accept(c);
if ((*i)->run_dependencies_key())
- (*i)->run_dependencies_key()->value()->top()->accept(c);
+ (*i)->run_dependencies_key()->parse_value()->top()->accept(c);
if ((*i)->post_dependencies_key())
- (*i)->post_dependencies_key()->value()->top()->accept(c);
+ (*i)->post_dependencies_key()->parse_value()->top()->accept(c);
if ((*i)->suggested_dependencies_key())
- (*i)->suggested_dependencies_key()->value()->top()->accept(c);
+ (*i)->suggested_dependencies_key()->parse_value()->top()->accept(c);
}
if (! c.result->empty())
diff --git a/paludis/resolver/collect_installed.cc b/paludis/resolver/collect_installed.cc
index 2b94800a4..ffcaccf9f 100644
--- a/paludis/resolver/collect_installed.cc
+++ b/paludis/resolver/collect_installed.cc
@@ -39,7 +39,7 @@ paludis::resolver::collect_installed(
Context context("When collecting installed packages:");
const std::shared_ptr<const PackageIDSequence> q((*env)[selection::AllVersionsUnsorted(
- generator::All() | filter::InstalledAtRoot(env->system_root_key()->value()))]);
+ generator::All() | filter::InstalledAtRoot(env->system_root_key()->parse_value()))]);
const std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>());
std::copy(q->begin(), q->end(), result->inserter());
diff --git a/paludis/resolver/collect_provided.cc b/paludis/resolver/collect_provided.cc
index a9c741efe..d4a7ea2f4 100644
--- a/paludis/resolver/collect_provided.cc
+++ b/paludis/resolver/collect_provided.cc
@@ -47,7 +47,7 @@ paludis::resolver::collect_provided(
if (id->provide_key())
{
DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(env, id);
- id->provide_key()->value()->top()->accept(f);
+ id->provide_key()->parse_value()->top()->accept(f);
for (DepSpecFlattener<ProvideSpecTree, PackageDepSpec>::ConstIterator v(f.begin()), v_end(f.end()) ;
v != v_end ; ++v)
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 3d5148157..c70a248ce 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -40,6 +40,7 @@
#include <paludis/resolver/same_slot.hh>
#include <paludis/resolver/reason_utils.hh>
#include <paludis/resolver/make_uninstall_blocker.hh>
+#include <paludis/resolver/has_behaviour-fwd.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
@@ -403,7 +404,7 @@ Decider::_collect_staying(const std::shared_ptr<const ChangeByResolventSequence>
Context context("When collecting staying packages:");
const std::shared_ptr<const PackageIDSequence> existing((*_imp->env)[selection::AllVersionsUnsorted(
- generator::All() | filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
+ generator::All() | filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]);
const std::shared_ptr<PackageIDSequence> result(std::make_shared<PackageIDSequence>());
for (PackageIDSequence::ConstIterator x(existing->begin()), x_end(existing->end()) ;
@@ -1389,7 +1390,7 @@ Decider::find_any_score(
const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly(
generator::Matches(spec, our_id, { }) |
- filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]);
if (! installed_ids->empty() ^ is_block)
return std::make_pair(acs_already_installed, operator_bias);
}
@@ -1421,7 +1422,7 @@ Decider::find_any_score(
const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly(
generator::Matches(spec, our_id, { }) |
- filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]);
if (! installed_ids->empty())
return std::make_pair(acs_blocks_installed, operator_bias);
}
@@ -1515,7 +1516,7 @@ Decider::_get_error_resolvents_for(
if (! ids->empty())
resolvent.slot() = make_named_values<SlotNameOrNull>(
n::name_or_null() = (*ids->rbegin())->slot_key() ?
- make_shared_copy((*ids->rbegin())->slot_key()->value()) :
+ make_shared_copy((*ids->rbegin())->slot_key()->parse_value()) :
make_null_shared_ptr(),
n::null_means_unknown() = true
);
@@ -1574,8 +1575,7 @@ Decider::_try_to_find_decision_for(
else if (existing_id && ! installable_id)
{
/* there's nothing installable. this may or may not be ok. */
- bool is_transient(existing_id->behaviours_key() && existing_id->behaviours_key()->value()->end() !=
- existing_id->behaviours_key()->value()->find("transient"));
+ bool is_transient(has_behaviour(existing_id, "transient"));
switch (resolution->constraints()->strictest_use_existing())
{
@@ -1633,11 +1633,16 @@ Decider::_try_to_find_decision_for(
is_same = true;
std::set<ChoiceNameWithPrefix> common;
+ std::shared_ptr<const Choices> installable_choices;
+ std::shared_ptr<const Choices> existing_choices;
+
if (existing_id->choices_key() && installable_id->choices_key())
{
+ installable_choices = installable_id->choices_key()->parse_value();
+ existing_choices = existing_id->choices_key()->parse_value();
+
std::set<ChoiceNameWithPrefix> i_common, u_common;
- for (Choices::ConstIterator k(installable_id->choices_key()->value()->begin()),
- k_end(installable_id->choices_key()->value()->end()) ;
+ for (Choices::ConstIterator k(installable_choices->begin()), k_end(installable_choices->end()) ;
k != k_end ; ++k)
{
if (! (*k)->consider_added_or_changed())
@@ -1649,8 +1654,7 @@ Decider::_try_to_find_decision_for(
i_common.insert((*i)->name_with_prefix());
}
- for (Choices::ConstIterator k(existing_id->choices_key()->value()->begin()),
- k_end(existing_id->choices_key()->value()->end()) ;
+ for (Choices::ConstIterator k(existing_choices->begin()), k_end(existing_choices->end()) ;
k != k_end ; ++k)
{
if (! (*k)->consider_added_or_changed())
@@ -1670,16 +1674,15 @@ Decider::_try_to_find_decision_for(
for (std::set<ChoiceNameWithPrefix>::const_iterator f(common.begin()), f_end(common.end()) ;
f != f_end ; ++f)
- if (installable_id->choices_key()->value()->find_by_name_with_prefix(*f)->enabled() !=
- existing_id->choices_key()->value()->find_by_name_with_prefix(*f)->enabled())
+ if (installable_choices->find_by_name_with_prefix(*f)->enabled() !=
+ existing_choices->find_by_name_with_prefix(*f)->enabled())
{
is_same = false;
break;
}
}
- bool is_transient(existing_id->behaviours_key() && existing_id->behaviours_key()->value()->end() !=
- existing_id->behaviours_key()->value()->find("transient"));
+ bool is_transient(has_behaviour(existing_id, "transient"));
/* we've got existing and installable. do we have any reason not to pick the existing id? */
const std::shared_ptr<Decision> existing(std::make_shared<ExistingNoChangeDecision>(
@@ -1971,8 +1974,7 @@ Decider::_get_unmatching_constraints(
if (existing)
{
- bool is_transient(id->behaviours_key() && id->behaviours_key()->value()->end() !=
- id->behaviours_key()->value()->find("transient"));
+ bool is_transient(has_behaviour(id, "transient"));
decision = std::make_shared<ExistingNoChangeDecision>(
resolution->resolvent(),
id,
@@ -2072,9 +2074,7 @@ Decider::purge()
{
_imp->env->trigger_notifier_callback(NotifierCallbackResolverStepEvent());
- if (((*i)->behaviours_key() && (*i)->behaviours_key()->value()->end() !=
- (*i)->behaviours_key()->value()->find("used")) ||
- (! (*i)->supports_action(SupportsActionTest<UninstallAction>())))
+ if (has_behaviour(*i, "used") || ! (*i)->supports_action(SupportsActionTest<UninstallAction>()))
continue;
Resolvent resolvent(*i, dt_install_to_slash);
@@ -2140,7 +2140,7 @@ Decider::_package_dep_spec_already_met(const PackageDepSpec & spec, const std::s
const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::AllVersionsUnsorted(
generator::Matches(spec, from_id, { }) |
- filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]);
if (installed_ids->empty())
return false;
else
@@ -2162,7 +2162,7 @@ Decider::_block_dep_spec_already_met(const BlockDepSpec & spec, const std::share
const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::SomeArbitraryVersion(
generator::Matches(spec.blocking(), from_id, { }) |
make_slot_filter(resolvent) |
- filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]);
return installed_ids->empty();
}
@@ -2341,8 +2341,7 @@ Decider::_resolve_purges()
{
_imp->env->trigger_notifier_callback(NotifierCallbackResolverStepEvent());
- if (((*i)->behaviours_key() && (*i)->behaviours_key()->value()->end() !=
- (*i)->behaviours_key()->value()->find("used")) ||
+ if (has_behaviour(*i, "used") ||
(! (*i)->supports_action(SupportsActionTest<UninstallAction>())))
continue;
diff --git a/paludis/resolver/destination_utils.cc b/paludis/resolver/destination_utils.cc
index 85f78a838..0e42da8e6 100644
--- a/paludis/resolver/destination_utils.cc
+++ b/paludis/resolver/destination_utils.cc
@@ -38,7 +38,8 @@ paludis::resolver::can_make_binary_for(const std::shared_ptr<const PackageID> &
{
if (! id->behaviours_key())
return true;
- return id->behaviours_key()->value()->end() == id->behaviours_key()->value()->find("unbinaryable");
+ auto v(id->behaviours_key()->parse_value());
+ return v->end() == v->find("unbinaryable");
}
bool
@@ -46,7 +47,8 @@ paludis::resolver::is_already_binary(const std::shared_ptr<const PackageID> & id
{
if (! id->behaviours_key())
return false;
- return id->behaviours_key()->value()->end() != id->behaviours_key()->value()->find("binary");
+ auto v(id->behaviours_key()->parse_value());
+ return v->end() != v->find("binary");
}
bool
@@ -54,7 +56,8 @@ paludis::resolver::can_chroot(const std::shared_ptr<const PackageID> & id)
{
if (! id->behaviours_key())
return true;
- return id->behaviours_key()->value()->end() == id->behaviours_key()->value()->find("unchrootable");
+ auto v(id->behaviours_key()->parse_value());
+ return v->end() == v->find("unchrootable");
}
namespace
@@ -102,10 +105,10 @@ paludis::resolver::destination_filtered_generator(
switch (t)
{
case dt_install_to_slash:
- return g | filter::InstalledAtRoot(env->system_root_key()->value());
+ return g | filter::InstalledAtRoot(env->system_root_key()->parse_value());
case dt_install_to_chroot:
- return g | filter::InstalledNotAtRoot(env->system_root_key()->value());
+ return g | filter::InstalledNotAtRoot(env->system_root_key()->parse_value());
case dt_create_binary:
return g & BinaryDestinationGenerator();
diff --git a/paludis/resolver/find_replacing_helper.cc b/paludis/resolver/find_replacing_helper.cc
index 79aeedb83..d9c77000c 100644
--- a/paludis/resolver/find_replacing_helper.cc
+++ b/paludis/resolver/find_replacing_helper.cc
@@ -80,7 +80,7 @@ FindReplacingHelper::operator() (
for (auto r(_imp->env->begin_repositories()), r_end(_imp->env->end_repositories()) ;
r != r_end ; ++r)
if ((*r)->installed_root_key() &&
- (*r)->installed_root_key()->value() == repo->installed_root_key()->value())
+ (*r)->installed_root_key()->parse_value() == repo->installed_root_key()->parse_value())
repos.insert((*r)->name());
}
else
diff --git a/paludis/resolver/find_repository_for_helper.cc b/paludis/resolver/find_repository_for_helper.cc
index 1951b0e49..67f560b9d 100644
--- a/paludis/resolver/find_repository_for_helper.cc
+++ b/paludis/resolver/find_repository_for_helper.cc
@@ -62,7 +62,7 @@ namespace
{
bool is_fake(const std::shared_ptr<const Repository> & repo)
{
- return repo->format_key() && repo->format_key()->value() == "installed_fake";
+ return repo->format_key() && repo->format_key()->parse_value() == "installed_fake";
}
}
@@ -79,12 +79,12 @@ FindRepositoryForHelper::operator() (
switch (resolution->resolvent().destination_type())
{
case dt_install_to_slash:
- if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() != _imp->env->system_root_key()->value()))
+ if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->parse_value() != _imp->env->system_root_key()->parse_value()))
continue;
break;
case dt_install_to_chroot:
- if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() == _imp->env->system_root_key()->value()))
+ if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->parse_value() == _imp->env->system_root_key()->parse_value()))
continue;
break;
diff --git a/paludis/resolver/get_constraints_for_dependent_helper.cc b/paludis/resolver/get_constraints_for_dependent_helper.cc
index ea12ac55f..cf3b441fe 100644
--- a/paludis/resolver/get_constraints_for_dependent_helper.cc
+++ b/paludis/resolver/get_constraints_for_dependent_helper.cc
@@ -86,7 +86,7 @@ GetConstraintsForDependentHelper::operator() (
MutablePackageDepSpecData partial_spec({ });
partial_spec.require_package(id->name());
if (id->slot_key())
- partial_spec.require_exact_slot(id->slot_key()->value(), false);
+ partial_spec.require_exact_slot(id->slot_key()->parse_value(), false);
spec = std::make_shared<PackageDepSpec>(partial_spec);
}
diff --git a/paludis/resolver/get_constraints_for_purge_helper.cc b/paludis/resolver/get_constraints_for_purge_helper.cc
index 1234ce9cd..af0bb9374 100644
--- a/paludis/resolver/get_constraints_for_purge_helper.cc
+++ b/paludis/resolver/get_constraints_for_purge_helper.cc
@@ -81,7 +81,7 @@ GetConstraintsForPurgeHelper::operator() (
MutablePackageDepSpecData partial_spec({ });
partial_spec.require_package(id->name());
if (id->slot_key())
- partial_spec.require_exact_slot(id->slot_key()->value(), false);
+ partial_spec.require_exact_slot(id->slot_key()->parse_value(), false);
PackageDepSpec spec(partial_spec);
const std::shared_ptr<WasUsedByReason> reason(std::make_shared<WasUsedByReason>(was_used_by_ids));
diff --git a/paludis/resolver/get_initial_constraints_for_helper.cc b/paludis/resolver/get_initial_constraints_for_helper.cc
index ef1fa0c27..1360a1ebe 100644
--- a/paludis/resolver/get_initial_constraints_for_helper.cc
+++ b/paludis/resolver/get_initial_constraints_for_helper.cc
@@ -184,7 +184,7 @@ namespace
static Timestamp current_time(Timestamp::now()); /* static to avoid weirdness */
time_t installed_time(current_time.seconds());
if (id->installed_time_key())
- installed_time = id->installed_time_key()->value().seconds();
+ installed_time = id->installed_time_key()->parse_value().seconds();
return (current_time.seconds() - installed_time) > (24 * 60 * 60 * n);
}
diff --git a/paludis/resolver/get_resolvents_for_helper.cc b/paludis/resolver/get_resolvents_for_helper.cc
index 2288b92f2..c11bc87c5 100644
--- a/paludis/resolver/get_resolvents_for_helper.cc
+++ b/paludis/resolver/get_resolvents_for_helper.cc
@@ -285,8 +285,8 @@ GetResolventsForHelper::operator() (
auto installed_ids((*_imp->env)[selection::BestVersionInEachSlot(
generator::Matches(spec, from_id, { }) |
(_imp->target_destination_type == dt_install_to_chroot ?
- Filter(filter::InstalledNotAtRoot(_imp->env->system_root_key()->value())) :
- Filter(filter::InstalledAtRoot(_imp->env->system_root_key()->value()))))]);
+ Filter(filter::InstalledNotAtRoot(_imp->env->system_root_key()->parse_value())) :
+ Filter(filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))))]);
auto target(is_target(reason));
auto want_installed(target ? _imp->want_installed_slots_for_targets : _imp->want_installed_slots_otherwise);
diff --git a/paludis/resolver/has_behaviour-fwd.hh b/paludis/resolver/has_behaviour-fwd.hh
new file mode 100644
index 000000000..abfcb7f99
--- /dev/null
+++ b/paludis/resolver/has_behaviour-fwd.hh
@@ -0,0 +1,35 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2011 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_HAS_BEHAVIOUR_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_RESOLVER_HAS_BEHAVIOUR_FWD_HH 1
+
+#include <paludis/package_id-fwd.hh>
+
+namespace paludis
+{
+ namespace resolver
+ {
+ bool has_behaviour(
+ const std::shared_ptr<const PackageID> &,
+ const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
+ }
+}
+
+#endif
diff --git a/paludis/resolver/has_behaviour.cc b/paludis/resolver/has_behaviour.cc
new file mode 100644
index 000000000..f7ebc0d1e
--- /dev/null
+++ b/paludis/resolver/has_behaviour.cc
@@ -0,0 +1,39 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2011 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/resolver/has_behaviour.hh>
+
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+
+using namespace paludis;
+using namespace paludis::resolver;
+
+bool
+paludis::resolver::has_behaviour(
+ const std::shared_ptr<const PackageID> & id,
+ const std::string & b)
+{
+ if (! id->behaviours_key())
+ return false;
+
+ auto behaviours(id->behaviours_key()->parse_value());
+ return behaviours->end() != behaviours->find(b);
+}
+
diff --git a/paludis/resolver/has_behaviour.hh b/paludis/resolver/has_behaviour.hh
new file mode 100644
index 000000000..a0cf0d7e9
--- /dev/null
+++ b/paludis/resolver/has_behaviour.hh
@@ -0,0 +1,25 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2011 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_HAS_BEHAVIOUR_HH
+#define PALUDIS_GUARD_PALUDIS_RESOLVER_HAS_BEHAVIOUR_HH 1
+
+#include <paludis/resolver/has_behaviour-fwd.hh>
+
+#endif
diff --git a/paludis/resolver/interest_in_spec_helper.cc b/paludis/resolver/interest_in_spec_helper.cc
index ab0436c93..fc56b3713 100644
--- a/paludis/resolver/interest_in_spec_helper.cc
+++ b/paludis/resolver/interest_in_spec_helper.cc
@@ -206,7 +206,7 @@ namespace
const std::shared_ptr<const PackageIDSequence> installed_ids(
(*env)[selection::SomeArbitraryVersion(
generator::Matches(*dep.spec().if_package(), dep.from_id(), { }) |
- filter::InstalledAtRoot(env->system_root_key()->value()))]);
+ filter::InstalledAtRoot(env->system_root_key()->parse_value()))]);
if (installed_ids->empty())
return false;
}
@@ -344,7 +344,7 @@ InterestInSpecHelper::operator() (
const std::shared_ptr<const PackageIDSequence> installed_ids(
(*_imp->env)[selection::SomeArbitraryVersion(
generator::Matches(*dep.spec().if_package(), dep.from_id(), { }) |
- filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]);
if (! installed_ids->empty())
return si_take;
}
diff --git a/paludis/resolver/resolvent.cc b/paludis/resolver/resolvent.cc
index 758264818..1b0617405 100644
--- a/paludis/resolver/resolvent.cc
+++ b/paludis/resolver/resolvent.cc
@@ -132,7 +132,7 @@ Resolvent::Resolvent(
package(id->name()),
slot(make_named_values<SlotNameOrNull>(
n::name_or_null() = id->slot_key() ?
- std::make_shared<SlotName>(id->slot_key()->value()) :
+ std::make_shared<SlotName>(id->slot_key()->parse_value()) :
make_null_shared_ptr(),
n::null_means_unknown() = false
))
diff --git a/paludis/resolver/same_slot.cc b/paludis/resolver/same_slot.cc
index 7cd9bcfd5..ee80d9f98 100644
--- a/paludis/resolver/same_slot.cc
+++ b/paludis/resolver/same_slot.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010 Ciaran McCreesh
+ * Copyright (c) 2010, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -32,7 +32,7 @@ paludis::resolver::same_slot(
const std::shared_ptr<const PackageID> & b)
{
if (a->slot_key())
- return b->slot_key() && a->slot_key()->value() == b->slot_key()->value();
+ return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value();
else
return ! b->slot_key();
}
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index c24a151b1..e0e682e61 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -491,7 +491,7 @@ SanitisedDependencies::_populate_one(
Finder f(env, decider, resolution, id, changed, *this, ((*id).*pmf)()->initial_labels(), ((*id).*pmf)()->raw_name(),
((*id).*pmf)()->human_name(), "");
- ((*id).*pmf)()->value()->top()->accept(f);
+ ((*id).*pmf)()->parse_value()->top()->accept(f);
}
void
diff --git a/paludis/resolver/spec_rewriter.cc b/paludis/resolver/spec_rewriter.cc
index a6c637e7f..1e0f1af4b 100644
--- a/paludis/resolver/spec_rewriter.cc
+++ b/paludis/resolver/spec_rewriter.cc
@@ -173,7 +173,7 @@ SpecRewriter::_need_rewrites() const
if (! ((*i)->virtual_for_key()))
throw InternalError(PALUDIS_HERE, "huh? " + stringify(**i) + " has no virtual_for_key");
_imp->rewrites.insert(std::make_pair((*i)->name(), std::set<QualifiedPackageName>())).first->second.insert(
- (*i)->virtual_for_key()->value()->name());
+ (*i)->virtual_for_key()->parse_value()->name());
}
#endif
}