aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2008-05-20 00:19:45 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2008-05-20 00:19:45 +0000
commit469846ab1baec8a1328c8bc3ac54d82bb76494ed (patch)
treeabef7faa4c96b299ed47a12a8a3c0a36ca665039
parent995aa300f3d2d404b12239eefc626eda4d98cf7d (diff)
downloadpaludis-469846ab1baec8a1328c8bc3ac54d82bb76494ed.tar.gz
paludis-469846ab1baec8a1328c8bc3ac54d82bb76494ed.tar.xz
Treat a sequence of four or more nines as an scm version. From Santiago M. Mola
-rw-r--r--paludis/version_spec.cc7
-rw-r--r--paludis/version_spec_TEST.cc8
2 files changed, 13 insertions, 2 deletions
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 48e7f45..7adb438 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -587,8 +587,11 @@ VersionSpec::is_scm() const
break;
}
- /* is our version without revisions exactly 9999? */
- if (remove_revision() == VersionSpec("9999"))
+ /* is our version without revisions a sequence of, at least,
+ * four 9's? */
+ std::string mystr = remove_revision()._imp->text;
+ if ((mystr.length() >= 4) &&
+ (std::string::npos == mystr.find_first_not_of("9")))
{
result = true;
break;
diff --git a/paludis/version_spec_TEST.cc b/paludis/version_spec_TEST.cc
index 976489c..24c1b21 100644
--- a/paludis/version_spec_TEST.cc
+++ b/paludis/version_spec_TEST.cc
@@ -280,6 +280,14 @@ namespace test_cases
TEST_CHECK(! VersionSpec("9999_alpha2").is_scm());
TEST_CHECK(VersionSpec("9999").is_scm());
TEST_CHECK(VersionSpec("9999-r4").is_scm());
+
+ TEST_CHECK(VersionSpec("99999999-r4").is_scm());
+ TEST_CHECK(! VersionSpec("99999998-r4").is_scm());
+ TEST_CHECK(! VersionSpec("999").is_scm());
+ TEST_CHECK(! VersionSpec("1.9999").is_scm());
+ TEST_CHECK(! VersionSpec("9999.1").is_scm());
+ TEST_CHECK(! VersionSpec("9999.9999").is_scm());
+
}
} test_version_is_scm;