aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Alex Elsayed <eternaleye@gmail.com> 2010-03-09 02:42:15 -0800
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-11 17:34:00 +0000
commitb8acd7c16e9dc196d349f430eca1f1d946113288 (patch)
tree1ba035881b74adc499acbc4098367c244a328df2
parent54b4e5757fd4ed78ef95dff6dfc94f70391414b4 (diff)
downloadpaludis-b8acd7c16e9dc196d349f430eca1f1d946113288.tar.gz
paludis-b8acd7c16e9dc196d349f430eca1f1d946113288.tar.xz
Add support for > comparisons to numeric keys in user dep specs
-rw-r--r--doc/configuration/specs.html.part3
-rw-r--r--paludis/user_dep_spec.cc10
2 files changed, 10 insertions, 3 deletions
diff --git a/doc/configuration/specs.html.part b/doc/configuration/specs.html.part
index b08121e..446b195 100644
--- a/doc/configuration/specs.html.part
+++ b/doc/configuration/specs.html.part
@@ -35,7 +35,8 @@ the following order:</p>
<li><code>[.key=value]</code>: Match only if the specified metadata key has a particular exact value. Only works for
simple values, sets, sequences and spec trees, not other complex compound keys. If <code>&lt;</code> is used in
place of <code>=</code>, for numeric values a less-than comparison is used, and for sets, sequences and spec trees,
- a match occurs if any member of the set or sequence is equal to the value.</li>
+ a match occurs if any member of the set or sequence is equal to the value. Similarly if <code>&gt;</code> is used,
+ for numeric values a greater-than comparison is used; it does not match for other types of values.</li>
</ul>
<p>Repository requirements are in the form <code>to</code>, <code>from-&gt;</code> or <code>::from-&gt;to</code>. The
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 8603a23..6577a87 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -355,9 +355,9 @@ namespace paludis
Implementation(const std::string & s)
{
- std::string::size_type p(s.find_first_of("=<"));
+ std::string::size_type p(s.find_first_of("=<>"));
if (std::string::npos == p)
- throw PackageDepSpecError("Expected an = or a < inside '[." + s + "]'");
+ throw PackageDepSpecError("Expected an =, a < or a > inside '[." + s + "]'");
key = s.substr(0, p);
value = s.substr(p + 1);
@@ -510,6 +510,8 @@ namespace
return pattern == stringify(k.value().seconds());
case '<':
return k.value().seconds() < destringify<time_t>(pattern);
+ case '>':
+ return k.value().seconds() > destringify<time_t>(pattern);
}
return false;
@@ -543,6 +545,8 @@ namespace
return pattern == stringify(k.value());
case '<':
return k.value() < destringify<long>(pattern);
+ case '>':
+ return k.value() > destringify<long>(pattern);
}
return false;
@@ -767,6 +771,8 @@ UserKeyRequirement::as_human_string() const
return "Key '" + _imp->key + "' has simple string value '" + _imp->value + "'";
case '<':
return "Key '" + _imp->key + "' contains or is less than '" + _imp->value + "'";
+ case '>':
+ return "Key '" + _imp->key + "' is greater than '" + _imp->value + "'";
}
throw InternalError(PALUDIS_HERE, "unknown op");