aboutsummaryrefslogtreecommitdiff
path: root/paludis/resolver/get_sameness.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/resolver/get_sameness.cc')
-rw-r--r--paludis/resolver/get_sameness.cc44
1 files changed, 10 insertions, 34 deletions
diff --git a/paludis/resolver/get_sameness.cc b/paludis/resolver/get_sameness.cc
index e313901a1..29c8a2ab7 100644
--- a/paludis/resolver/get_sameness.cc
+++ b/paludis/resolver/get_sameness.cc
@@ -40,38 +40,6 @@ using namespace paludis::resolver;
namespace
{
- /* since the EAPI5 syntax for rewritten := deps in the VDB doesn't
- allow us to tell whether the dep was originally a := kind or
- a :slot= kind, normalise them all to the same thing to avoid
- spurious differences */
- struct SloppySlotStringifier
- {
- /* this is probably covered by the generic case that just
- does a stringify, but a package format could theoretically
- define a different representation, so assume the standard
- form here for compatibility with the other two that we're
- assuming */
- std::string visit(const SlotAnyAtAllLockedRequirement &) const
- {
- return ":=";
- }
-
- std::string visit(const SlotAnyPartialLockedRequirement &) const
- {
- return ":=";
- }
-
- std::string visit(const SlotUnknownRewrittenRequirement &) const
- {
- return ":=";
- }
-
- std::string visit(const SlotRequirement & r) const
- {
- return stringify(r);
- }
- };
-
struct ComparingPrettyPrinter :
UnformattedPrettyPrinter
{
@@ -102,9 +70,17 @@ namespace
if (s.slot_requirement_ptr())
{
+ /* since the EAPI5 syntax for rewritten := deps in the VDB
+ * doesn't allow us to tell whether the dep was originally a :=
+ * kind or a :slot= kind, normalise them all to the same thing
+ * to avoid spurious differences */
auto r(s.slot_requirement_ptr()->maybe_original_requirement_if_rewritten());
- tokens.insert("slot_requirement:" + (r ? r : s.slot_requirement_ptr())
- ->accept_returning<std::string>(SloppySlotStringifier()));
+ tokens.insert("slot_requirement:" + (r ? r : s.slot_requirement_ptr())->make_accept_returning(
+ [&] (const SlotAnyAtAllLockedRequirement &) { return std::string{ ":=" }; },
+ [&] (const SlotAnyPartialLockedRequirement &) { return std::string{ ":=" }; },
+ [&] (const SlotUnknownRewrittenRequirement &) { return std::string{ ":=" }; },
+ [&] (const SlotRequirement & q) { return stringify(q); }
+ ));
}
if (s.in_repository_ptr())