aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-14 10:37:31 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-14 10:37:31 +0000
commit1cecfdf31951b271b397b466fdbeba61761b3c53 (patch)
treeb3c8315863b0e28cf192d908f9cadb9a2e1e41a2
parent49c8bd17fb38533c5ac533fb6d47c9343e1f8ed0 (diff)
downloadpaludis-1cecfdf31951b271b397b466fdbeba61761b3c53.tar.gz
paludis-1cecfdf31951b271b397b466fdbeba61761b3c53.tar.xz
Move DepParser, DepLexer -> PortageDepParser, PortageDepLexer, abstract out remaining parser calls into VersionMetadata
-rw-r--r--paludis/dep_list.cc19
-rw-r--r--paludis/dep_list_TEST.cc22
-rw-r--r--paludis/ebuild.cc4
-rw-r--r--paludis/environment.cc4
-rw-r--r--paludis/fake_repository.cc4
-rw-r--r--paludis/files.m44
-rw-r--r--paludis/portage_dep_lexer.cc (renamed from paludis/dep_lexer.cc)4
-rw-r--r--paludis/portage_dep_lexer.hh (renamed from paludis/dep_lexer.hh)18
-rw-r--r--paludis/portage_dep_lexer_TEST.cc (renamed from paludis/dep_lexer_TEST.cc)74
-rw-r--r--paludis/portage_dep_parser.cc (renamed from paludis/dep_parser.cc)18
-rw-r--r--paludis/portage_dep_parser.hh (renamed from paludis/dep_parser.hh)52
-rw-r--r--paludis/portage_dep_parser_TEST.cc (renamed from paludis/dep_parser_TEST.cc)108
-rw-r--r--paludis/portage_repository.cc16
-rw-r--r--paludis/vdb_repository.cc10
-rw-r--r--paludis/version_metadata.cc42
-rw-r--r--paludis/version_metadata.hh12
-rw-r--r--src/install.cc12
-rw-r--r--src/query.cc3
18 files changed, 220 insertions, 206 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 138e563..c6aeb08 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -20,7 +20,6 @@
#include <paludis/dep_atom.hh>
#include <paludis/dep_atom_flattener.hh>
#include <paludis/dep_list.hh>
-#include <paludis/dep_parser.hh>
#include <paludis/match_package.hh>
#include <paludis/util/container_entry.hh>
#include <paludis/util/iterator.hh>
@@ -433,13 +432,9 @@ DepList::visit(const PackageDepAtom * const p)
}
/* if we provide things, also insert them. */
- 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])
+ if ((metadata->get_ebuild_interface()) && ! merge_entry->get<dle_flags>()[dlef_skip])
{
- DepAtom::ConstPointer provide(DepParser::parse(provide_str,
- DepParserPolicy<PackageDepAtom, false>::get_instance()));
+ DepAtom::ConstPointer provide(metadata->get_ebuild_interface()->provide());
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
@@ -461,7 +456,7 @@ DepList::visit(const PackageDepAtom * const p)
continue;
VersionMetadata::Pointer p_metadata(new VersionMetadata::Ebuild(
- &DepParser::parse_depend));
+ merge_entry->get<dle_metadata>()->get<vm_deps>().get<vmd_parser>()));
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>()));
@@ -662,9 +657,7 @@ DepList::visit(const BlockDepAtom * const d)
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());
+ provide = _imp->current_package->get<dle_metadata>()->get_ebuild_interface()->provide();
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
@@ -719,9 +712,7 @@ DepList::visit(const BlockDepAtom * const d)
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());
+ provide = _imp->current_package->get<dle_metadata>()->get_ebuild_interface()->provide();
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
diff --git a/paludis/dep_list_TEST.cc b/paludis/dep_list_TEST.cc
index eec21de..3869739 100644
--- a/paludis/dep_list_TEST.cc
+++ b/paludis/dep_list_TEST.cc
@@ -74,7 +74,7 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env);
- d.add(DepParser::parse(merge_target));
+ d.add(PortageDepParser::parse(merge_target));
TEST_CHECK(true);
unsigned n(0);
@@ -991,7 +991,7 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env);
- TEST_CHECK_THROWS(d.add(DepParser::parse(merge_target)), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target)), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_39;
@@ -1019,7 +1019,7 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env);
- TEST_CHECK_THROWS(d.add(DepParser::parse(merge_target)), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target)), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_40;
@@ -1176,7 +1176,7 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env);
- TEST_CHECK_THROWS(d.add(DepParser::parse(merge_target)), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target)), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_47;
@@ -1203,7 +1203,7 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env);
- TEST_CHECK_THROWS(d.add(DepParser::parse(merge_target)), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target)), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_48;
@@ -1272,7 +1272,7 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env);
- TEST_CHECK_THROWS(d.add(DepParser::parse(merge_target)), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target)), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_51;
@@ -1299,7 +1299,7 @@ namespace test_cases
{
TEST_CHECK(true);
DepList d(&env);
- TEST_CHECK_THROWS(d.add(DepParser::parse(merge_target)), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse(merge_target)), DepListError);
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_52;
@@ -1328,11 +1328,11 @@ namespace test_cases
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"));
+ d.add(PortageDepParser::parse("cat/one"));
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(DepParser::parse("cat/five")), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse("cat/five")), 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");
@@ -1363,11 +1363,11 @@ namespace test_cases
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"));
+ d.add(PortageDepParser::parse("cat/one"));
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(DepParser::parse("cat/five")), DepListError);
+ TEST_CHECK_THROWS(d.add(PortageDepParser::parse("cat/five")), 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");
diff --git a/paludis/ebuild.cc b/paludis/ebuild.cc
index 3ddc800..3655c80 100644
--- a/paludis/ebuild.cc
+++ b/paludis/ebuild.cc
@@ -23,7 +23,7 @@
#include <paludis/util/log.hh>
#include <paludis/environment.hh>
#include <paludis/config_file.hh>
-#include <paludis/dep_parser.hh>
+#include <paludis/portage_dep_parser.hh>
/** \file
* Implementation for ebuild.hh things.
@@ -138,7 +138,7 @@ EbuildMetadataCommand::do_run_command(const std::string & cmd)
{
PStream prog(cmd);
KeyValueConfigFile f(&prog);
- _metadata.assign(new VersionMetadata::Ebuild(DepParser::parse_depend));
+ _metadata.assign(new VersionMetadata::Ebuild(PortageDepParser::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"));
diff --git a/paludis/environment.cc b/paludis/environment.cc
index 6a151a8..9a16e8b 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -19,7 +19,6 @@
#include <paludis/package_database.hh>
#include <paludis/dep_atom.hh>
-#include <paludis/dep_parser.hh>
#include <paludis/environment.hh>
#include <paludis/util/log.hh>
#include <paludis/util/save.hh>
@@ -170,8 +169,7 @@ Environment::mask_reasons(const PackageDatabaseEntry & e) const
}
LicenceChecker lc(this, &e);
- DepParser::parse(metadata->get<vm_license>(),
- DepParserPolicy<PlainTextDepAtom, true>::get_instance())->accept(&lc);
+ metadata->license()->accept(&lc);
if (! lc.ok)
result.set(mr_license);
diff --git a/paludis/fake_repository.cc b/paludis/fake_repository.cc
index 32f4bcc..b862fa0 100644
--- a/paludis/fake_repository.cc
+++ b/paludis/fake_repository.cc
@@ -21,7 +21,7 @@
#include <paludis/fake_repository.hh>
#include <paludis/util/stringify.hh>
#include <paludis/version_metadata.hh>
-#include <paludis/dep_parser.hh>
+#include <paludis/portage_dep_parser.hh>
/** \file
* Implementation for FakeRepository.
@@ -157,7 +157,7 @@ FakeRepository::add_version(const CategoryNamePart & c, const PackageNamePart &
_imp->versions.find(QualifiedPackageName(c, p))->second->insert(v);
_imp->metadata.insert(
std::make_pair(stringify(c) + "/" + stringify(p) + "-" + stringify(v),
- VersionMetadata::Pointer(new VersionMetadata::Ebuild(DepParser::parse_depend))));
+ VersionMetadata::Pointer(new VersionMetadata::Ebuild(PortageDepParser::parse_depend))));
VersionMetadata::Pointer r(_imp->metadata.find(stringify(c) +
"/" + stringify(p) + "-" + stringify(v))->second);
r->set<vm_slot>(SlotName("0"));
diff --git a/paludis/files.m4 b/paludis/files.m4
index 7dfd788..883def2 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -17,9 +17,7 @@ add(`dep_atom', `hh', `cc', `test')
add(`dep_atom_dumper', `hh', `cc', `test')
add(`dep_atom_flattener', `hh', `cc')
add(`dep_atom_pretty_printer', `hh', `cc')
-add(`dep_lexer', `hh', `cc', `test')
add(`dep_list', `hh', `cc', `test')
-add(`dep_parser', `hh', `cc', `test')
add(`dep_tag', `hh', `cc')
add(`ebuild', `hh', `cc')
add(`environment', `hh', `cc')
@@ -32,6 +30,8 @@ add(`package_database', `hh', `cc', `test')
add(`package_database_entry', `hh')
add(`paludis', `hh', `cc')
add(`portage_repository', `hh', `cc', `test', `testscript')
+add(`portage_dep_lexer', `hh', `cc', `test')
+add(`portage_dep_parser', `hh', `cc', `test')
add(`repository', `hh', `cc')
add(`syncer', `hh', `cc')
add(`test_environment', `hh', `cc')
diff --git a/paludis/dep_lexer.cc b/paludis/portage_dep_lexer.cc
index 2e14ad1..4327498 100644
--- a/paludis/dep_lexer.cc
+++ b/paludis/portage_dep_lexer.cc
@@ -18,7 +18,7 @@
*/
#include <paludis/dep_atom.hh>
-#include <paludis/dep_lexer.hh>
+#include <paludis/portage_dep_lexer.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/tokeniser.hh>
#include <vector>
@@ -42,7 +42,7 @@ DepStringError::DepStringError(const std::string & d, const std::string & m) thr
{
}
-DepLexer::DepLexer(const std::string & s)
+PortageDepLexer::PortageDepLexer(const std::string & s)
{
Context context("When lexing dependency string '" + s + "':");
diff --git a/paludis/dep_lexer.hh b/paludis/portage_dep_lexer.hh
index 092a3f9..9c56425 100644
--- a/paludis/dep_lexer.hh
+++ b/paludis/portage_dep_lexer.hh
@@ -26,7 +26,7 @@
#include <string>
/** \file
- * Declarations for the DepLexer class.
+ * Declarations for the PortageDepLexer class.
*
* \ingroup grpdeplexer
*/
@@ -68,13 +68,13 @@ namespace paludis
};
/**
- * Lexemes used by DepLexer.
+ * Lexemes used by PortageDepLexer.
*
- * \see DepLexer
+ * \see PortageDepLexer
*
* \ingroup grpdeplexer
*/
- enum DepLexerLexeme
+ enum PortageDepLexerLexeme
{
dpl_whitespace, ///< whitespace
dpl_text, ///< a package or item name
@@ -92,17 +92,17 @@ namespace paludis
*
* \ingroup grpdeplexer
*/
- class DepLexer :
- private InstantiationPolicy<DepLexer, instantiation_method::NonCopyableTag>
+ class PortageDepLexer :
+ private InstantiationPolicy<PortageDepLexer, instantiation_method::NonCopyableTag>
{
private:
- std::list<std::pair<DepLexerLexeme, std::string> > _tokens;
+ std::list<std::pair<PortageDepLexerLexeme, std::string> > _tokens;
public:
/**
* Iterator for our tokens.
*/
- typedef std::list<std::pair<DepLexerLexeme, std::string> >::const_iterator Iterator;
+ typedef std::list<std::pair<PortageDepLexerLexeme, std::string> >::const_iterator Iterator;
/**
* Iterator to the start of our tokens.
@@ -123,7 +123,7 @@ namespace paludis
/**
* Constructor.
*/
- DepLexer(const std::string &);
+ PortageDepLexer(const std::string &);
};
}
diff --git a/paludis/dep_lexer_TEST.cc b/paludis/portage_dep_lexer_TEST.cc
index 5361e84..1664126 100644
--- a/paludis/dep_lexer_TEST.cc
+++ b/paludis/portage_dep_lexer_TEST.cc
@@ -17,7 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/dep_lexer.hh>
+#include <paludis/portage_dep_lexer.hh>
#include <sstream>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -26,7 +26,7 @@ using namespace test;
using namespace paludis;
/** \file
- * Test cases for DepLexer.
+ * Test cases for PortageDepLexer.
*
* \ingroup grptestcases
*/
@@ -34,35 +34,35 @@ using namespace paludis;
namespace test_cases
{
/**
- * \test Test DepLexer with an empty input.
+ * \test Test PortageDepLexer with an empty input.
*
* \ingroup grptestcases
*/
- struct DepLexerEmptyTest : TestCase
+ struct PortageDepLexerEmptyTest : TestCase
{
- DepLexerEmptyTest() : TestCase("empty") { }
+ PortageDepLexerEmptyTest() : TestCase("empty") { }
void run()
{
- DepLexer l("");
- DepLexer::Iterator i(l.begin());
+ PortageDepLexer l("");
+ PortageDepLexer::Iterator i(l.begin());
TEST_CHECK(i == l.end());
}
} test_dep_atom_parser_lexer_empty;
/**
- * \test Test DepLexer with a blank input.
+ * \test Test PortageDepLexer with a blank input.
*
* \ingroup grptestcases
*/
- struct DepLexerBlankTest : TestCase
+ struct PortageDepLexerBlankTest : TestCase
{
- DepLexerBlankTest() : TestCase("blank") { }
+ PortageDepLexerBlankTest() : TestCase("blank") { }
void run()
{
- DepLexer l(" \n \t");
- DepLexer::Iterator i(l.begin());
+ PortageDepLexer l(" \n \t");
+ PortageDepLexer::Iterator i(l.begin());
TEST_CHECK(i != l.end());
TEST_CHECK_EQUAL(i->first, dpl_whitespace);
TEST_CHECK_EQUAL(i->second, " \n \t");
@@ -71,18 +71,18 @@ namespace test_cases
} test_dep_atom_parser_lexer_blank;
/**
- * \test Test DepLexer with a package.
+ * \test Test PortageDepLexer with a package.
*
* \ingroup grptestcases
*/
- struct DepLexerPackageTest : TestCase
+ struct PortageDepLexerPackageTest : TestCase
{
- DepLexerPackageTest() : TestCase("package") { }
+ PortageDepLexerPackageTest() : TestCase("package") { }
void run()
{
- DepLexer l("app-editors/vim");
- DepLexer::Iterator i(l.begin());
+ PortageDepLexer l("app-editors/vim");
+ PortageDepLexer::Iterator i(l.begin());
TEST_CHECK(i != l.end());
TEST_CHECK_EQUAL(i->first, dpl_text);
TEST_CHECK_EQUAL(i->second, "app-editors/vim");
@@ -95,14 +95,14 @@ namespace test_cases
*
* \ingroup grptestcases
*/
- struct DepLexerPackagesTest : TestCase
+ struct PortageDepLexerPackagesTest : TestCase
{
- DepLexerPackagesTest() : TestCase("packages") { }
+ PortageDepLexerPackagesTest() : TestCase("packages") { }
void run()
{
- DepLexer l("app-editors/vim app-misc/hilite \nsys-apps/findutils");
- DepLexer::Iterator i(l.begin());
+ PortageDepLexer l("app-editors/vim app-misc/hilite \nsys-apps/findutils");
+ PortageDepLexer::Iterator i(l.begin());
TEST_CHECK(i != l.end());
TEST_CHECK_EQUAL(i->first, dpl_text);
@@ -129,18 +129,18 @@ namespace test_cases
} test_dep_atom_parser_lexer_packages;
/**
- * \test Test DepLexer with an any group.
+ * \test Test PortageDepLexer with an any group.
*
* \ingroup grptestcases
*/
- struct DepLexerAnyTest : TestCase
+ struct PortageDepLexerAnyTest : TestCase
{
- DepLexerAnyTest() : TestCase("any") { }
+ PortageDepLexerAnyTest() : TestCase("any") { }
void run()
{
- DepLexer l("|| ( one/one two/two )");
- DepLexer::Iterator i(l.begin());
+ PortageDepLexer l("|| ( one/one two/two )");
+ PortageDepLexer::Iterator i(l.begin());
TEST_CHECK(i != l.end());
TEST_CHECK_EQUAL(i->first, dpl_double_bar);
@@ -183,18 +183,18 @@ namespace test_cases
} test_dep_atom_parser_lexer_any;
/**
- * \test Test DepLexer with a use group.
+ * \test Test PortageDepLexer with a use group.
*
* \ingroup grptestcases
*/
- struct DepLexerUseTest : TestCase
+ struct PortageDepLexerUseTest : TestCase
{
- DepLexerUseTest() : TestCase("use") { }
+ PortageDepLexerUseTest() : TestCase("use") { }
void run()
{
- DepLexer l("foo? ( one/one )");
- DepLexer::Iterator i(l.begin());
+ PortageDepLexer l("foo? ( one/one )");
+ PortageDepLexer::Iterator i(l.begin());
TEST_CHECK(i != l.end());
TEST_CHECK_EQUAL(i->first, dpl_use_flag);
@@ -229,19 +229,19 @@ namespace test_cases
} test_dep_atom_parser_lexer_use;
/**
- * \test Test DepLexer with bad input.
+ * \test Test PortageDepLexer with bad input.
*
* \ingroup grptestcases
*/
- struct DepLexerBadTest : TestCase
+ struct PortageDepLexerBadTest : TestCase
{
- DepLexerBadTest() : TestCase("bad") { }
+ PortageDepLexerBadTest() : TestCase("bad") { }
void run()
{
- TEST_CHECK_THROWS(DepLexer("(moo)"), DepStringError);
- TEST_CHECK_THROWS(DepLexer("|foo"), DepStringError);
- TEST_CHECK_THROWS(DepLexer("( moo )bar"), DepStringError);
+ TEST_CHECK_THROWS(PortageDepLexer("(moo)"), DepStringError);
+ TEST_CHECK_THROWS(PortageDepLexer("|foo"), DepStringError);
+ TEST_CHECK_THROWS(PortageDepLexer("( moo )bar"), DepStringError);
}
} test_dep_atom_parser_lexer_bad;
diff --git a/paludis/dep_parser.cc b/paludis/portage_dep_parser.cc
index 23c66c6..d091e61 100644
--- a/paludis/dep_parser.cc
+++ b/paludis/portage_dep_parser.cc
@@ -18,8 +18,8 @@
*/
#include <paludis/dep_atom.hh>
-#include <paludis/dep_lexer.hh>
-#include <paludis/dep_parser.hh>
+#include <paludis/portage_dep_lexer.hh>
+#include <paludis/portage_dep_parser.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <stack>
@@ -50,7 +50,7 @@ namespace
*
* \ingroup grpdepparser
*/
- enum DepParserState
+ enum PortageDepParserState
{
dps_initial,
dps_had_double_bar,
@@ -62,16 +62,16 @@ namespace
}
CompositeDepAtom::Pointer
-DepParser::parse(const std::string & s, const DepParserPolicyInterface * const policy)
+PortageDepParser::parse(const std::string & s, const PortageDepParserPolicyInterface * const policy)
{
Context context("When parsing dependency string '" + s + "':");
std::stack<CompositeDepAtom::Pointer> stack;
stack.push(CompositeDepAtom::Pointer(new AllDepAtom));
- DepParserState state(dps_initial);
- DepLexer lexer(s);
- DepLexer::Iterator i(lexer.begin()), i_end(lexer.end());
+ PortageDepParserState state(dps_initial);
+ PortageDepLexer lexer(s);
+ PortageDepLexer::Iterator i(lexer.begin()), i_end(lexer.end());
for ( ; i != i_end ; ++i)
{
@@ -280,7 +280,7 @@ DepParser::parse(const std::string & s, const DepParserPolicyInterface * const p
}
DepAtom::ConstPointer
-DepParser::parse_depend(const std::string & s)
+PortageDepParser::parse_depend(const std::string & s)
{
- return DepParser::parse(s);
+ return PortageDepParser::parse(s);
}
diff --git a/paludis/dep_parser.hh b/paludis/portage_dep_parser.hh
index 51835c4..f3f1d01 100644
--- a/paludis/dep_parser.hh
+++ b/paludis/portage_dep_parser.hh
@@ -21,14 +21,14 @@
#define PALUDIS_GUARD_PALUDIS_DEP_PARSER_HH 1
#include <paludis/dep_atom.hh>
-#include <paludis/dep_lexer.hh>
+#include <paludis/portage_dep_lexer.hh>
#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/instantiation_policy.hh>
#include <string>
/** \file
- * Declarations for the DepParser class.
+ * Declarations for the PortageDepParser class.
*
* \ingroup grpdepparser
*/
@@ -69,13 +69,13 @@ namespace paludis
};
/**
- * Interface provided by DepParserPolicy classes.
+ * Interface provided by PortageDepParserPolicy classes.
*
- * \see DepParserPolicy
+ * \see PortageDepParserPolicy
*
* \ingroup grpdepparser
*/
- struct DepParserPolicyInterface
+ struct PortageDepParserPolicyInterface
{
/**
* Create a new text atom from the provided string.
@@ -90,29 +90,29 @@ namespace paludis
/**
* Destructor.
*/
- virtual ~DepParserPolicyInterface()
+ virtual ~PortageDepParserPolicyInterface()
{
}
};
/**
- * Policy class describing how DepParser::parse should behave.
+ * Policy class describing how PortageDepParser::parse should behave.
*
- * \see DepParser
+ * \see PortageDepParser
*
* \ingroup grpdepparser
*/
template <typename TextAtom_, bool permit_any_>
- class DepParserPolicy :
- public DepParserPolicyInterface,
- public InstantiationPolicy<DepParserPolicy<TextAtom_, permit_any_>,
+ class PortageDepParserPolicy :
+ public PortageDepParserPolicyInterface,
+ public InstantiationPolicy<PortageDepParserPolicy<TextAtom_, permit_any_>,
instantiation_method::SingletonAsNeededTag>
{
- friend class InstantiationPolicy<DepParserPolicy<TextAtom_, permit_any_>,
+ friend class InstantiationPolicy<PortageDepParserPolicy<TextAtom_, permit_any_>,
instantiation_method::SingletonAsNeededTag>;
private:
- DepParserPolicy()
+ PortageDepParserPolicy()
{
}
@@ -129,24 +129,24 @@ namespace paludis
};
/**
- * Policy class describing how DepParser::parse should behave
+ * Policy class describing how PortageDepParser::parse should behave
* (specialisation for PackageDepAtom).
*
- * \see DepParser
+ * \see PortageDepParser
*
* \ingroup grpdepparser
*/
template <bool permit_any_>
- class DepParserPolicy<PackageDepAtom, permit_any_> :
- public DepParserPolicyInterface,
- public InstantiationPolicy<DepParserPolicy<PackageDepAtom, permit_any_>,
+ class PortageDepParserPolicy<PackageDepAtom, permit_any_> :
+ public PortageDepParserPolicyInterface,
+ public InstantiationPolicy<PortageDepParserPolicy<PackageDepAtom, permit_any_>,
instantiation_method::SingletonAsNeededTag>
{
- friend class InstantiationPolicy<DepParserPolicy<PackageDepAtom, permit_any_>,
+ friend class InstantiationPolicy<PortageDepParserPolicy<PackageDepAtom, permit_any_>,
instantiation_method::SingletonAsNeededTag>;
private:
- DepParserPolicy()
+ PortageDepParserPolicy()
{
}
@@ -167,17 +167,17 @@ namespace paludis
};
/**
- * The DepParser converts string representations of a dependency
- * specification into a DepAtom instance. The DepLexer class is
+ * The PortageDepParser converts string representations of a dependency
+ * specification into a DepAtom instance. The PortageDepLexer class is
* used as the first stage.
*
* \ingroup grpdepparser
*/
- class DepParser :
- private InstantiationPolicy<DepParser, instantiation_method::NonInstantiableTag>
+ class PortageDepParser :
+ private InstantiationPolicy<PortageDepParser, instantiation_method::NonInstantiableTag>
{
private:
- typedef DepParserPolicy<PackageDepAtom, true> DefaultPolicy;
+ typedef PortageDepParserPolicy<PackageDepAtom, true> DefaultPolicy;
public:
/**
@@ -185,7 +185,7 @@ namespace paludis
* DepAtom tree.
*/
static CompositeDepAtom::Pointer parse(const std::string & s,
- const DepParserPolicyInterface * const policy = DefaultPolicy::get_instance());
+ const PortageDepParserPolicyInterface * const policy = DefaultPolicy::get_instance());
/**
* Convenience wrapper for parse for depend strings, for VersionMetadata.
diff --git a/paludis/dep_parser_TEST.cc b/paludis/portage_dep_parser_TEST.cc
index a88e0c4..0047aca 100644
--- a/paludis/dep_parser_TEST.cc
+++ b/paludis/portage_dep_parser_TEST.cc
@@ -26,7 +26,7 @@ using namespace test;
using namespace paludis;
/** \file
- * Test cases for DepParser.
+ * Test cases for PortageDepParser.
*
* \ingroup grptestcases
*/
@@ -34,223 +34,223 @@ using namespace paludis;
namespace test_cases
{
/**
- * \test Test DepParser with an empty input.
+ * \test Test PortageDepParser with an empty input.
*
* \ingroup grptestcases
*/
- struct DepParserEmptyTest : TestCase
+ struct PortageDepParserEmptyTest : TestCase
{
- DepParserEmptyTest() : TestCase("empty") { }
+ PortageDepParserEmptyTest() : TestCase("empty") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- DepParser::parse("")->accept(&d);
+ PortageDepParser::parse("")->accept(&d);
TEST_CHECK_EQUAL(s.str(), "<all></all>");
}
} test_dep_atom_parser_empty;
/**
- * \test Test DepParser with a blank input.
+ * \test Test PortageDepParser with a blank input.
*
* \ingroup grptestcases
*/
- struct DepParserBlankTest : TestCase
+ struct PortageDepParserBlankTest : TestCase
{
- DepParserBlankTest() : TestCase("blank") { }
+ PortageDepParserBlankTest() : TestCase("blank") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- DepParser::parse(" \n \t")->accept(&d);
+ PortageDepParser::parse(" \n \t")->accept(&d);
TEST_CHECK_EQUAL(s.str(), "<all></all>");
}
} test_dep_atom_parser_blank;
/**
- * \test Test DepParser with a package.
+ * \test Test PortageDepParser with a package.
*
* \ingroup grptestcases
*/
- struct DepParserPackageTest : TestCase
+ struct PortageDepParserPackageTest : TestCase
{
- DepParserPackageTest() : TestCase("package") { }
+ PortageDepParserPackageTest() : TestCase("package") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- DepParser::parse("app-editors/vim")->accept(&d);
+ PortageDepParser::parse("app-editors/vim")->accept(&d);
TEST_CHECK_EQUAL(s.str(), "<all><package>app-editors/vim</package></all>");
}
} test_dep_atom_parser_package;
/**
- * \test Test DepParser with a decorated package.
+ * \test Test PortageDepParser with a decorated package.
*
* \ingroup grptestcases
*/
- struct DepParserDecoratedPackageTest : TestCase
+ struct PortageDepParserDecoratedPackageTest : TestCase
{
- DepParserDecoratedPackageTest() : TestCase("decorated package") { }
+ PortageDepParserDecoratedPackageTest() : TestCase("decorated package") { }
void run()
{
std::stringstream s1;
DepAtomDumper d1(&s1);
- DepParser::parse(">=app-editors/vim-6.4_alpha")->accept(&d1);
+ PortageDepParser::parse(">=app-editors/vim-6.4_alpha")->accept(&d1);
TEST_CHECK_EQUAL(s1.str(), "<all><package version=\">=6.4_alpha\">"
"app-editors/vim</package></all>");
std::stringstream s2;
DepAtomDumper d2(&s2);
- DepParser::parse("=app-editors/vim-6.4_alpha-r1")->accept(&d2);
+ PortageDepParser::parse("=app-editors/vim-6.4_alpha-r1")->accept(&d2);
TEST_CHECK_EQUAL(s2.str(), "<all><package version=\"=6.4_alpha-r1\">"
"app-editors/vim</package></all>");
std::stringstream s3;
DepAtomDumper d3(&s3);
- DepParser::parse(">=app-editors/vim-6.4_alpha:one")->accept(&d3);
+ PortageDepParser::parse(">=app-editors/vim-6.4_alpha:one")->accept(&d3);
TEST_CHECK_EQUAL(s3.str(), "<all><package slot=\"one\" version=\">=6.4_alpha\">"
"app-editors/vim</package></all>");
}
} test_dep_atom_parser_decorated_package;
/**
- * \test Test DepParser with a sequence of packages.
+ * \test Test PortageDepParser with a sequence of packages.
*
* \ingroup grptestcases
*/
- struct DepParserPackagesTest : TestCase
+ struct PortageDepParserPackagesTest : TestCase
{
- DepParserPackagesTest() : TestCase("packages") { }
+ PortageDepParserPackagesTest() : TestCase("packages") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- DepParser::parse("app-editors/vim app-misc/hilite \nsys-apps/findutils")->accept(&d);
+ PortageDepParser::parse("app-editors/vim app-misc/hilite \nsys-apps/findutils")->accept(&d);
TEST_CHECK_EQUAL(s.str(), "<all><package>app-editors/vim</package>"
"<package>app-misc/hilite</package><package>sys-apps/findutils</package></all>");
}
} test_dep_atom_parser_packages;
/**
- * \test Test DepParser with an any group.
+ * \test Test PortageDepParser with an any group.
*
* \ingroup grptestcases
*/
- struct DepParserAnyTest : TestCase
+ struct PortageDepParserAnyTest : TestCase
{
- DepParserAnyTest() : TestCase("any") { }
+ PortageDepParserAnyTest() : TestCase("any") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- DepParser::parse("|| ( one/one two/two )")->accept(&d);
+ PortageDepParser::parse("|| ( one/one two/two )")->accept(&d);
TEST_CHECK_EQUAL(s.str(), "<all><any><package>one/one</package>"
"<package>two/two</package></any></all>");
}
} test_dep_atom_parser_any;
/**
- * \test Test DepParser with an all group.
+ * \test Test PortageDepParser with an all group.
*
* \ingroup grptestcases
*/
- struct DepParserAllTest : TestCase
+ struct PortageDepParserAllTest : TestCase
{
- DepParserAllTest() : TestCase("all") { }
+ PortageDepParserAllTest() : TestCase("all") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- DepParser::parse(" ( one/one two/two ) ")->accept(&d);
+ PortageDepParser::parse(" ( one/one two/two ) ")->accept(&d);
TEST_CHECK_EQUAL(s.str(), "<all><all><package>one/one</package>"
"<package>two/two</package></all></all>");
}
} test_dep_atom_parser_all;
/**
- * \test Test DepParser with a use group.
+ * \test Test PortageDepParser with a use group.
*
* \ingroup grptestcases
*/
- struct DepParserUseTest : TestCase
+ struct PortageDepParserUseTest : TestCase
{
- DepParserUseTest() : TestCase("use") { }
+ PortageDepParserUseTest() : TestCase("use") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- DepParser::parse("foo? ( one/one )")->accept(&d);
+ PortageDepParser::parse("foo? ( one/one )")->accept(&d);
TEST_CHECK_EQUAL(s.str(), "<all><use flag=\"foo\" inverse=\"false\"><package>one/one</package>"
"</use></all>");
}
} test_dep_atom_parser_use;
/**
- * \test Test DepParser with an inverse use group.
+ * \test Test PortageDepParser with an inverse use group.
*
* \ingroup grptestcases
*/
- struct DepParserInvUseTest : TestCase
+ struct PortageDepParserInvUseTest : TestCase
{
- DepParserInvUseTest() : TestCase("!use") { }
+ PortageDepParserInvUseTest() : TestCase("!use") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- DepParser::parse("!foo? ( one/one )")->accept(&d);
+ PortageDepParser::parse("!foo? ( one/one )")->accept(&d);
TEST_CHECK_EQUAL(s.str(), "<all><use flag=\"foo\" inverse=\"true\"><package>one/one</package>"
"</use></all>");
}
} test_dep_atom_parser_inv_use;
/**
- * \test Test DepParser nesting errors.
+ * \test Test PortageDepParser nesting errors.
*
* \ingroup grptestcases
*/
- struct DepParserBadNestingTest : TestCase
+ struct PortageDepParserBadNestingTest : TestCase
{
- DepParserBadNestingTest() : TestCase("bad nesting") { }
+ PortageDepParserBadNestingTest() : TestCase("bad nesting") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- TEST_CHECK_THROWS(DepParser::parse("!foo? ( one/one")->accept(&d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse("!foo? ( one/one ) )")->accept(&d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse("( ( ( ) )")->accept(&d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse("( ( ( ) ) ) )")->accept(&d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse(")")->accept(&d), DepStringError);
+ TEST_CHECK_THROWS(PortageDepParser::parse("!foo? ( one/one")->accept(&d), DepStringError);
+ TEST_CHECK_THROWS(PortageDepParser::parse("!foo? ( one/one ) )")->accept(&d), DepStringError);
+ TEST_CHECK_THROWS(PortageDepParser::parse("( ( ( ) )")->accept(&d), DepStringError);
+ TEST_CHECK_THROWS(PortageDepParser::parse("( ( ( ) ) ) )")->accept(&d), DepStringError);
+ TEST_CHECK_THROWS(PortageDepParser::parse(")")->accept(&d), DepStringError);
}
} test_dep_atom_parser_bad_nesting;
/**
- * \test Test DepParser weird errors.
+ * \test Test PortageDepParser weird errors.
*
* \ingroup grptestcases
*/
- struct DepParserBadValuesTest : TestCase
+ struct PortageDepParserBadValuesTest : TestCase
{
- DepParserBadValuesTest() : TestCase("bad values") { }
+ PortageDepParserBadValuesTest() : TestCase("bad values") { }
void run()
{
std::stringstream s;
DepAtomDumper d(&s);
- TEST_CHECK_THROWS(DepParser::parse("!foo? ||")->accept(&d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse("(((")->accept(&d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse(")")->accept(&d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse("(foo/bar)")->accept(&d), DepStringError);
+ TEST_CHECK_THROWS(PortageDepParser::parse("!foo? ||")->accept(&d), DepStringError);
+ TEST_CHECK_THROWS(PortageDepParser::parse("(((")->accept(&d), DepStringError);
+ TEST_CHECK_THROWS(PortageDepParser::parse(")")->accept(&d), DepStringError);
+ TEST_CHECK_THROWS(PortageDepParser::parse("(foo/bar)")->accept(&d), DepStringError);
}
} test_dep_atom_parser_bad_values;
}
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 582eb55..802bd7d 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -20,15 +20,15 @@
#include "config.h"
+#include <paludis/config_file.hh>
#include <paludis/dep_atom.hh>
#include <paludis/dep_atom_flattener.hh>
-#include <paludis/dep_parser.hh>
#include <paludis/ebuild.hh>
#include <paludis/hashed_containers.hh>
-#include <paludis/config_file.hh>
#include <paludis/match_package.hh>
-#include <paludis/package_database_entry.hh>
#include <paludis/package_database.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/portage_dep_parser.hh>
#include <paludis/portage_repository.hh>
#include <paludis/syncer.hh>
#include <paludis/util/dir_iterator.hh>
@@ -822,10 +822,10 @@ PortageRepository::do_version_metadata(
stringify(c) + "/" + stringify(p) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "'");
return VersionMetadata::ConstPointer(new VersionMetadata::Ebuild(
- DepParser::parse_depend));
+ PortageDepParser::parse_depend));
}
- VersionMetadata::Pointer result(new VersionMetadata::Ebuild(DepParser::parse_depend));
+ VersionMetadata::Pointer result(new VersionMetadata::Ebuild(PortageDepParser::parse_depend));
FSEntry cache_file(_imp->cache);
cache_file /= stringify(c);
@@ -1307,7 +1307,7 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
{
if (q.get<qpn_category>() == CategoryNamePart("virtual"))
{
- VersionMetadata::Ebuild::Pointer m(new VersionMetadata::Ebuild(DepParser::parse_depend));
+ VersionMetadata::Ebuild::Pointer m(new VersionMetadata::Ebuild(PortageDepParser::parse_depend));
m->set<vm_slot>(SlotName("0"));
m->get_ebuild_interface()->set<evm_virtual>(" ");
metadata = m;
@@ -1337,8 +1337,8 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
std::set<std::string> already_in_archives;
DepAtomFlattener f(_imp->env, &e,
- DepParser::parse(metadata->get_ebuild_interface()->get<evm_src_uri>(),
- DepParserPolicy<PlainTextDepAtom, false>::get_instance()));
+ PortageDepParser::parse(metadata->get_ebuild_interface()->get<evm_src_uri>(),
+ PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance()));
for (DepAtomFlattener::Iterator ff(f.begin()), ff_end(f.end()) ; ff != ff_end ; ++ff)
{
diff --git a/paludis/vdb_repository.cc b/paludis/vdb_repository.cc
index a4f3601..286021f 100644
--- a/paludis/vdb_repository.cc
+++ b/paludis/vdb_repository.cc
@@ -19,7 +19,7 @@
#include <paludis/dep_atom.hh>
#include <paludis/dep_atom_flattener.hh>
-#include <paludis/dep_parser.hh>
+#include <paludis/portage_dep_parser.hh>
#include <paludis/ebuild.hh>
#include <paludis/hashed_containers.hh>
#include <paludis/config_file.hh>
@@ -318,7 +318,7 @@ 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::Ebuild(DepParser::parse_depend));
+ p->metadata = VersionMetadata::Pointer(new VersionMetadata::Ebuild(PortageDepParser::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>(
@@ -486,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(&DepParser::parse_depend));
+ return VersionMetadata::ConstPointer(new VersionMetadata(&PortageDepParser::parse_depend));
}
else
{
@@ -828,8 +828,8 @@ VDBRepository::begin_provide_map() const
if (provide_str.empty())
continue;
- DepAtom::ConstPointer provide(DepParser::parse(provide_str,
- DepParserPolicy<PackageDepAtom, false>::get_instance()));
+ DepAtom::ConstPointer provide(PortageDepParser::parse(provide_str,
+ PortageDepParserPolicy<PackageDepAtom, false>::get_instance()));
PackageDatabaseEntry dbe(e->name, e->version, name());
DepAtomFlattener f(_imp->env, &dbe, provide);
diff --git a/paludis/version_metadata.cc b/paludis/version_metadata.cc
index d8bbf0f..12e50ae 100644
--- a/paludis/version_metadata.cc
+++ b/paludis/version_metadata.cc
@@ -20,6 +20,7 @@
#include <paludis/util/iterator.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/version_metadata.hh>
+#include <paludis/portage_dep_parser.hh>
#include <vector>
/** \file
@@ -59,15 +60,7 @@ VersionMetadataDeps::post_depend() 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>(""))))
+ _e()
{
}
@@ -83,7 +76,7 @@ VersionMetadata::VersionMetadata(ParserFunction p) :
param<vm_license>(""),
param<vm_description>(""),
param<vm_eapi>("UNSET"),
- param<vm_licence>("")
+ param<vm_license>("")
))),
_ebuild_if(0)
{
@@ -97,9 +90,36 @@ VersionMetadata::VersionMetadata(ParserFunction p, EbuildVersionMetadata * ebuil
param<vm_license>(""),
param<vm_description>(""),
param<vm_eapi>("UNSET"),
- param<vm_licence>("")
+ param<vm_license>("")
))),
_ebuild_if(ebuild_if)
{
}
+EbuildVersionMetadata::EbuildVersionMetadata() :
+ MakeSmartRecord<EbuildVersionMetadataTag>::Type((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>("")))))
+{
+}
+
+DepAtom::ConstPointer
+EbuildVersionMetadata::provide() const
+{
+ return PortageDepParser::parse(get<evm_provide>(), PortageDepParserPolicy<PackageDepAtom,
+ false>::get_instance());
+}
+
+DepAtom::ConstPointer
+VersionMetadata::license() const
+{
+ return PortageDepParser::parse(get<vm_license>(), PortageDepParserPolicy<PlainTextDepAtom,
+ true>::get_instance());
+}
+
diff --git a/paludis/version_metadata.hh b/paludis/version_metadata.hh
index 461847f..29407ab 100644
--- a/paludis/version_metadata.hh
+++ b/paludis/version_metadata.hh
@@ -73,7 +73,6 @@ namespace paludis
vm_deps,
vm_slot,
vm_license,
- vm_licence = vm_license,
vm_eapi,
vm_homepage,
vm_description,
@@ -117,7 +116,14 @@ namespace paludis
{
};
- typedef MakeSmartRecord<EbuildVersionMetadataTag>::Type EbuildVersionMetadata;
+ class EbuildVersionMetadata :
+ public MakeSmartRecord<EbuildVersionMetadataTag>::Type
+ {
+ public:
+ EbuildVersionMetadata();
+
+ DepAtom::ConstPointer provide() const;
+ };
class VersionMetadata :
private InstantiationPolicy<VersionMetadata, instantiation_method::NonCopyableTag>,
@@ -147,6 +153,8 @@ namespace paludis
return _ebuild_if;
}
+ DepAtom::ConstPointer license() const;
+
class Ebuild;
};
diff --git a/src/install.cc b/src/install.cc
index 6362dbb..2af5d65 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -119,7 +119,7 @@ do_install()
* without a category. either should work. also allow full atoms, to make
* it easy to test things like '|| ( foo/bar foo/baz )'. */
if (std::string::npos != q->find('/'))
- targets->add_child(p::DepParser::parse(*q));
+ targets->add_child(p::PortageDepParser::parse(*q));
else
targets->add_child(p::DepAtom::Pointer(new p::PackageDepAtom(
env->package_database()->fetch_unique_qualified_package_name(
@@ -492,14 +492,12 @@ do_install()
else if (p::mr_license == mm)
{
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::vm_license>());
LicenceDisplayer ld(cerr, env, &*pp);
- p::DepParser::parse(license_str, p::DepParserPolicy<p::PlainTextDepAtom,
- true>::get_instance())->accept(&ld);
+ env->package_database()->fetch_repository(
+ pp->get<p::pde_repository>())->version_metadata(
+ pp->get<p::pde_name>(), pp->get<p::pde_version>())->license()->
+ accept(&ld);
}
else if (p::mr_keyword == mm)
{
diff --git a/src/query.cc b/src/query.cc
index b500dbb..131d938 100644
--- a/src/query.cc
+++ b/src/query.cc
@@ -220,8 +220,7 @@ void do_one_query(
{
cout << " " << std::setw(22) << std::left << "License:" << std::setw(0) << " ";
LicenceDisplayer d(cout, env, &display_entry);
- p::DepParser::parse(metadata->get<p::vm_license>(),
- p::DepParserPolicy<p::PlainTextDepAtom, true>::get_instance())->accept(&d);
+ metadata->license()->accept(&d);
cout << endl;
}