aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-16 17:29:10 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-16 17:29:10 +0000
commit3e64739636636c5a8bd088bfa0c63d6d9bcf4d84 (patch)
treeb429b9e04d8fb050d9a43d07fe217f635ba55e4f
parent6458a000d4f6bff1ce7e5bebdfb5315a21975a2c (diff)
downloadpaludis-3e64739636636c5a8bd088bfa0c63d6d9bcf4d84.tar.gz
paludis-3e64739636636c5a8bd088bfa0c63d6d9bcf4d84.tar.xz
Track active conditions for dependency reasons
Fixes: ticket:1064
-rw-r--r--paludis/resolver/sanitised_dependencies.cc12
-rw-r--r--paludis/resolver/sanitised_dependencies.hh2
-rwxr-xr-xsrc/clients/cave/cmd_display_resolution.cc2
3 files changed, 15 insertions, 1 deletions
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index 5076220..139605d 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -314,6 +314,7 @@ namespace
const std::string human_name;
std::string original_specs_as_string;
std::list<std::shared_ptr<const DependenciesLabelSequence> > labels_stack;
+ std::list<ConditionalDepSpec> conditions_stack;
Finder(
const Environment * const e,
@@ -352,7 +353,7 @@ namespace
SanitisedDependency make_sanitised(const PackageOrBlockDepSpec & spec)
{
- std::stringstream adl;
+ std::stringstream adl, acs;
auto classifier(std::make_shared<LabelsClassifier>());
for (DependenciesLabelSequence::ConstIterator i((*labels_stack.begin())->begin()),
i_end((*labels_stack.begin())->end()) ;
@@ -362,7 +363,12 @@ namespace
(*i)->accept(*classifier);
}
+ for (auto c(conditions_stack.begin()), c_end(conditions_stack.end()) ;
+ c != c_end ; ++c)
+ acs << (acs.str().empty() ? "" : ", ") << stringify(*c);
+
return make_named_values<SanitisedDependency>(
+ n::active_conditions_as_string() = acs.str(),
n::active_dependency_labels() = *labels_stack.begin(),
n::active_dependency_labels_as_string() = adl.str(),
n::active_dependency_labels_classifier() = classifier,
@@ -387,9 +393,11 @@ namespace
{
if (changed_choices ? node.spec()->condition_would_be_met_when(*changed_choices) : node.spec()->condition_met())
{
+ conditions_stack.push_front(*node.spec());
labels_stack.push_front(*labels_stack.begin());
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
labels_stack.pop_front();
+ conditions_stack.pop_front();
}
}
@@ -525,6 +533,7 @@ void
SanitisedDependency::serialise(Serialiser & s) const
{
s.object("SanitisedDependency")
+ .member(SerialiserFlags<>(), "active_conditions_as_string", active_conditions_as_string())
.member(SerialiserFlags<>(), "active_dependency_labels_as_string", active_dependency_labels_as_string())
.member(SerialiserFlags<serialise::might_be_null>(), "active_dependency_labels_classifier", active_dependency_labels_classifier())
.member(SerialiserFlags<>(), "metadata_key_human_name", metadata_key_human_name())
@@ -542,6 +551,7 @@ SanitisedDependency::deserialise(Deserialisation & d, const std::shared_ptr<cons
Deserialisator v(d, "SanitisedDependency");
return make_named_values<SanitisedDependency>(
+ n::active_conditions_as_string() = v.member<std::string>("active_conditions_as_string"),
n::active_dependency_labels() = make_null_shared_ptr(),
n::active_dependency_labels_as_string() = v.member<std::string>("active_dependency_labels_as_string"),
n::active_dependency_labels_classifier() = v.member<std::shared_ptr<LabelsClassifier> >("active_dependency_labels_classifier"),
diff --git a/paludis/resolver/sanitised_dependencies.hh b/paludis/resolver/sanitised_dependencies.hh
index 6d77b54..12e7c77 100644
--- a/paludis/resolver/sanitised_dependencies.hh
+++ b/paludis/resolver/sanitised_dependencies.hh
@@ -36,6 +36,7 @@ namespace paludis
{
namespace n
{
+ typedef Name<struct active_conditions_as_string_name> active_conditions_as_string;
typedef Name<struct active_dependency_labels_name> active_dependency_labels;
typedef Name<struct active_dependency_labels_as_string_name> active_dependency_labels_as_string;
typedef Name<struct active_dependency_labels_classifier_name> active_dependency_labels_classifier;
@@ -49,6 +50,7 @@ namespace paludis
{
struct SanitisedDependency
{
+ NamedValue<n::active_conditions_as_string, std::string> active_conditions_as_string;
NamedValue<n::active_dependency_labels, std::shared_ptr<const DependenciesLabelSequence> > active_dependency_labels;
NamedValue<n::active_dependency_labels_as_string, std::string> active_dependency_labels_as_string;
NamedValue<n::active_dependency_labels_classifier, std::shared_ptr<const LabelsClassifier> > active_dependency_labels_classifier;
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 7993d5e..18652f6 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -210,6 +210,8 @@ namespace
+ r.sanitised_dependency().metadata_key_human_name() + "'"
+ (r.sanitised_dependency().active_dependency_labels_as_string().empty() ? "" :
", labelled '" + r.sanitised_dependency().active_dependency_labels_as_string() + "'")
+ + (r.sanitised_dependency().active_conditions_as_string().empty() ? "" :
+ ", conditions '" + r.sanitised_dependency().active_conditions_as_string() + "'")
+ as,
false), false);
}