aboutsummaryrefslogtreecommitdiff
path: root/paludis/dep_list
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-13 21:19:35 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-13 21:19:35 +0000
commit402c186ce65b06a525ca6b586a5f11da2fef5faf (patch)
treecf49efa00896abbdb9894e76d8f27e16e41dc9cf /paludis/dep_list
parentd1856e25dbca494b9ceb69fa268c8ae11ecb931c (diff)
downloadpaludis-402c186ce65b06a525ca6b586a5f11da2fef5faf.tar.gz
paludis-402c186ce65b06a525ca6b586a5f11da2fef5faf.tar.xz
EAPI-aware dep parser. Fixes: ticket:120
Diffstat (limited to 'paludis/dep_list')
-rw-r--r--paludis/dep_list/dep_list.cc24
-rw-r--r--paludis/dep_list/dep_list_TEST.cc51
-rw-r--r--paludis/dep_list/dep_list_TEST.hh2
-rw-r--r--paludis/dep_list/dep_list_TEST_blockers.cc22
-rw-r--r--paludis/dep_list/range_rewriter_TEST.cc2
-rw-r--r--paludis/dep_list/uninstall_list_TEST.cc4
6 files changed, 68 insertions, 37 deletions
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 41b4c8f..aa77820 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -308,7 +308,8 @@ namespace
const PackageDepSpec * const u(spec->as_package_dep_spec());
if (0 != u && u->package_ptr())
{
- return ! env->package_database()->query(PackageDepSpec(*u->package_ptr()),
+ return ! env->package_database()->query(PackageDepSpec(
+ std::tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(*u->package_ptr()))),
is_installed_only, qo_whatever)->empty();
}
else
@@ -370,7 +371,7 @@ DepList::QueryVisitor::visit(const PackageDepSpec * const a)
d->_imp->merge_list_index.equal_range(m->name));
bool replaced(false);
- PackageDepSpec spec(m->name);
+ PackageDepSpec spec(std::tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(m->name)));
while (p.second != ((p.first = std::find_if(p.first, p.second,
MatchDepListEntryAgainstPackageDepSpec(d->_imp->env, &spec)))))
{
@@ -747,7 +748,13 @@ DepList::AddVisitor::visit(const PackageDepSpec * const a)
{
std::tr1::shared_ptr<PackageDatabaseEntryCollection> are_we_downgrading(
d->_imp->env->package_database()->query(PackageDepSpec(
- stringify(best_visible_candidate->name) + ":" + stringify(slot)),
+ std::tr1::shared_ptr<QualifiedPackageName>(
+ new QualifiedPackageName(best_visible_candidate->name)),
+ std::tr1::shared_ptr<CategoryNamePart>(),
+ std::tr1::shared_ptr<PackageNamePart>(),
+ std::tr1::shared_ptr<VersionRequirements>(),
+ vr_and,
+ std::tr1::shared_ptr<SlotName>(new SlotName(slot))),
is_installed_only, qo_order_by_version));
if (are_we_downgrading->empty())
@@ -903,7 +910,8 @@ DepList::AddVisitor::visit(const BlockDepSpec * const a)
if (a->blocked_spec()->package_ptr())
{
- PackageDepSpec just_package(*a->blocked_spec()->package_ptr());
+ PackageDepSpec just_package(std::tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(
+ *a->blocked_spec()->package_ptr())));
already_installed = d->_imp->env->package_database()->query(
just_package, is_installed_only, qo_whatever);
@@ -1213,7 +1221,13 @@ DepList::add_package(const PackageDatabaseEntry & p, std::tr1::shared_ptr<const
DepSpecFlattener f(_imp->env, _imp->current_pde(), metadata->ebuild_interface->provide());
for (DepSpecFlattener::Iterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
{
- std::tr1::shared_ptr<PackageDepSpec> pp(new PackageDepSpec("=" + (*i)->text() + "-" + stringify(p.version)));
+ std::tr1::shared_ptr<VersionRequirements> v(new VersionRequirements::Concrete);
+ v->push_back(VersionRequirement(vo_equal, p.version));
+ std::tr1::shared_ptr<PackageDepSpec> pp(new PackageDepSpec(
+ std::tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName((*i)->text())),
+ std::tr1::shared_ptr<CategoryNamePart>(),
+ std::tr1::shared_ptr<PackageNamePart>(),
+ v, vr_and));
std::pair<MergeListIndex::iterator, MergeListIndex::iterator> z;
if (pp->package_ptr())
diff --git a/paludis/dep_list/dep_list_TEST.cc b/paludis/dep_list/dep_list_TEST.cc
index 69f420c..c664606 100644
--- a/paludis/dep_list/dep_list_TEST.cc
+++ b/paludis/dep_list/dep_list_TEST.cc
@@ -951,7 +951,8 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_47;
@@ -977,7 +978,8 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_48;
@@ -1043,7 +1045,8 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_51;
@@ -1069,7 +1072,8 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_52;
@@ -1269,11 +1273,12 @@ namespace test_cases
repo->add_version("cat", "seven", "1")->deps_interface->build_depend_string = "cat/doesnotexist";
DepList d(&env, DepListOptions());
- d.add(PortageDepParser::parse("cat/one"), env.default_destinations());
+ d.add(PortageDepParser::parse_depend("cat/one", pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "),
"cat/four-1:0::repo cat/two-1:0::repo cat/three-1:0::repo cat/one-1:0::repo");
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse("cat/five"), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend("cat/five", pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "),
"cat/four-1:0::repo cat/two-1:0::repo cat/three-1:0::repo cat/one-1:0::repo");
@@ -1306,11 +1311,12 @@ namespace test_cases
repo->add_version("cat", "seven", "1")->deps_interface->post_depend_string = "cat/doesnotexist";
DepList d(&env, DepListOptions());
- d.add(PortageDepParser::parse("cat/one"), env.default_destinations());
+ d.add(PortageDepParser::parse_depend("cat/one", pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "),
"cat/four-1:0::repo cat/two-1:0::repo cat/three-1:0::repo cat/one-1:0::repo");
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse("cat/five"), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend("cat/five", pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "),
"cat/four-1:0::repo cat/two-1:0::repo cat/three-1:0::repo cat/one-1:0::repo");
@@ -1339,7 +1345,7 @@ namespace test_cases
installed_repo->add_version("cat", "one", "2");
DepList d(&env, DepListOptions());
- d.add(PortageDepParser::parse("cat/one"), env.default_destinations());
+ d.add(PortageDepParser::parse_depend("cat/one", pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "), "cat/one-1:0::repo");
}
} test_dep_list_forced_downgrade_of_installed;
@@ -1366,7 +1372,8 @@ namespace test_cases
DepList d(&env, DepListOptions());
d.options()->fall_back = dl_fall_back_never;
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse("cat/one"), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend("cat/one", pds_pm_unspecific),
+ env.default_destinations()), DepListError);
}
} test_dep_list_fall_back_never;
@@ -1392,8 +1399,8 @@ namespace test_cases
DepList d(&env, DepListOptions());
d.options()->fall_back = dl_fall_back_as_needed;
- d.add(PortageDepParser::parse("cat/one"), env.default_destinations());
- d.add(PortageDepParser::parse("cat/two"), env.default_destinations());
+ d.add(PortageDepParser::parse_depend("cat/one", pds_pm_unspecific), env.default_destinations());
+ d.add(PortageDepParser::parse_depend("cat/two", pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "), "cat/two-2:0::installed_repo cat/one-1:0::repo");
}
} test_dep_list_fall_back_as_needed;
@@ -1421,21 +1428,25 @@ namespace test_cases
DepList d1(&env, DepListOptions());
d1.options()->fall_back = dl_fall_back_as_needed_except_targets;
- d1.add(PortageDepParser::parse("cat/one"), env.default_destinations());
+ d1.add(PortageDepParser::parse_depend("cat/one", pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(join(d1.begin(), d1.end(), " "), "cat/two-2:0::installed_repo cat/one-1:0::repo");
- TEST_CHECK_THROWS(d1.add(PortageDepParser::parse("cat/three"), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d1.add(PortageDepParser::parse_depend("cat/three", pds_pm_unspecific),
+ env.default_destinations()), DepListError);
DepList d2(&env, DepListOptions());
d2.options()->fall_back = dl_fall_back_as_needed_except_targets;
- TEST_CHECK_THROWS(d2.add(PortageDepParser::parse("cat/two"), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d2.add(PortageDepParser::parse_depend("cat/two", pds_pm_unspecific),
+ env.default_destinations()), DepListError);
DepList d3(&env, DepListOptions());
d3.options()->fall_back = dl_fall_back_as_needed_except_targets;
- TEST_CHECK_THROWS(d3.add(PortageDepParser::parse("( cat/one cat/two )"), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d3.add(PortageDepParser::parse_depend("( cat/one cat/two )", pds_pm_unspecific),
+ env.default_destinations()), DepListError);
DepList d4(&env, DepListOptions());
d4.options()->fall_back = dl_fall_back_as_needed_except_targets;
- TEST_CHECK_THROWS(d4.add(PortageDepParser::parse("( cat/one cat/three )"), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d4.add(PortageDepParser::parse_depend("( cat/one cat/three )", pds_pm_unspecific),
+ env.default_destinations()), DepListError);
}
} test_dep_list_fall_back_as_needed_not_targets;
@@ -1462,12 +1473,12 @@ namespace test_cases
DepList d1(&env, DepListOptions());
d1.options()->upgrade = dl_upgrade_as_needed;
- d1.add(PortageDepParser::parse("cat/one"), env.default_destinations());
+ d1.add(PortageDepParser::parse_depend("cat/one", pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(join(d1.begin(), d1.end(), " "), "cat/two-0:0::installed_repo cat/one-1:0::repo");
DepList d2(&env, DepListOptions());
d2.options()->upgrade = dl_upgrade_as_needed;
- d2.add(PortageDepParser::parse("( cat/one cat/two )"), env.default_destinations());
+ d2.add(PortageDepParser::parse_depend("( cat/one cat/two )", pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(join(d2.begin(), d2.end(), " "), "cat/two-2:0::repo cat/one-1:0::repo");
}
} test_dep_list_upgrade_as_needed;
@@ -1506,7 +1517,7 @@ namespace test_cases
DepList d1(&env, DepListOptions());
d1.options()->reinstall_scm = dl_reinstall_scm_always;
- d1.add(PortageDepParser::parse("cat/zero"), env.default_destinations());
+ d1.add(PortageDepParser::parse_depend("cat/zero", pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(join(d1.begin(), d1.end(), " "), "cat/one-scm:0::repo cat/two-2:0::installed_repo "
"cat/three-live-0:0::repo cat/four-cvs-0:0::repo cat/five-svn-0:0::repo cat/six-darcs-0:0::repo "
"cat/zero-1:0::repo");
diff --git a/paludis/dep_list/dep_list_TEST.hh b/paludis/dep_list/dep_list_TEST.hh
index b3ad740..c44aef2 100644
--- a/paludis/dep_list/dep_list_TEST.hh
+++ b/paludis/dep_list/dep_list_TEST.hh
@@ -131,7 +131,7 @@ namespace test_cases
{
DepList d(&env, DepListOptions());
set_options(*d.options());
- d.add(PortageDepParser::parse(merge_target), env.default_destinations());
+ d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific), env.default_destinations());
TEST_CHECK(true);
TestMessageSuffix s("d={ " + join(d.begin(), d.end(), ", ") + " }", false);
diff --git a/paludis/dep_list/dep_list_TEST_blockers.cc b/paludis/dep_list/dep_list_TEST_blockers.cc
index 957ac79..926972d 100644
--- a/paludis/dep_list/dep_list_TEST_blockers.cc
+++ b/paludis/dep_list/dep_list_TEST_blockers.cc
@@ -44,11 +44,12 @@ namespace test_cases
TEST_CHECK(true);
DepList d(&env, DepListOptions());
d.options()->blocks = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
d.options()->blocks = dl_blocks_accumulate;
- d.add(PortageDepParser::parse(merge_target), env.default_destinations());
+ d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(std::distance(d.begin(), d.end()), 2);
TEST_CHECK_EQUAL(d.begin()->kind, dlk_block);
TEST_CHECK_STRINGIFY_EQUAL(d.begin()->package, "cat/two-1::installed");
@@ -119,11 +120,12 @@ namespace test_cases
TEST_CHECK(true);
DepList d(&env, DepListOptions());
d.options()->blocks = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
d.options()->blocks = dl_blocks_accumulate;
- d.add(PortageDepParser::parse(merge_target), env.default_destinations());
+ d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific), env.default_destinations());
TEST_CHECK_EQUAL(std::distance(d.begin(), d.end()), 4);
TEST_CHECK_EQUAL(d.begin()->kind, dlk_block);
TEST_CHECK_STRINGIFY_EQUAL(d.begin()->package, "virtual/two-1::installed_virtuals");
@@ -157,7 +159,8 @@ namespace test_cases
TEST_CHECK(true);
DepList d(&env, DepListOptions());
d.options()->blocks = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_block_on_list;
@@ -296,7 +299,8 @@ namespace test_cases
TEST_CHECK(true);
DepList d(&env, DepListOptions());
d.options()->blocks = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_restricted_older_self;
@@ -324,7 +328,8 @@ namespace test_cases
TEST_CHECK(true);
DepList d(&env, DepListOptions());
d.options()->blocks = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_restricted_older_self_provide;
@@ -352,7 +357,8 @@ namespace test_cases
TEST_CHECK(true);
DepList d(&env, DepListOptions());
d.options()->blocks = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target), env.default_destinations()), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse_depend(merge_target, pds_pm_unspecific),
+ env.default_destinations()), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_restricted_older_other_provide;
diff --git a/paludis/dep_list/range_rewriter_TEST.cc b/paludis/dep_list/range_rewriter_TEST.cc
index f1f0b5c..ff0696d 100644
--- a/paludis/dep_list/range_rewriter_TEST.cc
+++ b/paludis/dep_list/range_rewriter_TEST.cc
@@ -37,7 +37,7 @@ namespace test_cases
void run()
{
- std::tr1::shared_ptr<const CompositeDepSpec> p(PortageDepParser::parse_depend("=a/b-1 =a/b-2"));
+ std::tr1::shared_ptr<const CompositeDepSpec> p(PortageDepParser::parse_depend("=a/b-1 =a/b-2", pds_pm_unspecific));
RangeRewriter r;
TEST_CHECK(! r.spec());
diff --git a/paludis/dep_list/uninstall_list_TEST.cc b/paludis/dep_list/uninstall_list_TEST.cc
index c00011f..6cb7c0f 100644
--- a/paludis/dep_list/uninstall_list_TEST.cc
+++ b/paludis/dep_list/uninstall_list_TEST.cc
@@ -325,7 +325,7 @@ namespace test_cases
UninstallListTestCaseBase("with unused deps world")
{
installed_repo->add_package_set(SetName("world"), PortageDepParser::parse(
- "foo/moo"));
+ "foo/moo", PortageDepParser::Policy::text_is_package_dep_spec(true, pds_pm_unspecific)));
}
void populate_targets()
@@ -361,7 +361,7 @@ namespace test_cases
UninstallListTestCaseBase("with unused deps world target")
{
installed_repo->add_package_set(SetName("world"), PortageDepParser::parse(
- "foo/bar foo/moo"));
+ "foo/bar foo/moo", PortageDepParser::Policy::text_is_package_dep_spec(true, pds_pm_unspecific)));
}
void populate_targets()