aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2009-03-22 19:27:36 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2009-03-22 20:16:43 +0000
commit0e86b74b62a0a3ab97311a21d1c05a73424248b7 (patch)
tree1ac4d71ec6486ea11de05cebe866231e52a89196
parent4d3c6ba27de87d60b57a068db87c7e4fe39b32df (diff)
downloadpaludis-0e86b74b62a0a3ab97311a21d1c05a73424248b7.tar.gz
paludis-0e86b74b62a0a3ab97311a21d1c05a73424248b7.tar.xz
Support nice =* and use it for user and exheres
-rw-r--r--NEWS4
-rw-r--r--doc/configuration/specs.html.part4
-rw-r--r--paludis/dep_spec.cc8
-rw-r--r--paludis/elike_package_dep_spec.cc4
-rw-r--r--paludis/elike_package_dep_spec.se1
-rw-r--r--paludis/range_rewriter.cc4
-rw-r--r--paludis/repositories/e/e_repository_sets.cc17
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf3
-rw-r--r--paludis/user_dep_spec.cc4
-rw-r--r--paludis/version_operator.cc9
-rw-r--r--paludis/version_operator.se3
-rw-r--r--paludis/version_spec.cc23
-rw-r--r--paludis/version_spec.hh9
-rw-r--r--paludis/version_spec_TEST.cc78
-rwxr-xr-xpython/version_operator_TEST.py2
15 files changed, 129 insertions, 44 deletions
diff --git a/NEWS b/NEWS
index 9fc086b..e601509 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,10 @@ News for Paludis
This file lists the major changes between versions. For a more detailed list
of every change, see the ChangeLog.
+master:
+ * The =...* dependency operator in configuration files and command-line
+ arguments now matches component-wise rather than character-wise.
+
0.34.2:
* Wildcards are now allowed for --contents and --executables.
diff --git a/doc/configuration/specs.html.part b/doc/configuration/specs.html.part
index f8ad6fa..5a53b3c 100644
--- a/doc/configuration/specs.html.part
+++ b/doc/configuration/specs.html.part
@@ -77,8 +77,8 @@ the following order:</p>
greater than or equal to this revision.</dd>
<dt><code>=*</code></dt>
- <dd>Starting with this string. The asterisk comes <em>after</em> the version part (<code>=cat/pkg-1.2*</code> or
- <code>cat/pkg[=1.2*]</code>). This operator should be avoided in favour of ranged and slot dependencies.</dd>
+ <dd>Starting with this version, componentwise. The asterisk comes <em>after</em> the version part (<code>=cat/pkg-1.2*</code> or
+ <code>cat/pkg[=1.2*]</code>).</dd>
<dt><code>~&gt;</code></dt>
<dd>Greater than or equal to the version, and strictly less than the version with its one-before-least-significant
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 092de8f..bfcb1d4 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -885,7 +885,7 @@ namespace
}
else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end())
{
- if (version_requirements_ptr()->begin()->version_operator() == vo_equal_star)
+ if (version_requirements_ptr()->begin()->version_operator() == vo_stupid_equal_star || version_requirements_ptr()->begin()->version_operator() == vo_nice_equal_star)
s << "=";
else
s << version_requirements_ptr()->begin()->version_operator();
@@ -917,7 +917,7 @@ namespace
else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end())
{
s << "-" << version_requirements_ptr()->begin()->version_spec();
- if (version_requirements_ptr()->begin()->version_operator() == vo_equal_star)
+ if (version_requirements_ptr()->begin()->version_operator() == vo_stupid_equal_star || version_requirements_ptr()->begin()->version_operator() == vo_nice_equal_star)
s << "*";
}
}
@@ -1013,14 +1013,14 @@ namespace
} while (false);
}
- if (r->version_operator() == vo_equal_star)
+ if (r->version_operator() == vo_stupid_equal_star || r->version_operator() == vo_nice_equal_star)
s << "=";
else
s << r->version_operator();
s << r->version_spec();
- if (r->version_operator() == vo_equal_star)
+ if (r->version_operator() == vo_stupid_equal_star || r->version_operator() == vo_nice_equal_star)
s << "*";
need_op = true;
diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc
index 1065d38..8a45548 100644
--- a/paludis/elike_package_dep_spec.cc
+++ b/paludis/elike_package_dep_spec.cc
@@ -169,7 +169,7 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial
{
ver.erase(ver.length() - 1);
if (vop == vo_equal)
- vop = vo_equal_star;
+ vop = options[epdso_nice_equal_star] ? vo_nice_equal_star : vo_stupid_equal_star;
else
throw PackageDepSpecError("Invalid use of * with operator '" + stringify(vop) + " inside []");
}
@@ -339,7 +339,7 @@ paludis::elike_get_remove_version_operator(std::string & s, const ELikePackageDe
{
if (op != vo_equal)
throw PackageDepSpecError("Package dep spec uses * with operator '" + stringify(op) + "'");
- op = vo_equal_star;
+ op = options[epdso_nice_equal_star] ? vo_nice_equal_star : vo_stupid_equal_star;
s.erase(s.length() - 1);
}
diff --git a/paludis/elike_package_dep_spec.se b/paludis/elike_package_dep_spec.se
index c510ce9..043b3af 100644
--- a/paludis/elike_package_dep_spec.se
+++ b/paludis/elike_package_dep_spec.se
@@ -15,6 +15,7 @@ make_enum_ELikePackageDepSpecOption()
key epdso_allow_use_dep_defaults "Allow [use+] and [use-] deps"
key epdso_allow_ranged_deps "Allow [op version] deps"
key epdso_allow_tilde_greater_deps "Allow ~> deps"
+ key epdso_nice_equal_star "Make =* do something sensible"
key epdso_strict_parsing "Error rather than warn for violations"
}
diff --git a/paludis/range_rewriter.cc b/paludis/range_rewriter.cc
index f3f54b4..75bf675 100644
--- a/paludis/range_rewriter.cc
+++ b/paludis/range_rewriter.cc
@@ -78,14 +78,14 @@ namespace
} while (false);
}
- if (r->version_operator() == vo_equal_star)
+ if (r->version_operator() == vo_stupid_equal_star || r->version_operator() == vo_nice_equal_star)
s << "=";
else
s << r->version_operator();
s << r->version_spec();
- if (r->version_operator() == vo_equal_star)
+ if (r->version_operator() == vo_stupid_equal_star || r->version_operator() == vo_nice_equal_star)
s << "*";
need_op = true;
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index e0d9db7..feb143b 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -178,7 +178,7 @@ ERepositorySets::sets_list() const
namespace
{
bool
- match_range(const PackageID & e, const erepository::GLSARange & r, const VersionSpecOptions & ver_options)
+ match_range(const PackageID & e, const erepository::GLSARange & r, const VersionSpecOptions & ver_options, const ELikePackageDepSpecOptions & pds_options)
{
if (r.slot() != "*")
{
@@ -204,7 +204,7 @@ namespace
if (! ver.empty() && '*' == ver.at(ver.length() - 1))
{
ver.erase(ver.length() - 1);
- our_op = vo_equal_star;
+ our_op = pds_options[epdso_nice_equal_star] ? vo_nice_equal_star : vo_stupid_equal_star;
}
else
our_op = vo_equal;
@@ -224,21 +224,21 @@ namespace
value_for<n::op>(r.op().substr(1)),
value_for<n::slot>(r.slot()),
value_for<n::version>(r.version())),
- ver_options);
+ ver_options, pds_options);
}
throw GLSAError("Got bad op '" + r.op() + "'");
}
bool
- is_vulnerable(const GLSAPackage & glsa_pkg, const PackageID & c, const VersionSpecOptions & ver_options)
+ is_vulnerable(const GLSAPackage & glsa_pkg, const PackageID & c, const VersionSpecOptions & ver_options, const ELikePackageDepSpecOptions & pds_options)
{
/* a package is affected if it matches any vulnerable line, except if it matches
* any unaffected line. */
bool vulnerable(false);
for (GLSAPackage::RangesConstIterator r(glsa_pkg.begin_vulnerable()), r_end(glsa_pkg.end_vulnerable()) ;
r != r_end && ! vulnerable ; ++r)
- if (match_range(c, *r, ver_options))
+ if (match_range(c, *r, ver_options, pds_options))
vulnerable = true;
if (! vulnerable)
@@ -246,7 +246,7 @@ namespace
for (GLSAPackage::RangesConstIterator r(glsa_pkg.begin_unaffected()), r_end(glsa_pkg.end_unaffected()) ;
r != r_end && vulnerable ; ++r)
- if (match_range(c, *r, ver_options))
+ if (match_range(c, *r, ver_options, pds_options))
vulnerable = false;
return vulnerable;
@@ -279,6 +279,7 @@ ERepositorySets::security_set(bool insecurity) const
"' because it uses an unsupported EAPI");
const VersionSpecOptions ver_options(eapi->supported()->version_spec_options());
+ const ELikePackageDepSpecOptions pds_options(eapi->supported()->package_dep_spec_parse_options());
try
{
@@ -300,7 +301,7 @@ ERepositorySets::security_set(bool insecurity) const
for (PackageIDSequence::ConstIterator c(candidates->begin()), c_end(candidates->end()) ;
c != c_end ; ++c)
{
- if (! is_vulnerable(*glsa_pkg, **c, ver_options))
+ if (! is_vulnerable(*glsa_pkg, **c, ver_options, pds_options))
continue;
if (glsa_tags.end() == glsa_tags.find(glsa->id()))
@@ -336,7 +337,7 @@ ERepositorySets::security_set(bool insecurity) const
for (PackageIDSequence::ReverseConstIterator r(available->rbegin()), r_end(available->rend()) ; r != r_end ; ++r)
{
- if (is_vulnerable(*glsa_pkg, **r, ver_options))
+ if (is_vulnerable(*glsa_pkg, **r, ver_options, pds_options))
{
Log::get_instance()->message("e.glsa.skipping_vulnerable", ll_debug, lc_context)
<< "Skipping '" << **r << "' due to is_vulnerable match";
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index f0b29a8..46e9a54 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -7,7 +7,8 @@ can_be_pbin = true
package_dep_spec_parse_options = allow_slot_deps allow_use_deps \
allow_ranged_deps allow_tilde_greater_deps strict_parsing \
- allow_slot_equal_deps allow_slot_star_deps allow_use_dep_defaults
+ allow_slot_equal_deps allow_slot_star_deps allow_use_dep_defaults \
+ nice_equal_star
dependency_spec_tree_parse_options = disallow_any_use uri_supports_arrow
iuse_flag_parse_options = strict_parsing
version_spec_options = flexible_dashes flexible_dots ignore_case \
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 810b321..1416b6f 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -162,7 +162,7 @@ namespace
{
ver.erase(ver.length() - 1);
if (vop == vo_equal)
- vop = vo_equal_star;
+ vop = vo_nice_equal_star;
else
throw PackageDepSpecError("Invalid use of * with operator '" + stringify(vop) + " inside []");
}
@@ -296,7 +296,7 @@ paludis::parse_user_package_dep_spec(const std::string & ss, const Environment *
value_for<n::get_remove_trailing_version>(std::tr1::bind(&elike_get_remove_trailing_version, _1,
user_version_spec_options())),
value_for<n::get_remove_version_operator>(std::tr1::bind(&elike_get_remove_version_operator, _1,
- ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps)),
+ ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_nice_equal_star)),
value_for<n::has_version_operator>(std::tr1::bind(&elike_has_version_operator, _1, std::tr1::cref(had_bracket_version_requirements))),
value_for<n::remove_trailing_repo_if_exists>(std::tr1::bind(&user_remove_trailing_repo_if_exists, _1, _2)),
value_for<n::remove_trailing_slot_if_exists>(std::tr1::bind(&user_remove_trailing_slot_if_exists, _1, _2)),
diff --git a/paludis/version_operator.cc b/paludis/version_operator.cc
index 7ffa4a8..35260df 100644
--- a/paludis/version_operator.cc
+++ b/paludis/version_operator.cc
@@ -99,7 +99,8 @@ paludis::operator<< (std::ostream & s, const VersionOperator & v)
s << "<=";
continue;
- case vo_equal_star:
+ case vo_nice_equal_star:
+ case vo_stupid_equal_star:
s << "=*";
continue;
@@ -145,8 +146,10 @@ VersionOperator::as_version_spec_comparator() const
return &relational_operators::operator> <const VersionSpec>;
case vo_greater_equal:
return &relational_operators::operator>= <const VersionSpec>;
- case vo_equal_star:
- return &member_to_comparator<&VersionSpec::equal_star_compare>;
+ case vo_nice_equal_star:
+ return &member_to_comparator<&VersionSpec::nice_equal_star_compare>;
+ case vo_stupid_equal_star:
+ return &member_to_comparator<&VersionSpec::stupid_equal_star_compare>;
case vo_tilde_greater:
return &member_to_comparator<&VersionSpec::tilde_greater_compare>;
case last_vo:
diff --git a/paludis/version_operator.se b/paludis/version_operator.se
index 1ba7250..98a3d65 100644
--- a/paludis/version_operator.se
+++ b/paludis/version_operator.se
@@ -11,7 +11,8 @@ make_enum_VersionOperatorValue()
key vo_tilde "~ dependency"
key vo_greater "> dependency"
key vo_greater_equal ">= dependency"
- key vo_equal_star "=* dependency"
+ key vo_nice_equal_star "=* dependency (sensible EAPIs)"
+ key vo_stupid_equal_star "=* dependency (Gentooish EAPIs)"
key vo_tilde_greater "~> dependency (gems)"
doxygen_comment << "END"
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index fe558b3..8c99bd5 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -435,6 +435,21 @@ namespace
else
return std::make_pair(true, a.type() == vsct_empty || b.type() == vsct_empty);
}
+
+ std::pair<bool, bool>
+ nice_equal_star_compare_comparator(const VersionSpecComponent & a, Parts::const_iterator, Parts::const_iterator,
+ const VersionSpecComponent & b, Parts::const_iterator b_it, Parts::const_iterator b_it_end, int compared)
+ {
+ if (b.type() == vsct_empty)
+ return std::make_pair(true, true);
+ else if (a.type() == b.type() && next(b_it) == b_it_end &&
+ (b.type() == vsct_alpha || b.type() == vsct_beta || b.type() == vsct_pre ||
+ b.type() == vsct_rc || b.type() == vsct_patch) &&
+ std::string::npos == b.text().find_first_of("0123456789"))
+ return std::make_pair(true, true);
+ else
+ return std::make_pair(false, compared != 0);
+ }
}
int
@@ -450,7 +465,13 @@ VersionSpec::tilde_compare(const VersionSpec & other) const
}
bool
-VersionSpec::equal_star_compare(const VersionSpec & other) const
+VersionSpec::nice_equal_star_compare(const VersionSpec & other) const
+{
+ return componentwise_compare(_imp->parts, other._imp->parts, nice_equal_star_compare_comparator);
+}
+
+bool
+VersionSpec::stupid_equal_star_compare(const VersionSpec & other) const
{
return 0 == _imp->text.compare(0, other._imp->text.length(), other._imp->text);
}
diff --git a/paludis/version_spec.hh b/paludis/version_spec.hh
index aacc480..0f53d7e 100644
--- a/paludis/version_spec.hh
+++ b/paludis/version_spec.hh
@@ -154,9 +154,14 @@ namespace paludis
bool tilde_greater_compare(const VersionSpec & other) const;
/**
- * Comparison function for =* depend operator.
+ * Comparison function for =* depend operator in sensible EAPIs.
*/
- bool equal_star_compare(const VersionSpec & other) const;
+ bool nice_equal_star_compare(const VersionSpec & other) const;
+
+ /**
+ * Comparison function for =* depend operator in Gentooish EAPIs.
+ */
+ bool stupid_equal_star_compare(const VersionSpec & other) const;
/**
* Compare to another version.
diff --git a/paludis/version_spec_TEST.cc b/paludis/version_spec_TEST.cc
index 30be045..8cace1a 100644
--- a/paludis/version_spec_TEST.cc
+++ b/paludis/version_spec_TEST.cc
@@ -132,29 +132,76 @@ namespace test_cases
} test_version_spec_parse;
/**
- * \test VersionSpec star comparisons
+ * \test VersionSpec stupid star comparisons
*
*/
- struct VersionSpecStarCompareTest : TestCase
+ struct VersionSpecStupidStarCompareTest : TestCase
{
- VersionSpecStarCompareTest() : TestCase("version spec star compare") {}
+ VersionSpecStupidStarCompareTest() : TestCase("version spec stupid star compare") {}
void run()
{
- TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).equal_star_compare(VersionSpec("1", VersionSpecOptions())));
- TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).equal_star_compare(VersionSpec("1.2", VersionSpecOptions())));
- TEST_CHECK(VersionSpec("1.2.1", VersionSpecOptions()).equal_star_compare(VersionSpec("1", VersionSpecOptions())));
- TEST_CHECK(VersionSpec("1.2.1", VersionSpecOptions()).equal_star_compare(VersionSpec("1.2", VersionSpecOptions())));
- TEST_CHECK(VersionSpec("2.2", VersionSpecOptions()).equal_star_compare(VersionSpec("2", VersionSpecOptions())));
- TEST_CHECK(VersionSpec("2", VersionSpecOptions()).equal_star_compare(VersionSpec("2", VersionSpecOptions())));
- TEST_CHECK(VersionSpec("2.59", VersionSpecOptions()).equal_star_compare(VersionSpec("2.5", VersionSpecOptions())));
- TEST_CHECK(VersionSpec("2.59_alpha5-r1", VersionSpecOptions()).equal_star_compare(VersionSpec("2.59_alpha", VersionSpecOptions())));
- TEST_CHECK(! VersionSpec("2", VersionSpecOptions()).equal_star_compare(VersionSpec("2.5", VersionSpecOptions())));
- TEST_CHECK(! VersionSpec("2.59", VersionSpecOptions()).equal_star_compare(VersionSpec("2.50", VersionSpecOptions())));
- TEST_CHECK(! VersionSpec("1", VersionSpecOptions()).equal_star_compare(VersionSpec("2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2.1", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2.1", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("2.2", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("2", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("2.59", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("2.5", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("2.59_alpha5-r1", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("2.59_alpha", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("2", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("2.5", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("2.59", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("2.50", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("2", VersionSpecOptions())));
+
+ TEST_CHECK(! VersionSpec("01", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1.02", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1.020", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.020", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1.02", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_alpha1", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1_alpha01", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_alpha01", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1_alpha1", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1_alpha01", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1_alpha0", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1_pre1", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1_p", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1_pre-scm", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1_pre", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_pre1", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1_pre0", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_alpha1", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1_alpha-r1", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_alpha1", VersionSpecOptions()).stupid_equal_star_compare(VersionSpec("1_beta", VersionSpecOptions())));
+ }
+ } test_version_spec_stupid_star_compare;
+ /**
+ * \test VersionSpec nice star comparisons
+ *
+ */
+ struct VersionSpecNiceStarCompareTest : TestCase
+ {
+ VersionSpecNiceStarCompareTest() : TestCase("version spec nice star compare") {}
+
+ void run()
+ {
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2.1", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2.1", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("2.2", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("2", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("2", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("2.59", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("2.5", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("2.59_alpha5-r1", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("2.59_alpha", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("2", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("2.5", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("2.59", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("2.50", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("2", VersionSpecOptions())));
+
+ TEST_CHECK(VersionSpec("01", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.02", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1.020", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.020", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1.02", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1_alpha1", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1_alpha01", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1_alpha01", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1_alpha1", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_alpha01", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1_alpha0", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_pre1", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1_p", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1_pre-scm", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1_pre", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_pre1", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1_pre0", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_alpha1", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1_alpha-r1", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1_alpha1", VersionSpecOptions()).nice_equal_star_compare(VersionSpec("1_beta", VersionSpecOptions())));
}
- } test_version_spec_star_compare;
+ } test_version_spec_nice_star_compare;
/**
* \test VersionSpec tilde comparisons
@@ -166,6 +213,7 @@ namespace test_cases
void run()
{
+
TEST_CHECK(! VersionSpec("1.4-r1", VersionSpecOptions()).tilde_compare(VersionSpec("1.3-r1", VersionSpecOptions())));
TEST_CHECK(! VersionSpec("1.4", VersionSpecOptions()).tilde_compare(VersionSpec("1.3-r1", VersionSpecOptions())));
TEST_CHECK(! VersionSpec("1.2", VersionSpecOptions()).tilde_compare(VersionSpec("1.3-r1", VersionSpecOptions())));
diff --git a/python/version_operator_TEST.py b/python/version_operator_TEST.py
index 96118d9..ef1b4a1 100755
--- a/python/version_operator_TEST.py
+++ b/python/version_operator_TEST.py
@@ -36,7 +36,7 @@ class TestCase_VersionOperator(unittest.TestCase):
def test_04_compare(self):
self.assert_(VersionOperator("<").compare(VersionSpec("1.0"), VersionSpec("2.0")))
self.assert_(VersionOperator(">").compare(VersionSpec("3.0"), VersionSpec("2.0")))
- self.assert_(VersionOperator(VersionOperatorValue.EQUAL_STAR).compare(VersionSpec("2.0.1-r1"), VersionSpec("2.0")))
+ self.assert_(VersionOperator(VersionOperatorValue.STUPID_EQUAL_STAR).compare(VersionSpec("2.0.1-r1"), VersionSpec("2.0")))
if __name__ == "__main__":
unittest.main()