aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-17 23:14:33 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-17 23:14:33 +0000
commit8d2ca8c97e7782e4a12fc09a099606ee5e6c320a (patch)
tree214492beae37c29149316c0bcabdf070f623da75
parentb2030d59d050c1e725895b7d00b49deb28a6494d (diff)
downloadpaludis-8d2ca8c97e7782e4a12fc09a099606ee5e6c320a.tar.gz
paludis-8d2ca8c97e7782e4a12fc09a099606ee5e6c320a.tar.xz
Fix scm version voodoo with multiple suffixes. From Peper.
-rw-r--r--paludis/version_spec.cc6
-rw-r--r--paludis/version_spec_TEST.cc6
2 files changed, 12 insertions, 0 deletions
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index efd0abc..e9fdb49 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -251,6 +251,12 @@ VersionSpec::VersionSpec(const std::string & text) :
if ((p < text.length()) && (0 == text.compare(p, 4, "-scm")))
{
p += 4;
+ std::vector<Part>::reverse_iterator i(_imp->parts.rbegin()), i_end(_imp->parts.rend());
+ if (i != i_end)
+ ++i;
+ for ( ; i != i_end ; ++i)
+ if (std::numeric_limits<unsigned long>::max() == i->value)
+ i->value = 0;
_imp->parts.push_back(Part(scm, 0, 0));
}
else
diff --git a/paludis/version_spec_TEST.cc b/paludis/version_spec_TEST.cc
index 54fae5c..a681427 100644
--- a/paludis/version_spec_TEST.cc
+++ b/paludis/version_spec_TEST.cc
@@ -315,6 +315,9 @@ namespace test_cases
TEST_CHECK(VersionSpec("1.2-r3") == VersionSpec("1.2-r3.0"));
TEST_CHECK(VersionSpec("1.2") == VersionSpec("1.2-r0.0"));
+ TEST_CHECK(VersionSpec("1_alpha_beta-scm") == VersionSpec("1_alpha0_beta-scm"));
+ TEST_CHECK(VersionSpec("1_alpha_beta0_rc3-scm") == VersionSpec("1_alpha0_beta_rc3-scm"));
+
TEST_CHECK(VersionSpec("0001").hash_value() == VersionSpec("1").hash_value());
TEST_CHECK(VersionSpec("01").hash_value() == VersionSpec("001").hash_value());
TEST_CHECK(VersionSpec("0001.1").hash_value() == VersionSpec("1.1").hash_value());
@@ -382,6 +385,9 @@ namespace test_cases
v.push_back(VersionSpec("1.2_alpha"));
v.push_back(VersionSpec("1.2_alpha-scm"));
v.push_back(VersionSpec("1.2_beta"));
+ v.push_back(VersionSpec("1.2_beta_p1-scm"));
+ v.push_back(VersionSpec("1.2_beta_p-scm"));
+ v.push_back(VersionSpec("1.2_beta1_p-scm"));
v.push_back(VersionSpec("1.2_beta10"));
v.push_back(VersionSpec("1.2_beta10_p"));
v.push_back(VersionSpec("1.2_beta10_p1"));