aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-28 14:23:13 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-28 14:23:13 +0000
commit018b3eec707251446d97f6e67a2ef3be4a962c83 (patch)
tree80892f144601661e8786f19107f511b6dd848dee
parent783dde75f668b948157f2d9db6afef635e442e2f (diff)
downloadpaludis-018b3eec707251446d97f6e67a2ef3be4a962c83.tar.gz
paludis-018b3eec707251446d97f6e67a2ef3be4a962c83.tar.xz
Allow _p anywhere in the list of suffixes.
-rw-r--r--paludis/version_spec.cc28
-rw-r--r--paludis/version_spec_TEST.cc10
2 files changed, 12 insertions, 26 deletions
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 8e349bf..52f8a81 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -167,6 +167,11 @@ VersionSpec::VersionSpec(const std::string & text) :
k = rc;
p += 3;
}
+ else if (0 == text.compare(p, 2, "_p"))
+ {
+ k = patch;
+ p += 2;
+ }
else
break;
@@ -190,29 +195,6 @@ VersionSpec::VersionSpec(const std::string & text) :
} while (false);
}
- /* patch level */
- if (p < text.length() && 0 == text.compare(p, 2, "_p"))
- {
- p += 2;
-
- std::string::size_type q(text.find_first_not_of("0123456789", p));
- std::string number_part(std::string::npos == q ? text.substr(p) : text.substr(p, q - p));
- p = std::string::npos == q ? text.length() : q;
-
- if (number_part.size() > 8)
- Log::get_instance()->message(ll_qa, lc_context) <<
- "Number part '" << number_part << "' exceeds 8 digit limit permitted by the Package Manager Specification "
- "(Paludis supports arbitrary lengths, but other package managers do not)";
-
- if (number_part.size() > 0)
- {
- number_part = strip_leading(number_part, "0");
- if (number_part.empty())
- number_part = "0";
- }
- _imp->parts.push_back(Part(patch, number_part));
- }
-
/* try */
if (p < text.length() && 0 == text.compare(p, 4, "-try"))
{
diff --git a/paludis/version_spec_TEST.cc b/paludis/version_spec_TEST.cc
index 5f4c140..2adfc5d 100644
--- a/paludis/version_spec_TEST.cc
+++ b/paludis/version_spec_TEST.cc
@@ -67,7 +67,9 @@ namespace test_cases
VersionSpec v21("1_rc1-r1");
VersionSpec v22("1_p1-r1");
VersionSpec v23("1_alpha_p");
- VersionSpec v24("scm");
+ VersionSpec v24("1_p3_alpha");
+ VersionSpec v25("1_p4_p-r2");
+ VersionSpec v26("scm");
TEST_CHECK(true);
}
@@ -90,8 +92,6 @@ namespace test_cases
TEST_CHECK_THROWS(VersionSpec v1("1_blah"), BadVersionSpecError);
TEST_CHECK_THROWS(VersionSpec v1("1_pre-r2b"), BadVersionSpecError);
TEST_CHECK_THROWS(VersionSpec v1("1_pre-r2-r2"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1_p_p"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1_p_alpha"), BadVersionSpecError);
TEST_CHECK_THROWS(VersionSpec v1("1-try-try"), BadVersionSpecError);
TEST_CHECK_THROWS(VersionSpec v1("1-try_alpha"), BadVersionSpecError);
TEST_CHECK_THROWS(VersionSpec v1("1-scm-scm"), BadVersionSpecError);
@@ -418,6 +418,10 @@ namespace test_cases
v.push_back(VersionSpec("1.2_beta-scm"));
v.push_back(VersionSpec("1.2"));
v.push_back(VersionSpec("1.2-r1"));
+ v.push_back(VersionSpec("1.2_p3_pre"));
+ v.push_back(VersionSpec("1.2_p3"));
+ v.push_back(VersionSpec("1.2_p3_p"));
+ v.push_back(VersionSpec("1.2_p3-try4"));
v.push_back(VersionSpec("1.2-scm"));
v.push_back(VersionSpec("1.2-scm-r1"));
v.push_back(VersionSpec("1-scm"));