aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-03-22 15:17:45 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-03-22 15:17:24 +0000
commit7d0466af57231a0b727f4a619434fb80bbbbc5ff (patch)
tree31c12cce3c043d30bf29b44cd5606b39c09cbd08
parente025e1b8be908dccb561b4e11e426ac84f3f5561 (diff)
downloadpaludis-7d0466af57231a0b727f4a619434fb80bbbbc5ff.tar.gz
paludis-7d0466af57231a0b727f4a619434fb80bbbbc5ff.tar.xz
VersionSpecOptions(), but don't use them
-rw-r--r--doc/api/cplusplus/examples/example_version_operator.cc14
-rw-r--r--doc/api/cplusplus/examples/example_version_spec.cc20
-rw-r--r--paludis/elike_package_dep_spec-fwd.hh17
-rw-r--r--paludis/elike_package_dep_spec.cc23
-rw-r--r--paludis/filter_TEST.cc14
-rw-r--r--paludis/generator_TEST.cc14
-rw-r--r--paludis/ndbam.cc13
-rw-r--r--paludis/ndbam.hh7
-rw-r--r--paludis/package_database_TEST.cc48
-rw-r--r--paludis/repositories/accounts/accounts_id.cc2
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.cc2
-rw-r--r--paludis/repositories/e/dep_parser.cc7
-rw-r--r--paludis/repositories/e/e_repository.cc1
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc12
-rw-r--r--paludis/repositories/e/e_repository_news.cc8
-rw-r--r--paludis/repositories/e/e_repository_profile.cc4
-rw-r--r--paludis/repositories/e/e_repository_sets.cc29
-rw-r--r--paludis/repositories/e/eapi.cc13
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf1
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf2
-rw-r--r--paludis/repositories/e/ebuild_entries.cc4
-rw-r--r--paludis/repositories/e/exndbam_repository.cc17
-rw-r--r--paludis/repositories/e/exndbam_repository.hh2
-rw-r--r--paludis/repositories/e/info_metadata_key.cc1
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc26
-rw-r--r--paludis/repositories/e/vdb_repository.cc16
-rw-r--r--paludis/repositories/e/vdb_repository.hh2
-rw-r--r--paludis/repositories/fake/dep_parser.cc9
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc10
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh8
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_file.cc3
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc3
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc10
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.cc5
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc14
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.cc5
-rw-r--r--paludis/uninstall_list_TEST.cc2
-rw-r--r--paludis/user_dep_spec-fwd.hh9
-rw-r--r--paludis/user_dep_spec.cc12
-rw-r--r--paludis/version_spec-fwd.hh11
-rw-r--r--paludis/version_spec.cc16
-rw-r--r--paludis/version_spec.hh6
-rw-r--r--paludis/version_spec.se22
-rw-r--r--paludis/version_spec_TEST.cc525
-rw-r--r--ruby/version_spec.cc7
-rw-r--r--src/clients/adjutrix/downgrade_check.cc4
-rw-r--r--src/clients/adjutrix/find_dropped_keywords.cc8
-rw-r--r--src/clients/adjutrix/find_stable_candidates.cc6
-rw-r--r--src/clients/importare/importare.cc5
50 files changed, 598 insertions, 423 deletions
diff --git a/doc/api/cplusplus/examples/example_version_operator.cc b/doc/api/cplusplus/examples/example_version_operator.cc
index 1bea6e2..9369e8c 100644
--- a/doc/api/cplusplus/examples/example_version_operator.cc
+++ b/doc/api/cplusplus/examples/example_version_operator.cc
@@ -36,13 +36,15 @@ int main(int argc, char * argv[])
CommandLine::get_instance()->run(argc, argv,
"example_version_operator", "EXAMPLE_VERSION_OPERATOR_OPTIONS", "EXAMPLE_VERSION_OPERATOR_CMDLINE");
- /* Make a set of versions */
+ /* Make a set of versions. Use user_version_spec_options() for the
+ * options parameter for VersionSpec's constructor for handling any
+ * user-inputted data. */
std::set<VersionSpec> versions;
- versions.insert(VersionSpec("1.0"));
- versions.insert(VersionSpec("1.1"));
- versions.insert(VersionSpec("1.2"));
- versions.insert(VersionSpec("1.2-r1"));
- versions.insert(VersionSpec("2.0"));
+ versions.insert(VersionSpec("1.0", user_version_spec_options()));
+ versions.insert(VersionSpec("1.1", user_version_spec_options()));
+ versions.insert(VersionSpec("1.2", user_version_spec_options()));
+ versions.insert(VersionSpec("1.2-r1", user_version_spec_options()));
+ versions.insert(VersionSpec("2.0", user_version_spec_options()));
/* And a list of operators */
std::list<VersionOperator> operators;
diff --git a/doc/api/cplusplus/examples/example_version_spec.cc b/doc/api/cplusplus/examples/example_version_spec.cc
index 9b9fcc8..a6048d7 100644
--- a/doc/api/cplusplus/examples/example_version_spec.cc
+++ b/doc/api/cplusplus/examples/example_version_spec.cc
@@ -36,16 +36,18 @@ int main(int argc, char * argv[])
CommandLine::get_instance()->run(argc, argv,
"example_version_spec", "EXAMPLE_VERSION_SPEC_OPTIONS", "EXAMPLE_VERSION_SPEC_CMDLINE");
- /* Make a set of versions */
+ /* Make a set of versions. Use user_version_spec_options() for the
+ * options parameter for VersionSpec's constructor for handling any
+ * user-inputted data. */
std::set<VersionSpec> versions;
- versions.insert(VersionSpec("1.0"));
- versions.insert(VersionSpec("1.1"));
- versions.insert(VersionSpec("1.2"));
- versions.insert(VersionSpec("1.2-r1"));
- versions.insert(VersionSpec("2.0"));
- versions.insert(VersionSpec("2.0-try1"));
- versions.insert(VersionSpec("2.0-scm"));
- versions.insert(VersionSpec("9999"));
+ versions.insert(VersionSpec("1.0", user_version_spec_options()));
+ versions.insert(VersionSpec("1.1", user_version_spec_options()));
+ versions.insert(VersionSpec("1.2", user_version_spec_options()));
+ versions.insert(VersionSpec("1.2-r1", user_version_spec_options()));
+ versions.insert(VersionSpec("2.0", user_version_spec_options()));
+ versions.insert(VersionSpec("2.0-try1", user_version_spec_options()));
+ versions.insert(VersionSpec("2.0-scm", user_version_spec_options()));
+ versions.insert(VersionSpec("9999", user_version_spec_options()));
/* For each version... */
for (std::set<VersionSpec>::const_iterator v(versions.begin()), v_end(versions.end()) ;
diff --git a/paludis/elike_package_dep_spec-fwd.hh b/paludis/elike_package_dep_spec-fwd.hh
index 5b4960c..95d980c 100644
--- a/paludis/elike_package_dep_spec-fwd.hh
+++ b/paludis/elike_package_dep_spec-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -46,17 +46,22 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
PackageDepSpec parse_elike_package_dep_spec(const std::string & ss, const ELikePackageDepSpecOptions &,
+ const VersionSpecOptions &,
const std::tr1::shared_ptr<const PackageID> &)
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
- PartiallyMadePackageDepSpec partial_parse_elike_package_dep_spec(const std::string & ss, const ELikePackageDepSpecOptions &,
+ PartiallyMadePackageDepSpec partial_parse_elike_package_dep_spec(const std::string & ss,
+ const ELikePackageDepSpecOptions &,
+ const VersionSpecOptions &,
const std::tr1::shared_ptr<const PackageID> &)
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
void elike_check_sanity(const std::string & s) PALUDIS_VISIBLE;
bool elike_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
- const ELikePackageDepSpecOptions & options, bool & had_bracket_version_requirements,
+ const ELikePackageDepSpecOptions & options,
+ const VersionSpecOptions & version_options,
+ bool & had_bracket_version_requirements,
bool & had_use_requirements, const std::tr1::shared_ptr<const PackageID> & id) PALUDIS_VISIBLE;
void elike_remove_trailing_repo_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
@@ -67,9 +72,11 @@ namespace paludis
bool elike_has_version_operator(const std::string & s, const bool had_bracket_version_requirements) PALUDIS_VISIBLE;
- VersionOperator elike_get_remove_version_operator(std::string & s, const ELikePackageDepSpecOptions & options) PALUDIS_VISIBLE;
+ VersionOperator elike_get_remove_version_operator(std::string & s,
+ const ELikePackageDepSpecOptions & options) PALUDIS_VISIBLE;
- VersionSpec elike_get_remove_trailing_version(std::string & s) PALUDIS_VISIBLE;
+ VersionSpec elike_get_remove_trailing_version(std::string & s,
+ const VersionSpecOptions &) PALUDIS_VISIBLE;
void elike_add_version_requirement(const VersionOperator & op, const VersionSpec & spec, PartiallyMadePackageDepSpec & result)
PALUDIS_VISIBLE;
diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc
index 9edbc56..ab95c43 100644
--- a/paludis/elike_package_dep_spec.cc
+++ b/paludis/elike_package_dep_spec.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -85,7 +85,9 @@ paludis::elike_check_sanity(const std::string & s)
bool
paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
- const ELikePackageDepSpecOptions & options, bool & had_bracket_version_requirements,
+ const ELikePackageDepSpecOptions & options,
+ const VersionSpecOptions & version_options,
+ bool & had_bracket_version_requirements,
bool & had_use_requirements, const std::tr1::shared_ptr<const PackageID> & id)
{
std::string::size_type use_group_p;
@@ -171,7 +173,7 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Partial
throw PackageDepSpecError("Invalid use of * with operator '" + stringify(vop) + " inside []");
}
- VersionSpec vs(ver);
+ VersionSpec vs(ver, version_options);
result.version_requirement(make_named_values<VersionRequirement>(
value_for<n::version_operator>(vop),
value_for<n::version_spec>(vs)));
@@ -344,7 +346,7 @@ paludis::elike_get_remove_version_operator(std::string & s, const ELikePackageDe
}
VersionSpec
-paludis::elike_get_remove_trailing_version(std::string & s)
+paludis::elike_get_remove_trailing_version(std::string & s, const VersionSpecOptions & version_options)
{
/* find the last place a version spec could start (that is, a hyphen
* followed by a digit, or a hyphen followed by 'scm'). if it's the scm
@@ -392,7 +394,7 @@ paludis::elike_get_remove_trailing_version(std::string & s)
hyphen_pos = s.rfind('-', hyphen_pos - 1);
}
- VersionSpec result(s.substr(hyphen_pos + 1));
+ VersionSpec result(s.substr(hyphen_pos + 1), version_options);
s.erase(hyphen_pos);
return result;
}
@@ -430,7 +432,9 @@ paludis::elike_add_package_requirement(const std::string & s, PartiallyMadePacka
PartiallyMadePackageDepSpec
paludis::partial_parse_elike_package_dep_spec(
- const std::string & ss, const ELikePackageDepSpecOptions & options, const std::tr1::shared_ptr<const PackageID> & id)
+ const std::string & ss, const ELikePackageDepSpecOptions & options,
+ const VersionSpecOptions & version_options,
+ const std::tr1::shared_ptr<const PackageID> & id)
{
using namespace std::tr1::placeholders;
@@ -442,21 +446,22 @@ paludis::partial_parse_elike_package_dep_spec(
value_for<n::add_package_requirement>(std::tr1::bind(&elike_add_package_requirement, _1, _2)),
value_for<n::add_version_requirement>(std::tr1::bind(&elike_add_version_requirement, _1, _2, _3)),
value_for<n::check_sanity>(&elike_check_sanity),
- value_for<n::get_remove_trailing_version>(std::tr1::bind(&elike_get_remove_trailing_version, _1)),
+ value_for<n::get_remove_trailing_version>(std::tr1::bind(&elike_get_remove_trailing_version, _1, version_options)),
value_for<n::get_remove_version_operator>(std::tr1::bind(&elike_get_remove_version_operator, _1, options)),
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(&elike_remove_trailing_repo_if_exists, _1, _2, options)),
value_for<n::remove_trailing_slot_if_exists>(std::tr1::bind(&elike_remove_trailing_slot_if_exists, _1, _2, options)),
value_for<n::remove_trailing_square_bracket_if_exists>(std::tr1::bind(&elike_remove_trailing_square_bracket_if_exists,
- _1, _2, options, std::tr1::ref(had_bracket_version_requirements), std::tr1::ref(had_use_requirements), id))
+ _1, _2, options, version_options, std::tr1::ref(had_bracket_version_requirements), std::tr1::ref(had_use_requirements), id))
));
}
PackageDepSpec
paludis::parse_elike_package_dep_spec(const std::string & ss, const ELikePackageDepSpecOptions & options,
+ const VersionSpecOptions & version_options,
const std::tr1::shared_ptr<const PackageID> & id)
{
- return partial_parse_elike_package_dep_spec(ss, options, id);
+ return partial_parse_elike_package_dep_spec(ss, options, version_options, id);
}
diff --git a/paludis/filter_TEST.cc b/paludis/filter_TEST.cc
index 8244f01..3af2cdf 100644
--- a/paludis/filter_TEST.cc
+++ b/paludis/filter_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -61,14 +61,14 @@ namespace test_cases
env.package_database()->add_repository(10, repo2);
env.package_database()->add_repository(0, inst_repo1);
- repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1"));
- repo1->add_version(CategoryNamePart("cat") + PackageNamePart("b"), VersionSpec("2"));
+ repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1", VersionSpecOptions()));
+ repo1->add_version(CategoryNamePart("cat") + PackageNamePart("b"), VersionSpec("2", VersionSpecOptions()));
- repo2->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1"));
- repo2->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("2"))->keywords_key()->set_from_string("");
- repo2->add_version(CategoryNamePart("cat") + PackageNamePart("c"), VersionSpec("3"));
+ repo2->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1", VersionSpecOptions()));
+ repo2->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("2", VersionSpecOptions()))->keywords_key()->set_from_string("");
+ repo2->add_version(CategoryNamePart("cat") + PackageNamePart("c"), VersionSpec("3", VersionSpecOptions()));
- inst_repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1"));
+ inst_repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1", VersionSpecOptions()));
}
virtual std::string get_expected() const = 0;
diff --git a/paludis/generator_TEST.cc b/paludis/generator_TEST.cc
index 0acfbb1..9868ec2 100644
--- a/paludis/generator_TEST.cc
+++ b/paludis/generator_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -61,14 +61,14 @@ namespace test_cases
env.package_database()->add_repository(10, repo2);
env.package_database()->add_repository(0, inst_repo1);
- repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1"));
- repo1->add_version(CategoryNamePart("cat") + PackageNamePart("b"), VersionSpec("2"));
+ repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1", VersionSpecOptions()));
+ repo1->add_version(CategoryNamePart("cat") + PackageNamePart("b"), VersionSpec("2", VersionSpecOptions()));
- repo2->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1"));
- repo2->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("2"))->keywords_key()->set_from_string("");
- repo2->add_version(CategoryNamePart("cat") + PackageNamePart("c"), VersionSpec("3"));
+ repo2->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1", VersionSpecOptions()));
+ repo2->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("2", VersionSpecOptions()))->keywords_key()->set_from_string("");
+ repo2->add_version(CategoryNamePart("cat") + PackageNamePart("c"), VersionSpec("3", VersionSpecOptions()));
- inst_repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1"));
+ inst_repo1->add_version(CategoryNamePart("cat") + PackageNamePart("a"), VersionSpec("1", VersionSpecOptions()));
}
virtual std::string get_expected() const = 0;
diff --git a/paludis/ndbam.cc b/paludis/ndbam.cc
index 991630e..6297ad6 100644
--- a/paludis/ndbam.cc
+++ b/paludis/ndbam.cc
@@ -86,6 +86,7 @@ namespace paludis
struct Implementation<NDBAM>
{
const FSEntry location;
+ const VersionSpecOptions version_options;
mutable Mutex category_names_mutex;
mutable std::tr1::shared_ptr<CategoryNamePartSet> category_names;
@@ -94,8 +95,9 @@ namespace paludis
mutable Mutex category_names_containing_package_mutex;
mutable CategoryNamesContainingPackage category_names_containing_package;
- Implementation(const FSEntry & l) :
- location(l)
+ Implementation(const FSEntry & l, const VersionSpecOptions & o) :
+ location(l),
+ version_options(o)
{
}
};
@@ -103,8 +105,9 @@ namespace paludis
NDBAM::NDBAM(const FSEntry & l,
const std::tr1::function<bool (const std::string &)> & check_format,
- const std::string & preferred_format) :
- PrivateImplementationPattern<NDBAM>(new Implementation<NDBAM>(l))
+ const std::string & preferred_format,
+ const VersionSpecOptions & version_options) :
+ PrivateImplementationPattern<NDBAM>(new Implementation<NDBAM>(l, version_options))
{
Context c("When checking NDBAM layout at '" + stringify(l) + "':");
if ((l / "ndbam.conf").exists())
@@ -324,7 +327,7 @@ NDBAM::entries(const QualifiedPackageName & q)
continue;
}
- VersionSpec v(tokens[0]);
+ VersionSpec v(tokens[0], _imp->version_options);
SlotName s(tokens[1]);
std::string m(tokens[2]);
pc.entries->push_back(make_shared_ptr(new NDBAMEntry(NDBAMEntry(make_named_values<NDBAMEntry>(
diff --git a/paludis/ndbam.hh b/paludis/ndbam.hh
index 902d268..2d64f6f 100644
--- a/paludis/ndbam.hh
+++ b/paludis/ndbam.hh
@@ -73,9 +73,14 @@ namespace paludis
///\name Basic operations
///\{
+ /**
+ * Constructor.
+ *
+ * \param version_options \since 0.38
+ */
NDBAM(const FSEntry &,
const std::tr1::function<bool (const std::string &)> & check_format,
- const std::string & preferred_format);
+ const std::string & preferred_format, const VersionSpecOptions & version_options);
~NDBAM();
///\}
diff --git a/paludis/package_database_TEST.cc b/paludis/package_database_TEST.cc
index 82ed036..dbb795f 100644
--- a/paludis/package_database_TEST.cc
+++ b/paludis/package_database_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -117,47 +117,47 @@ namespace test_cases
PackageDatabase & p(*e.package_database());
std::tr1::shared_ptr<FakeRepository> r1(new FakeRepository(&e, RepositoryName("repo1")));
- r1->add_version(CategoryNamePart("cat-one") + PackageNamePart("pkg-one"), VersionSpec("0"));
- r1->add_version(CategoryNamePart("cat-one") + PackageNamePart("pkg-two"), VersionSpec("0"));
- r1->add_version(CategoryNamePart("cat-two") + PackageNamePart("pkg-two"), VersionSpec("0"));
- r1->add_version(CategoryNamePart("cat-two") + PackageNamePart("pkg-three"), VersionSpec("0"));
+ r1->add_version(CategoryNamePart("cat-one") + PackageNamePart("pkg-one"), VersionSpec("0", VersionSpecOptions()));
+ r1->add_version(CategoryNamePart("cat-one") + PackageNamePart("pkg-two"), VersionSpec("0", VersionSpecOptions()));
+ r1->add_version(CategoryNamePart("cat-two") + PackageNamePart("pkg-two"), VersionSpec("0", VersionSpecOptions()));
+ r1->add_version(CategoryNamePart("cat-two") + PackageNamePart("pkg-three"), VersionSpec("0", VersionSpecOptions()));
p.add_repository(10, r1);
TEST_CHECK(true);
std::tr1::shared_ptr<FakeRepository> r2(new FakeRepository(&e, RepositoryName("repo2")));
- r2->add_version(CategoryNamePart("cat-three") + PackageNamePart("pkg-three"), VersionSpec("0"));
- r2->add_version(CategoryNamePart("cat-three") + PackageNamePart("pkg-four"), VersionSpec("0"));
+ r2->add_version(CategoryNamePart("cat-three") + PackageNamePart("pkg-three"), VersionSpec("0", VersionSpecOptions()));
+ r2->add_version(CategoryNamePart("cat-three") + PackageNamePart("pkg-four"), VersionSpec("0", VersionSpecOptions()));
p.add_repository(10, r2);
TEST_CHECK(true);
std::tr1::shared_ptr<FakeRepository> r3(new CoolFakeRepository(&e, RepositoryName("repo3")));
- r3->add_version(CategoryNamePart("bad-cat1") + PackageNamePart("pkg-important"), VersionSpec("0"));
- r3->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-important"), VersionSpec("0"));
+ r3->add_version(CategoryNamePart("bad-cat1") + PackageNamePart("pkg-important"), VersionSpec("0", VersionSpecOptions()));
+ r3->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-important"), VersionSpec("0", VersionSpecOptions()));
- r3->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-installed"), VersionSpec("0"));
- r3->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-installed"), VersionSpec("0"));
+ r3->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-installed"), VersionSpec("0", VersionSpecOptions()));
+ r3->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-installed"), VersionSpec("0", VersionSpecOptions()));
- r3->add_version(CategoryNamePart("bad-cat1") + PackageNamePart("pkg-fail1"), VersionSpec("0"));
- r3->add_version(CategoryNamePart("bad-cat2") + PackageNamePart("pkg-fail1"), VersionSpec("0"));
+ r3->add_version(CategoryNamePart("bad-cat1") + PackageNamePart("pkg-fail1"), VersionSpec("0", VersionSpecOptions()));
+ r3->add_version(CategoryNamePart("bad-cat2") + PackageNamePart("pkg-fail1"), VersionSpec("0", VersionSpecOptions()));
- r3->add_version(CategoryNamePart("bad-cat1") + PackageNamePart("pkg-fail2"), VersionSpec("0"));
- r3->add_version(CategoryNamePart("bad-cat2") + PackageNamePart("pkg-fail2"), VersionSpec("0"));
+ r3->add_version(CategoryNamePart("bad-cat1") + PackageNamePart("pkg-fail2"), VersionSpec("0", VersionSpecOptions()));
+ r3->add_version(CategoryNamePart("bad-cat2") + PackageNamePart("pkg-fail2"), VersionSpec("0", VersionSpecOptions()));
- r3->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-fail3"), VersionSpec("0"));
- r3->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-fail3"), VersionSpec("0"));
+ r3->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-fail3"), VersionSpec("0", VersionSpecOptions()));
+ r3->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-fail3"), VersionSpec("0", VersionSpecOptions()));
- r3->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-fail4"), VersionSpec("0"));
- r3->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-fail4"), VersionSpec("0"));
+ r3->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-fail4"), VersionSpec("0", VersionSpecOptions()));
+ r3->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-fail4"), VersionSpec("0", VersionSpecOptions()));
- r3->add_version(CategoryNamePart("avail-cat") + PackageNamePart("pkg-foo"), VersionSpec("0"));
+ r3->add_version(CategoryNamePart("avail-cat") + PackageNamePart("pkg-foo"), VersionSpec("0", VersionSpecOptions()));
p.add_repository(10, r3);
TEST_CHECK(true);
std::tr1::shared_ptr<FakeInstalledRepository> r4(new FakeInstalledRepository(&e, RepositoryName("repo4")));
- r4->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-installed"), VersionSpec("0"));
- r4->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-fail4"), VersionSpec("0"));
- r4->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-fail4"), VersionSpec("0"));
- r4->add_version(CategoryNamePart("inst-cat") + PackageNamePart("pkg-foo"), VersionSpec("0"));
+ r4->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-installed"), VersionSpec("0", VersionSpecOptions()));
+ r4->add_version(CategoryNamePart("good-cat1") + PackageNamePart("pkg-fail4"), VersionSpec("0", VersionSpecOptions()));
+ r4->add_version(CategoryNamePart("good-cat2") + PackageNamePart("pkg-fail4"), VersionSpec("0", VersionSpecOptions()));
+ r4->add_version(CategoryNamePart("inst-cat") + PackageNamePart("pkg-foo"), VersionSpec("0", VersionSpecOptions()));
p.add_repository(10, r4);
TEST_CHECK_STRINGIFY_EQUAL(p.fetch_unique_qualified_package_name(PackageNamePart("pkg-one")),
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index 83484b1..38fe0ed 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -79,7 +79,7 @@ namespace paludis
const FSEntry & l, const bool u) :
env(e),
name(q),
- version("0"),
+ version("0", VersionSpecOptions()),
repository(r),
fs_location_key(new LiteralMetadataValueKey<FSEntry>("location", "Location", mkt_internal, l)),
from_repositories_key(f),
diff --git a/paludis/repositories/accounts/installed_accounts_id.cc b/paludis/repositories/accounts/installed_accounts_id.cc
index 689b3f1..55e08fe 100644
--- a/paludis/repositories/accounts/installed_accounts_id.cc
+++ b/paludis/repositories/accounts/installed_accounts_id.cc
@@ -57,7 +57,7 @@ namespace paludis
const bool u) :
env(e),
name(q),
- version("0"),
+ version("0", VersionSpecOptions()),
repository(r),
transient_key(new LiteralMetadataValueKey<bool>("transient", "Transient", mkt_internal, true)),
is_user(u)
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index c652051..59fb87d 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -83,7 +83,8 @@ namespace
const std::tr1::shared_ptr<const PackageID> & id)
{
std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
- parse_elike_package_dep_spec(s, eapi.supported()->package_dep_spec_parse_options(), id)));
+ parse_elike_package_dep_spec(s, eapi.supported()->package_dep_spec_parse_options(),
+ eapi.supported()->version_spec_options(), id)));
h.begin()->item()->append(spec);
annotations_go_here(spec);
}
@@ -108,7 +109,9 @@ namespace
std::tr1::shared_ptr<BlockDepSpec> spec(new BlockDepSpec(
make_shared_ptr(new PackageDepSpec(parse_elike_package_dep_spec(s.substr(specstart),
- eapi.supported()->package_dep_spec_parse_options(), id))), s));
+ eapi.supported()->package_dep_spec_parse_options(),
+ eapi.supported()->version_spec_options(),
+ id))), s));
h.begin()->item()->append(spec);
annotations_go_here(spec);
}
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 7f2deb9..61dfa4d 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -591,6 +591,7 @@ ERepository::repository_masked(const PackageID & id) const
{
std::tr1::shared_ptr<const PackageDepSpec> a(new PackageDepSpec(parse_elike_package_dep_spec(
line->second.first, line->first->supported()->package_dep_spec_parse_options(),
+ line->first->supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>())));
if (a->package_ptr())
_imp->repo_mask[*a->package_ptr()].push_back(std::make_pair(a, line->second.second));
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 54442cd..1bb5724 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -397,13 +397,13 @@ namespace test_cases
TEST_CHECK_EQUAL(2, std::distance(versions->begin(), versions->end()));
TEST_CHECK(indirect_iterator(versions->end()) != std::find_if(
indirect_iterator(versions->begin()), indirect_iterator(versions->end()),
- std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("1"))));
+ std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("1", VersionSpecOptions()))));
TEST_CHECK(indirect_iterator(versions->end()) != std::find_if(
indirect_iterator(versions->begin()), indirect_iterator(versions->end()),
- std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("1.1-r1"))));
+ std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("1.1-r1", VersionSpecOptions()))));
TEST_CHECK(indirect_iterator(versions->end()) == std::find_if(
indirect_iterator(versions->begin()), indirect_iterator(versions->end()),
- std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("2"))));
+ std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("2", VersionSpecOptions()))));
versions = repo->package_ids(QualifiedPackageName("cat-one/pkg-neither"));
TEST_CHECK(versions->empty());
@@ -442,13 +442,13 @@ namespace test_cases
TEST_CHECK_EQUAL(2, std::distance(versions->begin(), versions->end()));
TEST_CHECK(indirect_iterator(versions->end()) != std::find_if(
indirect_iterator(versions->begin()), indirect_iterator(versions->end()),
- std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("1"))));
+ std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("1", VersionSpecOptions()))));
TEST_CHECK(indirect_iterator(versions->end()) != std::find_if(
indirect_iterator(versions->begin()), indirect_iterator(versions->end()),
- std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("1.1-r1"))));
+ std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("1.1-r1", VersionSpecOptions()))));
TEST_CHECK(indirect_iterator(versions->end()) == std::find_if(
indirect_iterator(versions->begin()), indirect_iterator(versions->end()),
- std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("2"))));
+ std::tr1::bind(std::equal_to<VersionSpec>(), std::tr1::bind(std::tr1::mem_fn(&PackageID::version), _1), VersionSpec("2", VersionSpecOptions()))));
versions = repo->package_ids(QualifiedPackageName("cat-one/pkg-neither"));
TEST_CHECK(versions->empty());
diff --git a/paludis/repositories/e/e_repository_news.cc b/paludis/repositories/e/e_repository_news.cc
index 86c0cfd..c5d8c14 100644
--- a/paludis/repositories/e/e_repository_news.cc
+++ b/paludis/repositories/e/e_repository_news.cc
@@ -144,6 +144,9 @@ ERepositoryNews::update_news() const
NewsFile news(*d / (d->basename() + ".en.txt"));
bool show(true);
+ const EAPI & eapi(*erepository::EAPIData::get_instance()->eapi_from_string(
+ _imp->e_repository->params().profile_eapi_when_unspecified()));
+
if (news.begin_display_if_installed() != news.end_display_if_installed())
{
bool local_show(false);
@@ -151,9 +154,8 @@ ERepositoryNews::update_news() const
i_end(news.end_display_if_installed()) ; i != i_end ; ++i)
if (! (*_imp->environment)[selection::SomeArbitraryVersion(
generator::Matches(PackageDepSpec(parse_elike_package_dep_spec(*i,
- erepository::EAPIData::get_instance()->eapi_from_string(
- _imp->e_repository->params().profile_eapi_when_unspecified())
- ->supported()->package_dep_spec_parse_options(),
+ eapi.supported()->package_dep_spec_parse_options(),
+ eapi.supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>())), MatchPackageOptions()) |
filter::SupportsAction<InstalledAction>())]->empty())
local_show = true;
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index 7182f1b..08fbb97 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -484,6 +484,7 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
parse_elike_package_dep_spec(i->second.substr(1),
i->first->supported()->package_dep_spec_parse_options(),
+ i->first->supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>())));
spec->set_tag(system_tag);
@@ -517,6 +518,7 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
virtuals.insert(std::make_pair(v, std::tr1::shared_ptr<PackageDepSpec>(new PackageDepSpec(
parse_elike_package_dep_spec(tokens[1],
line->first->supported()->package_dep_spec_parse_options(),
+ line->first->supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>())))));
}
}
@@ -541,6 +543,7 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
std::tr1::shared_ptr<const PackageDepSpec> a(new PackageDepSpec(
parse_elike_package_dep_spec(line->second.first,
line->first->supported()->package_dep_spec_parse_options(),
+ line->first->supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>())));
if (a->package_ptr())
@@ -623,6 +626,7 @@ Implementation<ERepositoryProfile>::load_spec_use_file(const EAPI & eapi, const
{
std::tr1::shared_ptr<const PackageDepSpec> spec(new PackageDepSpec(
parse_elike_package_dep_spec(*tokens.begin(), eapi.supported()->package_dep_spec_parse_options(),
+ eapi.supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>())));
PackageFlagStatusMapList::iterator n(m.insert(m.end(), std::make_pair(spec, FlagStatusMap())));
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index 65610b8..e0d9db7 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -22,6 +22,7 @@
#include <paludis/repositories/e/e_repository_sets.hh>
#include <paludis/repositories/e/glsa.hh>
#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/eapi.hh>
#include <paludis/environment.hh>
#include <paludis/util/config_file.hh>
@@ -60,6 +61,7 @@
#include "config.h"
using namespace paludis;
+using namespace paludis::erepository;
namespace paludis
{
@@ -176,7 +178,7 @@ ERepositorySets::sets_list() const
namespace
{
bool
- match_range(const PackageID & e, const erepository::GLSARange & r)
+ match_range(const PackageID & e, const erepository::GLSARange & r, const VersionSpecOptions & ver_options)
{
if (r.slot() != "*")
{
@@ -213,29 +215,30 @@ namespace
our_op = vo_greater_equal;
if (-1 != our_op)
- return (VersionOperator(our_op).as_version_spec_comparator()(e.version(), VersionSpec(ver)));
+ return (VersionOperator(our_op).as_version_spec_comparator()(e.version(), VersionSpec(ver, ver_options)));
if (0 == r.op().compare(0, 1, "r"))
{
- return e.version().remove_revision() == VersionSpec(ver).remove_revision() &&
+ return e.version().remove_revision() == VersionSpec(ver, ver_options).remove_revision() &&
match_range(e, make_named_values<erepository::GLSARange>(
value_for<n::op>(r.op().substr(1)),
value_for<n::slot>(r.slot()),
- value_for<n::version>(r.version())));
+ value_for<n::version>(r.version())),
+ ver_options);
}
throw GLSAError("Got bad op '" + r.op() + "'");
}
bool
- is_vulnerable(const GLSAPackage & glsa_pkg, const PackageID & c)
+ is_vulnerable(const GLSAPackage & glsa_pkg, const PackageID & c, const VersionSpecOptions & ver_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))
+ if (match_range(c, *r, ver_options))
vulnerable = true;
if (! vulnerable)
@@ -243,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))
+ if (match_range(c, *r, ver_options))
vulnerable = false;
return vulnerable;
@@ -269,6 +272,14 @@ ERepositorySets::security_set(bool insecurity) const
Context local_context("When parsing security advisory '" + stringify(*f) + "':");
+ const std::tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string(
+ _imp->e_repository->eapi_for_file(*f)));
+ if (! eapi->supported())
+ throw GLSAError("Can't use advisory '" + stringify(*f) +
+ "' because it uses an unsupported EAPI");
+
+ const VersionSpecOptions ver_options(eapi->supported()->version_spec_options());
+
try
{
std::tr1::shared_ptr<const GLSA> glsa(GLSA::create_from_xml_file(stringify(*f)));
@@ -289,7 +300,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))
+ if (! is_vulnerable(*glsa_pkg, **c, ver_options))
continue;
if (glsa_tags.end() == glsa_tags.find(glsa->id()))
@@ -325,7 +336,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))
+ if (is_vulnerable(*glsa_pkg, **r, ver_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/eapi.cc b/paludis/repositories/e/eapi.cc
index c3eb56d..59a6330 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -268,6 +268,16 @@ namespace
iuse_flag_parse_options += destringify<IUseFlagParseOption>(*t);
}
+ VersionSpecOptions version_spec_options;
+ {
+ std::list<std::string> version_spec_options_tokens;
+ tokenise_whitespace(check_get(k, "version_spec_options"), std::back_inserter(version_spec_options_tokens));
+ for (std::list<std::string>::const_iterator t(version_spec_options_tokens.begin()),
+ t_end(version_spec_options_tokens.end()) ;
+ t != t_end ; ++t)
+ version_spec_options += destringify<VersionSpecOption>(*t);
+ }
+
MergerOptions merger_options;
{
std::list<std::string> merger_options_tokens;
@@ -295,7 +305,8 @@ namespace
value_for<n::pipe_commands>(make_pipe_commands(k)),
value_for<n::tools_options>(make_tool_options(k)),
value_for<n::uri_labels>(make_shared_ptr(new const EAPILabels(check_get(k, "uri_labels")))),
- value_for<n::userpriv_cannot_use_root>(destringify_key<bool>(k, "userpriv_cannot_use_root"))
+ value_for<n::userpriv_cannot_use_root>(destringify_key<bool>(k, "userpriv_cannot_use_root")),
+ value_for<n::version_spec_options>(version_spec_options)
)));
}
}
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index eba7938..a26cd88 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -163,6 +163,7 @@ namespace paludis
struct utility_path_suffixes;
struct vdb_from_env_unless_empty_variables;
struct vdb_from_env_variables;
+ struct version_spec_options;
struct want_portage_emulation_vars;
}
@@ -249,6 +250,7 @@ namespace paludis
NamedValue<n::tools_options, std::tr1::shared_ptr<const EAPIToolsOptions> > tools_options;
NamedValue<n::uri_labels, std::tr1::shared_ptr<const EAPILabels> > uri_labels;
NamedValue<n::userpriv_cannot_use_root, bool> userpriv_cannot_use_root;
+ NamedValue<n::version_spec_options, VersionSpecOptions> version_spec_options;
};
struct EAPIChoicesOptions
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 6407393..fea74db 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -7,6 +7,7 @@ can_be_pbin = true
package_dep_spec_parse_options =
dependency_spec_tree_parse_options =
iuse_flag_parse_options =
+version_spec_options =
merger_options = rewrite_symlinks allow_empty_dirs
breaks_portage = false
rdepend_defaults_to_depend = true
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 2340abe..f0b29a8 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -10,6 +10,8 @@ package_dep_spec_parse_options = allow_slot_deps allow_use_deps \
allow_slot_equal_deps allow_slot_star_deps allow_use_dep_defaults
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 \
+ letters_anywhere dotted_suffixes
merger_options =
breaks_portage = true
want_portage_emulation_vars = false
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 5d91abd..d50b17b 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -1043,7 +1043,9 @@ EbuildEntries::extract_package_file_version(const QualifiedPackageName & n, cons
std::string::size_type p(e.basename().rfind('.'));
if (std::string::npos == p)
throw InternalError(PALUDIS_HERE, "got npos");
- return VersionSpec(strip_leading_string(e.basename().substr(0, p), stringify(n.package()) + "-"));
+ return VersionSpec(strip_leading_string(e.basename().substr(0, p), stringify(n.package()) + "-"),
+ EAPIData::get_instance()->eapi_from_string(
+ _imp->e_repository->params().eapi_when_unknown())->supported()->version_spec_options());
}
bool
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 7595976..a2022cc 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -72,10 +72,13 @@ namespace paludis
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > root_key;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key;
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > builddir_key;
+ std::tr1::shared_ptr<const MetadataValueKey<std::string> > eapi_when_unknown_key;
Implementation(const ExndbamRepositoryParams & p) :
params(p),
- ndbam(params.location(), &supported_exndbam, "exndbam-1"),
+ ndbam(params.location(), &supported_exndbam, "exndbam-1",
+ EAPIData::get_instance()->eapi_from_string(
+ params.eapi_when_unknown())->supported()->version_spec_options()),
location_key(new LiteralMetadataValueKey<FSEntry> ("location", "location",
mkt_significant, params.location())),
root_key(new LiteralMetadataValueKey<FSEntry> ("root", "root",
@@ -83,7 +86,9 @@ namespace paludis
format_key(new LiteralMetadataValueKey<std::string> ("format", "format",
mkt_significant, "vdb")),
builddir_key(new LiteralMetadataValueKey<FSEntry> ("builddir", "builddir",
- mkt_normal, params.builddir()))
+ mkt_normal, params.builddir())),
+ eapi_when_unknown_key(new LiteralMetadataValueKey<std::string> (
+ "eapi_when_unknown", "eapi_when_unknown", mkt_normal, params.eapi_when_unknown()))
{
}
};
@@ -129,6 +134,7 @@ ExndbamRepository::_add_metadata_keys() const
add_metadata_key(_imp->root_key);
add_metadata_key(_imp->format_key);
add_metadata_key(_imp->builddir_key);
+ add_metadata_key(_imp->eapi_when_unknown_key);
}
std::tr1::shared_ptr<Repository>
@@ -155,10 +161,17 @@ ExndbamRepository::repository_factory_create(
if (name.empty())
name = "installed";
+ std::string eapi_when_unknown(f("eapi_when_unknown"));
+ if (eapi_when_unknown.empty())
+ eapi_when_unknown = EExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_eapi_when_unknown();
+
return std::tr1::shared_ptr<Repository>(new ExndbamRepository(
RepositoryName(name),
make_named_values<ExndbamRepositoryParams>(
value_for<n::builddir>(builddir),
+ value_for<n::eapi_when_unknown>(eapi_when_unknown),
value_for<n::environment>(env),
value_for<n::location>(location),
value_for<n::root>(root)
diff --git a/paludis/repositories/e/exndbam_repository.hh b/paludis/repositories/e/exndbam_repository.hh
index 609f5ed..d5fb511 100644
--- a/paludis/repositories/e/exndbam_repository.hh
+++ b/paludis/repositories/e/exndbam_repository.hh
@@ -32,6 +32,7 @@ namespace paludis
namespace n
{
struct builddir;
+ struct eapi_when_unknown;
struct environment;
struct location;
struct root;
@@ -44,6 +45,7 @@ namespace paludis
struct ExndbamRepositoryParams
{
NamedValue<n::builddir, FSEntry> builddir;
+ NamedValue<n::eapi_when_unknown, std::string> eapi_when_unknown;
NamedValue<n::environment, Environment *> environment;
NamedValue<n::location, FSEntry> location;
NamedValue<n::root, FSEntry> root;
diff --git a/paludis/repositories/e/info_metadata_key.cc b/paludis/repositories/e/info_metadata_key.cc
index 32ae6b8..383e211 100644
--- a/paludis/repositories/e/info_metadata_key.cc
+++ b/paludis/repositories/e/info_metadata_key.cc
@@ -184,6 +184,7 @@ InfoPkgsMetadataKey::need_keys_added() const
std::tr1::shared_ptr<const PackageIDSequence> q((*_imp->env)[selection::AllVersionsSorted(
generator::Matches(parse_elike_package_dep_spec(i->first,
eapi->supported()->package_dep_spec_parse_options(),
+ eapi->supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>()), MatchPackageOptions()) |
filter::InstalledAtRoot(_imp->env->root()))]);
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index f2892c2..cfb1db0 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -158,7 +158,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
if (! eapi->supported())
return "EBEST_VERSION EAPI " + tokens[1] + " unsupported";
- PackageDepSpec spec(parse_elike_package_dep_spec(tokens[2], eapi->supported()->package_dep_spec_parse_options(), package_id));
+ PackageDepSpec spec(parse_elike_package_dep_spec(tokens[2],
+ eapi->supported()->package_dep_spec_parse_options(),
+ eapi->supported()->version_spec_options(), package_id));
std::tr1::shared_ptr<const PackageIDSequence> entries((*environment)[selection::AllVersionsSorted(
generator::Matches(spec, MatchPackageOptions()) | filter::InstalledAtRoot(environment->root()))]);
if (eapi->supported()->pipe_commands()->rewrite_virtuals() && (! entries->empty()) &&
@@ -197,7 +199,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
if (! eapi->supported())
return "EHAS_VERSION EAPI " + tokens[1] + " unsupported";
- PackageDepSpec spec(parse_elike_package_dep_spec(tokens[2], eapi->supported()->package_dep_spec_parse_options(), package_id));
+ PackageDepSpec spec(parse_elike_package_dep_spec(tokens[2],
+ eapi->supported()->package_dep_spec_parse_options(),
+ eapi->supported()->version_spec_options(), package_id));
std::tr1::shared_ptr<const PackageIDSequence> entries((*environment)[selection::SomeArbitraryVersion(
generator::Matches(spec, MatchPackageOptions()) | filter::InstalledAtRoot(environment->root()))]);
if (entries->empty())
@@ -219,7 +223,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
if (! eapi->supported())
return "EMATCH EAPI " + tokens[1] + " unsupported";
- PackageDepSpec spec(parse_elike_package_dep_spec(tokens[2], eapi->supported()->package_dep_spec_parse_options(), package_id));
+ PackageDepSpec spec(parse_elike_package_dep_spec(tokens[2],
+ eapi->supported()->package_dep_spec_parse_options(),
+ eapi->supported()->version_spec_options(), package_id));
std::tr1::shared_ptr<const PackageIDSequence> entries((*environment)[selection::AllVersionsSorted(
generator::Matches(spec, MatchPackageOptions()) | filter::InstalledAtRoot(environment->root()))]);
if (eapi->supported()->pipe_commands()->rewrite_virtuals() && (! entries->empty()))
@@ -338,6 +344,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
}
else if (tokens[0] == "EVER")
{
+ std::tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string(tokens[1]));
+ if (! eapi->supported())
+ return "EVER EAPI " + tokens[1] + " unsupported";
if (tokens.size() < 3)
{
Log::get_instance()->message("e.pipe_commands.ever.bad", ll_warning, lc_context) << "Got bad EVER pipe command";
@@ -352,7 +361,8 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
return "Ebad EVER AT_LEAST command {'" + join(tokens.begin(), tokens.end(), "', '") + "'}";
}
- VersionSpec v1(tokens[3]), v2(tokens[4]);
+ VersionSpec v1(tokens[3], eapi->supported()->version_spec_options()),
+ v2(tokens[4], eapi->supported()->version_spec_options());
return v2 >= v1 ? "O0;" : "O1;";
}
else if (tokens[2] == "SPLIT" || tokens[2] == "SPLIT_ALL")
@@ -365,7 +375,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
return "Ebad EVER " + tokens[2] + " command {'" + join(tokens.begin(), tokens.end(), "', '") + "'}";
}
- VersionSpec v(tokens[3]);
+ VersionSpec v(tokens[3], eapi->supported()->version_spec_options());
std::string result;
for (VersionSpec::ConstIterator c(v.begin()), c_end(v.end()) ;
c != c_end ; ++c)
@@ -432,7 +442,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
}
- VersionSpec v(tokens[4]);
+ VersionSpec v(tokens[4], eapi->supported()->version_spec_options());
int current_pos(0);
std::string result;
@@ -478,7 +488,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
return "Ebad EVER " + tokens[2] + " command {'" + join(tokens.begin(), tokens.end(), "', '") + "'}";
}
- VersionSpec v(tokens[5]);
+ VersionSpec v(tokens[5], eapi->supported()->version_spec_options());
int current_pos(0);
std::string replacement(tokens[4]);
std::string result;
@@ -551,7 +561,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
return "Ebad EVER " + tokens[2] + " command {'" + join(tokens.begin(), tokens.end(), "', '") + "'}";
}
- VersionSpec v(tokens[4]);
+ VersionSpec v(tokens[4], eapi->supported()->version_spec_options());
std::string replacement(tokens[3]);
std::string result;
for (VersionSpec::ConstIterator c(v.begin()), c_end(v.end()) ;
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 9355458..034ae12 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -116,6 +116,7 @@ namespace paludis
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > provides_cache_key;
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > names_cache_key;
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > builddir_key;
+ std::tr1::shared_ptr<const MetadataValueKey<std::string> > eapi_when_unknown_key;
};
Implementation<VDBRepository>::Implementation(const VDBRepository * const r,
@@ -137,7 +138,9 @@ namespace paludis
names_cache_key(new LiteralMetadataValueKey<FSEntry> ("names_cache", "names_cache",
mkt_normal, params.names_cache())),
builddir_key(new LiteralMetadataValueKey<FSEntry> ("builddir", "builddir",
- mkt_normal, params.builddir()))
+ mkt_normal, params.builddir())),
+ eapi_when_unknown_key(new LiteralMetadataValueKey<std::string> (
+ "eapi_when_unknown", "eapi_when_unknown", mkt_normal, params.eapi_when_unknown()))
{
}
@@ -188,6 +191,7 @@ VDBRepository::_add_metadata_keys() const
add_metadata_key(_imp->provides_cache_key);
add_metadata_key(_imp->names_cache_key);
add_metadata_key(_imp->builddir_key);
+ add_metadata_key(_imp->eapi_when_unknown_key);
}
bool
@@ -329,8 +333,15 @@ VDBRepository::repository_factory_create(
if (name.empty())
name = "installed";
+ std::string eapi_when_unknown(f("eapi_when_unknown"));
+ if (eapi_when_unknown.empty())
+ eapi_when_unknown = EExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_eapi_when_unknown();
+
return std::tr1::shared_ptr<Repository>(new VDBRepository(make_named_values<VDBRepositoryParams>(
value_for<n::builddir>(builddir),
+ value_for<n::eapi_when_unknown>(eapi_when_unknown),
value_for<n::environment>(env),
value_for<n::location>(location),
value_for<n::name>(RepositoryName(name)),
@@ -619,7 +630,8 @@ VDBRepository::load_provided_using_cache() const
}
QualifiedPackageName q(tokens.at(0));
- VersionSpec v(tokens.at(1));
+ VersionSpec v(tokens.at(1), EAPIData::get_instance()->eapi_from_string(
+ _imp->params.eapi_when_unknown())->supported()->version_spec_options());
std::tr1::shared_ptr<Sequence<QualifiedPackageName> > qpns(new Sequence<QualifiedPackageName>);
std::copy(tokens.begin() + 2, tokens.end(), create_inserter<QualifiedPackageName>(qpns->back_inserter()));
diff --git a/paludis/repositories/e/vdb_repository.hh b/paludis/repositories/e/vdb_repository.hh
index 971c59a..c5cdbee 100644
--- a/paludis/repositories/e/vdb_repository.hh
+++ b/paludis/repositories/e/vdb_repository.hh
@@ -41,6 +41,7 @@ namespace paludis
namespace n
{
struct builddir;
+ struct eapi_when_unknown;
struct environment;
struct location;
struct name;
@@ -54,6 +55,7 @@ namespace paludis
struct VDBRepositoryParams
{
NamedValue<n::builddir, FSEntry> builddir;
+ NamedValue<n::eapi_when_unknown, std::string> eapi_when_unknown;
NamedValue<n::environment, Environment *> environment;
NamedValue<n::location, FSEntry> location;
NamedValue<n::name, RepositoryName> name;
diff --git a/paludis/repositories/fake/dep_parser.cc b/paludis/repositories/fake/dep_parser.cc
index 3a791d1..e30b427 100644
--- a/paludis/repositories/fake/dep_parser.cc
+++ b/paludis/repositories/fake/dep_parser.cc
@@ -29,6 +29,7 @@
#include <paludis/environment.hh>
#include <paludis/repository.hh>
#include <paludis/package_id.hh>
+#include <paludis/user_dep_spec.hh>
#include <list>
using namespace paludis;
@@ -54,7 +55,9 @@ namespace
PackageDepSpec p(parse_elike_package_dep_spec(s, ELikePackageDepSpecOptions() + epdso_allow_slot_deps
+ epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps
+ epdso_allow_use_deps + epdso_allow_ranged_deps + epdso_allow_tilde_greater_deps
- + epdso_strict_parsing, id));
+ + epdso_strict_parsing,
+ user_version_spec_options(),
+ id));
(*h.begin())->append(make_shared_ptr(new PackageDepSpec(p)));
}
@@ -69,7 +72,9 @@ namespace
ELikePackageDepSpecOptions() + epdso_allow_slot_deps
+ epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps
+ epdso_allow_use_deps + epdso_allow_ranged_deps + epdso_allow_tilde_greater_deps
- + epdso_strict_parsing, id))))));
+ + epdso_strict_parsing,
+ user_version_spec_options(),
+ id))))));
}
else
package_dep_spec_string_handler<T_>(h, s, id);
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index a4a9002..8f0515b 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -26,6 +26,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_output_iterator.hh>
+#include <paludis/user_dep_spec.hh>
#include <tr1/functional>
#include <map>
#include <algorithm>
@@ -141,6 +142,13 @@ FakeRepositoryBase::add_version(const QualifiedPackageName & q, const VersionSpe
return id;
}
+std::tr1::shared_ptr<FakePackageID>
+FakeRepositoryBase::add_version(const std::string & c, const std::string & p,
+ const std::string & v)
+{
+ return add_version(CategoryNamePart(c) + PackageNamePart(p), VersionSpec(v, user_version_spec_options()));
+}
+
void
FakeRepositoryBase::invalidate()
{
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index 195dbac..136530a 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -87,10 +87,8 @@ namespace paludis
* default values for its metadata, and return said metadata (convenience
* overload taking strings).
*/
- std::tr1::shared_ptr<FakePackageID> add_version(const std::string & c, const std::string & p, const std::string & v)
- {
- return add_version(CategoryNamePart(c) + PackageNamePart(p), VersionSpec(v));
- }
+ std::tr1::shared_ptr<FakePackageID> add_version(const std::string & c, const std::string & p,
+ const std::string & v);
/**
* Add a package set.
diff --git a/paludis/repositories/unavailable/unavailable_repository_file.cc b/paludis/repositories/unavailable/unavailable_repository_file.cc
index 8c395e6..7fa5d0b 100644
--- a/paludis/repositories/unavailable/unavailable_repository_file.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_file.cc
@@ -29,6 +29,7 @@
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/user_dep_spec.hh>
#include <list>
using namespace paludis;
@@ -160,7 +161,7 @@ UnavailableRepositoryFile::_load(const FSEntry & f)
(+simple_parser::any_except(" \t") >> token) &
(+simple_parser::any_of(" \t"))
))
- versions.push_back(VersionSpec(token));
+ versions.push_back(VersionSpec(token, user_version_spec_options()));
else
throw UnavailableRepositoryConfigurationError(
"Cannot parse body version line '" + line + " in '" + stringify(f) + "'");
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index f8be695..62ecec5 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -41,6 +41,7 @@
#include <paludis/dep_tag.hh>
#include <paludis/metadata_key.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/user_dep_spec.hh>
#include <sstream>
#include <sys/time.h>
@@ -69,7 +70,7 @@ namespace paludis
Implementation(const InstalledUnpackagedRepositoryParams & p) :
params(p),
- ndbam(p.location(), &supported_installed_unpackaged, "installed_unpackaged-1"),
+ ndbam(p.location(), &supported_installed_unpackaged, "installed_unpackaged-1", user_version_spec_options()),
location_key(new LiteralMetadataValueKey<FSEntry> ("location", "location",
mkt_significant, params.location())),
root_key(new LiteralMetadataValueKey<FSEntry> ("root", "root",
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index f61d56b..59de60f 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -131,7 +131,7 @@ namespace test_cases
generator::Matches(parse_user_package_dep_spec("cat-one/foo:0",
&env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin());
- TEST_CHECK_EQUAL(id1->version(), VersionSpec("1"));
+ TEST_CHECK_EQUAL(id1->version(), VersionSpec("1", VersionSpecOptions()));
TEST_CHECK_EQUAL(id1->slot_key()->value(), SlotName("0"));
TEST_CHECK_EQUAL(id1->name(), QualifiedPackageName("cat-one/foo"));
TEST_CHECK_EQUAL(id1->repository()->name(), RepositoryName("installed-unpackaged"));
@@ -149,7 +149,7 @@ namespace test_cases
generator::Matches(parse_user_package_dep_spec("cat-one/foo:1",
&env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin());
- TEST_CHECK_EQUAL(id2->version(), VersionSpec("2"));
+ TEST_CHECK_EQUAL(id2->version(), VersionSpec("2", VersionSpecOptions()));
TEST_CHECK_EQUAL(id2->slot_key()->value(), SlotName("1"));
TEST_CHECK_EQUAL(id2->name(), QualifiedPackageName("cat-one/foo"));
TEST_CHECK_EQUAL(id2->repository()->name(), RepositoryName("installed-unpackaged"));
@@ -388,7 +388,7 @@ namespace test_cases
value_for<n::rewrite_ids_over_to_root>(-1),
value_for<n::run_dependencies>(""),
value_for<n::slot>(SlotName("foo")),
- value_for<n::version>(VersionSpec("1.0"))
+ value_for<n::version>(VersionSpec("1.0", VersionSpecOptions()))
)));
env.package_database()->add_repository(1, source_repo);
@@ -446,7 +446,7 @@ namespace test_cases
value_for<n::rewrite_ids_over_to_root>(-1),
value_for<n::run_dependencies>(""),
value_for<n::slot>(SlotName("foo")),
- value_for<n::version>(VersionSpec("1.0"))
+ value_for<n::version>(VersionSpec("1.0", VersionSpecOptions()))
)));
env.package_database()->add_repository(1, source_repo);
@@ -506,7 +506,7 @@ namespace test_cases
value_for<n::rewrite_ids_over_to_root>(-1),
value_for<n::run_dependencies>(""),
value_for<n::slot>(SlotName("foo")),
- value_for<n::version>(VersionSpec("1.0"))
+ value_for<n::version>(VersionSpec("1.0", VersionSpecOptions()))
)));
env.package_database()->add_repository(1, source_repo);
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.cc b/paludis/repositories/unpackaged/unpackaged_repository.cc
index fbeefd0..e3ca4c4 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -31,6 +31,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/user_dep_spec.hh>
using namespace paludis;
using namespace paludis::unpackaged_repositories;
@@ -257,7 +258,7 @@ UnpackagedRepository::repository_factory_create(
value_for<n::rewrite_ids_over_to_root>(rewrite_ids_over_to_root),
value_for<n::run_dependencies>(run_dependencies),
value_for<n::slot>(SlotName(slot)),
- value_for<n::version>(VersionSpec(version))
+ value_for<n::version>(VersionSpec(version, user_version_spec_options()))
)));
}
diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index f663d8d..3daac95 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -84,7 +84,7 @@ namespace test_cases
value_for<n::rewrite_ids_over_to_root>(-1),
value_for<n::run_dependencies>(""),
value_for<n::slot>(SlotName("foo")),
- value_for<n::version>(VersionSpec("1.0"))
+ value_for<n::version>(VersionSpec("1.0", VersionSpecOptions()))
)));
env.package_database()->add_repository(1, repo);
@@ -114,14 +114,14 @@ namespace test_cases
value_for<n::rewrite_ids_over_to_root>(-1),
value_for<n::run_dependencies>(""),
value_for<n::slot>(SlotName("foo")),
- value_for<n::version>(VersionSpec("1.0"))
+ value_for<n::version>(VersionSpec("1.0", VersionSpecOptions()))
)));
env.package_database()->add_repository(1, repo);
const std::tr1::shared_ptr<const PackageID> id(
*env[selection::RequireExactlyOne(generator::All())]->begin());
- TEST_CHECK_EQUAL(id->version(), VersionSpec("1.0"));
+ TEST_CHECK_EQUAL(id->version(), VersionSpec("1.0", VersionSpecOptions()));
TEST_CHECK_EQUAL(id->slot_key()->value(), SlotName("foo"));
TEST_CHECK_EQUAL(id->name(), QualifiedPackageName("cat/pkg"));
TEST_CHECK_EQUAL(id->repository()->name(), RepositoryName("unpackaged"));
@@ -149,7 +149,7 @@ namespace test_cases
value_for<n::rewrite_ids_over_to_root>(-1),
value_for<n::run_dependencies>(""),
value_for<n::slot>(SlotName("foo")),
- value_for<n::version>(VersionSpec("1.0"))
+ value_for<n::version>(VersionSpec("1.0", VersionSpecOptions()))
)));
env.package_database()->add_repository(1, repo);
@@ -179,7 +179,7 @@ namespace test_cases
value_for<n::rewrite_ids_over_to_root>(-1),
value_for<n::run_dependencies>(""),
value_for<n::slot>(SlotName("foo")),
- value_for<n::version>(VersionSpec("1.0"))
+ value_for<n::version>(VersionSpec("1.0", VersionSpecOptions()))
)));
env.package_database()->add_repository(1, repo);
@@ -222,7 +222,7 @@ namespace test_cases
value_for<n::rewrite_ids_over_to_root>(-1),
value_for<n::run_dependencies>(""),
value_for<n::slot>(SlotName("foo")),
- value_for<n::version>(VersionSpec("1.0"))
+ value_for<n::version>(VersionSpec("1.0", VersionSpecOptions()))
)));
env.package_database()->add_repository(1, repo);
@@ -278,7 +278,7 @@ namespace test_cases
value_for<n::rewrite_ids_over_to_root>(-1),
value_for<n::run_dependencies>(""),
value_for<n::slot>(SlotName("foo")),
- value_for<n::version>(VersionSpec("1.0"))
+ value_for<n::version>(VersionSpec("1.0", VersionSpecOptions()))
)));
env.package_database()->add_repository(1, repo);
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc
index 8f48e90..a5bda43 100644
--- a/paludis/repositories/unwritten/unwritten_repository_file.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_file.cc
@@ -35,6 +35,7 @@
#include <paludis/metadata_key-fwd.hh>
#include <paludis/dep_spec.hh>
#include <paludis/formatter.hh>
+#include <paludis/user_dep_spec.hh>
#include <list>
using namespace paludis;
@@ -194,7 +195,7 @@ UnwrittenRepositoryFile::_load(const FSEntry & f)
CategoryNamePart category("x");
PackageNamePart package("x");
std::tr1::shared_ptr<MetadataValueKey<SlotName> > slot;
- VersionSpec version("0");
+ VersionSpec version("0", VersionSpecOptions());
std::tr1::shared_ptr<UnwrittenRepositoryFileEntry> entry;
while (std::getline(file, line))
{
@@ -245,7 +246,7 @@ UnwrittenRepositoryFile::_load(const FSEntry & f)
if (line_parser.consume(
(+simple_parser::any_except(" \t") >> token)
))
- version = VersionSpec(token);
+ version = VersionSpec(token, user_version_spec_options());
else
throw UnwrittenRepositoryConfigurationError(
"Cannot parse body slot+version line '" + line + " in '" + stringify(f) + "'");
diff --git a/paludis/uninstall_list_TEST.cc b/paludis/uninstall_list_TEST.cc
index 4db6b58..957c554 100644
--- a/paludis/uninstall_list_TEST.cc
+++ b/paludis/uninstall_list_TEST.cc
@@ -116,7 +116,7 @@ namespace test_cases
targets->push_back(
env.fetch_package_id(
QualifiedPackageName(p),
- VersionSpec(v),
+ VersionSpec(v, VersionSpecOptions()),
RepositoryName("installed")));
}
diff --git a/paludis/user_dep_spec-fwd.hh b/paludis/user_dep_spec-fwd.hh
index 116d434..788e04b 100644
--- a/paludis/user_dep_spec-fwd.hh
+++ b/paludis/user_dep_spec-fwd.hh
@@ -26,6 +26,7 @@
#include <paludis/dep_spec-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
+#include <paludis/version_spec-fwd.hh>
#include <tr1/memory>
#include <iosfwd>
@@ -65,6 +66,14 @@ namespace paludis
struct UserSlotExactRequirement;
struct UserKeyRequirement;
+
+ /**
+ * The VersionSpecOptions to use for parsing a user spec.
+ *
+ * \since 0.38
+ * \ingroup g_dep_spec
+ */
+ VersionSpecOptions user_version_spec_options() PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
}
#endif
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 5a0319a..810b321 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -167,7 +167,7 @@ namespace
throw PackageDepSpecError("Invalid use of * with operator '" + stringify(vop) + " inside []");
}
- VersionSpec vs(ver);
+ VersionSpec vs(ver, user_version_spec_options());
result.version_requirement(make_named_values<VersionRequirement>(
value_for<n::version_operator>(vop),
value_for<n::version_spec>(vs)));
@@ -293,7 +293,8 @@ paludis::parse_user_package_dep_spec(const std::string & ss, const Environment *
value_for<n::add_package_requirement>(std::tr1::bind(&user_add_package_requirement, _1, _2, env, options, filter)),
value_for<n::add_version_requirement>(std::tr1::bind(&elike_add_version_requirement, _1, _2, _3)),
value_for<n::check_sanity>(std::tr1::bind(&user_check_sanity, _1, options, env)),
- value_for<n::get_remove_trailing_version>(std::tr1::bind(&elike_get_remove_trailing_version, _1)),
+ 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)),
value_for<n::has_version_operator>(std::tr1::bind(&elike_has_version_operator, _1, std::tr1::cref(had_bracket_version_requirements))),
@@ -507,5 +508,12 @@ UserKeyRequirement::as_raw_string() const
return "[." + _imp->key + "=" + _imp->value + "]";
}
+VersionSpecOptions
+paludis::user_version_spec_options()
+{
+ return VersionSpecOptions() + vso_flexible_dashes + vso_flexible_dots +
+ vso_ignore_case + vso_letters_anywhere + vso_dotted_suffixes;
+}
+
template class PrivateImplementationPattern<UserKeyRequirement>;
diff --git a/paludis/version_spec-fwd.hh b/paludis/version_spec-fwd.hh
index fdb0819..6d328ba 100644
--- a/paludis/version_spec-fwd.hh
+++ b/paludis/version_spec-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -22,6 +22,7 @@
#include <iosfwd>
#include <paludis/util/attributes.hh>
+#include <paludis/util/options-fwd.hh>
/** \file
* Forward declarations for paludis/version_spec.hh .
@@ -39,6 +40,14 @@ namespace paludis
#include <paludis/version_spec-se.hh>
/**
+ * Options for parsing a VersionSpec.
+ *
+ * \since 0.38
+ * \ingroup g_names
+ */
+ typedef Options<VersionSpecOption> VersionSpecOptions;
+
+ /**
* Output a VersionSpec to a stream.
*
* \ingroup g_names
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 2b36dc1..212d797 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -30,6 +30,7 @@
#include <paludis/util/named_value.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/options.hh>
#include <paludis/version_spec.hh>
#include <vector>
#include <limits>
@@ -64,16 +65,19 @@ namespace paludis
mutable bool has_is_scm;
mutable bool is_scm;
- Implementation() :
+ const VersionSpecOptions options;
+
+ Implementation(const VersionSpecOptions & o) :
has_hash(false),
- has_is_scm(false)
+ has_is_scm(false),
+ options(o)
{
}
};
}
-VersionSpec::VersionSpec(const std::string & text) :
- PrivateImplementationPattern<VersionSpec>(new Implementation<VersionSpec>)
+VersionSpec::VersionSpec(const std::string & text, const VersionSpecOptions & options) :
+ PrivateImplementationPattern<VersionSpec>(new Implementation<VersionSpec>(options))
{
Context c("When parsing version spec '" + text + "':");
@@ -250,7 +254,7 @@ VersionSpec::VersionSpec(const std::string & text) :
}
VersionSpec::VersionSpec(const VersionSpec & other) :
- PrivateImplementationPattern<VersionSpec>(new Implementation<VersionSpec>)
+ PrivateImplementationPattern<VersionSpec>(new Implementation<VersionSpec>(other._imp->options))
{
_imp->text = other._imp->text;
_imp->parts = other._imp->parts;
@@ -673,7 +677,7 @@ VersionSpec::bump() const
str.append((*r).number_value());
need_dot = true;
}
- return VersionSpec(str);
+ return VersionSpec(str, _imp->options);
}
bool
diff --git a/paludis/version_spec.hh b/paludis/version_spec.hh
index c5e7d0f..aacc480 100644
--- a/paludis/version_spec.hh
+++ b/paludis/version_spec.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -116,8 +116,10 @@ namespace paludis
/**
* Constructor.
+ *
+ * \param options \since 0.38
*/
- explicit VersionSpec(const std::string & text);
+ VersionSpec(const std::string & text, const VersionSpecOptions & options);
/**
* Copy constructor.
diff --git a/paludis/version_spec.se b/paludis/version_spec.se
index 9657c3c..aca4991 100644
--- a/paludis/version_spec.se
+++ b/paludis/version_spec.se
@@ -27,4 +27,26 @@ make_enum_VersionSpecComponentType()
END
}
+make_enum_VersionSpecOption()
+{
+ prefix vso
+
+ key vso_flexible_dashes "Allow - and _ to be interchanged"
+ key vso_flexible_dots "Allow - where . is allowed"
+ key vso_ignore_case "Allow uppercase letters"
+ key vso_letters_anywhere "Allow 1a2.3 etc"
+ key vso_dotted_suffixes "Allow 1_alpha2.3"
+
+ want_destringify
+
+ doxygen_comment << "END"
+ /**
+ * An option for parsing a VersionSpec.
+ *
+ * \ingroup g_dep_spec
+ * \since 0.38
+ * \see VersionSpecOptions
+ */
+END
+}
diff --git a/paludis/version_spec_TEST.cc b/paludis/version_spec_TEST.cc
index 988acbf..686024d 100644
--- a/paludis/version_spec_TEST.cc
+++ b/paludis/version_spec_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -19,6 +19,7 @@
#include <paludis/version_spec.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/options.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <vector>
@@ -44,33 +45,33 @@ namespace test_cases
void run()
{
- VersionSpec v("1");
- VersionSpec v1("1b");
- VersionSpec v2("1_alpha");
- VersionSpec v3("1_beta");
- VersionSpec v4("1_pre");
- VersionSpec v5("1_rc");
- VersionSpec v6("1_p");
- VersionSpec v7("1_alpha1");
- VersionSpec v8("1_beta1");
- VersionSpec v9("1_pre1");
- VersionSpec v10("1_rc1");
- VersionSpec v11("1_p1");
- VersionSpec v12("1_alpha-r1");
- VersionSpec v13("1_beta-r1");
- VersionSpec v14("1_pre-r1");
- VersionSpec v15("1_rc-r1");
- VersionSpec v16("1_p-r1");
- VersionSpec v17("1_alpha1-r1");
- VersionSpec v18("1_beta1-r1");
- VersionSpec v19("1_pre1-r1");
- VersionSpec v20("1_pre1-r1.2");
- VersionSpec v21("1_rc1-r1");
- VersionSpec v22("1_p1-r1");
- VersionSpec v23("1_alpha_p");
- VersionSpec v24("1_p3_alpha");
- VersionSpec v25("1_p4_p-r2");
- VersionSpec v26("scm");
+ VersionSpec v("1", VersionSpecOptions());
+ VersionSpec v1("1b", VersionSpecOptions());
+ VersionSpec v2("1_alpha", VersionSpecOptions());
+ VersionSpec v3("1_beta", VersionSpecOptions());
+ VersionSpec v4("1_pre", VersionSpecOptions());
+ VersionSpec v5("1_rc", VersionSpecOptions());
+ VersionSpec v6("1_p", VersionSpecOptions());
+ VersionSpec v7("1_alpha1", VersionSpecOptions());
+ VersionSpec v8("1_beta1", VersionSpecOptions());
+ VersionSpec v9("1_pre1", VersionSpecOptions());
+ VersionSpec v10("1_rc1", VersionSpecOptions());
+ VersionSpec v11("1_p1", VersionSpecOptions());
+ VersionSpec v12("1_alpha-r1", VersionSpecOptions());
+ VersionSpec v13("1_beta-r1", VersionSpecOptions());
+ VersionSpec v14("1_pre-r1", VersionSpecOptions());
+ VersionSpec v15("1_rc-r1", VersionSpecOptions());
+ VersionSpec v16("1_p-r1", VersionSpecOptions());
+ VersionSpec v17("1_alpha1-r1", VersionSpecOptions());
+ VersionSpec v18("1_beta1-r1", VersionSpecOptions());
+ VersionSpec v19("1_pre1-r1", VersionSpecOptions());
+ VersionSpec v20("1_pre1-r1.2", VersionSpecOptions());
+ VersionSpec v21("1_rc1-r1", VersionSpecOptions());
+ VersionSpec v22("1_p1-r1", VersionSpecOptions());
+ VersionSpec v23("1_alpha_p", VersionSpecOptions());
+ VersionSpec v24("1_p3_alpha", VersionSpecOptions());
+ VersionSpec v25("1_p4_p-r2", VersionSpecOptions());
+ VersionSpec v26("scm", VersionSpecOptions());
TEST_CHECK(true);
}
@@ -86,26 +87,26 @@ namespace test_cases
void run()
{
- TEST_CHECK_THROWS(VersionSpec v1(""), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("b"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1-r1_pre"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1-pre"), BadVersionSpecError);
- 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-try-try"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1-try_alpha"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1-scm-scm"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1-scm-try"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1-scm_alpha"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1-r2_pre"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1."), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1.1."), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1.-r"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1.-r1"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1-r.0"), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1-r1."), BadVersionSpecError);
- TEST_CHECK_THROWS(VersionSpec v1("1_p1."), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("b", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-r1_pre", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-pre", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1_blah", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1_pre-r2b", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1_pre-r2-r2", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-try-try", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-try_alpha", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-scm-scm", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-scm-try", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-scm_alpha", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-r2_pre", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1.", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1.1.", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1.-r", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1.-r1", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-r.0", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1-r1.", VersionSpecOptions()), BadVersionSpecError);
+ TEST_CHECK_THROWS(VersionSpec v1("1_p1.", VersionSpecOptions()), BadVersionSpecError);
}
} test_version_spec_reject;
@@ -119,14 +120,14 @@ namespace test_cases
void run()
{
- VersionSpec v("1.2.3");
- TEST_CHECK(v == VersionSpec("1.2.3"));
- VersionSpec v1("1.2_pre2-r1");
- TEST_CHECK(v1 == VersionSpec("1.2_pre2-r1"));
- VersionSpec v2("1.2_pre2_rc5_p6-r1");
- TEST_CHECK(v2 == VersionSpec("1.2_pre2_rc5_p6-r1"));
- VersionSpec v3("1.2_pre2_pre3_pre4");
- TEST_CHECK(v3 == VersionSpec("1.2_pre2_pre3_pre4"));
+ VersionSpec v("1.2.3", VersionSpecOptions());
+ TEST_CHECK(v == VersionSpec("1.2.3", VersionSpecOptions()));
+ VersionSpec v1("1.2_pre2-r1", VersionSpecOptions());
+ TEST_CHECK(v1 == VersionSpec("1.2_pre2-r1", VersionSpecOptions()));
+ VersionSpec v2("1.2_pre2_rc5_p6-r1", VersionSpecOptions());
+ TEST_CHECK(v2 == VersionSpec("1.2_pre2_rc5_p6-r1", VersionSpecOptions()));
+ VersionSpec v3("1.2_pre2_pre3_pre4", VersionSpecOptions());
+ TEST_CHECK(v3 == VersionSpec("1.2_pre2_pre3_pre4", VersionSpecOptions()));
}
} test_version_spec_parse;
@@ -140,17 +141,17 @@ namespace test_cases
void run()
{
- TEST_CHECK(VersionSpec("1.2").equal_star_compare(VersionSpec("1")));
- TEST_CHECK(VersionSpec("1.2").equal_star_compare(VersionSpec("1.2")));
- TEST_CHECK(VersionSpec("1.2.1").equal_star_compare(VersionSpec("1")));
- TEST_CHECK(VersionSpec("1.2.1").equal_star_compare(VersionSpec("1.2")));
- TEST_CHECK(VersionSpec("2.2").equal_star_compare(VersionSpec("2")));
- TEST_CHECK(VersionSpec("2").equal_star_compare(VersionSpec("2")));
- TEST_CHECK(VersionSpec("2.59").equal_star_compare(VersionSpec("2.5")));
- TEST_CHECK(VersionSpec("2.59_alpha5-r1").equal_star_compare(VersionSpec("2.59_alpha")));
- TEST_CHECK(! VersionSpec("2").equal_star_compare(VersionSpec("2.5")));
- TEST_CHECK(! VersionSpec("2.59").equal_star_compare(VersionSpec("2.50")));
- TEST_CHECK(! VersionSpec("1").equal_star_compare(VersionSpec("2")));
+ 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_version_spec_star_compare;
@@ -165,22 +166,22 @@ namespace test_cases
void run()
{
- TEST_CHECK(! VersionSpec("1.4-r1").tilde_compare(VersionSpec("1.3-r1")));
- TEST_CHECK(! VersionSpec("1.4").tilde_compare(VersionSpec("1.3-r1")));
- TEST_CHECK(! VersionSpec("1.2").tilde_compare(VersionSpec("1.3-r1")));
- TEST_CHECK(! VersionSpec("1.3").tilde_compare(VersionSpec("1.3-r1")));
-
- TEST_CHECK(VersionSpec("1.2").tilde_compare(VersionSpec("1.2")));
- TEST_CHECK(VersionSpec("1.2-r1").tilde_compare(VersionSpec("1.2")));
- TEST_CHECK(VersionSpec("1.2-r1.2.3").tilde_compare(VersionSpec("1.2")));
- TEST_CHECK(! VersionSpec("1.3").tilde_compare(VersionSpec("1.2")));
- TEST_CHECK(VersionSpec("1.2-r2").tilde_compare(VersionSpec("1.2-r1")));
- TEST_CHECK(VersionSpec("1.2-r2.3").tilde_compare(VersionSpec("1.2-r1")));
- TEST_CHECK(VersionSpec("1.2-r2").tilde_compare(VersionSpec("1.2-r2")));
- TEST_CHECK(! VersionSpec("1.2-r1").tilde_compare(VersionSpec("1.2-r2")));
- TEST_CHECK(! VersionSpec("1.2-r1.3").tilde_compare(VersionSpec("1.2-r2")));
- TEST_CHECK(! VersionSpec("1.2-r2").tilde_compare(VersionSpec("1.2-r2.3")));
- TEST_CHECK(VersionSpec("1.2-r2.4").tilde_compare(VersionSpec("1.2-r2.3")));
+ 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())));
+ TEST_CHECK(! VersionSpec("1.3", VersionSpecOptions()).tilde_compare(VersionSpec("1.3-r1", VersionSpecOptions())));
+
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).tilde_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2-r1", VersionSpecOptions()).tilde_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2-r1.2.3", VersionSpecOptions()).tilde_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1.3", VersionSpecOptions()).tilde_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2-r2", VersionSpecOptions()).tilde_compare(VersionSpec("1.2-r1", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2-r2.3", VersionSpecOptions()).tilde_compare(VersionSpec("1.2-r1", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2-r2", VersionSpecOptions()).tilde_compare(VersionSpec("1.2-r2", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1.2-r1", VersionSpecOptions()).tilde_compare(VersionSpec("1.2-r2", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1.2-r1.3", VersionSpecOptions()).tilde_compare(VersionSpec("1.2-r2", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1.2-r2", VersionSpecOptions()).tilde_compare(VersionSpec("1.2-r2.3", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2-r2.4", VersionSpecOptions()).tilde_compare(VersionSpec("1.2-r2.3", VersionSpecOptions())));
}
} test_version_spec_tilde_compare;
@@ -194,10 +195,10 @@ namespace test_cases
void run()
{
- TEST_CHECK(VersionSpec("1.2").tilde_greater_compare(VersionSpec("1.2")));
- TEST_CHECK(VersionSpec("1.2.1").tilde_greater_compare(VersionSpec("1.2")));
- TEST_CHECK(! VersionSpec("1.1").tilde_greater_compare(VersionSpec("1.2")));
- TEST_CHECK(! VersionSpec("2.0").tilde_greater_compare(VersionSpec("1.2")));
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).tilde_greater_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(VersionSpec("1.2.1", VersionSpecOptions()).tilde_greater_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("1.1", VersionSpecOptions()).tilde_greater_compare(VersionSpec("1.2", VersionSpecOptions())));
+ TEST_CHECK(! VersionSpec("2.0", VersionSpecOptions()).tilde_greater_compare(VersionSpec("1.2", VersionSpecOptions())));
}
} test_version_spec_tilde_greater_compare;
@@ -211,15 +212,15 @@ namespace test_cases
void run()
{
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2").remove_revision(), "1.2");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r").remove_revision(), "1.2");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r99").remove_revision(), "1.2");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r3.4").remove_revision(), "1.2");
-
- TEST_CHECK_EQUAL(VersionSpec("1.2").remove_revision(), VersionSpec("1.2"));
- TEST_CHECK_EQUAL(VersionSpec("1.2-r").remove_revision(), VersionSpec("1.2"));
- TEST_CHECK_EQUAL(VersionSpec("1.2-r99").remove_revision(), VersionSpec("1.2"));
- TEST_CHECK_EQUAL(VersionSpec("1.2-r3.4").remove_revision(), VersionSpec("1.2"));
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2", VersionSpecOptions()).remove_revision(), "1.2");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r", VersionSpecOptions()).remove_revision(), "1.2");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r99", VersionSpecOptions()).remove_revision(), "1.2");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r3.4", VersionSpecOptions()).remove_revision(), "1.2");
+
+ TEST_CHECK_EQUAL(VersionSpec("1.2", VersionSpecOptions()).remove_revision(), VersionSpec("1.2", VersionSpecOptions()));
+ TEST_CHECK_EQUAL(VersionSpec("1.2-r", VersionSpecOptions()).remove_revision(), VersionSpec("1.2", VersionSpecOptions()));
+ TEST_CHECK_EQUAL(VersionSpec("1.2-r99", VersionSpecOptions()).remove_revision(), VersionSpec("1.2", VersionSpecOptions()));
+ TEST_CHECK_EQUAL(VersionSpec("1.2-r3.4", VersionSpecOptions()).remove_revision(), VersionSpec("1.2", VersionSpecOptions()));
}
} test_version_remove_revision;
@@ -233,14 +234,14 @@ namespace test_cases
void run()
{
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2").bump(), "2");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r99").bump(), "2");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2.3").bump(), "1.3");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1").bump(), "2");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.99.0").bump(), "1.100");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.099.0").bump(), "1.100");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.0099.0").bump(), "1.0100");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("scm").bump(), "scm");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2", VersionSpecOptions()).bump(), "2");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r99", VersionSpecOptions()).bump(), "2");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2.3", VersionSpecOptions()).bump(), "1.3");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1", VersionSpecOptions()).bump(), "2");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.99.0", VersionSpecOptions()).bump(), "1.100");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.099.0", VersionSpecOptions()).bump(), "1.100");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.0099.0", VersionSpecOptions()).bump(), "1.0100");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("scm", VersionSpecOptions()).bump(), "scm");
}
} test_version_bump;
@@ -254,10 +255,10 @@ namespace test_cases
void run()
{
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2").revision_only(), "r0");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r").revision_only(), "r0");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r99").revision_only(), "r99");
- TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r3.4").revision_only(), "r3.4");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2", VersionSpecOptions()).revision_only(), "r0");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r", VersionSpecOptions()).revision_only(), "r0");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r99", VersionSpecOptions()).revision_only(), "r99");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r3.4", VersionSpecOptions()).revision_only(), "r3.4");
}
} test_version_revision_only;
@@ -271,23 +272,23 @@ namespace test_cases
void run()
{
- TEST_CHECK(! VersionSpec("1.2").is_scm());
- TEST_CHECK(VersionSpec("1.2-scm-r99").is_scm());
+ TEST_CHECK(! VersionSpec("1.2", VersionSpecOptions()).is_scm());
+ TEST_CHECK(VersionSpec("1.2-scm-r99", VersionSpecOptions()).is_scm());
- TEST_CHECK(! VersionSpec("1.2-r9998").is_scm());
- TEST_CHECK(VersionSpec("1.2-r9999").is_scm());
+ TEST_CHECK(! VersionSpec("1.2-r9998", VersionSpecOptions()).is_scm());
+ TEST_CHECK(VersionSpec("1.2-r9999", VersionSpecOptions()).is_scm());
- TEST_CHECK(! VersionSpec("9998").is_scm());
- TEST_CHECK(! VersionSpec("9999_alpha2").is_scm());
- TEST_CHECK(VersionSpec("9999").is_scm());
- TEST_CHECK(VersionSpec("9999-r4").is_scm());
+ TEST_CHECK(! VersionSpec("9998", VersionSpecOptions()).is_scm());
+ TEST_CHECK(! VersionSpec("9999_alpha2", VersionSpecOptions()).is_scm());
+ TEST_CHECK(VersionSpec("9999", VersionSpecOptions()).is_scm());
+ TEST_CHECK(VersionSpec("9999-r4", VersionSpecOptions()).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_CHECK(VersionSpec("99999999-r4", VersionSpecOptions()).is_scm());
+ TEST_CHECK(! VersionSpec("99999998-r4", VersionSpecOptions()).is_scm());
+ TEST_CHECK(! VersionSpec("999", VersionSpecOptions()).is_scm());
+ TEST_CHECK(! VersionSpec("1.9999", VersionSpecOptions()).is_scm());
+ TEST_CHECK(! VersionSpec("9999.1", VersionSpecOptions()).is_scm());
+ TEST_CHECK(! VersionSpec("9999.9999", VersionSpecOptions()).is_scm());
}
} test_version_is_scm;
@@ -302,22 +303,22 @@ namespace test_cases
void run()
{
- TEST_CHECK(! VersionSpec("1.2").has_scm_part());
- TEST_CHECK(VersionSpec("1.2-scm").has_scm_part());
- TEST_CHECK(VersionSpec("1.2-scm-r99").has_scm_part());
- TEST_CHECK(! VersionSpec("9999").has_scm_part());
- TEST_CHECK(VersionSpec("scm").has_scm_part());
-
- TEST_CHECK(! VersionSpec("1").has_try_part());
- TEST_CHECK(VersionSpec("1-try2").has_try_part());
- TEST_CHECK(VersionSpec("1.2-try3-r4").has_try_part());
-
- TEST_CHECK(! VersionSpec("1.2").has_local_revision());
- TEST_CHECK(! VersionSpec("1.2-r0").has_local_revision());
- TEST_CHECK(! VersionSpec("1.2-r3").has_local_revision());
- TEST_CHECK(VersionSpec("1.2-r3.0").has_local_revision());
- TEST_CHECK(VersionSpec("1.2-r3.4").has_local_revision());
- TEST_CHECK(VersionSpec("1.2-r3.4.5").has_local_revision());
+ TEST_CHECK(! VersionSpec("1.2", VersionSpecOptions()).has_scm_part());
+ TEST_CHECK(VersionSpec("1.2-scm", VersionSpecOptions()).has_scm_part());
+ TEST_CHECK(VersionSpec("1.2-scm-r99", VersionSpecOptions()).has_scm_part());
+ TEST_CHECK(! VersionSpec("9999", VersionSpecOptions()).has_scm_part());
+ TEST_CHECK(VersionSpec("scm", VersionSpecOptions()).has_scm_part());
+
+ TEST_CHECK(! VersionSpec("1", VersionSpecOptions()).has_try_part());
+ TEST_CHECK(VersionSpec("1-try2", VersionSpecOptions()).has_try_part());
+ TEST_CHECK(VersionSpec("1.2-try3-r4", VersionSpecOptions()).has_try_part());
+
+ TEST_CHECK(! VersionSpec("1.2", VersionSpecOptions()).has_local_revision());
+ TEST_CHECK(! VersionSpec("1.2-r0", VersionSpecOptions()).has_local_revision());
+ TEST_CHECK(! VersionSpec("1.2-r3", VersionSpecOptions()).has_local_revision());
+ TEST_CHECK(VersionSpec("1.2-r3.0", VersionSpecOptions()).has_local_revision());
+ TEST_CHECK(VersionSpec("1.2-r3.4", VersionSpecOptions()).has_local_revision());
+ TEST_CHECK(VersionSpec("1.2-r3.4.5", VersionSpecOptions()).has_local_revision());
}
} test_version_has_stuff;
@@ -327,11 +328,11 @@ namespace test_cases
void run()
{
- TEST_CHECK(VersionSpec("0").hash() != VersionSpec("0.0").hash());
- TEST_CHECK(VersionSpec("1").hash() != VersionSpec("1.0").hash());
- TEST_CHECK(VersionSpec("1.0").hash() != VersionSpec("1").hash());
- TEST_CHECK(VersionSpec("1.0_alpha").hash() != VersionSpec("1_alpha").hash());
- TEST_CHECK(VersionSpec("1_alpha").hash() != VersionSpec("1.0_alpha").hash());
+ TEST_CHECK(VersionSpec("0", VersionSpecOptions()).hash() != VersionSpec("0.0", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1", VersionSpecOptions()).hash() != VersionSpec("1.0", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1.0", VersionSpecOptions()).hash() != VersionSpec("1", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1.0_alpha", VersionSpecOptions()).hash() != VersionSpec("1_alpha", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1_alpha", VersionSpecOptions()).hash() != VersionSpec("1.0_alpha", VersionSpecOptions()).hash());
}
} test_version_spec_hash;
@@ -350,126 +351,126 @@ namespace test_cases
void run()
{
- TEST_CHECK(VersionSpec("1.0") > VersionSpec("1"));
- TEST_CHECK(VersionSpec("1") < VersionSpec("1.0"));
- TEST_CHECK(VersionSpec("1.0_alpha") > VersionSpec("1_alpha"));
- TEST_CHECK(VersionSpec("1.0_alpha") > VersionSpec("1"));
- TEST_CHECK(VersionSpec("1.0_alpha") < VersionSpec("1.0"));
- TEST_CHECK(VersionSpec("1.2.0.0_alpha7-r4") > VersionSpec("1.2_alpha7-r4"));
-
- TEST_CHECK(VersionSpec("0001") == VersionSpec("1"));
- TEST_CHECK(VersionSpec("01") == VersionSpec("001"));
- TEST_CHECK(VersionSpec("0001.1") == VersionSpec("1.1"));
- TEST_CHECK(VersionSpec("01.01") == VersionSpec("1.01"));
- TEST_CHECK(VersionSpec("1.010") == VersionSpec("1.01"));
- TEST_CHECK(VersionSpec("1.00") == VersionSpec("1.0"));
- TEST_CHECK(VersionSpec("1.0100") == VersionSpec("1.010"));
- TEST_CHECK(VersionSpec("1") == VersionSpec("1-r0"));
- TEST_CHECK(VersionSpec("1-r00") == VersionSpec("1-r0"));
- TEST_CHECK(VersionSpec("1.2") == VersionSpec("1.2-r"));
- 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_beta000_rc3-scm") == VersionSpec("1_alpha00_beta_rc3-scm"));
-
- TEST_CHECK(VersionSpec("0001").hash() == VersionSpec("1").hash());
- TEST_CHECK(VersionSpec("01").hash() == VersionSpec("001").hash());
- TEST_CHECK(VersionSpec("0001.1").hash() == VersionSpec("1.1").hash());
- TEST_CHECK(VersionSpec("01.01").hash() == VersionSpec("1.01").hash());
- TEST_CHECK(VersionSpec("1.010").hash() == VersionSpec("1.01").hash());
- TEST_CHECK(VersionSpec("1.00").hash() == VersionSpec("1.0").hash());
- TEST_CHECK(VersionSpec("1.0100").hash() == VersionSpec("1.010").hash());
- TEST_CHECK(VersionSpec("1").hash() == VersionSpec("1-r0").hash());
- TEST_CHECK(VersionSpec("1.2").hash() == VersionSpec("1.2-r").hash());
- TEST_CHECK(VersionSpec("1.2-r3").hash() == VersionSpec("1.2-r3.0").hash());
- TEST_CHECK(VersionSpec("1.2").hash() == VersionSpec("1.2-r0.0").hash());
+ TEST_CHECK(VersionSpec("1.0", VersionSpecOptions()) > VersionSpec("1", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1", VersionSpecOptions()) < VersionSpec("1.0", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.0_alpha", VersionSpecOptions()) > VersionSpec("1_alpha", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.0_alpha", VersionSpecOptions()) > VersionSpec("1", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.0_alpha", VersionSpecOptions()) < VersionSpec("1.0", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.2.0.0_alpha7-r4", VersionSpecOptions()) > VersionSpec("1.2_alpha7-r4", VersionSpecOptions()));
+
+ TEST_CHECK(VersionSpec("0001", VersionSpecOptions()) == VersionSpec("1", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("01", VersionSpecOptions()) == VersionSpec("001", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("0001.1", VersionSpecOptions()) == VersionSpec("1.1", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("01.01", VersionSpecOptions()) == VersionSpec("1.01", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.010", VersionSpecOptions()) == VersionSpec("1.01", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.00", VersionSpecOptions()) == VersionSpec("1.0", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.0100", VersionSpecOptions()) == VersionSpec("1.010", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1", VersionSpecOptions()) == VersionSpec("1-r0", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1-r00", VersionSpecOptions()) == VersionSpec("1-r0", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()) == VersionSpec("1.2-r", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.2-r3", VersionSpecOptions()) == VersionSpec("1.2-r3.0", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()) == VersionSpec("1.2-r0.0", VersionSpecOptions()));
+
+ TEST_CHECK(VersionSpec("1_alpha_beta-scm", VersionSpecOptions()) == VersionSpec("1_alpha0_beta-scm", VersionSpecOptions()));
+ TEST_CHECK(VersionSpec("1_alpha_beta000_rc3-scm", VersionSpecOptions()) == VersionSpec("1_alpha00_beta_rc3-scm", VersionSpecOptions()));
+
+ TEST_CHECK(VersionSpec("0001", VersionSpecOptions()).hash() == VersionSpec("1", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("01", VersionSpecOptions()).hash() == VersionSpec("001", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("0001.1", VersionSpecOptions()).hash() == VersionSpec("1.1", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("01.01", VersionSpecOptions()).hash() == VersionSpec("1.01", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1.010", VersionSpecOptions()).hash() == VersionSpec("1.01", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1.00", VersionSpecOptions()).hash() == VersionSpec("1.0", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1.0100", VersionSpecOptions()).hash() == VersionSpec("1.010", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1", VersionSpecOptions()).hash() == VersionSpec("1-r0", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).hash() == VersionSpec("1.2-r", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1.2-r3", VersionSpecOptions()).hash() == VersionSpec("1.2-r3.0", VersionSpecOptions()).hash());
+ TEST_CHECK(VersionSpec("1.2", VersionSpecOptions()).hash() == VersionSpec("1.2-r0.0", VersionSpecOptions()).hash());
std::vector<VersionSpec> v;
- v.push_back(VersionSpec("1_alpha_alpha"));
- v.push_back(VersionSpec("1_alpha"));
- v.push_back(VersionSpec("1_alpha1_alpha"));
- v.push_back(VersionSpec("1_alpha1_beta_pre"));
- v.push_back(VersionSpec("1_alpha1_beta"));
- v.push_back(VersionSpec("1_alpha1"));
- v.push_back(VersionSpec("1_alpha1-r1"));
- v.push_back(VersionSpec("1_alpha10"));
- v.push_back(VersionSpec("1_alpha10-r1"));
- v.push_back(VersionSpec("1_alpha10-r1.1"));
- v.push_back(VersionSpec("1_alpha10-r1.2"));
- v.push_back(VersionSpec("1_alpha10-r2"));
- v.push_back(VersionSpec("1_alpha10_p1"));
- v.push_back(VersionSpec("1_alpha10_p1-r1"));
- v.push_back(VersionSpec("1_alpha11"));
- v.push_back(VersionSpec("1_beta"));
- v.push_back(VersionSpec("1_beta10"));
- v.push_back(VersionSpec("1_beta10-r1"));
- v.push_back(VersionSpec("1_beta10_p1"));
- v.push_back(VersionSpec("1_beta10_p1-r1"));
- v.push_back(VersionSpec("1_beta11"));
- v.push_back(VersionSpec("1_pre"));
- v.push_back(VersionSpec("1_pre10"));
- v.push_back(VersionSpec("1_pre10-r1"));
- v.push_back(VersionSpec("1_pre10_p1"));
- v.push_back(VersionSpec("1_pre10_p1-r1"));
- v.push_back(VersionSpec("1_pre11"));
- v.push_back(VersionSpec("1_rc"));
- v.push_back(VersionSpec("1_rc10"));
- v.push_back(VersionSpec("1_rc10-r1"));
- v.push_back(VersionSpec("1_rc10_p1"));
- v.push_back(VersionSpec("1_rc10_p1-r1"));
- v.push_back(VersionSpec("1_rc11"));
- v.push_back(VersionSpec("1"));
- v.push_back(VersionSpec("1-r1"));
- v.push_back(VersionSpec("1_p1"));
- v.push_back(VersionSpec("1-try2"));
- v.push_back(VersionSpec("1p"));
- v.push_back(VersionSpec("1.0"));
- v.push_back(VersionSpec("1.0a"));
- v.push_back(VersionSpec("1.0.0"));
- v.push_back(VersionSpec("1.001"));
- v.push_back(VersionSpec("1.01"));
- v.push_back(VersionSpec("1.0101"));
- v.push_back(VersionSpec("1.1_alpha3"));
- v.push_back(VersionSpec("1.1"));
- v.push_back(VersionSpec("1.1-r1"));
- v.push_back(VersionSpec("1.1.1"));
- v.push_back(VersionSpec("1.1.1-scm"));
- v.push_back(VersionSpec("1.1.2"));
- v.push_back(VersionSpec("1.1-scm"));
- v.push_back(VersionSpec("1.1-scm-r1"));
- 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_p0-scm"));
- 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"));
- v.push_back(VersionSpec("1.2_beta10_p1-scm"));
- v.push_back(VersionSpec("1.2_beta10_p10"));
- v.push_back(VersionSpec("1.2_beta10-scm"));
- v.push_back(VersionSpec("1.2_beta11"));
- v.push_back(VersionSpec("1.2_beta11-scm"));
- 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"));
- v.push_back(VersionSpec("2_alpha"));
- v.push_back(VersionSpec("09"));
- v.push_back(VersionSpec("10"));
- v.push_back(VersionSpec("100"));
- v.push_back(VersionSpec("scm"));
- v.push_back(VersionSpec("scm-r3"));
- v.push_back(VersionSpec("scm-r3.4"));
+ v.push_back(VersionSpec("1_alpha_alpha", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha1_alpha", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha1_beta_pre", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha1_beta", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha1-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha10", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha10-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha10-r1.1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha10-r1.2", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha10-r2", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha10_p1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha10_p1-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_alpha11", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_beta", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_beta10", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_beta10-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_beta10_p1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_beta10_p1-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_beta11", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_pre", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_pre10", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_pre10-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_pre10_p1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_pre10_p1-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_pre11", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_rc", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_rc10", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_rc10-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_rc10_p1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_rc10_p1-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_rc11", VersionSpecOptions()));
+ v.push_back(VersionSpec("1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1_p1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1-try2", VersionSpecOptions()));
+ v.push_back(VersionSpec("1p", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.0", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.0a", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.0.0", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.001", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.01", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.0101", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.1_alpha3", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.1-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.1.1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.1.1-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.1.2", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.1-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.1-scm-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_alpha", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_alpha-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta_p0-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta_p1-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta_p-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta1_p-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta10", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta10_p", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta10_p1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta10_p1-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta10_p10", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta10-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta11", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta11-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_beta-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_p3_pre", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_p3", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_p3_p", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2_p3-try4", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("1.2-scm-r1", VersionSpecOptions()));
+ v.push_back(VersionSpec("1-scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("2_alpha", VersionSpecOptions()));
+ v.push_back(VersionSpec("09", VersionSpecOptions()));
+ v.push_back(VersionSpec("10", VersionSpecOptions()));
+ v.push_back(VersionSpec("100", VersionSpecOptions()));
+ v.push_back(VersionSpec("scm", VersionSpecOptions()));
+ v.push_back(VersionSpec("scm-r3", VersionSpecOptions()));
+ v.push_back(VersionSpec("scm-r3.4", VersionSpecOptions()));
std::vector<VersionSpec>::iterator v1(v.begin()), v_end(v.end());
for ( ; v1 != v_end ; ++v1)
@@ -521,7 +522,7 @@ namespace test_cases
void run()
{
- VersionSpec v1("1.2x_pre3_rc-scm");
+ VersionSpec v1("1.2x_pre3_rc-scm", VersionSpecOptions());
VersionSpec::ConstIterator i(v1.begin()), i_end(v1.end());
TEST_CHECK(i != i_end);
diff --git a/ruby/version_spec.cc b/ruby/version_spec.cc
index e6ac453..9dfe211 100644
--- a/ruby/version_spec.cc
+++ b/ruby/version_spec.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -19,6 +19,7 @@
#include <paludis_ruby.hh>
#include <paludis/version_spec.hh>
+#include <paludis/user_dep_spec.hh>
#include <ruby.h>
using namespace paludis;
@@ -46,7 +47,7 @@ namespace
VersionSpec * ptr(0);
try
{
- ptr = new VersionSpec(std::string(StringValuePtr(s)));
+ ptr = new VersionSpec(std::string(StringValuePtr(s)), user_version_spec_options());
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<VersionSpec>::free, ptr));
rb_obj_call_init(tdata, 1, &s);
return tdata;
@@ -185,7 +186,7 @@ VersionSpec
paludis::ruby::value_to_version_spec(VALUE v)
{
if (T_STRING == TYPE(v))
- return VersionSpec(StringValuePtr(v));
+ return VersionSpec(StringValuePtr(v), user_version_spec_options());
else if (rb_obj_is_kind_of(v, c_version_spec))
{
VersionSpec * v_ptr;
diff --git a/src/clients/adjutrix/downgrade_check.cc b/src/clients/adjutrix/downgrade_check.cc
index f2525d3..b8f668d 100644
--- a/src/clients/adjutrix/downgrade_check.cc
+++ b/src/clients/adjutrix/downgrade_check.cc
@@ -59,7 +59,7 @@ namespace
QualifiedPackageName old_package("dummy/dummy");
std::string old_slot("dummy");
- VersionSpec best_version("0");
+ VersionSpec best_version("0", VersionSpecOptions());
for (IndirectIterator<PackageIDSequence::ConstIterator> m(matches->begin()), m_end(matches->end()) ;
m != m_end ; ++m)
{
@@ -122,7 +122,7 @@ namespace
throw ConfigurationError("Bad line '" + s + "'");
map.insert(std::make_pair(make_pair(QualifiedPackageName(tokens.at(0)),
- tokens.at(1)), VersionSpec(tokens.at(2))));
+ tokens.at(1)), VersionSpec(tokens.at(2), user_version_spec_options())));
}
}
diff --git a/src/clients/adjutrix/find_dropped_keywords.cc b/src/clients/adjutrix/find_dropped_keywords.cc
index 761ad8e..9b679cc 100644
--- a/src/clients/adjutrix/find_dropped_keywords.cc
+++ b/src/clients/adjutrix/find_dropped_keywords.cc
@@ -120,7 +120,7 @@ namespace
p += ":" + stringify(slot);
cout << " " << std::setw(col_width_package - 2) << p;
- if (best_keyworded != VersionSpec("0"))
+ if (best_keyworded != VersionSpec("0", VersionSpecOptions()))
cout << std::setw(col_width_best_keyworded) << best_keyworded;
else
cout << std::setw(col_width_best_keyworded) << " ";
@@ -137,7 +137,7 @@ namespace
* version for us, best stable version for anyone). */
bool is_interesting(false);
- VersionSpec worst_keyworded("99999999");
+ VersionSpec worst_keyworded("99999999", VersionSpecOptions());
typedef std::map<std::string, VersionsEntry> VersionsInSlots;
VersionsInSlots versions_in_slots;
@@ -151,8 +151,8 @@ namespace
/* ensure that there's an entry for this SLOT */
versions_in_slots.insert(std::make_pair(slot_as_string(*v), VersionsEntry(
make_named_values<VersionsEntry>(
- value_for<n::best_anywhere>(VersionSpec("0")),
- value_for<n::best_keyworded>(VersionSpec("0"))
+ value_for<n::best_anywhere>(VersionSpec("0", VersionSpecOptions())),
+ value_for<n::best_keyworded>(VersionSpec("0", VersionSpecOptions()))
))));
if ((*v)->keywords_key()->value()->end() != (*v)->keywords_key()->value()->find(keyword) ||
diff --git a/src/clients/adjutrix/find_stable_candidates.cc b/src/clients/adjutrix/find_stable_candidates.cc
index 2afb3bf..9c33ff9 100644
--- a/src/clients/adjutrix/find_stable_candidates.cc
+++ b/src/clients/adjutrix/find_stable_candidates.cc
@@ -112,7 +112,7 @@ namespace
p += ":" + stringify(slot);
cout << " " << std::setw(col_width_package - 2) << p;
- if (our_version != VersionSpec("0"))
+ if (our_version != VersionSpec("0", VersionSpecOptions()))
cout << std::setw(col_width_our_version) << our_version;
else
cout << std::setw(col_width_our_version) << " ";
@@ -155,7 +155,7 @@ namespace
slots_to_versions.erase(slot_as_string(*v));
slots_to_versions.insert(std::make_pair(slot_as_string(*v),
make_named_values<SlotsEntry>(
- value_for<n::best_version>(VersionSpec("0")),
+ value_for<n::best_version>(VersionSpec("0", VersionSpecOptions())),
value_for<n::our_version>((*v)->version())
)));
}
@@ -167,7 +167,7 @@ namespace
slots_to_versions.insert(std::make_pair(slot_as_string(*v),
make_named_values<SlotsEntry>(
value_for<n::best_version>((*v)->version()),
- value_for<n::our_version>(VersionSpec("0"))
+ value_for<n::our_version>(VersionSpec("0", VersionSpecOptions()))
)));
/* update the entry to mark our current version as the best
diff --git a/src/clients/importare/importare.cc b/src/clients/importare/importare.cc
index ab7ba4b..9f77f9e 100644
--- a/src/clients/importare/importare.cc
+++ b/src/clients/importare/importare.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -38,6 +38,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
+#include <paludis/user_dep_spec.hh>
#include <algorithm>
#include <iterator>
@@ -138,7 +139,7 @@ main(int argc, char *argv[])
throw args::DoHelp("install action takes between one and three parameters (cat/pkg version slot)");
QualifiedPackageName q(params[0]);
- VersionSpec v(params.size() >= 2 ? params[1] : "0");
+ VersionSpec v(params.size() >= 2 ? params[1] : "0", user_version_spec_options());
SlotName s(params.size() >= 3 ? params[2] : "0");
std::string build_dependencies, run_dependencies, description;