aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-06 12:54:21 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-06 17:14:33 +0100
commit9538f2a7fa74240b8ca6ac6cccb0ad51433cb1d3 (patch)
tree6734733c25225de34b0272b0466e5ed584cbcc2b
parent300e20ba7ad2d795ba1d36c6cdd034f6a46ae5ed (diff)
downloadpaludis-9538f2a7fa74240b8ca6ac6cccb0ad51433cb1d3.tar.gz
paludis-9538f2a7fa74240b8ca6ac6cccb0ad51433cb1d3.tar.xz
1.2rc3 is legal too
-rw-r--r--paludis/version_spec.cc7
-rw-r--r--paludis/version_spec_TEST.cc6
2 files changed, 11 insertions, 2 deletions
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 53b1893..b2e21ee 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -90,7 +90,7 @@ namespace paludis
{
simple_parser::SimpleParserExpression expr(ignore_case ? simple_parser::exact_ignoring_case(text) : simple_parser::exact(text));
if (flexible_dashes)
- return simple_parser::any_of("-_") & expr;
+ return -simple_parser::any_of("-_") & expr;
else
return simple_parser::exact(strict_dash) & expr;
}
@@ -169,7 +169,10 @@ VersionSpec::VersionSpec(const std::string & text, const VersionSpecOptions & op
first_number = false;
}
- /* letter */
+ /* letter (but not if it's two letters, since that's 1.23rc4) */
+ if (! parser.lookahead(
+ simple_parser::any_of("abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ") &
+ simple_parser::any_of("abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ")))
{
std::string l;
if (parser.consume(simple_parser::any_of("abcdefghijklmnopqrstuvwxyz") >> l))
diff --git a/paludis/version_spec_TEST.cc b/paludis/version_spec_TEST.cc
index f44e1b9..5495dcb 100644
--- a/paludis/version_spec_TEST.cc
+++ b/paludis/version_spec_TEST.cc
@@ -702,6 +702,12 @@ namespace test_cases
VersionSpec v6("1.2-r3", VersionSpecOptions());
TEST_CHECK(v5 == v6);
TEST_CHECK(v5.hash() == v6.hash());
+
+ TEST_CHECK_THROWS(VersionSpec("1.23alpha4rc5", VersionSpecOptions()), BadVersionSpecError);
+ VersionSpec v7("1.23alpha4rc5", VersionSpecOptions() + vso_flexible_dashes);
+ VersionSpec v8("1.23_alpha4_rc5", VersionSpecOptions());
+ TEST_CHECK(v7 == v8);
+ TEST_CHECK(v7.hash() == v8.hash());
}
} test_version_spec_flexible_dashes;