aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ralph Sennhauser <sera@gentoo.org> 2013-01-10 21:43:17 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2013-01-10 21:10:01 +0000
commitb3203f2ba9c8c92c1853a0a5bf039d0015615441 (patch)
treee130d5abbcdd846bbbd560e79888988c870c6cfc
parentc8961658a2d8342927d29c7edcf99bc85aa1e7d0 (diff)
downloadpaludis-b3203f2ba9c8c92c1853a0a5bf039d0015615441.tar.gz
paludis-b3203f2ba9c8c92c1853a0a5bf039d0015615441.tar.xz
Allow EAPI 5 subslots in user package dep specs
-rw-r--r--paludis/user_dep_spec-fwd.hh1
-rw-r--r--paludis/user_dep_spec.cc41
-rw-r--r--paludis/user_dep_spec.hh14
3 files changed, 52 insertions, 4 deletions
diff --git a/paludis/user_dep_spec-fwd.hh b/paludis/user_dep_spec-fwd.hh
index 224176a..d775ce6 100644
--- a/paludis/user_dep_spec-fwd.hh
+++ b/paludis/user_dep_spec-fwd.hh
@@ -63,6 +63,7 @@ namespace paludis
///\}
};
+ struct UserSlotExactFullRequirement;
struct UserSlotExactPartialRequirement;
struct UserKeyRequirement;
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index a35b461..0281016 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -244,11 +244,21 @@ namespace
void
user_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePackageDepSpec & result)
{
- std::string::size_type slot_p(s.rfind(':'));
- if (std::string::npos != slot_p)
+ std::string::size_type slot_p;
+ if (std::string::npos == ((slot_p = s.rfind(':'))))
+ return;
+
+ std::string text(s.substr(slot_p + 1));
+ s.erase(slot_p);
+
+ auto p(text.find('/'));
+ if (std::string::npos != p)
+ {
+ result.slot_requirement(std::make_shared<UserSlotExactFullRequirement>(std::make_pair(SlotName(text.substr(0, p)), SlotName(text.substr(p + 1)))));
+ }
+ else
{
- result.slot_requirement(std::make_shared<UserSlotExactPartialRequirement>(SlotName(s.substr(slot_p + 1))));
- s.erase(slot_p);
+ result.slot_requirement(std::make_shared<UserSlotExactPartialRequirement>(SlotName(text)));
}
}
@@ -387,6 +397,29 @@ paludis::envless_parse_package_dep_spec_for_tests(const std::string & ss)
}
+UserSlotExactFullRequirement::UserSlotExactFullRequirement(const std::pair<SlotName, SlotName> & s) :
+ _s(s)
+{
+}
+
+const std::pair<SlotName, SlotName>
+UserSlotExactFullRequirement::slots() const
+{
+ return _s;
+}
+
+const std::string
+UserSlotExactFullRequirement::as_string() const
+{
+ return ":" + stringify(_s.first) + "/" + stringify(_s.second);
+}
+
+const std::shared_ptr<const SlotRequirement>
+UserSlotExactFullRequirement::maybe_original_requirement_if_rewritten() const
+{
+ return make_null_shared_ptr();
+}
+
UserSlotExactPartialRequirement::UserSlotExactPartialRequirement(const SlotName & s) :
_s(s)
{
diff --git a/paludis/user_dep_spec.hh b/paludis/user_dep_spec.hh
index 92c01a9..9624412 100644
--- a/paludis/user_dep_spec.hh
+++ b/paludis/user_dep_spec.hh
@@ -53,6 +53,20 @@ namespace paludis
PackageDepSpec envless_parse_package_dep_spec_for_tests(
const std::string &) PALUDIS_VISIBLE;
+ class PALUDIS_VISIBLE UserSlotExactFullRequirement :
+ public SlotExactFullRequirement
+ {
+ private:
+ const std::pair<SlotName, SlotName> _s;
+
+ public:
+ UserSlotExactFullRequirement(const std::pair<SlotName, SlotName> &);
+
+ virtual const std::pair<SlotName, SlotName> slots() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
class PALUDIS_VISIBLE UserSlotExactPartialRequirement :
public SlotExactPartialRequirement
{