aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-13 12:05:51 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-13 12:05:51 +0000
commit4c6642465a4950796da1e63527f0b919ac896ec7 (patch)
tree09ae4d334ff4f49c79eb544547b0a8e49c9c7a2f
parent8e461f3110e4d139c2e26441f2d29edbe00ac113 (diff)
downloadpaludis-4c6642465a4950796da1e63527f0b919ac896ec7.tar.gz
paludis-4c6642465a4950796da1e63527f0b919ac896ec7.tar.xz
Rework VersionMetadata to be far less ebuild-centric. Avoid using always_inline. Add a WhitespaceTokeniser singleton class.
-rw-r--r--paludis/dep_list.cc54
-rw-r--r--paludis/dep_list_TEST.cc198
-rw-r--r--paludis/dep_parser.cc5
-rw-r--r--paludis/dep_parser.hh5
-rw-r--r--paludis/ebuild.cc38
-rw-r--r--paludis/ebuild.hh2
-rw-r--r--paludis/environment.cc81
-rw-r--r--paludis/fake_repository.cc9
-rw-r--r--paludis/match_package.cc4
-rw-r--r--paludis/portage_repository.cc103
-rw-r--r--paludis/portage_repository_TEST.cc8
-rw-r--r--paludis/util/compare.hh14
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/tokeniser.cc28
-rw-r--r--paludis/util/tokeniser.hh14
-rw-r--r--paludis/vdb_repository.cc42
-rw-r--r--paludis/version_metadata.cc151
-rw-r--r--paludis/version_metadata.hh178
-rw-r--r--src/install.cc76
-rw-r--r--src/query.cc89
20 files changed, 595 insertions, 506 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 57e6541..138e563 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -40,7 +40,7 @@ std::ostream &
paludis::operator<< (std::ostream & s, const DepListEntry & e)
{
s << e.get<dle_name>() << "-" << e.get<dle_version>() << ":"
- << e.get<dle_metadata>()->get(vmk_slot) << "::" << e.get<dle_repository>();
+ << e.get<dle_metadata>()->get<vm_slot>() << "::" << e.get<dle_repository>();
return s;
}
@@ -182,10 +182,10 @@ DepList::add(DepAtom::ConstPointer atom)
{
Save<const DepListEntry *> save_current_package(
&_imp->current_package, &*i);
- _add_in_role(DepParser::parse(
- _imp->environment->package_database()->fetch_metadata(
- PackageDatabaseEntry(i->get<dle_name>(), i->get<dle_version>(),
- i->get<dle_repository>()))->get(vmk_rdepend)), "RDEPEND");
+ _add_in_role(_imp->environment->package_database()->fetch_metadata(
+ PackageDatabaseEntry(i->get<dle_name>(), i->get<dle_version>(),
+ i->get<dle_repository>()))->get<vm_deps>().run_depend(),
+ "runtime dependencies");
i->get<dle_flags>().set(dlef_has_trypredeps);
}
@@ -193,10 +193,10 @@ DepList::add(DepAtom::ConstPointer atom)
{
Save<const DepListEntry *> save_current_package(
&_imp->current_package, &*i);
- _add_in_role(DepParser::parse(
- _imp->environment->package_database()->fetch_metadata(
- PackageDatabaseEntry(i->get<dle_name>(), i->get<dle_version>(),
- i->get<dle_repository>()))->get(vmk_pdepend)), "PDEPEND");
+ _add_in_role(_imp->environment->package_database()->fetch_metadata(
+ PackageDatabaseEntry(i->get<dle_name>(), i->get<dle_version>(),
+ i->get<dle_repository>()))->get<vm_deps>().post_depend(),
+ "post dependencies");
i->get<dle_flags>().set(dlef_has_postdeps);
}
else
@@ -433,10 +433,13 @@ DepList::visit(const PackageDepAtom * const p)
}
/* if we provide things, also insert them. */
- if ((! metadata->get(vmk_provide).empty()) && ! merge_entry->get<dle_flags>()[dlef_skip])
+ std::string provide_str;
+ if (metadata->get_ebuild_interface())
+ provide_str = metadata->get_ebuild_interface()->get<evm_provide>();
+ if ((! provide_str.empty()) && ! merge_entry->get<dle_flags>()[dlef_skip])
{
- DepAtom::ConstPointer provide(DepParser::parse(metadata->get(vmk_provide),
- DepParserPolicy<PackageDepAtom, false>::get_instance()));
+ DepAtom::ConstPointer provide(DepParser::parse(provide_str,
+ DepParserPolicy<PackageDepAtom, false>::get_instance()));
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
@@ -457,9 +460,10 @@ DepList::visit(const PackageDepAtom * const p)
DepListEntryMatcher(_imp->environment, pp)))
continue;
- VersionMetadata::Pointer p_metadata(new VersionMetadata);
- p_metadata->set(vmk_slot, merge_entry->get<dle_metadata>()->get(vmk_slot));
- p_metadata->set(vmk_virtual, stringify(merge_entry->get<dle_name>()));
+ VersionMetadata::Pointer p_metadata(new VersionMetadata::Ebuild(
+ &DepParser::parse_depend));
+ p_metadata->set<vm_slot>(merge_entry->get<dle_metadata>()->get<vm_slot>());
+ p_metadata->get_ebuild_interface()->set<evm_virtual>(stringify(merge_entry->get<dle_name>()));
DepListEntryFlags flags;
flags.set(dlef_has_predeps);
@@ -484,7 +488,7 @@ DepList::visit(const PackageDepAtom * const p)
/* merge depends */
if ((! merge_entry->get<dle_flags>()[dlef_has_predeps]) && ! (_imp->drop_all))
- _add_in_role(DepParser::parse(metadata->get(vmk_depend)), "DEPEND");
+ _add_in_role(metadata->get<vm_deps>().build_depend(), "build dependencies");
merge_entry->get<dle_flags>().set(dlef_has_predeps);
/* merge rdepends */
@@ -493,7 +497,7 @@ DepList::visit(const PackageDepAtom * const p)
{
try
{
- _add_in_role(DepParser::parse(metadata->get(vmk_rdepend)), "RDEPEND");
+ _add_in_role(metadata->get<vm_deps>().run_depend(), "runtime dependencies");
merge_entry->get<dle_flags>().set(dlef_has_trypredeps);
}
catch (const CircularDependencyError &)
@@ -656,9 +660,11 @@ DepList::visit(const BlockDepAtom * const d)
continue;
}
- DepAtom::ConstPointer provide(DepParser::parse(
- _imp->current_package->get<dle_metadata>()->get(vmk_provide),
- DepParserPolicy<PackageDepAtom, false>::get_instance()));
+ DepAtom::ConstPointer provide(new AllDepAtom);
+ if (_imp->current_package->get<dle_metadata>()->get_ebuild_interface())
+ provide = DepParser::parse(
+ _imp->current_package->get<dle_metadata>()->get_ebuild_interface()->get<evm_provide>(),
+ DepParserPolicy<PackageDepAtom, false>::get_instance());
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
@@ -711,9 +717,11 @@ DepList::visit(const BlockDepAtom * const d)
continue;
}
- DepAtom::ConstPointer provide(DepParser::parse(
- _imp->current_package->get<dle_metadata>()->get(vmk_provide),
- DepParserPolicy<PackageDepAtom, false>::get_instance()));
+ DepAtom::ConstPointer provide(new AllDepAtom);
+ if (_imp->current_package->get<dle_metadata>()->get_ebuild_interface())
+ provide = DepParser::parse(
+ _imp->current_package->get<dle_metadata>()->get_ebuild_interface()->get<evm_provide>(),
+ DepParserPolicy<PackageDepAtom, false>::get_instance());
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
diff --git a/paludis/dep_list_TEST.cc b/paludis/dep_list_TEST.cc
index e0da065..eec21de 100644
--- a/paludis/dep_list_TEST.cc
+++ b/paludis/dep_list_TEST.cc
@@ -151,7 +151,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two");
repo->add_version("cat", "two", "1");
}
@@ -172,8 +172,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two");
- repo->add_version("cat", "two", "1")->set(vmk_depend, "cat/three");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three");
repo->add_version("cat", "three", "1");
}
@@ -195,7 +195,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -218,8 +218,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
- repo->add_version("cat", "two", "1")->set(vmk_depend, "cat/three");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three");
repo->add_version("cat", "three", "1");
}
@@ -241,9 +241,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->set(vmk_depend, "cat/two");
+ repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two");
}
void populate_expected()
@@ -264,9 +264,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
- repo->add_version("cat", "two", "1")->set(vmk_depend, "cat/four");
- repo->add_version("cat", "three", "1")->set(vmk_depend, "cat/four");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
+ repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
repo->add_version("cat", "four", "1");
}
@@ -289,9 +289,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
- repo->add_version("cat", "two", "1")->set(vmk_depend, "cat/four cat/three");
- repo->add_version("cat", "three", "1")->set(vmk_depend, "cat/four");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four cat/three");
+ repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
repo->add_version("cat", "four", "1");
}
@@ -314,9 +314,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
- repo->add_version("cat", "two", "1")->set(vmk_depend, "cat/four");
- repo->add_version("cat", "three", "1")->set(vmk_depend, "cat/four cat/two");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
+ repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four cat/two");
repo->add_version("cat", "four", "1");
}
@@ -339,7 +339,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( cat/two cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -361,9 +361,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->set(vmk_depend, "|| ( cat/two cat/four )");
+ repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/four )");
repo->add_version("cat", "four", "1");
}
@@ -385,7 +385,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( ( cat/two cat/three ) cat/four )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( ( cat/two cat/three ) cat/four )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
repo->add_version("cat", "four", "1");
@@ -409,10 +409,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three cat/four");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three cat/four");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
- repo->add_version("cat", "four", "1")->set(vmk_depend, "|| ( ( cat/two cat/three ) cat/five )");
+ repo->add_version("cat", "four", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( ( cat/two cat/three ) cat/five )");
}
void populate_expected()
@@ -434,7 +434,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( cat/two cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
repo->add_version("cat", "three", "1");
}
@@ -455,8 +455,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->set(vmk_depend, "cat/four");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
repo->add_version("cat", "three", "1");
}
@@ -477,10 +477,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two:slot2");
- repo->add_version("cat", "two", "1.1")->set(vmk_slot, "slot1");
- repo->add_version("cat", "two", "1.2")->set(vmk_slot, "slot2");
- repo->add_version("cat", "two", "1.3")->set(vmk_slot, "slot3");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two:slot2");
+ repo->add_version("cat", "two", "1.1")->set<vm_slot>(SlotName("slot1"));
+ repo->add_version("cat", "two", "1.2")->set<vm_slot>(SlotName("slot2"));
+ repo->add_version("cat", "two", "1.3")->set<vm_slot>(SlotName("slot3"));
}
void populate_expected()
@@ -500,12 +500,12 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "<cat/two-1.2-r2:slot2");
- repo->add_version("cat", "two", "1.1")->set(vmk_slot, "slot1");
- repo->add_version("cat", "two", "1.2")->set(vmk_slot, "slot2");
- repo->add_version("cat", "two", "1.2-r1")->set(vmk_slot, "slot2");
- repo->add_version("cat", "two", "1.2-r2")->set(vmk_slot, "slot2");
- repo->add_version("cat", "two", "1.3")->set(vmk_slot, "slot3");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("<cat/two-1.2-r2:slot2");
+ repo->add_version("cat", "two", "1.1")->set<vm_slot>(SlotName("slot1"));
+ repo->add_version("cat", "two", "1.2")->set<vm_slot>(SlotName("slot2"));
+ repo->add_version("cat", "two", "1.2-r1")->set<vm_slot>(SlotName("slot2"));
+ repo->add_version("cat", "two", "1.2-r2")->set<vm_slot>(SlotName("slot2"));
+ repo->add_version("cat", "two", "1.3")->set<vm_slot>(SlotName("slot3"));
}
void populate_expected()
@@ -525,7 +525,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( )");
}
void populate_expected()
@@ -544,7 +544,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "enabled? ( cat/two )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("enabled? ( cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -565,7 +565,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "!enabled? ( cat/two )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("!enabled? ( cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -585,7 +585,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "disabled? ( cat/two )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("disabled? ( cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -605,7 +605,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "!disabled? ( cat/two )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("!disabled? ( cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -626,7 +626,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( enabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( enabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -648,7 +648,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( !enabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( !enabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -670,7 +670,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( disabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( disabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -692,7 +692,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( !disabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( !disabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -714,8 +714,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "cat/three || ( enabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>(
+ "cat/three || ( enabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -737,8 +737,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "cat/three || ( !enabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( !enabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -760,8 +759,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "cat/three || ( disabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( disabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -783,8 +781,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "cat/three || ( !disabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( !disabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -806,8 +803,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "cat/three || ( enabled? ( cat/three ) cat/two )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( enabled? ( cat/three ) cat/two )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -829,8 +825,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "cat/three || ( !enabled? ( cat/three ) cat/two )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( !enabled? ( cat/three ) cat/two )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -853,8 +848,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "cat/three || ( disabled? ( cat/three ) cat/two )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( disabled? ( cat/three ) cat/two )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -877,8 +871,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "cat/three || ( !disabled? ( cat/three ) cat/two )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( !disabled? ( cat/three ) cat/two )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -900,8 +893,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "|| ( enabled1? ( cat/two ) enabled2? ( cat/three ) )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( enabled1? ( cat/two ) enabled2? ( cat/three ) )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -923,8 +915,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "|| ( !enabled1? ( cat/two ) enabled2? ( cat/three ) )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( !enabled1? ( cat/two ) enabled2? ( cat/three ) )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -946,8 +937,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(
- vmk_depend, "|| ( !enabled1? ( cat/two ) !enabled2? ( cat/three ) )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( !enabled1? ( cat/two ) !enabled2? ( cat/three ) )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -968,7 +958,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "!cat/two");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("!cat/two");
repo->add_version("cat", "two", "1");
}
@@ -988,7 +978,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two !cat/two");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two !cat/two");
repo->add_version("cat", "two", "1");
}
@@ -1015,9 +1005,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->set(vmk_depend, "!cat/two");
+ repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("!cat/two");
}
void populate_expected()
@@ -1043,9 +1033,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/three cat/two");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three cat/two");
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->set(vmk_depend, "!cat/two");
+ repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("!cat/two");
}
void populate_expected()
@@ -1066,8 +1056,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->set(vmk_depend, "cat/one");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/one");
repo->add_version("cat", "three", "1");
}
@@ -1088,8 +1078,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->set(vmk_rdepend, "cat/one");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_run_depend_string>("cat/one");
repo->add_version("cat", "three", "1");
}
@@ -1110,7 +1100,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "( cat/two cat/two )");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -1131,8 +1121,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "( cat/two[enabled] )");
- repo->add_version("cat", "two", "1")->set(vmk_iuse, "enabled");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two[enabled] )");
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("enabled");
}
void populate_expected()
@@ -1152,8 +1142,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "( cat/two[-disabled] )");
- repo->add_version("cat", "two", "1")->set(vmk_iuse, "disabled");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two[-disabled] )");
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("disabled");
}
void populate_expected()
@@ -1173,8 +1163,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "( cat/two[disabled] )");
- repo->add_version("cat", "two", "1")->set(vmk_iuse, "disabled");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two[disabled] )");
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("disabled");
}
void populate_expected()
@@ -1200,8 +1190,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "( cat/two[-enabled] )");
- repo->add_version("cat", "two", "1")->set(vmk_iuse, "enabled");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two[-enabled] )");
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("enabled");
}
void populate_expected()
@@ -1227,8 +1217,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "( cat/two cat/two[enabled] )");
- repo->add_version("cat", "two", "1")->set(vmk_iuse, "enabled");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two[enabled] )");
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("enabled");
}
void populate_expected()
@@ -1248,8 +1238,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "( cat/two cat/two[-disabled] )");
- repo->add_version("cat", "two", "1")->set(vmk_iuse, "disabled");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two[-disabled] )");
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("disabled");
}
void populate_expected()
@@ -1269,8 +1259,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "( cat/two cat/two[disabled] )");
- repo->add_version("cat", "two", "1")->set(vmk_iuse, "disabled");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two[disabled] )");
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("disabled");
}
void populate_expected()
@@ -1296,8 +1286,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->set(vmk_depend, "( cat/two cat/two[-enabled] )");
- repo->add_version("cat", "two", "1")->set(vmk_iuse, "enabled");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two[-enabled] )");
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("enabled");
}
void populate_expected()
@@ -1329,13 +1319,13 @@ namespace test_cases
FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
env.package_database()->add_repository(repo);
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
- repo->add_version("cat", "two", "1")->set(vmk_depend, "cat/four");
- repo->add_version("cat", "three", "1")->set(vmk_depend, "cat/four cat/two");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
+ repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four cat/two");
repo->add_version("cat", "four", "1");
- repo->add_version("cat", "five", "1")->set(vmk_depend, "cat/six cat/seven");
+ repo->add_version("cat", "five", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/six cat/seven");
repo->add_version("cat", "six", "1");
- repo->add_version("cat", "seven", "1")->set(vmk_depend, "cat/doesnotexist");
+ repo->add_version("cat", "seven", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/doesnotexist");
DepList d(&env);
d.add(DepParser::parse("cat/one"));
@@ -1364,13 +1354,13 @@ namespace test_cases
FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
env.package_database()->add_repository(repo);
- repo->add_version("cat", "one", "1")->set(vmk_depend, "cat/two cat/three");
- repo->add_version("cat", "two", "1")->set(vmk_depend, "cat/four");
- repo->add_version("cat", "three", "1")->set(vmk_depend, "cat/four cat/two");
+ repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
+ repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four cat/two");
repo->add_version("cat", "four", "1");
- repo->add_version("cat", "five", "1")->set(vmk_depend, "cat/six cat/seven");
+ repo->add_version("cat", "five", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/six cat/seven");
repo->add_version("cat", "six", "1");
- repo->add_version("cat", "seven", "1")->set(vmk_pdepend, "cat/doesnotexist");
+ repo->add_version("cat", "seven", "1")->get<vm_deps>().set<vmd_post_depend_string>("cat/doesnotexist");
DepList d(&env);
d.add(DepParser::parse("cat/one"));
diff --git a/paludis/dep_parser.cc b/paludis/dep_parser.cc
index 3333e5f..23c66c6 100644
--- a/paludis/dep_parser.cc
+++ b/paludis/dep_parser.cc
@@ -279,3 +279,8 @@ DepParser::parse(const std::string & s, const DepParserPolicyInterface * const p
return result;
}
+DepAtom::ConstPointer
+DepParser::parse_depend(const std::string & s)
+{
+ return DepParser::parse(s);
+}
diff --git a/paludis/dep_parser.hh b/paludis/dep_parser.hh
index cf6a213..51835c4 100644
--- a/paludis/dep_parser.hh
+++ b/paludis/dep_parser.hh
@@ -186,6 +186,11 @@ namespace paludis
*/
static CompositeDepAtom::Pointer parse(const std::string & s,
const DepParserPolicyInterface * const policy = DefaultPolicy::get_instance());
+
+ /**
+ * Convenience wrapper for parse for depend strings, for VersionMetadata.
+ */
+ static DepAtom::ConstPointer parse_depend(const std::string & s);
};
}
diff --git a/paludis/ebuild.cc b/paludis/ebuild.cc
index 199558e..3ddc800 100644
--- a/paludis/ebuild.cc
+++ b/paludis/ebuild.cc
@@ -23,6 +23,7 @@
#include <paludis/util/log.hh>
#include <paludis/environment.hh>
#include <paludis/config_file.hh>
+#include <paludis/dep_parser.hh>
/** \file
* Implementation for ebuild.hh things.
@@ -137,30 +138,29 @@ EbuildMetadataCommand::do_run_command(const std::string & cmd)
{
PStream prog(cmd);
KeyValueConfigFile f(&prog);
- _metadata.assign(new VersionMetadata);
-
- _metadata->set(vmk_depend, f.get("DEPEND"));
- _metadata->set(vmk_rdepend, f.get("RDEPEND"));
- _metadata->set(vmk_slot, f.get("SLOT"));
- _metadata->set(vmk_src_uri, f.get("SRC_URI"));
- _metadata->set(vmk_restrict, f.get("RESTRICT"));
- _metadata->set(vmk_homepage, f.get("HOMEPAGE"));
- _metadata->set(vmk_license, f.get("LICENSE"));
- _metadata->set(vmk_description, f.get("DESCRIPTION"));
- _metadata->set(vmk_keywords, f.get("KEYWORDS"));
- _metadata->set(vmk_inherited, f.get("INHERITED"));
- _metadata->set(vmk_iuse, f.get("IUSE"));
- _metadata->set(vmk_pdepend, f.get("PDEPEND"));
- _metadata->set(vmk_provide, f.get("PROVIDE"));
- _metadata->set(vmk_eapi, f.get("EAPI"));
- _metadata->set(vmk_virtual, "");
- _metadata->set(vmk_e_keywords, f.get("E_KEYWORDS"));
+ _metadata.assign(new VersionMetadata::Ebuild(DepParser::parse_depend));
+
+ _metadata->get<vm_deps>().set<vmd_build_depend_string>(f.get("DEPEND"));
+ _metadata->get<vm_deps>().set<vmd_run_depend_string>(f.get("RDEPEND"));
+ _metadata->set<vm_slot>(SlotName(f.get("SLOT")));
+ _metadata->get_ebuild_interface()->set<evm_src_uri>(f.get("SRC_URI"));
+ _metadata->get_ebuild_interface()->set<evm_restrict>(f.get("RESTRICT"));
+ _metadata->set<vm_homepage>(f.get("HOMEPAGE"));
+ _metadata->set<vm_license>(f.get("LICENSE"));
+ _metadata->set<vm_description>(f.get("DESCRIPTION"));
+ _metadata->get_ebuild_interface()->set<evm_keywords>(f.get("KEYWORDS"));
+ _metadata->get_ebuild_interface()->set<evm_inherited>(f.get("INHERITED"));
+ _metadata->get_ebuild_interface()->set<evm_iuse>(f.get("IUSE"));
+ _metadata->get<vm_deps>().set<vmd_post_depend_string>(f.get("PDEPEND"));
+ _metadata->get_ebuild_interface()->set<evm_provide>(f.get("PROVIDE"));
+ _metadata->set<vm_eapi>(f.get("EAPI"));
+ _metadata->get_ebuild_interface()->set<evm_virtual>("");
if (prog.exit_status())
{
Log::get_instance()->message(ll_warning, "Could not generate cache for '"
+ stringify(*params.get<ecpk_db_entry>()) + "'");
- _metadata->set(vmk_eapi, "UNKNOWN");
+ _metadata->set<vm_eapi>("UNKNOWN");
return false;
}
diff --git a/paludis/ebuild.hh b/paludis/ebuild.hh
index 158300f..ae7aef4 100644
--- a/paludis/ebuild.hh
+++ b/paludis/ebuild.hh
@@ -168,7 +168,7 @@ namespace paludis
public EbuildCommand
{
private:
- VersionMetadata::Pointer _metadata;
+ VersionMetadata::Ebuild::Pointer _metadata;
protected:
virtual std::string commands() const;
diff --git a/paludis/environment.cc b/paludis/environment.cc
index b793337..6a151a8 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -23,6 +23,7 @@
#include <paludis/environment.hh>
#include <paludis/util/log.hh>
#include <paludis/util/save.hh>
+#include <paludis/util/tokeniser.hh>
/** \file
* Implementation of Environment.
@@ -127,40 +128,53 @@ Environment::mask_reasons(const PackageDatabaseEntry & e) const
MaskReasons result;
VersionMetadata::ConstPointer metadata(package_database()->fetch_metadata(e));
- if (metadata->get(vmk_eapi) != "0" && metadata->get(vmk_eapi) != ""
- && metadata->get(vmk_eapi) != "paludis-1")
+ if (metadata->get<vm_eapi>() != "0" && metadata->get<vm_eapi>() != ""
+ && metadata->get<vm_eapi>() != "paludis-1")
result.set(mr_eapi);
else
{
- result.set(mr_keyword);
- for (VersionMetadata::KeywordIterator k(metadata->begin_keywords()),
- k_end(metadata->end_keywords()) ; k != k_end ; ++k)
- if (accept_keyword(*k, &e))
+ if (metadata->get_ebuild_interface())
+ {
+ std::set<KeywordName> keywords;
+ WhitespaceTokeniser::get_instance()->tokenise(
+ metadata->get_ebuild_interface()->get<evm_keywords>(),
+ create_inserter<KeywordName>(std::inserter(keywords, keywords.end())));
+
+ result.set(mr_keyword);
+ for (std::set<KeywordName>::const_iterator i(keywords.begin()),
+ i_end(keywords.end()) ; i != i_end ; ++i)
+ if (accept_keyword(*i, &e))
+ {
+ result.reset(mr_keyword);
+ break;
+ }
+
+ if (! metadata->get_ebuild_interface()->get<evm_virtual>().empty())
{
- result.reset(mr_keyword);
- break;
+ QualifiedPackageName n(metadata->get_ebuild_interface()->get<evm_virtual>());
+
+ PackageDatabaseEntry ee(n, e.get<pde_version>(), e.get<pde_repository>());
+ std::set<KeywordName> keywords;
+ WhitespaceTokeniser::get_instance()->tokenise(
+ metadata->get_ebuild_interface()->get<evm_keywords>(),
+ create_inserter<KeywordName>(std::inserter(keywords, keywords.end())));
+
+ for (std::set<KeywordName>::const_iterator i(keywords.begin()),
+ i_end(keywords.end()) ; i != i_end ; ++i)
+ if (accept_keyword(*i, &ee))
+ {
+ result.reset(mr_keyword);
+ break;
+ }
}
+ }
LicenceChecker lc(this, &e);
- DepParser::parse(metadata->get(vmk_license),
+ DepParser::parse(metadata->get<vm_license>(),
DepParserPolicy<PlainTextDepAtom, true>::get_instance())->accept(&lc);
if (! lc.ok)
result.set(mr_license);
- if (! metadata->get(vmk_virtual).empty())
- {
- QualifiedPackageName n(metadata->get(vmk_virtual));
-
- PackageDatabaseEntry ee(n, e.get<pde_version>(), e.get<pde_repository>());
- for (VersionMetadata::KeywordIterator k(metadata->begin_keywords()),
- k_end(metadata->end_keywords()) ; k != k_end ; ++k)
- if (accept_keyword(*k, &ee))
- {
- result.reset(mr_keyword);
- break;
- }
- }
-
if (! query_user_unmasks(e))
{
if (query_user_masks(e))
@@ -174,18 +188,19 @@ Environment::mask_reasons(const PackageDatabaseEntry & e) const
e.get<pde_version>()))
result.set(mr_repository_mask);
- if (! metadata->get(vmk_virtual).empty())
- {
- QualifiedPackageName n(metadata->get(vmk_virtual));
+ if (metadata->get_ebuild_interface())
+ if (! metadata->get_ebuild_interface()->get<evm_virtual>().empty())
+ {
+ QualifiedPackageName n(metadata->get_ebuild_interface()->get<evm_virtual>());
- if (package_database()->fetch_repository(e.get<pde_repository>())->query_profile_masks(n,
- e.get<pde_version>()))
- result.set(mr_profile_mask);
+ if (package_database()->fetch_repository(e.get<pde_repository>())->query_profile_masks(n,
+ e.get<pde_version>()))
+ result.set(mr_profile_mask);
- if (package_database()->fetch_repository(e.get<pde_repository>())->query_repository_masks(n,
- e.get<pde_version>()))
- result.set(mr_repository_mask);
- }
+ if (package_database()->fetch_repository(e.get<pde_repository>())->query_repository_masks(n,
+ e.get<pde_version>()))
+ result.set(mr_repository_mask);
+ }
}
}
diff --git a/paludis/fake_repository.cc b/paludis/fake_repository.cc
index 47c671c..32f4bcc 100644
--- a/paludis/fake_repository.cc
+++ b/paludis/fake_repository.cc
@@ -21,6 +21,7 @@
#include <paludis/fake_repository.hh>
#include <paludis/util/stringify.hh>
#include <paludis/version_metadata.hh>
+#include <paludis/dep_parser.hh>
/** \file
* Implementation for FakeRepository.
@@ -155,11 +156,13 @@ FakeRepository::add_version(const CategoryNamePart & c, const PackageNamePart &
add_package(c, p);
_imp->versions.find(QualifiedPackageName(c, p))->second->insert(v);
_imp->metadata.insert(
- std::make_pair(stringify(c) + "/" + stringify(p) + "-" + stringify(v), new VersionMetadata));
+ std::make_pair(stringify(c) + "/" + stringify(p) + "-" + stringify(v),
+ VersionMetadata::Pointer(new VersionMetadata::Ebuild(DepParser::parse_depend))));
VersionMetadata::Pointer r(_imp->metadata.find(stringify(c) +
"/" + stringify(p) + "-" + stringify(v))->second);
- r->set(vmk_slot, "0");
- r->set(vmk_keywords, "test");
+ r->set<vm_slot>(SlotName("0"));
+ r->set<vm_eapi>("0");
+ r->get_ebuild_interface()->set<evm_keywords>("test");
return r;
}
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index a18dd87..88bd08a 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -50,7 +50,7 @@ match_package_internals::do_match(
VersionMetadata::ConstPointer metadata(env->package_database()->fetch_metadata(*entry));
if (atom->slot_ptr())
- if (*atom->slot_ptr() != SlotName(metadata->get(vmk_slot)))
+ if (*atom->slot_ptr() != SlotName(metadata->get<vm_slot>()))
return false;
if (atom->use_requirements_ptr())
@@ -98,7 +98,7 @@ match_package_internals::do_match(
if (atom->repository_ptr() && (*atom->repository_ptr() != entry->get<dle_repository>()))
return false;
- if (atom->slot_ptr() && (atom->slot_ptr()->data() != entry->get<dle_metadata>()->get(vmk_slot)))
+ if (atom->slot_ptr() && (*atom->slot_ptr() != entry->get<dle_metadata>()->get<vm_slot>()))
return false;
if (atom->use_requirements_ptr())
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index ca53f3e..758be69 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -87,7 +87,8 @@ namespace paludis
typedef MakeHashedSet<UseFlagName>::Type UseMaskSet;
/// Map for package USE masking.
- typedef MakeHashedMap<QualifiedPackageName, std::list<std::pair<PackageDepAtom::ConstPointer, UseFlagName> > >::Type PackageUseMaskMap;
+ typedef MakeHashedMap<QualifiedPackageName,
+ std::list<std::pair<PackageDepAtom::ConstPointer, UseFlagName> > >::Type PackageUseMaskMap;
/// Map for USE flag sets.
typedef MakeHashedSet<UseFlagName>::Type UseFlagSet;
@@ -96,7 +97,8 @@ namespace paludis
typedef MakeHashedMap<std::string, std::list<std::string> >::Type MirrorMap;
/// Map for metadata.
- typedef MakeHashedMap<std::pair<QualifiedPackageName, VersionSpec>, VersionMetadata::Pointer>::Type MetadataMap;
+ typedef MakeHashedMap<std::pair<QualifiedPackageName, VersionSpec>,
+ VersionMetadata::Pointer>::Type MetadataMap;
/// Map for profile environment.
typedef MakeHashedMap<std::string, std::string>::Type ProfileEnvMap;
@@ -821,10 +823,11 @@ PortageRepository::do_version_metadata(
Log::get_instance()->message(ll_warning, "has_version failed for request for '" +
stringify(c) + "/" + stringify(p) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "'");
- return VersionMetadata::ConstPointer(new VersionMetadata);
+ return VersionMetadata::ConstPointer(new VersionMetadata::Ebuild(
+ DepParser::parse_depend));
}
- VersionMetadata::Pointer result(new VersionMetadata);
+ VersionMetadata::Pointer result(new VersionMetadata::Ebuild(DepParser::parse_depend));
FSEntry cache_file(_imp->cache);
cache_file /= stringify(c);
@@ -839,23 +842,22 @@ PortageRepository::do_version_metadata(
if (cache)
{
- /// \bug this lot
- std::getline(cache, line); result->set(vmk_depend, line);
- std::getline(cache, line); result->set(vmk_rdepend, line);
- std::getline(cache, line); result->set(vmk_slot, line);
- std::getline(cache, line); result->set(vmk_src_uri, line);
- std::getline(cache, line); result->set(vmk_restrict, line);
- std::getline(cache, line); result->set(vmk_homepage, line);
- std::getline(cache, line); result->set(vmk_license, line);
- std::getline(cache, line); result->set(vmk_description, line);
- std::getline(cache, line); result->set(vmk_keywords, line);
- std::getline(cache, line); result->set(vmk_inherited, line);
- std::getline(cache, line); result->set(vmk_iuse, line);
+ std::getline(cache, line); result->get<vm_deps>().set<vmd_build_depend_string>(line);
+ std::getline(cache, line); result->get<vm_deps>().set<vmd_run_depend_string>(line);
+ std::getline(cache, line); result->set<vm_slot>(SlotName(line));
+ std::getline(cache, line); result->get_ebuild_interface()->set<evm_src_uri>(line);
+ std::getline(cache, line); result->get_ebuild_interface()->set<evm_restrict>(line);
+ std::getline(cache, line); result->set<vm_homepage>(line);
+ std::getline(cache, line); result->set<vm_license>(line);
+ std::getline(cache, line); result->set<vm_description>(line);
+ std::getline(cache, line); result->get_ebuild_interface()->set<evm_keywords>(line);
+ std::getline(cache, line); result->get_ebuild_interface()->set<evm_inherited>(line);
+ std::getline(cache, line); result->get_ebuild_interface()->set<evm_iuse>(line);
std::getline(cache, line);
- std::getline(cache, line); result->set(vmk_pdepend, line);
- std::getline(cache, line); result->set(vmk_provide, line);
- std::getline(cache, line); result->set(vmk_eapi, line);
- result->set(vmk_virtual, "");
+ std::getline(cache, line); result->get<vm_deps>().set<vmd_post_depend_string>(line);
+ std::getline(cache, line); result->get_ebuild_interface()->set<evm_provide>(line);
+ std::getline(cache, line); result->set<vm_eapi>(line);
+ result->get_ebuild_interface()->set<evm_virtual>("");
// check mtimes
time_t cache_time(cache_file.mtime());
@@ -870,10 +872,10 @@ PortageRepository::do_version_metadata(
if (timestamp.exists())
cache_time = timestamp.mtime();
- static Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
std::list<std::string> inherits;
- tokeniser.tokenise(stringify(result->get(vmk_inherited)),
- std::back_inserter(inherits));
+ WhitespaceTokeniser::get_instance()->tokenise(
+ stringify(result->get_ebuild_interface()->get<evm_inherited>()),
+ std::back_inserter(inherits));
for (std::list<std::string>::const_iterator i(inherits.begin()),
i_end(inherits.end()) ; i != i_end ; ++i)
if ((_imp->eclassdir / (*i + ".eclass")).mtime() > cache_time)
@@ -892,11 +894,12 @@ PortageRepository::do_version_metadata(
QualifiedPackageName(c, p)))))
{
VersionMetadata::ConstPointer m(version_metadata(vi->second->package(), v));
- result->set(vmk_slot, m->get(vmk_slot));
- result->set(vmk_keywords, m->get(vmk_keywords));
- result->set(vmk_eapi, m->get(vmk_eapi));
- result->set(vmk_virtual, stringify(vi->second->package()));
- result->set(vmk_depend, "=" + stringify(vi->second->package()) + "-" + stringify(v));
+ result->set<vm_slot>(m->get<vm_slot>());
+ result->get_ebuild_interface()->set<evm_keywords>(m->get_ebuild_interface()->get<evm_keywords>());
+ result->set<vm_eapi>(m->get<vm_eapi>());
+ result->get_ebuild_interface()->set<evm_virtual>(stringify(vi->second->package()));
+ result->get<vm_deps>().set<vmd_build_depend_string>(
+ "=" + stringify(vi->second->package()) + "-" + stringify(v));
ok = true;
}
@@ -1293,8 +1296,6 @@ void
PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec & v,
const InstallOptions & o) const
{
- static Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
-
if (! _imp->has_profile)
{
_imp->add_profile(_imp->profile.realpath());
@@ -1310,9 +1311,9 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
{
if (q.get<qpn_category>() == CategoryNamePart("virtual"))
{
- VersionMetadata::Pointer m(new VersionMetadata);
- m->set(vmk_slot, "0");
- m->set(vmk_virtual, " ");
+ VersionMetadata::Ebuild::Pointer m(new VersionMetadata::Ebuild(DepParser::parse_depend));
+ m->set<vm_slot>(SlotName("0"));
+ m->get_ebuild_interface()->set<evm_virtual>(" ");
metadata = m;
}
else
@@ -1327,7 +1328,8 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
bool fetch_restrict(false), no_mirror(false);
{
std::list<std::string> restricts;
- tokeniser.tokenise(metadata->get(vmk_restrict), std::back_inserter(restricts));
+ WhitespaceTokeniser::get_instance()->tokenise(
+ metadata->get_ebuild_interface()->get<evm_restrict>(), std::back_inserter(restricts));
fetch_restrict = (restricts.end() != std::find(restricts.begin(), restricts.end(), "fetch")) ||
(restricts.end() != std::find(restricts.begin(), restricts.end(), "nofetch"));
no_mirror = (restricts.end() != std::find(restricts.begin(), restricts.end(), "mirror")) ||
@@ -1339,7 +1341,7 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
std::set<std::string> already_in_archives;
DepAtomFlattener f(_imp->env, &e,
- DepParser::parse(metadata->get(vmk_src_uri),
+ DepParser::parse(metadata->get_ebuild_interface()->get<evm_src_uri>(),
DepParserPolicy<PlainTextDepAtom, false>::get_instance()));
for (DepAtomFlattener::Iterator ff(f.begin()), ff_end(f.end()) ; ff != ff_end ; ++ff)
@@ -1398,11 +1400,14 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
}
std::string use;
- VersionMetadata::IuseIterator iuse_it=metadata->begin_iuse(), iuse_end=metadata->end_iuse();
- for ( ; iuse_it != iuse_end; ++iuse_it)
{
- if (_imp->env->query_use(*iuse_it, &e))
- use += (*iuse_it).data() + " ";
+ std::set<UseFlagName> iuse;
+ WhitespaceTokeniser::get_instance()->tokenise(metadata->get_ebuild_interface()->
+ get<evm_iuse>(), create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
+ for (std::set<UseFlagName>::const_iterator iuse_it(iuse.begin()), iuse_end(iuse.end()) ;
+ iuse_it != iuse_end; ++iuse_it)
+ if (_imp->env->query_use(*iuse_it, &e))
+ use += (*iuse_it).data() + " ";
}
use += _imp->profile_env["ARCH"] + " ";
@@ -1414,7 +1419,8 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
&::tolower);
std::list<std::string> uses;
- tokeniser.tokenise(_imp->profile_env[stringify(*x)], std::back_inserter(uses));
+ WhitespaceTokeniser::get_instance()->tokenise(_imp->profile_env[stringify(*x)],
+ std::back_inserter(uses));
for (std::list<std::string>::const_iterator u(uses.begin()), u_end(uses.end()) ;
u != u_end ; ++u)
@@ -1468,7 +1474,7 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
param<ecfpk_no_fetch>(fetch_restrict)
)));
- if (metadata->get(vmk_virtual).empty())
+ if (metadata->get_ebuild_interface()->get<evm_virtual>().empty())
fetch_cmd();
if (o.get<io_fetchonly>())
@@ -1494,8 +1500,8 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
param<ecipk_root>(stringify(_imp->root) + "/"),
param<ecipk_profile>(stringify(_imp->profile)),
param<ecipk_disable_cfgpro>(o.get<io_noconfigprotect>()),
- param<ecipk_merge_only>(! metadata->get(vmk_virtual).empty()),
- param<ecipk_slot>(SlotName(metadata->get(vmk_slot)))
+ param<ecipk_merge_only>(! metadata->get_ebuild_interface()->get<evm_virtual>().empty()),
+ param<ecipk_slot>(SlotName(metadata->get<vm_slot>()))
)));
install_cmd();
@@ -1532,19 +1538,18 @@ namespace
PackageDatabaseEntryCollection::Iterator
PortageRepository::find_best(PackageDatabaseEntryCollection::Pointer & c, const PackageDatabaseEntry & e) const
{
- Context local("When finding best update for '" + stringify(e.get<pde_name>()) + "-" + stringify(e.get<pde_version>()) + "':");
- //Find an entry in c that matches e best. e is not in c.
+ Context local("When finding best update for '" + stringify(e.get<pde_name>()) + "-" +
+ stringify(e.get<pde_version>()) + "':");
+ // Find an entry in c that matches e best. e is not in c.
QualifiedPackageName n(e.get<pde_name>());
- std::string s(_imp->env->package_database()->fetch_metadata(e)->get(vmk_slot));
+ SlotName s(_imp->env->package_database()->fetch_metadata(e)->get<vm_slot>());
PackageDatabaseEntryCollection::Iterator i(c->begin()), i_end(c->end()), i_best(c->end());
for ( ; i != i_end; ++i)
{
if (n != i->get<pde_name>())
continue;
- if (s != _imp->env->package_database()->fetch_metadata(*i)->get(vmk_slot))
- {
+ if (s != _imp->env->package_database()->fetch_metadata(*i)->get<vm_slot>())
continue;
- }
i_best = i;
}
diff --git a/paludis/portage_repository_TEST.cc b/paludis/portage_repository_TEST.cc
index 6e99f1b..e94dc64 100644
--- a/paludis/portage_repository_TEST.cc
+++ b/paludis/portage_repository_TEST.cc
@@ -483,13 +483,13 @@ namespace test_cases
VersionMetadata::ConstPointer m(0);
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"));
- TEST_CHECK_EQUAL(m->get(vmk_description), "the-description");
+ TEST_CHECK_EQUAL(m->get<vm_description>(), "the-description");
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("2"));
- TEST_CHECK_EQUAL(m->get(vmk_description), "");
+ TEST_CHECK_EQUAL(m->get<vm_description>(), "");
m = repo->version_metadata(QualifiedPackageName("cat-two/pkg-one"), VersionSpec("1"));
- TEST_CHECK_EQUAL(m->get(vmk_description), "");
+ TEST_CHECK_EQUAL(m->get<vm_description>(), "");
}
}
} test_portage_repository_metadata_cached;
@@ -524,7 +524,7 @@ namespace test_cases
VersionMetadata::ConstPointer m(0);
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"));
- TEST_CHECK_EQUAL(m->get(vmk_description), "The Description");
+ TEST_CHECK_EQUAL(m->get<vm_description>(), "The Description");
}
}
} test_portage_repository_metadata_uncached;
diff --git a/paludis/util/compare.hh b/paludis/util/compare.hh
index 225fd3e..3304b85 100644
--- a/paludis/util/compare.hh
+++ b/paludis/util/compare.hh
@@ -39,8 +39,6 @@ namespace paludis
*
* \ingroup grpcompare
*/
- inline int compare(int t1, int t2) PALUDIS_ATTRIBUTE((always_inline));
-
inline int compare(int t1, int t2)
{
if (t1 < t2)
@@ -58,8 +56,6 @@ namespace paludis
*
* \ingroup grpcompare
*/
- inline int compare(unsigned t1, unsigned t2) PALUDIS_ATTRIBUTE((always_inline));
-
inline int compare(unsigned t1, unsigned t2)
{
if (t1 < t2)
@@ -77,8 +73,6 @@ namespace paludis
*
* \ingroup grpcompare
*/
- inline int long compare(unsigned long t1, unsigned long t2) PALUDIS_ATTRIBUTE((always_inline));
-
inline int long compare(unsigned long t1, unsigned long t2)
{
if (t1 < t2)
@@ -96,8 +90,6 @@ namespace paludis
*
* \ingroup grpcompare
*/
- inline int compare(long t1, long t2) PALUDIS_ATTRIBUTE((always_inline));
-
inline int compare(long t1, long t2)
{
if (t1 < t2)
@@ -119,12 +111,6 @@ namespace paludis
inline int compare(
const std::basic_string<T_> & t1,
const std::basic_string<T_> & t2)
- PALUDIS_ATTRIBUTE((always_inline));
-
- template <typename T_>
- inline int compare(
- const std::basic_string<T_> & t1,
- const std::basic_string<T_> & t2)
{
register int r(t1.compare(t2));
if (r < 0)
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 14ac79f..e362d37 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -34,7 +34,7 @@ add(`smart_record', `hh', `test')
add(`stringify', `hh', `test')
add(`strip', `hh', `cc', `test')
add(`system', `hh', `cc', `test')
-add(`tokeniser', `hh', `test')
+add(`tokeniser', `hh', `cc', `test')
add(`util', `hh')
add(`validated', `hh', `test')
add(`virtual_constructor', `hh', `test')
diff --git a/paludis/util/tokeniser.cc b/paludis/util/tokeniser.cc
new file mode 100644
index 0000000..8d5fbbe
--- /dev/null
+++ b/paludis/util/tokeniser.cc
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "tokeniser.hh"
+
+using namespace paludis;
+
+WhitespaceTokeniser::WhitespaceTokeniser() :
+ Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(" \t\n")
+{
+}
+
diff --git a/paludis/util/tokeniser.hh b/paludis/util/tokeniser.hh
index 24fdb12..f350826 100644
--- a/paludis/util/tokeniser.hh
+++ b/paludis/util/tokeniser.hh
@@ -224,6 +224,20 @@ namespace paludis
}
}
+ /**
+ * Convenience singleton class for tokenising on whitespace.
+ *
+ * \ingroup grptokenise
+ */
+ class WhitespaceTokeniser :
+ public InstantiationPolicy<WhitespaceTokeniser, instantiation_method::SingletonAtStartupTag>,
+ public Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag>
+ {
+ friend class InstantiationPolicy<WhitespaceTokeniser, instantiation_method::SingletonAtStartupTag>;
+
+ private:
+ WhitespaceTokeniser();
+ };
}
#endif
diff --git a/paludis/vdb_repository.cc b/paludis/vdb_repository.cc
index bc3792b..bb1a307 100644
--- a/paludis/vdb_repository.cc
+++ b/paludis/vdb_repository.cc
@@ -318,18 +318,24 @@ Implementation<VDBRepository>::load_entry(std::vector<VDBEntry>::iterator p) con
Context context("When loading VDBRepository entry for '" + stringify(p->name)
+ "-" + stringify(p->version) + "' from '" + stringify(location) + "':");
- p->metadata = VersionMetadata::Pointer(new VersionMetadata);
- p->metadata->set(vmk_depend, file_contents(location, p->name, p->version, "DEPEND"));
- p->metadata->set(vmk_rdepend, file_contents(location, p->name, p->version, "RDEPEND"));
- p->metadata->set(vmk_license, file_contents(location, p->name, p->version, "LICENSE"));
- p->metadata->set(vmk_keywords, "*");
- p->metadata->set(vmk_inherited, file_contents(location, p->name, p->version, "INHERITED"));
- p->metadata->set(vmk_iuse, file_contents(location, p->name, p->version, "IUSE"));
- p->metadata->set(vmk_pdepend, file_contents(location, p->name, p->version, "PDEPEND"));
- p->metadata->set(vmk_provide, file_contents(location, p->name, p->version, "PROVIDE"));
- p->metadata->set(vmk_eapi, file_contents(location, p->name, p->version, "EAPI"));
- p->metadata->set(vmk_homepage, file_contents(location, p->name, p->version, "HOMEPAGE"));
- p->metadata->set(vmk_description, file_contents(location, p->name, p->version, "DESCRIPTION"));
+ p->metadata = VersionMetadata::Pointer(new VersionMetadata::Ebuild(DepParser::parse_depend));
+ p->metadata->get<vm_deps>().set<vmd_build_depend_string>(
+ file_contents(location, p->name, p->version, "DEPEND"));
+ p->metadata->get<vm_deps>().set<vmd_run_depend_string>(
+ file_contents(location, p->name, p->version, "RDEPEND"));
+ p->metadata->set<vm_license>(file_contents(location, p->name, p->version, "LICENSE"));
+ p->metadata->get_ebuild_interface()->set<evm_keywords>("*");
+ p->metadata->get_ebuild_interface()->set<evm_inherited>(
+ file_contents(location, p->name, p->version, "INHERITED"));
+ p->metadata->get_ebuild_interface()->set<evm_iuse>(
+ file_contents(location, p->name, p->version, "IUSE"));
+ p->metadata->get<vm_deps>().set<vmd_post_depend_string>(
+ file_contents(location, p->name, p->version, "PDEPEND"));
+ p->metadata->get_ebuild_interface()->set<evm_provide>(
+ file_contents(location, p->name, p->version, "PROVIDE"));
+ p->metadata->set<vm_eapi>(file_contents(location, p->name, p->version, "EAPI"));
+ p->metadata->set<vm_homepage>(file_contents(location, p->name, p->version, "HOMEPAGE"));
+ p->metadata->set<vm_description>(file_contents(location, p->name, p->version, "DESCRIPTION"));
std::string slot(file_contents(location, p->name, p->version, "SLOT"));
if (slot.empty())
@@ -339,12 +345,12 @@ Implementation<VDBRepository>::load_entry(std::vector<VDBEntry>::iterator p) con
stringify(location) + "' has empty SLOT, setting to \"0\"");
slot = "0";
}
- p->metadata->set(vmk_slot, slot);
+ p->metadata->set<vm_slot>(SlotName(slot));
std::string raw_use(file_contents(location, p->name, p->version, "USE"));
p->use.clear();
- Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> t(" \t\n");
- t.tokenise(raw_use, filter_inserter(create_inserter<UseFlagName>(
+ WhitespaceTokeniser::get_instance()->tokenise(raw_use,
+ filter_inserter(create_inserter<UseFlagName>(
std::inserter(p->use, p->use.begin())), IsPositiveFlag()));
}
@@ -480,7 +486,7 @@ VDBRepository::do_version_metadata(
Log::get_instance()->message(ll_warning, "version lookup failed for request for '" +
stringify(c) + "/" + stringify(p) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "'");
- return VersionMetadata::ConstPointer(new VersionMetadata);
+ return VersionMetadata::ConstPointer(new VersionMetadata(&DepParser::parse_depend));
}
else
{
@@ -728,7 +734,7 @@ VDBRepository::do_uninstall(const QualifiedPackageName & q, const VersionSpec &
EbuildUninstallCommandParams::create((
param<ecupk_root>(stringify(_imp->root) + "/"),
param<ecupk_disable_cfgpro>(o.get<io_noconfigprotect>()),
- param<ecupk_unmerge_only>(! metadata->get(vmk_virtual).empty())
+ param<ecupk_unmerge_only>(! metadata->get_ebuild_interface()->get<evm_virtual>().empty())
)));
uninstall_cmd();
@@ -819,7 +825,7 @@ VDBRepository::begin_provide_map() const
{
if (! e->metadata)
_imp->load_entry(e);
- const std::string provide_str(e->metadata->get(vmk_provide));
+ const std::string provide_str(e->metadata->get_ebuild_interface()->get<evm_provide>());
if (provide_str.empty())
continue;
diff --git a/paludis/version_metadata.cc b/paludis/version_metadata.cc
index 47396f2..d8bbf0f 100644
--- a/paludis/version_metadata.cc
+++ b/paludis/version_metadata.cc
@@ -30,129 +30,76 @@
using namespace paludis;
-namespace paludis
+VersionMetadataDeps::VersionMetadataDeps(ParserFunction p) :
+ MakeSmartRecord<VersionMetadataDepsTag>::Type(MakeSmartRecord<VersionMetadataDepsTag>::Type::create((
+ param<vmd_build_depend_string>(""),
+ param<vmd_run_depend_string>(""),
+ param<vmd_post_depend_string>(""),
+ param<vmd_parser>(p))))
{
- /**
- * Implementation data for VersionMetadata.
- *
- * \ingroup grpversions
- */
- template <>
- struct Implementation<VersionMetadata> :
- InternalCounted<Implementation<VersionMetadata> >
- {
- /**
- * Our values.
- */
- std::vector<std::string> values;
-
- /**
- * Cache: IUSE.
- */
- mutable std::set<UseFlagName> iuse;
-
- /**
- * Cache: KEYWORDS.
- */
- mutable std::set<KeywordName> keywords;
-
- /**
- * Cache: PROVIDE.
- */
- mutable std::set<QualifiedPackageName> provide;
-
- /**
- * Constructor.
- */
- Implementation();
- };
}
-Implementation<VersionMetadata>::Implementation()
+DepAtom::ConstPointer
+VersionMetadataDeps::build_depend() const
{
- values.resize(static_cast<unsigned>(last_vmk));
+ return get<vmd_parser>()(get<vmd_build_depend_string>());
}
-VersionMetadata::VersionMetadata() :
- PrivateImplementationPattern<VersionMetadata>(new Implementation<VersionMetadata>())
+DepAtom::ConstPointer
+VersionMetadataDeps::run_depend() const
{
+ return get<vmd_parser>()(get<vmd_run_depend_string>());
}
-VersionMetadata::~VersionMetadata()
+DepAtom::ConstPointer
+VersionMetadataDeps::post_depend() const
{
+ return get<vmd_parser>()(get<vmd_post_depend_string>());
}
-const std::string &
-VersionMetadata::get(const VersionMetadataKey key) const
+VersionMetadata::Ebuild::Ebuild(ParserFunction f) :
+ VersionMetadata(f, &_e),
+ _e(EbuildVersionMetadata::create((
+ param<evm_src_uri>(""),
+ param<evm_restrict>(""),
+ param<evm_keywords>(""),
+ param<evm_inherited>(""),
+ param<evm_iuse>(""),
+ param<evm_inherited>(""),
+ param<evm_provide>(""),
+ param<evm_virtual>(""))))
{
- if (key < 0 || key >= static_cast<int>(_imp->values.size()))
- throw InternalError(PALUDIS_HERE, "Bad value for key");
- return _imp->values[key];
}
-VersionMetadata &
-VersionMetadata::set(const VersionMetadataKey key, const std::string & value)
-{
- if (key < 0 || key >= static_cast<int>(_imp->values.size()))
- throw InternalError(PALUDIS_HERE, "Bad value for key");
-
- _imp->values[key] = value;
-
- switch (key)
- {
- case vmk_iuse:
- _imp->iuse.clear();
- break;
-
- case vmk_keywords:
- _imp->keywords.clear();
- break;
-
- case vmk_provide:
- _imp->provide.clear();
- break;
-
- default:
- break;
- }
-
- return *this;
-}
-
-VersionMetadata::IuseIterator
-VersionMetadata::begin_iuse() const
-{
- if (_imp->iuse.empty())
- {
- Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
- tokeniser.tokenise(get(vmk_iuse), create_inserter<UseFlagName>(
- std::inserter(_imp->iuse, _imp->iuse.begin())));
- }
- return _imp->iuse.begin();
-}
-
-VersionMetadata::IuseIterator
-VersionMetadata::end_iuse() const
+VersionMetadata::~VersionMetadata()
{
- return _imp->iuse.end();
}
-VersionMetadata::KeywordIterator
-VersionMetadata::begin_keywords() const
+VersionMetadata::VersionMetadata(ParserFunction p) :
+ MakeSmartRecord<VersionMetadataTag>::Type(MakeSmartRecord<VersionMetadataTag>::Type::create((
+ param<vm_slot>(SlotName("unset")),
+ param<vm_deps>(VersionMetadataDeps(p)),
+ param<vm_homepage>(""),
+ param<vm_license>(""),
+ param<vm_description>(""),
+ param<vm_eapi>("UNSET"),
+ param<vm_licence>("")
+ ))),
+ _ebuild_if(0)
{
- if (_imp->keywords.empty())
- {
- Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
- tokeniser.tokenise(get(vmk_keywords), create_inserter<KeywordName>(
- std::inserter(_imp->keywords, _imp->keywords.begin())));
- }
-
- return _imp->keywords.begin();
}
-VersionMetadata::KeywordIterator
-VersionMetadata::end_keywords() const
+VersionMetadata::VersionMetadata(ParserFunction p, EbuildVersionMetadata * ebuild_if) :
+ MakeSmartRecord<VersionMetadataTag>::Type(MakeSmartRecord<VersionMetadataTag>::Type::create((
+ param<vm_slot>(SlotName("unset")),
+ param<vm_deps>(VersionMetadataDeps(p)),
+ param<vm_homepage>(""),
+ param<vm_license>(""),
+ param<vm_description>(""),
+ param<vm_eapi>("UNSET"),
+ param<vm_licence>("")
+ ))),
+ _ebuild_if(ebuild_if)
{
- return _imp->keywords.end();
}
diff --git a/paludis/version_metadata.hh b/paludis/version_metadata.hh
index a71be4e..461847f 100644
--- a/paludis/version_metadata.hh
+++ b/paludis/version_metadata.hh
@@ -23,7 +23,8 @@
#include <paludis/name.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/version_metadata.hh>
+#include <paludis/util/smart_record.hh>
+#include <paludis/dep_atom.hh>
#include <set>
#include <string>
@@ -35,74 +36,131 @@
namespace paludis
{
- /**
- * Represents a VersionMetadata key value.
- *
- * \ingroup grpversions
- */
+ typedef DepAtom::ConstPointer (* ParserFunction) (const std::string &);
+
+ enum VersionMetadataDepsKey
+ {
+ vmd_parser,
+ vmd_build_depend_string,
+ vmd_run_depend_string,
+ vmd_post_depend_string,
+ last_vmd
+ };
+
+ struct VersionMetadataDepsTag :
+ SmartRecordTag<comparison_mode::NoComparisonTag, void>,
+ SmartRecordKeys<VersionMetadataDepsKey, last_vmd>,
+ SmartRecordKey<vmd_parser, ParserFunction>,
+ SmartRecordKey<vmd_build_depend_string, std::string>,
+ SmartRecordKey<vmd_run_depend_string, std::string>,
+ SmartRecordKey<vmd_post_depend_string, std::string>
+ {
+ };
+
+ class VersionMetadataDeps :
+ public MakeSmartRecord<VersionMetadataDepsTag>::Type
+ {
+ public:
+ VersionMetadataDeps(ParserFunction);
+
+ DepAtom::ConstPointer build_depend() const;
+ DepAtom::ConstPointer run_depend() const;
+ DepAtom::ConstPointer post_depend() const;
+ };
+
enum VersionMetadataKey
{
- vmk_depend, ///< DEPEND
- vmk_rdepend, ///< RDEPEND
- vmk_slot, ///< SLOT
- vmk_src_uri, ///< SRC_URI
- vmk_restrict, ///< RESTRICT
- vmk_license, ///< LICENSE
- vmk_licence = vmk_license, ///< Convenience spelling for vmk_license
- vmk_keywords, ///< KEYWORDS
- vmk_inherited, ///< INHERITED
- vmk_iuse, ///< IUSE
- vmk_pdepend, ///< PDEPEND
- vmk_provide, ///< PROVIDE
- vmk_eapi, ///< EAPI
- vmk_homepage, ///< HOMEPAGE
- vmk_description, ///< DESCRIPTION
- vmk_virtual, ///< Are we a virtual for something (empty is no)?
- vmk_e_keywords, ///< KEYWORDS from ECLASS, for QA checks
- last_vmk ///< Number of items (keep at end!)
+ vm_deps,
+ vm_slot,
+ vm_license,
+ vm_licence = vm_license,
+ vm_eapi,
+ vm_homepage,
+ vm_description,
+ last_vm
+ };
+
+ struct VersionMetadataTag :
+ SmartRecordTag<comparison_mode::NoComparisonTag, void>,
+ SmartRecordKeys<VersionMetadataKey, last_vm>,
+ SmartRecordKey<vm_deps, VersionMetadataDeps>,
+ SmartRecordKey<vm_slot, SlotName>,
+ SmartRecordKey<vm_license, std::string>,
+ SmartRecordKey<vm_eapi, std::string>,
+ SmartRecordKey<vm_homepage, std::string>,
+ SmartRecordKey<vm_description, std::string>
+ {
+ };
+
+ enum EbuildVersionMetadataKey
+ {
+ evm_provide,
+ evm_src_uri,
+ evm_restrict,
+ evm_keywords,
+ evm_iuse,
+ evm_virtual,
+ evm_inherited,
+ last_evm
};
- /**
- * Holds the metadata associated with a particular version.
- *
- * \ingroup grpversions
- */
+ struct EbuildVersionMetadataTag :
+ SmartRecordTag<comparison_mode::NoComparisonTag, void>,
+ SmartRecordKeys<EbuildVersionMetadataKey, last_evm>,
+ SmartRecordKey<evm_provide, std::string>,
+ SmartRecordKey<evm_src_uri, std::string>,
+ SmartRecordKey<evm_restrict, std::string>,
+ SmartRecordKey<evm_keywords, std::string>,
+ SmartRecordKey<evm_iuse, std::string>,
+ SmartRecordKey<evm_virtual, std::string>,
+ SmartRecordKey<evm_inherited, std::string>
+ {
+ };
+
+ typedef MakeSmartRecord<EbuildVersionMetadataTag>::Type EbuildVersionMetadata;
+
class VersionMetadata :
private InstantiationPolicy<VersionMetadata, instantiation_method::NonCopyableTag>,
- private PrivateImplementationPattern<VersionMetadata>,
+ public MakeSmartRecord<VersionMetadataTag>::Type,
public InternalCounted<VersionMetadata>
{
+ private:
+ EbuildVersionMetadata * _ebuild_if;
+
+ protected:
+ VersionMetadata(ParserFunction, EbuildVersionMetadata * ebuild_if);
+
public:
- /**
- * Constructor.
- */
- VersionMetadata();
-
- /**
- * Destructor.
- */
- ~VersionMetadata();
-
- /**
- * Fetch the value of a key.
- */
- const std::string & get(const VersionMetadataKey key) const;
-
- /// \name Convenience iterators
- ///{
- typedef std::set<UseFlagName>::const_iterator IuseIterator;
- IuseIterator begin_iuse() const;
- IuseIterator end_iuse() const;
-
- typedef std::set<KeywordName>::const_iterator KeywordIterator;
- KeywordIterator begin_keywords() const;
- KeywordIterator end_keywords() const;
- ///}
-
- /**
- * Set a key, return self.
- */
- VersionMetadata & set(const VersionMetadataKey key, const std::string & value);
+ VersionMetadata(ParserFunction);
+
+ virtual ~VersionMetadata();
+
+ EbuildVersionMetadata *
+ get_ebuild_interface()
+ {
+ return _ebuild_if;
+ }
+
+ const EbuildVersionMetadata *
+ get_ebuild_interface() const
+ {
+ return _ebuild_if;
+ }
+
+ class Ebuild;
+ };
+
+ class VersionMetadata::Ebuild :
+ public VersionMetadata
+ {
+ private:
+ EbuildVersionMetadata _e;
+
+ public:
+ Ebuild(ParserFunction);
+
+ typedef CountedPtr<VersionMetadata::Ebuild, count_policy::InternalCountTag> Pointer;
+ typedef CountedPtr<const VersionMetadata::Ebuild, count_policy::InternalCountTag> ConstPointer;
};
}
diff --git a/src/install.cc b/src/install.cc
index 3297c25..6362dbb 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -23,6 +23,7 @@
#include <iostream>
#include <paludis/paludis.hh>
#include <paludis/util/iterator.hh>
+#include <paludis/util/tokeniser.hh>
/** \file
* Handle the --install action for the main paludis program.
@@ -178,9 +179,9 @@ do_install()
cout << "::" << dep->get<p::dle_repository>();
/* display slot name, unless it's 0 */
- if ("0" != dep->get<p::dle_metadata>()->get(p::vmk_slot))
+ if (p::SlotName("0") != dep->get<p::dle_metadata>()->get<p::vm_slot>())
cout << colour(cl_slot, " {:" + p::stringify(
- dep->get<p::dle_metadata>()->get(p::vmk_slot)) + "}");
+ dep->get<p::dle_metadata>()->get<p::vm_slot>()) + "}");
/* indicate [U], [S] or [N]. display existing version, if we're
* already installed */
@@ -194,7 +195,7 @@ do_install()
{
existing = env->package_database()->query(p::PackageDepAtom::Pointer(
new p::PackageDepAtom(p::stringify(dep->get<p::dle_name>()) + ":" +
- dep->get<p::dle_metadata>()->get(p::vmk_slot))),
+ stringify(dep->get<p::dle_metadata>()->get<p::vm_slot>()))),
p::is_installed_only);
if (existing->empty())
cout << colour(cl_updatemode, " [S]");
@@ -213,24 +214,31 @@ do_install()
dep->get<p::dle_version>(), dep->get<p::dle_repository>()));
/* display USE flags */
- for (p::VersionMetadata::IuseIterator i(dep->get<p::dle_metadata>()->begin_iuse()),
- i_end(dep->get<p::dle_metadata>()->end_iuse()) ; i != i_end ; ++i)
+ if (dep->get<p::dle_metadata>()->get_ebuild_interface())
{
- if (env->query_use(*i, &p))
+ std::set<p::UseFlagName> iuse;
+ p::WhitespaceTokeniser::get_instance()->tokenise(
+ dep->get<p::dle_metadata>()->get_ebuild_interface()->get<p::evm_iuse>(),
+ p::create_inserter<p::UseFlagName>(std::inserter(iuse, iuse.end())));
+ for (std::set<p::UseFlagName>::const_iterator i(iuse.begin()), i_end(iuse.end()) ;
+ i != i_end ; ++i)
{
- if (env->package_database()->fetch_repository(
- dep->get<p::dle_repository>())->query_use_force(*i, &p))
- cout << " " << colour(cl_flag_on, "(" + p::stringify(*i) + ")");
- else
- cout << " " << colour(cl_flag_on, *i);
- }
- else
- {
- if (env->package_database()->fetch_repository(
- dep->get<p::dle_repository>())->query_use_mask(*i, &p))
- cout << " " << colour(cl_flag_off, "(-" + p::stringify(*i) + ")");
+ if (env->query_use(*i, &p))
+ {
+ if (env->package_database()->fetch_repository(
+ dep->get<p::dle_repository>())->query_use_force(*i, &p))
+ cout << " " << colour(cl_flag_on, "(" + p::stringify(*i) + ")");
+ else
+ cout << " " << colour(cl_flag_on, *i);
+ }
else
- cout << " " << colour(cl_flag_off, "-" + p::stringify(*i));
+ {
+ if (env->package_database()->fetch_repository(
+ dep->get<p::dle_repository>())->query_use_mask(*i, &p))
+ cout << " " << colour(cl_flag_off, "(-" + p::stringify(*i) + ")");
+ else
+ cout << " " << colour(cl_flag_off, "-" + p::stringify(*i));
+ }
}
}
@@ -369,7 +377,7 @@ do_install()
p::PackageDatabaseEntryCollection::Pointer collision_list(env->package_database()->query(
p::PackageDepAtom::Pointer(new p::PackageDepAtom(
p::stringify(dep->get<p::dle_name>()) + ":" +
- p::stringify(dep->get<p::dle_metadata>()->get(p::vmk_slot)))),
+ p::stringify(dep->get<p::dle_metadata>()->get<p::vm_slot>()))),
p::is_installed_only));
// don't clean the thing we just installed
@@ -477,8 +485,7 @@ do_install()
{
std::string eapi_str(env->package_database()->fetch_repository(
pp->get<p::pde_repository>())->version_metadata(
- pp->get<p::pde_name>(), pp->get<p::pde_version>())->get(
- p::vmk_eapi));
+ pp->get<p::pde_name>(), pp->get<p::pde_version>())->get<p::vm_eapi>());
cerr << " ( " << colour(cl_red, eapi_str) << " )";
}
@@ -487,8 +494,8 @@ do_install()
cerr << " ";
std::string license_str(env->package_database()->fetch_repository(
pp->get<p::pde_repository>())->version_metadata(
- pp->get<p::pde_name>(), pp->get<p::pde_version>())->get(
- p::vmk_license));
+ pp->get<p::pde_name>(), pp->get<p::pde_version>())->get<
+ p::vm_license>());
LicenceDisplayer ld(cerr, env, &*pp);
p::DepParser::parse(license_str, p::DepParserPolicy<p::PlainTextDepAtom,
@@ -496,15 +503,20 @@ do_install()
}
else if (p::mr_keyword == mm)
{
- cerr << " ( " << colour(cl_red, p::join(
- env->package_database()->fetch_repository(
- pp->get<p::pde_repository>())->version_metadata(
- pp->get<p::pde_name>(), pp->get<p::pde_version>())->
- begin_keywords(),
- env->package_database()->fetch_repository(
- pp->get<p::pde_repository>())->version_metadata(
- pp->get<p::pde_name>(), pp->get<p::pde_version>())->
- end_keywords(), " ")) << " )";
+ p::VersionMetadata::ConstPointer m(env->package_database()->fetch_repository(
+ pp->get<p::pde_repository>())->version_metadata(
+ pp->get<p::pde_name>(), pp->get<p::pde_version>()));
+ if (m->get_ebuild_interface())
+ {
+ std::set<p::KeywordName> keywords;
+ p::WhitespaceTokeniser::get_instance()->tokenise(
+ m->get_ebuild_interface()->get<p::evm_keywords>(),
+ p::create_inserter<p::KeywordName>(
+ std::inserter(keywords, keywords.end())));
+
+ cerr << " ( " << colour(cl_red, p::join(keywords.begin(),
+ keywords.end(), " ")) << " )";
+ }
}
need_comma = true;
diff --git a/src/query.cc b/src/query.cc
index d555556..38688e0 100644
--- a/src/query.cc
+++ b/src/query.cc
@@ -110,7 +110,7 @@ void do_one_query(
if (CommandLine::get_instance()->a_show_slot.specified())
{
/* show the slot, if we're about to move onto a new slot */
- std::string slot_name(metadata->get(p::vmk_slot));
+ std::string slot_name(stringify(metadata->get<p::vm_slot>()));
if (old_slot.empty())
old_slot = slot_name;
else if (old_slot != slot_name)
@@ -176,84 +176,91 @@ void do_one_query(
if (CommandLine::get_instance()->a_show_metadata.specified())
{
- cout << " " << std::setw(22) << std::left << "DEPEND:" << std::setw(0) <<
- " " << metadata->get(p::vmk_depend) << endl;
cout << " " << std::setw(22) << std::left << "DESCRIPTION:" << std::setw(0) <<
- " " << metadata->get(p::vmk_description) << endl;
+ " " << metadata->get<p::vm_description>() << endl;
cout << " " << std::setw(22) << std::left << "HOMEPAGE:" << std::setw(0) <<
- " " << metadata->get(p::vmk_homepage) << endl;
- cout << " " << std::setw(22) << std::left << "IUSE:" << std::setw(0) <<
- " " << metadata->get(p::vmk_iuse) << endl;
- cout << " " << std::setw(22) << std::left << "KEYWORDS:" << std::setw(0) <<
- " " << metadata->get(p::vmk_keywords) << endl;
+ " " << metadata->get<p::vm_homepage>() << endl;
cout << " " << std::setw(22) << std::left << "LICENSE:" << std::setw(0) <<
- " " << metadata->get(p::vmk_license) << endl;
- cout << " " << std::setw(22) << std::left << "PDEPEND:" << std::setw(0) <<
- " " << metadata->get(p::vmk_pdepend) << endl;
- cout << " " << std::setw(22) << std::left << "PROVIDE:" << std::setw(0) <<
- " " << metadata->get(p::vmk_provide) << endl;
+ " " << metadata->get<p::vm_license>() << endl;
+
+ cout << " " << std::setw(22) << std::left << "DEPEND:" << std::setw(0) <<
+ " " << metadata->get<p::vm_deps>().get<p::vmd_build_depend_string>() << endl;
cout << " " << std::setw(22) << std::left << "RDEPEND:" << std::setw(0) <<
- " " << metadata->get(p::vmk_rdepend) << endl;
- cout << " " << std::setw(22) << std::left << "RESTRICT:" << std::setw(0) <<
- " " << metadata->get(p::vmk_restrict) << endl;
- cout << " " << std::setw(22) << std::left << "SRC_URI:" << std::setw(0) <<
- " " << metadata->get(p::vmk_src_uri) << endl;
- cout << " " << std::setw(22) << std::left << "VIRTUAL:" << std::setw(0) <<
- " " << metadata->get(p::vmk_virtual) << endl;
+ " " << metadata->get<p::vm_deps>().get<p::vmd_run_depend_string>() << endl;
+ cout << " " << std::setw(22) << std::left << "PDEPEND:" << std::setw(0) <<
+ " " << metadata->get<p::vm_deps>().get<p::vmd_post_depend_string>() << endl;
+
+ if (metadata->get_ebuild_interface())
+ {
+ cout << " " << std::setw(22) << std::left << "IUSE:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->get<p::evm_iuse>() << endl;
+ cout << " " << std::setw(22) << std::left << "KEYWORDS:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->get<p::evm_keywords>() << endl;
+ cout << " " << std::setw(22) << std::left << "PROVIDE:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->get<p::evm_provide>() << endl;
+ cout << " " << std::setw(22) << std::left << "RESTRICT:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->get<p::evm_restrict>() << endl;
+ cout << " " << std::setw(22) << std::left << "SRC_URI:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->get<p::evm_src_uri>() << endl;
+ cout << " " << std::setw(22) << std::left << "VIRTUAL:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->get<p::evm_virtual>() << endl;
+ }
}
else
{
- if (! metadata->get(p::vmk_homepage).empty())
+ if (! metadata->get<p::vm_homepage>().empty())
cout << " " << std::setw(22) << std::left << "Homepage:" << std::setw(0) <<
- " " << metadata->get(p::vmk_homepage) << endl;
+ " " << metadata->get<p::vm_homepage>() << endl;
- if (! metadata->get(p::vmk_description).empty())
+ if (! metadata->get<p::vm_description>().empty())
cout << " " << std::setw(22) << std::left << "Description:" << std::setw(0) <<
- " " << metadata->get(p::vmk_description) << endl;
+ " " << metadata->get<p::vm_description>() << endl;
- if (! metadata->get(p::vmk_license).empty())
+ if (! metadata->get<p::vm_license>().empty())
{
cout << " " << std::setw(22) << std::left << "License:" << std::setw(0) << " ";
LicenceDisplayer d(cout, env, &display_entry);
- p::DepParser::parse(metadata->get(p::vmk_license),
+ p::DepParser::parse(metadata->get<p::vm_license>(),
p::DepParserPolicy<p::PlainTextDepAtom, true>::get_instance())->accept(&d);
cout << endl;
}
if (CommandLine::get_instance()->a_show_deps.specified())
{
- if (! metadata->get(p::vmk_depend).empty())
+ if (! metadata->get<p::vm_deps>().get<p::vmd_build_depend_string>().empty())
{
p::DepAtomPrettyPrinter p_depend(12);
- p::DepParser::parse(metadata->get(p::vmk_depend))->accept(&p_depend);
+ metadata->get<p::vm_deps>().build_depend()->accept(&p_depend);
cout << " " << std::setw(22) << std::left << "Build dependencies:" << std::setw(0)
<< endl << p_depend;
}
- if (! metadata->get(p::vmk_rdepend).empty())
+ if (! metadata->get<p::vm_deps>().get<p::vmd_run_depend_string>().empty())
{
- p::DepAtomPrettyPrinter p_rdepend(12);
- p::DepParser::parse(metadata->get(p::vmk_rdepend))->accept(&p_rdepend);
+ p::DepAtomPrettyPrinter p_depend(12);
+ metadata->get<p::vm_deps>().run_depend()->accept(&p_depend);
cout << " " << std::setw(22) << std::left << "Runtime dependencies:" << std::setw(0)
- << endl << p_rdepend;
+ << endl << p_depend;
}
- if (! metadata->get(p::vmk_pdepend).empty())
+ if (! metadata->get<p::vm_deps>().get<p::vmd_post_depend_string>().empty())
{
- p::DepAtomPrettyPrinter p_pdepend(12);
- p::DepParser::parse(metadata->get(p::vmk_pdepend))->accept(&p_pdepend);
+ p::DepAtomPrettyPrinter p_depend(12);
+ metadata->get<p::vm_deps>().post_depend()->accept(&p_depend);
cout << " " << std::setw(22) << std::left << "Post dependencies:" << std::setw(0)
- << endl << p_pdepend;
+ << endl << p_depend;
}
}
- if (! metadata->get(p::vmk_virtual).empty())
+ if (metadata->get_ebuild_interface() && ! metadata->get_ebuild_interface()->
+ get<p::evm_virtual>().empty())
cout << " " << std::setw(22) << std::left << "Virtual for:" << std::setw(0) <<
- " " << metadata->get(p::vmk_virtual) << endl;
+ " " << metadata->get_ebuild_interface()->get<p::evm_virtual>() << endl;
- if (! metadata->get(p::vmk_provide).empty())
+ if (metadata->get_ebuild_interface() && ! metadata->get_ebuild_interface()->
+ get<p::evm_provide>().empty())
cout << " " << std::setw(22) << std::left << "Provides:" << std::setw(0) <<
- " " << metadata->get(p::vmk_provide) << endl;
+ " " << metadata->get_ebuild_interface()->get<p::evm_provide>() << endl;
}