aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-08 11:40:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-08 11:40:48 +0000
commit87e8dbe0c0dab386965d8a2e94280c5a83bd3a14 (patch)
tree6589b6f508e5b8ec32c7b9faeb35aef2064b05b7
parent141be4efd04237d93c6dff1a844ea9be376caf26 (diff)
downloadpaludis-87e8dbe0c0dab386965d8a2e94280c5a83bd3a14.tar.gz
paludis-87e8dbe0c0dab386965d8a2e94280c5a83bd3a14.tar.xz
DependentReason
-rw-r--r--paludis/resolver/constraint.cc7
-rw-r--r--paludis/resolver/orderer.cc9
-rw-r--r--paludis/resolver/reason-fwd.hh3
-rw-r--r--paludis/resolver/reason.cc44
-rw-r--r--paludis/resolver/reason.hh17
-rw-r--r--src/clients/cave/cmd_display_resolution.cc5
-rw-r--r--src/clients/cave/cmd_resolve_dump.cc5
-rw-r--r--src/clients/cave/resolve_common.cc15
8 files changed, 102 insertions, 3 deletions
diff --git a/paludis/resolver/constraint.cc b/paludis/resolver/constraint.cc
index 79124f4..b89435a 100644
--- a/paludis/resolver/constraint.cc
+++ b/paludis/resolver/constraint.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 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
@@ -168,6 +168,11 @@ namespace
{
return make_null_shared_ptr();
}
+
+ const std::tr1::shared_ptr<const PackageID> visit(const DependentReason &) const
+ {
+ return make_null_shared_ptr();
+ }
};
}
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index daeb486..999b85e 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -482,6 +482,10 @@ namespace
}
}
}
+
+ void visit(const DependentReason &) const
+ {
+ }
};
struct DepArrowHandler
@@ -720,6 +724,11 @@ namespace
struct AlreadyMetDep
{
+ bool visit(const DependentReason &) const
+ {
+ return false;
+ }
+
bool visit(const PresetReason &) const
{
return false;
diff --git a/paludis/resolver/reason-fwd.hh b/paludis/resolver/reason-fwd.hh
index 14d0ae2..4fa50d7 100644
--- a/paludis/resolver/reason-fwd.hh
+++ b/paludis/resolver/reason-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 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
@@ -31,6 +31,7 @@ namespace paludis
struct TargetReason;
struct PresetReason;
struct SetReason;
+ struct DependentReason;
}
}
diff --git a/paludis/resolver/reason.cc b/paludis/resolver/reason.cc
index 6191782..7499979 100644
--- a/paludis/resolver/reason.cc
+++ b/paludis/resolver/reason.cc
@@ -109,6 +109,43 @@ DependencyReason::serialise(Serialiser & s) const
namespace paludis
{
template <>
+ struct Implementation<DependentReason>
+ {
+ const std::tr1::shared_ptr<const PackageID> id_being_removed;
+
+ Implementation(const std::tr1::shared_ptr<const PackageID> & i) :
+ id_being_removed(i)
+ {
+ }
+ };
+}
+
+DependentReason::DependentReason(const std::tr1::shared_ptr<const PackageID> & i) :
+ PrivateImplementationPattern<DependentReason>(new Implementation<DependentReason>(i))
+{
+}
+
+DependentReason::~DependentReason()
+{
+}
+
+const std::tr1::shared_ptr<const PackageID>
+DependentReason::id_being_removed() const
+{
+ return _imp->id_being_removed;
+}
+
+void
+DependentReason::serialise(Serialiser & s) const
+{
+ s.object("DependencyReason")
+ .member(SerialiserFlags<serialise::might_be_null>(), "id_being_removed", id_being_removed())
+ ;
+}
+
+namespace paludis
+{
+ template <>
struct Implementation<PresetReason>
{
const std::string explanation;
@@ -233,11 +270,18 @@ Reason::deserialise(Deserialisation & d)
v.member<bool>("already_met"))
);
}
+ else if (d.class_name() == "DependentReason")
+ {
+ Deserialisator v(d, "DependentReason");
+ const std::tr1::shared_ptr<const PackageID> id_being_removed(v.member<std::tr1::shared_ptr<const PackageID> >("id_being_removed"));
+ return make_shared_ptr(new DependentReason(id_being_removed));
+ }
else
throw InternalError(PALUDIS_HERE, "unknown class '" + stringify(d.class_name()) + "'");
}
template class PrivateImplementationPattern<DependencyReason>;
+template class PrivateImplementationPattern<DependentReason>;
template class PrivateImplementationPattern<SetReason>;
template class PrivateImplementationPattern<PresetReason>;
diff --git a/paludis/resolver/reason.hh b/paludis/resolver/reason.hh
index a48e84e..8144e76 100644
--- a/paludis/resolver/reason.hh
+++ b/paludis/resolver/reason.hh
@@ -37,7 +37,7 @@ namespace paludis
{
class Reason :
public virtual DeclareAbstractAcceptMethods<Reason, MakeTypeList<
- TargetReason, DependencyReason, PresetReason, SetReason>::Type>
+ TargetReason, DependencyReason, DependentReason, PresetReason, SetReason>::Type>
{
public:
virtual ~Reason() = 0;
@@ -78,6 +78,20 @@ namespace paludis
virtual void serialise(Serialiser &) const;
};
+ class DependentReason :
+ private PrivateImplementationPattern<DependentReason>,
+ public Reason,
+ public ImplementAcceptMethods<Reason, DependentReason>
+ {
+ public:
+ DependentReason(const std::tr1::shared_ptr<const PackageID> & id);
+ ~DependentReason();
+
+ const std::tr1::shared_ptr<const PackageID> id_being_removed() const;
+
+ virtual void serialise(Serialiser &) const;
+ };
+
class PresetReason :
private PrivateImplementationPattern<PresetReason>,
public Reason,
@@ -114,6 +128,7 @@ namespace paludis
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
extern template class PrivateImplementationPattern<resolver::DependencyReason>;
+ extern template class PrivateImplementationPattern<resolver::DependentReason>;
extern template class PrivateImplementationPattern<resolver::SetReason>;
#endif
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index f486433..615af9f 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -195,6 +195,11 @@ namespace
}
}
+ std::pair<std::string, bool> visit(const DependentReason & r) const
+ {
+ return std::make_pair("dependent upon " + stringify(*r.id_being_removed()), true);
+ }
+
std::pair<std::string, bool> visit(const TargetReason &) const
{
return std::make_pair("target", true);
diff --git a/src/clients/cave/cmd_resolve_dump.cc b/src/clients/cave/cmd_resolve_dump.cc
index 40f8fa3..caf5a80 100644
--- a/src/clients/cave/cmd_resolve_dump.cc
+++ b/src/clients/cave/cmd_resolve_dump.cc
@@ -156,6 +156,11 @@ namespace
str = "Set(" + stringify(r.set_name()) + " " + f.str + ")";
}
+ void visit(const DependentReason & r)
+ {
+ str = "Dependent(" + stringify(*r.id_being_removed()) + ")";
+ }
+
void visit(const DependencyReason & r)
{
std::stringstream s;
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index c945246..8242cc6 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -340,6 +340,11 @@ namespace
return common_target();
}
+ DestinationTypes visit(const DependentReason &) const
+ {
+ return common_target();
+ }
+
DestinationTypes visit(const DependencyReason & reason) const
{
DestinationTypes result;
@@ -512,6 +517,11 @@ namespace
return use_existing_from_cmdline(resolution_options.a_keep_targets, from_set);
}
+ UseExisting visit(const DependentReason &) const
+ {
+ return ue_if_possible;
+ }
+
UseExisting visit(const PresetReason &) const
{
return ue_if_possible;
@@ -697,6 +707,11 @@ namespace
return false;
}
+ bool visit(const DependentReason &) const
+ {
+ return false;
+ }
+
bool visit(const PresetReason &) const
{
return false;