aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2012-11-16 00:17:54 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2012-11-16 22:28:15 +0000
commita48b2c55c744a8a8c04464533b482302f838102b (patch)
treef520104ec739a16543d0065e21cc3b2d59fe2ae8
parent82518eb45b579e15db394764c79a35e0df740def (diff)
downloadpaludis-a48b2c55c744a8a8c04464533b482302f838102b.tar.gz
paludis-a48b2c55c744a8a8c04464533b482302f838102b.tar.xz
Introduce SlotUnknownRewrittenRequirement
-rw-r--r--paludis/match_package.cc5
-rw-r--r--paludis/resolver/decider.cc5
-rw-r--r--paludis/resolver/get_sameness.cc40
-rw-r--r--paludis/slot_requirement-fwd.hh1
-rw-r--r--paludis/slot_requirement.hh22
-rw-r--r--python/slot_requirement.cc21
-rw-r--r--ruby/dep_spec.cc24
7 files changed, 106 insertions, 12 deletions
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index 0f9bac3..8e1167b 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -85,6 +85,11 @@ namespace
{
result = true;
}
+
+ void visit(const SlotUnknownRewrittenRequirement &) PALUDIS_ATTRIBUTE((noreturn))
+ {
+ throw InternalError(PALUDIS_HERE, "Should not be matching against SlotUnknownRewrittenRequirement");
+ }
};
}
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index f01f76a..118f11b 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -1361,6 +1361,11 @@ namespace
{
return make_null_shared_ptr();
}
+
+ std::shared_ptr<SlotName> visit(const SlotUnknownRewrittenRequirement &) PALUDIS_ATTRIBUTE((noreturn))
+ {
+ throw InternalError(PALUDIS_HERE, "Should not be finding resolvents matching a SlotUnknownRewrittenRequirement");
+ }
};
}
diff --git a/paludis/resolver/get_sameness.cc b/paludis/resolver/get_sameness.cc
index 4e3432c..81e692a 100644
--- a/paludis/resolver/get_sameness.cc
+++ b/paludis/resolver/get_sameness.cc
@@ -31,8 +31,6 @@
#include <paludis/name.hh>
#include <paludis/dep_spec.hh>
#include <paludis/slot_requirement.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
-#include <paludis/elike_slot_requirement.hh>
#include <paludis/version_requirements.hh>
#include <set>
@@ -43,6 +41,38 @@ 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
{
@@ -74,10 +104,8 @@ namespace
if (s.slot_requirement_ptr())
{
auto r(s.slot_requirement_ptr()->maybe_original_requirement_if_rewritten());
- if (r)
- tokens.insert("slot_requirement:" + stringify(*r));
- else
- tokens.insert("slot_requirement:" + stringify(*s.slot_requirement_ptr()));
+ tokens.insert("slot_requirement:" + (r ? r : s.slot_requirement_ptr())
+ ->accept_returning<std::string>(SloppySlotStringifier()));
}
if (s.in_repository_ptr())
diff --git a/paludis/slot_requirement-fwd.hh b/paludis/slot_requirement-fwd.hh
index ceaa070..46ce6d4 100644
--- a/paludis/slot_requirement-fwd.hh
+++ b/paludis/slot_requirement-fwd.hh
@@ -31,6 +31,7 @@ namespace paludis
struct SlotAnyAtAllLockedRequirement;
struct SlotAnyPartialLockedRequirement;
struct SlotAnyUnlockedRequirement;
+ struct SlotUnknownRewrittenRequirement;
std::ostream & operator<< (std::ostream &, const SlotRequirement &) PALUDIS_VISIBLE;
}
diff --git a/paludis/slot_requirement.hh b/paludis/slot_requirement.hh
index db36c13..388b3e2 100644
--- a/paludis/slot_requirement.hh
+++ b/paludis/slot_requirement.hh
@@ -37,7 +37,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE SlotRequirement :
public virtual DeclareAbstractAcceptMethods<SlotRequirement, MakeTypeList<
- SlotExactPartialRequirement, SlotExactFullRequirement, SlotAnyAtAllLockedRequirement, SlotAnyPartialLockedRequirement, SlotAnyUnlockedRequirement>::Type>
+ SlotExactPartialRequirement, SlotExactFullRequirement, SlotAnyAtAllLockedRequirement, SlotAnyPartialLockedRequirement, SlotAnyUnlockedRequirement, SlotUnknownRewrittenRequirement>::Type>
{
public:
/**
@@ -131,6 +131,26 @@ namespace paludis
public ImplementAcceptMethods<SlotRequirement, SlotAnyUnlockedRequirement>
{
};
+
+ /**
+ * A SlotUnknownRewrittenRequirement is a SlotRequirement for the
+ * <code>maybe_original_requirement_if_written()</code> method of
+ * <code>:3/3.1=</code> slot requirements that do not indicate whether
+ * they were originally of <code>:=</code> or <code>:3=</code> type.
+ *
+ * \ingroup g_dep_spec
+ */
+ class PALUDIS_VISIBLE SlotUnknownRewrittenRequirement :
+ public SlotRequirement,
+ public ImplementAcceptMethods<SlotRequirement, SlotUnknownRewrittenRequirement>
+ {
+ public:
+ /**
+ * The slot that the original spec might have specified, if
+ * it was of <code>:3=</code> type.
+ */
+ virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
}
#endif
diff --git a/python/slot_requirement.cc b/python/slot_requirement.cc
index 58acbae..80ebc52 100644
--- a/python/slot_requirement.cc
+++ b/python/slot_requirement.cc
@@ -70,6 +70,11 @@ namespace
{
obj = bp::object(std::static_pointer_cast<const SlotAnyUnlockedRequirement>(_m_ptr));
}
+
+ void visit(const SlotUnknownRewrittenRequirement &)
+ {
+ obj = bp::object(std::static_pointer_cast<const SlotUnknownRewrittenRequirement>(_m_ptr));
+ }
};
struct SlotRequirementSptrToPython
@@ -181,5 +186,21 @@ void expose_slot_requirement()
bp::no_init
)
;
+
+ /**
+ * SlotUnknownRewrittenRequirement
+ */
+ register_shared_ptrs_to_python<SlotUnknownRewrittenRequirement>(rsp_const);
+ bp::implicitly_convertible<std::shared_ptr<SlotUnknownRewrittenRequirement>, std::shared_ptr<SlotRequirement> >();
+ bp::class_<SlotUnknownRewrittenRequirement, std::shared_ptr<SlotUnknownRewrittenRequirement>, bp::bases<SlotRequirement>, boost::noncopyable>
+ (
+ "SlotUnknownRewrittenRequirement",
+ "A SlotUnknownRewrittenRequirement is a SlotRequirement for the "
+ "maybe_original_requirement_if_written() method of :3/3.1= slot "
+ "requirements that do not indicate whether they were originally "
+ "of := or :3= type.",
+ bp::no_init
+ )
+ ;
}
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 445f867..ad9ee78 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -70,6 +70,7 @@ namespace
static VALUE c_slot_any_partial_locked_requirement;
static VALUE c_slot_any_at_all_locked_requirement;
static VALUE c_slot_any_unlocked_requirement;
+ static VALUE c_slot_unknown_rewritten_requirement;
struct V
{
@@ -111,6 +112,12 @@ namespace
new std::shared_ptr<const SlotRequirement>(mm));
}
+ void visit(const SlotUnknownRewrittenRequirement &)
+ {
+ value = Data_Wrap_Struct(c_slot_unknown_rewritten_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ new std::shared_ptr<const SlotRequirement>(mm));
+ }
+
};
VALUE
@@ -1244,7 +1251,7 @@ namespace
/*
* Document-class: Paludis::SlotExactPartialRequirement
*
- * An exact slot requiremet (:)
+ * An exact slot requirement (:slot)
*/
c_slot_exact_partial_requirement = rb_define_class_under(paludis_module(), "SlotExactPartialRequirement", c_slot_requirement);
rb_define_method(c_slot_exact_partial_requirement, "slot", RUBY_FUNC_CAST(&slot_exact_requirement_slot), 0);
@@ -1252,30 +1259,37 @@ namespace
/*
* Document-class: Paludis::SlotExactFullRequirement
*
- * An exact slot requiremet
+ * An exact slot requirement (:slot/sub)
*/
c_slot_exact_full_requirement = rb_define_class_under(paludis_module(), "SlotExactFullRequirement", c_slot_requirement);
/*
* Document-class: Paludis::SlotAnyPartialLockedRequirement
*
- * An any locked slot requiremet (:=)
+ * A partial locked slot requirement (:slot=)
*/
c_slot_any_partial_locked_requirement = rb_define_class_under(paludis_module(), "SlotAnyPartialLockedRequirement", c_slot_requirement);
/*
* Document-class: Paludis::SlotAnyAtAllLockedRequirement
*
- * An any locked slot requiremet (:=)
+ * An any locked slot requirement (:=)
*/
c_slot_any_at_all_locked_requirement = rb_define_class_under(paludis_module(), "SlotAnyAtAllLockedRequirement", c_slot_requirement);
/*
* Document-class: Paludis::SlotAnyUnlockedRequirement
*
- * An any unlocked slot requiremet (:*)
+ * An any unlocked slot requirement (:*)
*/
c_slot_any_unlocked_requirement = rb_define_class_under(paludis_module(), "SlotAnyUnlockedRequirement", c_slot_requirement);
+
+ /*
+ * Document-class: Paludis::SlotUnknownRewrittenRequirement
+ *
+ * An unknown rewritten slot requirement (either := or :slot=)
+ */
+ c_slot_unknown_rewritten_requirement = rb_define_class_under(paludis_module(), "SlotUnknownRewrittenRequirement", c_slot_requirement);
}
}