aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-29 02:09:11 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-01 03:57:52 +0000
commitcdaf7c2138035625d99ee5be127f427943b66e09 (patch)
tree4c8999476b01ae421aba55bcec101b827f2ce3d6
parentd3dcce377a01c5b3ae0414e9e4dd67eaddc4ef0e (diff)
downloadpaludis-cdaf7c2138035625d99ee5be127f427943b66e09.tar.gz
paludis-cdaf7c2138035625d99ee5be127f427943b66e09.tar.xz
Pass env, package_id to labels enabled
-rw-r--r--paludis/always_enabled_dependency_label.cc2
-rw-r--r--paludis/always_enabled_dependency_label.hh4
-rw-r--r--paludis/dep_label.hh12
-rw-r--r--paludis/repositories/e/dep_parser.cc66
-rw-r--r--paludis/resolver/get_resolvents_for_helper.cc13
-rw-r--r--paludis/resolver/interest_in_spec_helper.cc12
-rw-r--r--paludis/resolver/labels_classifier-fwd.hh43
-rw-r--r--paludis/resolver/labels_classifier.cc66
-rw-r--r--paludis/resolver/labels_classifier.hh54
-rw-r--r--paludis/resolver/orderer.cc7
-rw-r--r--paludis/resolver/sanitised_dependencies.cc2
11 files changed, 184 insertions, 97 deletions
diff --git a/paludis/always_enabled_dependency_label.cc b/paludis/always_enabled_dependency_label.cc
index 9bfd7dd..682ae06 100644
--- a/paludis/always_enabled_dependency_label.cc
+++ b/paludis/always_enabled_dependency_label.cc
@@ -41,7 +41,7 @@ AlwaysEnabledDependencyLabel<Label_>::text() const
template <typename Label_>
bool
-AlwaysEnabledDependencyLabel<Label_>::enabled() const
+AlwaysEnabledDependencyLabel<Label_>::enabled(const Environment * const, const std::shared_ptr<const PackageID> &) const
{
return true;
}
diff --git a/paludis/always_enabled_dependency_label.hh b/paludis/always_enabled_dependency_label.hh
index de260bc..ed0c5d8 100644
--- a/paludis/always_enabled_dependency_label.hh
+++ b/paludis/always_enabled_dependency_label.hh
@@ -38,7 +38,9 @@ namespace paludis
~AlwaysEnabledDependencyLabel();
virtual const std::string text() const;
- virtual bool enabled() const;
+ virtual bool enabled(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &) const;
};
extern template class AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag>;
diff --git a/paludis/dep_label.hh b/paludis/dep_label.hh
index dc5925a..57ad3a1 100644
--- a/paludis/dep_label.hh
+++ b/paludis/dep_label.hh
@@ -22,6 +22,8 @@
#include <paludis/dep_label-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/pimp.hh>
#include <paludis/util/attributes.hh>
@@ -128,8 +130,14 @@ namespace paludis
/// Our text.
virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- /// Are we enabled?
- virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ /**
+ * Are we enabled?
+ *
+ * \since 0.58 takes env, package_id
+ */
+ virtual bool enabled(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
/**
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index 9438750..a589307 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -915,6 +915,29 @@ namespace
{
typedef std::tuple<std::string, std::string, std::string> DepLabelsIndex;
+ struct EnabledByChoiceTestDependencyLabel :
+ DependenciesTestLabel
+ {
+ std::string label_text;
+ ChoiceNameWithPrefix choice_name;
+
+ EnabledByChoiceTestDependencyLabel(const std::string & s, const ChoiceNameWithPrefix & p) :
+ label_text(s),
+ choice_name(p)
+ {
+ }
+
+ virtual bool enabled(const Environment * const env, const std::shared_ptr<const PackageID> & id) const
+ {
+ return enabled_if_option(env, id, label_text, choice_name);
+ }
+
+ virtual const std::string text() const
+ {
+ return label_text;
+ }
+ };
+
struct DepLabelsStore :
Singleton<DepLabelsStore>
{
@@ -945,6 +968,15 @@ namespace
throw EDepParseError(text, "Label '" + text + "' maps to unknown class '" + class_name + "'");
}
+ std::shared_ptr<DependenciesLabel> make_test(const std::string & class_name,
+ const ChoiceNameWithPrefix & c, const std::string & text)
+ {
+ if (class_name == "DependenciesTestLabel")
+ return std::make_shared<EnabledByChoiceTestDependencyLabel>(text, c);
+ else
+ throw EDepParseError(text, "Label '" + text + "' maps to unknown test label class '" + class_name + "'");
+ }
+
std::shared_ptr<DependenciesLabel> get(const std::string & eapi_name, const std::string & class_name, const std::string & text)
{
Lock lock(mutex);
@@ -955,36 +987,25 @@ namespace
i = store.insert(std::make_pair(x, make(class_name, text))).first;
return i->second;
}
- };
-
- struct TestLabel :
- DependenciesTestLabel
- {
- std::string label_text;
- std::function<bool ()> label_enabled;
- TestLabel(const std::string & s, const std::function<bool ()> & l) :
- label_text(s),
- label_enabled(l)
+ std::shared_ptr<DependenciesLabel> get_test(const std::string & eapi_name, const std::string & class_name,
+ const ChoiceNameWithPrefix & choice_name, const std::string & text)
{
- }
-
- virtual bool enabled() const
- {
- return label_enabled();
- }
+ Lock lock(mutex);
+ DepLabelsIndex x{eapi_name, class_name, stringify(choice_name) + "/" + text};
- virtual const std::string text() const
- {
- return label_text;
+ auto i(store.find(x));
+ if (i == store.end())
+ i = store.insert(std::make_pair(x, make_test(class_name, choice_name, text))).first;
+ return i->second;
}
};
}
std::shared_ptr<DependenciesLabelsDepSpec>
paludis::erepository::parse_dependency_label(
- const Environment * const env,
- const std::shared_ptr<const PackageID> & id,
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
const std::string & s,
const EAPI & e)
{
@@ -1017,8 +1038,7 @@ paludis::erepository::parse_dependency_label(
if (cc.empty())
l->add_label(DepLabelsStore::get_instance()->get(e.name(), c, *it));
else
- l->add_label(std::make_shared<TestLabel>(*it, std::bind(
- &enabled_if_option, env, id, *it, ChoiceNameWithPrefix(cc))));
+ l->add_label(DepLabelsStore::get_instance()->get_test(e.name(), c, ChoiceNameWithPrefix(cc), *it));
}
else
l->add_label(DepLabelsStore::get_instance()->get(e.name(), c, *it));
diff --git a/paludis/resolver/get_resolvents_for_helper.cc b/paludis/resolver/get_resolvents_for_helper.cc
index 04d5f49..24a6f36 100644
--- a/paludis/resolver/get_resolvents_for_helper.cc
+++ b/paludis/resolver/get_resolvents_for_helper.cc
@@ -140,6 +140,7 @@ namespace
{
struct DestinationTypesFinder
{
+ const Environment * const env;
const DestinationType target_destination_type;
const bool want_target_dependencies;
const bool want_target_runtime_dependencies;
@@ -182,7 +183,7 @@ namespace
{
/* this will track run deps of build deps, which isn't
* really right... */
- if (is_run_or_post_dep(dep.sanitised_dependency()))
+ if (is_run_or_post_dep(env, package_id, dep.sanitised_dependency()))
binary_if_possible = true;
}
@@ -198,7 +199,7 @@ namespace
chroot_if_possible = true;
else if (want_target_runtime_dependencies)
{
- if (is_run_or_post_dep(dep.sanitised_dependency()))
+ if (is_run_or_post_dep(env, package_id, dep.sanitised_dependency()))
chroot_if_possible = true;
}
@@ -216,9 +217,9 @@ namespace
if (want_runtime_dependencies_on_slash ^ want_dependencies_on_slash)
{
- if (want_dependencies_on_slash && ! is_run_or_post_dep(dep.sanitised_dependency()))
+ if (want_dependencies_on_slash && ! is_run_or_post_dep(env, package_id, dep.sanitised_dependency()))
slash += dt_install_to_slash;
- if (want_runtime_dependencies_on_slash && is_run_or_post_dep(dep.sanitised_dependency()))
+ if (want_runtime_dependencies_on_slash && is_run_or_post_dep(env, package_id, dep.sanitised_dependency()))
slash += dt_install_to_slash;
}
else if (want_runtime_dependencies_on_slash || want_dependencies_on_slash)
@@ -244,7 +245,7 @@ namespace
};
DestinationTypes get_destination_types_for_fn(
- const Environment * const,
+ const Environment * const env,
const PackageDepSpec &,
const DestinationType target_destination_type,
const bool want_target_dependencies,
@@ -254,7 +255,7 @@ namespace
const std::shared_ptr<const PackageID> & package_id,
const std::shared_ptr<const Reason> & reason)
{
- DestinationTypesFinder f{target_destination_type, want_target_dependencies, want_target_runtime_dependencies,
+ DestinationTypesFinder f{env, target_destination_type, want_target_dependencies, want_target_runtime_dependencies,
want_dependencies_on_slash, want_runtime_dependencies_on_slash, package_id};
return reason->accept_returning<DestinationTypes>(f);
}
diff --git a/paludis/resolver/interest_in_spec_helper.cc b/paludis/resolver/interest_in_spec_helper.cc
index e1eaeb9..35f5fc9 100644
--- a/paludis/resolver/interest_in_spec_helper.cc
+++ b/paludis/resolver/interest_in_spec_helper.cc
@@ -181,17 +181,17 @@ namespace
if (ignore_dep_from(env, no_blockers_from_specs, no_dependencies_from_specs, decision.existing_id(), bool(dep.spec().if_block())))
return false;
- if (! is_enabled_dep(dep))
+ if (! is_enabled_dep(env, decision.existing_id(), dep))
return false;
if (! follow_installed_build_dependencies)
- if (is_just_build_dep(dep))
+ if (is_just_build_dep(env, decision.existing_id(), dep))
return false;
if (! follow_installed_dependencies)
- if (! is_compiled_against_dep(dep))
+ if (! is_compiled_against_dep(env, decision.existing_id(), dep))
return false;
- if (is_suggestion(dep) || is_recommendation(dep))
+ if (is_suggestion(env, decision.existing_id(), dep) || is_recommendation(env, decision.existing_id(), dep))
{
/* we only take a suggestion or recommendation for an existing
* package if it's already met. for now, we ignore suggested
@@ -236,7 +236,7 @@ namespace
if (ignore_dep_from(env, no_blockers_from_specs, no_dependencies_from_specs, decision.origin_id(), bool(dep.spec().if_block())))
return false;
- if (is_enabled_dep(dep))
+ if (is_enabled_dep(env, decision.origin_id(), dep))
return true;
return false;
@@ -255,7 +255,7 @@ InterestInSpecHelper::operator() (
if (resolution->decision()->accept_returning<bool>(v))
{
- bool suggestion(is_suggestion(dep)), recommendation(is_recommendation(dep));
+ bool suggestion(is_suggestion(_imp->env, id, dep)), recommendation(is_recommendation(_imp->env, id, dep));
if (! (suggestion || recommendation))
return si_take;
diff --git a/paludis/resolver/labels_classifier-fwd.hh b/paludis/resolver/labels_classifier-fwd.hh
index 198ad5a..794d58c 100644
--- a/paludis/resolver/labels_classifier-fwd.hh
+++ b/paludis/resolver/labels_classifier-fwd.hh
@@ -22,6 +22,9 @@
#include <paludis/util/attributes.hh>
#include <paludis/resolver/sanitised_dependencies-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <memory>
namespace paludis
{
@@ -29,14 +32,40 @@ namespace paludis
{
struct LabelsClassifier;
- bool is_suggestion(const SanitisedDependency & dep) PALUDIS_ATTRIBUTE((warn_unused_result));
- bool is_recommendation(const SanitisedDependency & dep) PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool is_suggestion(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const SanitisedDependency &) PALUDIS_ATTRIBUTE((warn_unused_result));
- bool is_just_build_dep(const SanitisedDependency & dep) PALUDIS_ATTRIBUTE((warn_unused_result));
- bool is_just_fetch_dep(const SanitisedDependency & dep) PALUDIS_ATTRIBUTE((warn_unused_result));
- bool is_run_or_post_dep(const SanitisedDependency & dep) PALUDIS_ATTRIBUTE((warn_unused_result));
- bool is_compiled_against_dep(const SanitisedDependency & dep) PALUDIS_ATTRIBUTE((warn_unused_result));
- bool is_enabled_dep(const SanitisedDependency & dep) PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool is_recommendation(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const SanitisedDependency &) PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool is_just_build_dep(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const SanitisedDependency &) PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool is_just_fetch_dep(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const SanitisedDependency &) PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool is_run_or_post_dep(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const SanitisedDependency &) PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool is_compiled_against_dep(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const SanitisedDependency &) PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool is_enabled_dep(
+ const Environment * const,
+ const std::shared_ptr<const PackageID> &,
+ const SanitisedDependency &) PALUDIS_ATTRIBUTE((warn_unused_result));
}
}
diff --git a/paludis/resolver/labels_classifier.cc b/paludis/resolver/labels_classifier.cc
index f6dd4ce..73ee75c 100644
--- a/paludis/resolver/labels_classifier.cc
+++ b/paludis/resolver/labels_classifier.cc
@@ -22,6 +22,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/pimp-impl.hh>
#include <paludis/dep_label.hh>
#include <paludis/serialise-impl.hh>
#include <algorithm>
@@ -29,7 +30,24 @@
using namespace paludis;
using namespace paludis::resolver;
-LabelsClassifier::LabelsClassifier() :
+namespace paludis
+{
+ template <>
+ struct Imp<LabelsClassifier>
+ {
+ const Environment * const env;
+ const std::shared_ptr<const PackageID> package_id;
+
+ Imp(const Environment * const e, const std::shared_ptr<const PackageID> & i) :
+ env(e),
+ package_id(i)
+ {
+ }
+ };
+}
+
+LabelsClassifier::LabelsClassifier(const Environment * const env, const std::shared_ptr<const PackageID> & id) :
+ Pimp<LabelsClassifier>(env, id),
any_enabled(false),
includes_buildish(false),
includes_compile_against(false),
@@ -44,10 +62,12 @@ LabelsClassifier::LabelsClassifier() :
{
}
+LabelsClassifier::~LabelsClassifier() = default;
+
void
LabelsClassifier::visit(const DependenciesBuildLabel & l)
{
- if (l.enabled())
+ if (l.enabled(_imp->env, _imp->package_id))
{
is_requirement = true;
includes_buildish = true;
@@ -59,7 +79,7 @@ LabelsClassifier::visit(const DependenciesBuildLabel & l)
void
LabelsClassifier::visit(const DependenciesTestLabel & l)
{
- if (l.enabled())
+ if (l.enabled(_imp->env, _imp->package_id))
{
is_requirement = true;
includes_buildish = true;
@@ -70,7 +90,7 @@ LabelsClassifier::visit(const DependenciesTestLabel & l)
void
LabelsClassifier::visit(const DependenciesFetchLabel & l)
{
- if (l.enabled())
+ if (l.enabled(_imp->env, _imp->package_id))
{
is_requirement = true;
includes_buildish = true;
@@ -83,7 +103,7 @@ LabelsClassifier::visit(const DependenciesFetchLabel & l)
void
LabelsClassifier::visit(const DependenciesRunLabel & l)
{
- if (l.enabled())
+ if (l.enabled(_imp->env, _imp->package_id))
{
is_requirement = true;
includes_non_post_runish = true;
@@ -94,7 +114,7 @@ LabelsClassifier::visit(const DependenciesRunLabel & l)
void
LabelsClassifier::visit(const DependenciesPostLabel & l)
{
- if (l.enabled())
+ if (l.enabled(_imp->env, _imp->package_id))
{
is_requirement = true;
includes_postish = true;
@@ -105,7 +125,7 @@ LabelsClassifier::visit(const DependenciesPostLabel & l)
void
LabelsClassifier::visit(const DependenciesInstallLabel & l)
{
- if (l.enabled())
+ if (l.enabled(_imp->env, _imp->package_id))
{
is_requirement = true;
includes_buildish = true;
@@ -117,7 +137,7 @@ LabelsClassifier::visit(const DependenciesInstallLabel & l)
void
LabelsClassifier::visit(const DependenciesCompileAgainstLabel & l)
{
- if (l.enabled())
+ if (l.enabled(_imp->env, _imp->package_id))
{
is_requirement = true;
includes_non_post_runish = true;
@@ -130,7 +150,7 @@ LabelsClassifier::visit(const DependenciesCompileAgainstLabel & l)
void
LabelsClassifier::visit(const DependenciesRecommendationLabel & l)
{
- if (l.enabled())
+ if (l.enabled(_imp->env, _imp->package_id))
{
is_recommendation = true;
includes_postish = true;
@@ -141,7 +161,7 @@ LabelsClassifier::visit(const DependenciesRecommendationLabel & l)
void
LabelsClassifier::visit(const DependenciesSuggestionLabel & l)
{
- if (l.enabled())
+ if (l.enabled(_imp->env, _imp->package_id))
{
is_suggestion = true;
includes_postish = true;
@@ -172,7 +192,7 @@ LabelsClassifier::deserialise(
Deserialisation & d)
{
Deserialisator v(d, "LabelsClassifier");
- auto result(std::make_shared<LabelsClassifier>());
+ auto result(std::make_shared<LabelsClassifier>(static_cast<const Environment *>(0), std::shared_ptr<const PackageID>()));
result->any_enabled = v.member<bool>("any_enabled");
result->includes_buildish = v.member<bool>("includes_buildish");
result->includes_compile_against = v.member<bool>("includes_compile_against");
@@ -189,12 +209,12 @@ LabelsClassifier::deserialise(
}
bool
-paludis::resolver::is_suggestion(const SanitisedDependency & dep)
+paludis::resolver::is_suggestion(const Environment * const env, const std::shared_ptr<const PackageID> & id, const SanitisedDependency & dep)
{
if (dep.active_dependency_labels()->empty())
return false;
- LabelsClassifier v;
+ LabelsClassifier v(env, id);
std::for_each(indirect_iterator(dep.active_dependency_labels()->begin()),
indirect_iterator(dep.active_dependency_labels()->end()),
accept_visitor(v));
@@ -202,12 +222,12 @@ paludis::resolver::is_suggestion(const SanitisedDependency & dep)
}
bool
-paludis::resolver::is_recommendation(const SanitisedDependency & dep)
+paludis::resolver::is_recommendation(const Environment * const env, const std::shared_ptr<const PackageID> & id, const SanitisedDependency & dep)
{
if (dep.active_dependency_labels()->empty())
return false;
- LabelsClassifier v;
+ LabelsClassifier v(env, id);
std::for_each(indirect_iterator(dep.active_dependency_labels()->begin()),
indirect_iterator(dep.active_dependency_labels()->end()),
accept_visitor(v));
@@ -215,12 +235,12 @@ paludis::resolver::is_recommendation(const SanitisedDependency & dep)
}
bool
-paludis::resolver::is_just_build_dep(const SanitisedDependency & dep)
+paludis::resolver::is_just_build_dep(const Environment * const env, const std::shared_ptr<const PackageID> & id, const SanitisedDependency & dep)
{
if (dep.active_dependency_labels()->empty())
throw InternalError(PALUDIS_HERE, "not implemented");
- LabelsClassifier v;
+ LabelsClassifier v(env, id);
std::for_each(indirect_iterator(dep.active_dependency_labels()->begin()),
indirect_iterator(dep.active_dependency_labels()->end()),
accept_visitor(v));
@@ -228,12 +248,12 @@ paludis::resolver::is_just_build_dep(const SanitisedDependency & dep)
}
bool
-paludis::resolver::is_compiled_against_dep(const SanitisedDependency & dep)
+paludis::resolver::is_compiled_against_dep(const Environment * const env, const std::shared_ptr<const PackageID> & id, const SanitisedDependency & dep)
{
if (dep.active_dependency_labels()->empty())
throw InternalError(PALUDIS_HERE, "not implemented");
- LabelsClassifier v;
+ LabelsClassifier v(env, id);
std::for_each(indirect_iterator(dep.active_dependency_labels()->begin()),
indirect_iterator(dep.active_dependency_labels()->end()),
accept_visitor(v));
@@ -241,12 +261,12 @@ paludis::resolver::is_compiled_against_dep(const SanitisedDependency & dep)
}
bool
-paludis::resolver::is_enabled_dep(const SanitisedDependency & dep)
+paludis::resolver::is_enabled_dep(const Environment * const env, const std::shared_ptr<const PackageID> & id, const SanitisedDependency & dep)
{
if (dep.active_dependency_labels()->empty())
throw InternalError(PALUDIS_HERE, "not implemented");
- LabelsClassifier v;
+ LabelsClassifier v(env, id);
std::for_each(indirect_iterator(dep.active_dependency_labels()->begin()),
indirect_iterator(dep.active_dependency_labels()->end()),
accept_visitor(v));
@@ -254,12 +274,12 @@ paludis::resolver::is_enabled_dep(const SanitisedDependency & dep)
}
bool
-paludis::resolver::is_run_or_post_dep(const SanitisedDependency & dep)
+paludis::resolver::is_run_or_post_dep(const Environment * const env, const std::shared_ptr<const PackageID> & id, const SanitisedDependency & dep)
{
if (dep.active_dependency_labels()->empty())
throw InternalError(PALUDIS_HERE, "not implemented");
- LabelsClassifier v;
+ LabelsClassifier v(env, id);
std::for_each(indirect_iterator(dep.active_dependency_labels()->begin()),
indirect_iterator(dep.active_dependency_labels()->end()),
accept_visitor(v));
diff --git a/paludis/resolver/labels_classifier.hh b/paludis/resolver/labels_classifier.hh
index fd2d990..c491505 100644
--- a/paludis/resolver/labels_classifier.hh
+++ b/paludis/resolver/labels_classifier.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_LABELS_CLASSIFIER_HH 1
#include <paludis/resolver/labels_classifier-fwd.hh>
+#include <paludis/util/pimp.hh>
#include <paludis/dep_label-fwd.hh>
#include <paludis/serialise-fwd.hh>
@@ -28,38 +29,41 @@ namespace paludis
{
namespace resolver
{
- struct LabelsClassifier
+ class LabelsClassifier :
+ private Pimp<LabelsClassifier>
{
- LabelsClassifier();
+ public:
+ LabelsClassifier(const Environment * const, const std::shared_ptr<const PackageID> &);
+ ~LabelsClassifier();
- bool any_enabled;
+ bool any_enabled;
- bool includes_buildish;
- bool includes_compile_against;
- bool includes_fetch;
- bool includes_non_post_runish;
- bool includes_non_test_buildish;
- bool includes_post;
- bool includes_postish;
+ bool includes_buildish;
+ bool includes_compile_against;
+ bool includes_fetch;
+ bool includes_non_post_runish;
+ bool includes_non_test_buildish;
+ bool includes_post;
+ bool includes_postish;
- bool is_recommendation;
- bool is_requirement;
- bool is_suggestion;
+ bool is_recommendation;
+ bool is_requirement;
+ bool is_suggestion;
- void visit(const DependenciesBuildLabel &);
- void visit(const DependenciesCompileAgainstLabel &);
- void visit(const DependenciesFetchLabel &);
- void visit(const DependenciesInstallLabel &);
- void visit(const DependenciesPostLabel &);
- void visit(const DependenciesRecommendationLabel &);
- void visit(const DependenciesRunLabel &);
- void visit(const DependenciesSuggestionLabel &);
- void visit(const DependenciesTestLabel &);
+ void visit(const DependenciesBuildLabel &);
+ void visit(const DependenciesCompileAgainstLabel &);
+ void visit(const DependenciesFetchLabel &);
+ void visit(const DependenciesInstallLabel &);
+ void visit(const DependenciesPostLabel &);
+ void visit(const DependenciesRecommendationLabel &);
+ void visit(const DependenciesRunLabel &);
+ void visit(const DependenciesSuggestionLabel &);
+ void visit(const DependenciesTestLabel &);
- void serialise(Serialiser &) const;
+ void serialise(Serialiser &) const;
- static const std::shared_ptr<LabelsClassifier> deserialise(
- Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
+ static const std::shared_ptr<LabelsClassifier> deserialise(
+ Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index 48600c4..50a3fc1 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -226,16 +226,19 @@ namespace
struct EdgesFromReasonVisitor
{
+ const Environment * const env;
const std::shared_ptr<NAG> nag;
const ResolventsSet & ignore_dependencies_from_resolvents;
const Resolvent resolvent;
const std::function<NAGIndexRole (const Resolvent &)> role_for_fetching;
EdgesFromReasonVisitor(
+ const Environment * const e,
const std::shared_ptr<NAG> & n,
const ResolventsSet & i,
const Resolvent & v,
const std::function<NAGIndexRole (const Resolvent &)> & f) :
+ env(e),
nag(n),
ignore_dependencies_from_resolvents(i),
resolvent(v),
@@ -251,7 +254,7 @@ namespace
return;
/* what sort of dep are we? */
- LabelsClassifier classifier;
+ LabelsClassifier classifier(env, r.from_id());
for (DependenciesLabelSequence::ConstIterator l(r.sanitised_dependency().active_dependency_labels()->begin()),
l_end(r.sanitised_dependency().active_dependency_labels()->end()) ;
l != l_end ; ++l)
@@ -471,7 +474,7 @@ Orderer::resolve()
_add_binary_cleverness(*r);
- EdgesFromReasonVisitor edges_from_reason_visitor(_imp->resolved->nag(), ignore_dependencies_from_resolvents, (*r)->resolvent(),
+ EdgesFromReasonVisitor edges_from_reason_visitor(_imp->env, _imp->resolved->nag(), ignore_dependencies_from_resolvents, (*r)->resolvent(),
std::bind(&Orderer::_role_for_fetching, this, std::placeholders::_1));
for (Constraints::ConstIterator c((*r)->constraints()->begin()),
c_end((*r)->constraints()->end()) ;
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index 0a8d520..02a8b6f 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -360,7 +360,7 @@ namespace
SanitisedDependency make_sanitised(const PackageOrBlockDepSpec & spec)
{
std::stringstream adl, acs;
- auto classifier(std::make_shared<LabelsClassifier>());
+ auto classifier(std::make_shared<LabelsClassifier>(env, our_id));
for (DependenciesLabelSequence::ConstIterator i((*labels_stack.begin())->begin()),
i_end((*labels_stack.begin())->end()) ;
i != i_end ; ++i)