aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-13 09:22:21 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-13 09:22:21 +0000
commit3fff5654a7df96f3cefc73461dd883129725af03 (patch)
treecabc33339394a1f31bdd306ca9b1eb88b59a891b
parentee47699a48861203976c870c1baabd948f9cf21d (diff)
downloadpaludis-3fff5654a7df96f3cefc73461dd883129725af03.tar.gz
paludis-3fff5654a7df96f3cefc73461dd883129725af03.tar.xz
Cache VersionMetadata values. Make RESTRICT, HOMEPAGE DepSpecs rather than flat. Allow +/- in IUSE.
-rwxr-xr-xmisc/make_sr.bash131
-rw-r--r--paludis/dep_list/dep_list.cc21
-rw-r--r--paludis/dep_list/dep_list_TEST.cc200
-rw-r--r--paludis/dep_list/dep_list_TEST_blockers.cc80
-rw-r--r--paludis/dep_list/uninstall_list_TEST.cc18
-rw-r--r--paludis/environment_implementation_TEST.cc8
-rw-r--r--paludis/name.cc87
-rw-r--r--paludis/name.hh125
-rw-r--r--paludis/name.se19
-rw-r--r--paludis/name.sr23
-rw-r--r--paludis/qa/dep_flags_check.cc8
-rw-r--r--paludis/qa/homepage_check.cc59
-rw-r--r--paludis/qa/inherits_check.cc6
-rw-r--r--paludis/qa/iuse_check.cc8
-rw-r--r--paludis/qa/keywords_check.cc13
-rw-r--r--paludis/qa/license_check.cc7
-rw-r--r--paludis/qa/parse_deps_check.cc6
-rw-r--r--paludis/qa/restrict_check.cc59
-rw-r--r--paludis/qa/src_uri_check.cc26
-rw-r--r--paludis/repositories/cran/cran_description.cc10
-rw-r--r--paludis/repositories/cran/cran_repository.cc4
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc4
-rw-r--r--paludis/repositories/fake/fake_repository.cc8
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc2
-rw-r--r--paludis/repositories/gems/gems_repository.cc2
-rw-r--r--paludis/repositories/gentoo/ebin_entries.cc65
-rw-r--r--paludis/repositories/gentoo/ebuild.cc24
-rw-r--r--paludis/repositories/gentoo/ebuild_entries.cc44
-rw-r--r--paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc80
-rw-r--r--paludis/repositories/gentoo/portage_repository.cc4
-rw-r--r--paludis/repositories/gentoo/vdb_repository.cc50
-rw-r--r--paludis/util/iterator.hh30
-rw-r--r--paludis/version_metadata.cc140
-rw-r--r--paludis/version_metadata.hh5
-rw-r--r--paludis/version_metadata.sr112
-rw-r--r--python/version_metadata.cc12
-rwxr-xr-xpython/version_metadata_TEST.py29
-rw-r--r--ruby/version_metadata.cc20
-rw-r--r--ruby/version_metadata_TEST.rb22
-rw-r--r--src/output/console_query_task.cc12
-rw-r--r--src/output/use_flag_pretty_printer.cc12
41 files changed, 977 insertions, 618 deletions
diff --git a/misc/make_sr.bash b/misc/make_sr.bash
index f2a7a41..aa1b881 100755
--- a/misc/make_sr.bash
+++ b/misc/make_sr.bash
@@ -48,6 +48,7 @@ while read a ; do
want_visible=
want_keys=( )
want_key_types=( )
+ want_cache_func=( )
want_inherit=( )
want_comparison_operators=
want_comparison_fields=( )
@@ -86,6 +87,14 @@ while read a ; do
{
want_keys=( "${want_keys[@]}" "$1" )
want_key_types=( "${want_key_types[@]}" "$2" )
+ want_cache_func=( "${want_cache_func[@]}" "__unset_function__" )
+ }
+
+ cache_key()
+ {
+ want_keys=( "${want_keys[@]}" "$1" )
+ want_key_types=( "${want_key_types[@]}" "$2 -> $3" )
+ want_cache_func=( "${want_cache_func[@]}" "$4" )
}
comparison_operators()
@@ -116,6 +125,11 @@ while read a ; do
:
}
+ cache_key()
+ {
+ :
+ }
+
inherit()
{
:
@@ -171,20 +185,47 @@ while read a ; do
fi
echo "{"
- echo " public:"
- echo
echo " ///\\name Data members"
echo " ///\\{"
echo
for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
- echo " ${want_key_types[${k}]} ${want_keys[${k}]};"
+ if [[ ${want_key_types[${k}]/->} == ${want_key_types[${k}]} ]] ; then
+ echo " public:"
+ echo " ${want_key_types[${k}]} ${want_keys[${k}]};"
+ echo
+ else
+ echo " protected:"
+ echo " ${want_key_types[${k}]% ->*} raw_${want_keys[${k}]};"
+ echo " mutable std::tr1::shared_ptr<const ${want_key_types[${k}]#*-> }> cached_${want_keys[${k}]};"
+ echo
+ fi
done
echo
echo " ///\\}"
echo
+ echo " public:"
+ echo
+
+ echo " ///\\name Cache key methods"
+ echo " ///\\{"
+ echo
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ if [[ ${want_key_types[${k}]/->} != ${want_key_types[${k}]} ]] ; then
+ echo " ${current_class} & set_${want_keys[${k}]}($(make_const_ref ${want_key_types[${k}]% ->*}));"
+ echo
+ echo " const ${want_key_types[${k}]%-> *} get_raw_${want_keys[${k}]}() const;"
+ echo
+ echo " std::tr1::shared_ptr<const ${want_key_types[${k}]#*-> }> ${want_keys[${k}]}() const;"
+ echo
+ fi
+ done
+ echo
+ echo " ///\\}"
+
+
if [[ -n "${want_comparison_operators}" ]] ; then
echo " ///\\name Comparison operators"
@@ -216,7 +257,7 @@ while read a ; do
echo " explicit ${a}("
for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
- echo -n " $(make_const_ref "${want_key_types[${k}]}") value_for_${want_keys[${k}]}"
+ echo -n " $(make_const_ref "${want_key_types[${k}]% ->*}") value_for_${want_keys[${k}]}"
if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
echo ","
else
@@ -234,6 +275,7 @@ while read a ; do
if [[ -n "${want_named_args}" ]] ; then
+ echo " public:"
echo " ///\\name Named argument constructor"
echo " ///\\{"
echo
@@ -272,12 +314,12 @@ while read a ; do
echo " private:"
for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
- echo " const typename paludis::Select<has_${k}_, ${want_key_types[${k}]}, paludis::Empty>::Type _v${k};"
+ echo " const typename paludis::Select<has_${k}_, ${want_key_types[${k}]% ->*}, paludis::Empty>::Type _v${k};"
done
echo " NamedArguments("
for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
- echo -n " const typename paludis::Select<has_${k}_, ${want_key_types[${k}]}, paludis::Empty>::Type & v${k}"
+ echo -n " const typename paludis::Select<has_${k}_, ${want_key_types[${k}]% ->*}, paludis::Empty>::Type & v${k}"
if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
echo ","
else
@@ -319,7 +361,7 @@ while read a ; do
echo ">"
fi
done
- echo " ${want_keys[${k}]}($(make_const_ref "${want_key_types[${k}]}" ) v)"
+ echo " ${want_keys[${k}]}($(make_const_ref "${want_key_types[${k}]% ->*}" ) v)"
echo " {"
echo " const typename paludis::Select<has_${k}_, void, paludis::Empty>::Type"
echo " check_not_already_specified = paludis::Empty::instance;"
@@ -367,19 +409,9 @@ while read a ; do
if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
echo ","
else
- echo "> & va) :"
+ echo "> & va);"
fi
done
- for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
- echo -n " ${want_keys[${k}]}(va._v${k})"
- if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
- echo ","
- else
- echo
- fi
- done
- echo " {"
- echo " }"
echo
echo " /**"
@@ -406,7 +438,7 @@ while read a ; do
echo "${a}::${a}("
for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
- echo -n " $(make_const_ref "${want_key_types[${k}]}") value_for_${want_keys[${k}]}"
+ echo -n " $(make_const_ref "${want_key_types[${k}]% ->*}") value_for_${want_keys[${k}]}"
if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
echo ","
else
@@ -414,7 +446,12 @@ while read a ; do
fi
done
for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
- echo -n " ${want_keys[${k}]}(value_for_${want_keys[${k}]})"
+ if [[ ${want_key_types[${k}]/->} == ${want_key_types[${k}]} ]] ; then
+ echo -n " ${want_keys[${k}]}(value_for_${want_keys[${k}]})"
+ else
+ echo " raw_${want_keys[${k}]}(value_for_${want_keys[${k}]}),"
+ echo -n " cached_${want_keys[${k}]}()"
+ fi
if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
echo ","
else
@@ -425,6 +462,60 @@ while read a ; do
echo "}"
echo
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ if [[ ${want_key_types[${k}]/->} != ${want_key_types[${k}]} ]] ; then
+ echo "${a} &"
+ echo "${a}::set_${want_keys[${k}]}($(make_const_ref ${want_key_types[${k}]% ->*}) va)"
+ echo "{"
+ echo " raw_${want_keys[${k}]} = va;"
+ echo " cached_${want_keys[${k}]}.reset();"
+ echo " return *this;"
+ echo "}"
+ echo
+ echo "const ${want_key_types[${k}]%-> *}"
+ echo "${a}::get_raw_${want_keys[${k}]}() const"
+ echo "{"
+ echo " return raw_${want_keys[${k}]};"
+ echo "}"
+ echo
+ echo "std::tr1::shared_ptr<const ${want_key_types[${k}]#*-> }>"
+ echo "${a}::${want_keys[${k}]}() const"
+ echo "{"
+ echo " if (! cached_${want_keys[${k}]})"
+ echo " cached_${want_keys[${k}]} = ${want_cache_func[${k}]}(raw_${want_keys[${k}]});"
+ echo " return cached_${want_keys[${k}]};"
+ echo "}"
+ echo
+ fi
+ done
+
+ if [[ -n "${want_named_args}" ]] ; then
+ echo "${a}::${a}(const NamedArguments<"
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n " true"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ","
+ else
+ echo "> & va) :"
+ fi
+ done
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ if [[ ${want_key_types[${k}]/->} == ${want_key_types[${k}]} ]] ; then
+ echo -n " ${want_keys[${k}]}(va._v${k})"
+ else
+ echo " raw_${want_keys[${k}]}(va._v${k}),"
+ echo -n " cached_${want_keys[${k}]}()"
+ fi
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ","
+ else
+ echo
+ fi
+ done
+ echo " {"
+ echo " }"
+ fi
+
if [[ -n "${want_comparison_operators}" ]] ; then
if [[ "${want_comparison_operators}" == "all" ]] ; then
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 3f20497..1113d0a 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -1607,18 +1607,17 @@ DepList::prefer_installed_over_uninstalled(const PackageDatabaseEntry & installe
const VersionMetadataEbuildInterface * const evm_u(_imp->env->package_database()->fetch_repository(
uninstalled.repository)->version_metadata(uninstalled.name, uninstalled.version)->ebuild_interface);
- std::set<std::string> use_i, use_u, use_common;
- if (evm_i)
- WhitespaceTokeniser::get_instance()->tokenise(evm_i->iuse, std::inserter(use_i, use_i.end()));
- if (evm_u)
- WhitespaceTokeniser::get_instance()->tokenise(evm_u->iuse, std::inserter(use_u, use_u.end()));
-
- std::set_intersection(use_i.begin(), use_i.end(), use_u.begin(), use_u.end(),
- std::inserter(use_common, use_common.end()));
-
- for (std::set<std::string>::const_iterator f(use_common.begin()), f_end(use_common.end()) ;
+ std::set<UseFlagName> use_common;
+ if (evm_i && evm_u)
+ std::set_intersection(
+ evm_i->iuse()->begin(), evm_i->iuse()->end(),
+ evm_u->iuse()->begin(), evm_u->iuse()->end(),
+ transform_inserter(std::inserter(use_common, use_common.end()),
+ SelectMember<IUseFlag, UseFlagName, &IUseFlag::flag>()));
+
+ for (std::set<UseFlagName>::const_iterator f(use_common.begin()), f_end(use_common.end()) ;
f != f_end ; ++f)
- if (_imp->env->query_use(UseFlagName(*f), installed) != _imp->env->query_use(UseFlagName(*f), uninstalled))
+ if (_imp->env->query_use(*f, installed) != _imp->env->query_use(*f, uninstalled))
return false;
}
diff --git a/paludis/dep_list/dep_list_TEST.cc b/paludis/dep_list/dep_list_TEST.cc
index eca7998..f4742c3 100644
--- a/paludis/dep_list/dep_list_TEST.cc
+++ b/paludis/dep_list/dep_list_TEST.cc
@@ -66,7 +66,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
repo->add_version("cat", "two", "1");
}
@@ -86,8 +86,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/three";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/three");
repo->add_version("cat", "three", "1");
}
@@ -108,7 +108,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -130,8 +130,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/three";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/three");
repo->add_version("cat", "three", "1");
}
@@ -152,9 +152,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("cat/two");
}
void populate_expected()
@@ -174,9 +174,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/four";
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "cat/four";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/four");
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("cat/four");
repo->add_version("cat", "four", "1");
}
@@ -198,9 +198,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/four cat/three";
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "cat/four";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/four cat/three");
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("cat/four");
repo->add_version("cat", "four", "1");
}
@@ -222,9 +222,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/four";
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "cat/four cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/four");
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("cat/four cat/two");
repo->add_version("cat", "four", "1");
}
@@ -246,7 +246,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( cat/two cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( cat/two cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -267,9 +267,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "|| ( cat/two cat/four )";
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("|| ( cat/two cat/four )");
repo->add_version("cat", "four", "1");
}
@@ -290,7 +290,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( ( cat/two cat/three ) cat/four )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( ( cat/two cat/three ) cat/four )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
repo->add_version("cat", "four", "1");
@@ -313,10 +313,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three cat/four";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three cat/four");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
- repo->add_version("cat", "four", "1")->deps_interface->build_depend_string = "|| ( ( cat/two cat/three ) cat/five )";
+ repo->add_version("cat", "four", "1")->deps_interface->set_build_depend("|| ( ( cat/two cat/three ) cat/five )");
}
void populate_expected()
@@ -337,7 +337,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( cat/two cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( cat/two cat/three )");
repo->add_version("cat", "three", "1");
}
@@ -357,8 +357,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( cat/two cat/three )";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/four";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( cat/two cat/three )");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/four");
repo->add_version("cat", "three", "1");
}
@@ -378,7 +378,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two:slot2";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two:slot2");
repo->add_version("cat", "two", "1.1")->slot = SlotName("slot1");
repo->add_version("cat", "two", "1.2")->slot = SlotName("slot2");
repo->add_version("cat", "two", "1.3")->slot = SlotName("slot3");
@@ -400,7 +400,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "<cat/two-1.2-r2:slot2";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("<cat/two-1.2-r2:slot2");
repo->add_version("cat", "two", "1.1")->slot = SlotName("slot1");
repo->add_version("cat", "two", "1.2")->slot = SlotName("slot2");
repo->add_version("cat", "two", "1.2-r1")->slot = SlotName("slot2");
@@ -424,7 +424,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( )");
}
void populate_expected()
@@ -442,7 +442,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "enabled? ( cat/two )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("enabled? ( cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -462,7 +462,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "!enabled? ( cat/two )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("!enabled? ( cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -481,7 +481,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "disabled? ( cat/two )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("disabled? ( cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -500,7 +500,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "!disabled? ( cat/two )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("!disabled? ( cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -520,7 +520,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( enabled? ( cat/two ) cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( enabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -541,7 +541,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( !enabled? ( cat/two ) cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( !enabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -562,7 +562,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( disabled? ( cat/two ) cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( disabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -583,7 +583,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( !disabled? ( cat/two ) cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( !disabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -604,7 +604,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/three || ( enabled? ( cat/two ) cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/three || ( enabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -625,7 +625,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/three || ( !enabled? ( cat/two ) cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/three || ( !enabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -646,7 +646,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/three || ( disabled? ( cat/two ) cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/three || ( disabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -667,7 +667,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/three || ( !disabled? ( cat/two ) cat/three )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/three || ( !disabled? ( cat/two ) cat/three )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -688,7 +688,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/three || ( enabled? ( cat/three ) cat/two )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/three || ( enabled? ( cat/three ) cat/two )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -709,7 +709,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/three || ( !enabled? ( cat/three ) cat/two )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/three || ( !enabled? ( cat/three ) cat/two )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -731,7 +731,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/three || ( disabled? ( cat/three ) cat/two )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/three || ( disabled? ( cat/three ) cat/two )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -753,7 +753,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/three || ( !disabled? ( cat/three ) cat/two )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/three || ( !disabled? ( cat/three ) cat/two )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -774,7 +774,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( enabled1? ( cat/two ) enabled2? ( cat/three ) )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( enabled1? ( cat/two ) enabled2? ( cat/three ) )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -795,7 +795,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( !enabled1? ( cat/two ) enabled2? ( cat/three ) )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( !enabled1? ( cat/two ) enabled2? ( cat/three ) )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -816,7 +816,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( !enabled1? ( cat/two ) !enabled2? ( cat/three ) )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( !enabled1? ( cat/two ) !enabled2? ( cat/three ) )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -836,8 +836,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( cat/two cat/three )";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/one";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( cat/two cat/three )");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/one");
repo->add_version("cat", "three", "1");
}
@@ -857,8 +857,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( cat/two cat/three )";
- repo->add_version("cat", "two", "1")->deps_interface->post_depend_string = "cat/one";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( cat/two cat/three )");
+ repo->add_version("cat", "two", "1")->deps_interface->set_post_depend("cat/one");
repo->add_version("cat", "three", "1");
}
@@ -878,7 +878,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "( cat/two cat/two )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("( cat/two cat/two )");
repo->add_version("cat", "two", "1");
}
@@ -898,8 +898,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "( cat/two[enabled] )";
- repo->add_version("cat", "two", "1")->ebuild_interface->iuse = "enabled";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("( cat/two[enabled] )");
+ repo->add_version("cat", "two", "1")->ebuild_interface->set_iuse("enabled");
}
void populate_expected()
@@ -918,8 +918,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "( cat/two[-disabled] )";
- repo->add_version("cat", "two", "1")->ebuild_interface->iuse = "disabled";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("( cat/two[-disabled] )");
+ repo->add_version("cat", "two", "1")->ebuild_interface->set_iuse("disabled");
}
void populate_expected()
@@ -938,8 +938,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "( cat/two[disabled] )";
- repo->add_version("cat", "two", "1")->ebuild_interface->iuse = "disabled";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("( cat/two[disabled] )");
+ repo->add_version("cat", "two", "1")->ebuild_interface->set_iuse("disabled");
}
void populate_expected()
@@ -965,8 +965,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "( cat/two[-enabled] )";
- repo->add_version("cat", "two", "1")->ebuild_interface->iuse = "enabled";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("( cat/two[-enabled] )");
+ repo->add_version("cat", "two", "1")->ebuild_interface->set_iuse("enabled");
}
void populate_expected()
@@ -992,8 +992,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "( cat/two cat/two[enabled] )";
- repo->add_version("cat", "two", "1")->ebuild_interface->iuse = "enabled";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("( cat/two cat/two[enabled] )");
+ repo->add_version("cat", "two", "1")->ebuild_interface->set_iuse("enabled");
}
void populate_expected()
@@ -1012,8 +1012,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "( cat/two cat/two[-disabled] )";
- repo->add_version("cat", "two", "1")->ebuild_interface->iuse = "disabled";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("( cat/two cat/two[-disabled] )");
+ repo->add_version("cat", "two", "1")->ebuild_interface->set_iuse("disabled");
}
void populate_expected()
@@ -1032,8 +1032,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "( cat/two cat/two[disabled] )";
- repo->add_version("cat", "two", "1")->ebuild_interface->iuse = "disabled";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("( cat/two cat/two[disabled] )");
+ repo->add_version("cat", "two", "1")->ebuild_interface->set_iuse("disabled");
}
void populate_expected()
@@ -1059,8 +1059,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "( cat/two cat/two[-enabled] )";
- repo->add_version("cat", "two", "1")->ebuild_interface->iuse = "enabled";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("( cat/two cat/two[-enabled] )");
+ repo->add_version("cat", "two", "1")->ebuild_interface->set_iuse("enabled");
}
void populate_expected()
@@ -1086,7 +1086,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->post_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_post_depend("cat/two");
repo->add_version("cat", "two", "1");
}
@@ -1106,8 +1106,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->post_depend_string = "cat/two";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/three";
+ repo->add_version("cat", "one", "1")->deps_interface->set_post_depend("cat/two");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/three");
repo->add_version("cat", "three", "1");
}
@@ -1128,8 +1128,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->post_depend_string = "cat/two";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/one";
+ repo->add_version("cat", "one", "1")->deps_interface->set_post_depend("cat/two");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/one");
}
void populate_expected()
@@ -1148,8 +1148,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two || ( cat/three cat/four )";
- repo->add_version("cat", "two", "1")->ebuild_interface->provide_string = "cat/four";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two || ( cat/three cat/four )");
+ repo->add_version("cat", "two", "1")->ebuild_interface->set_provide("cat/four");
repo->add_version("cat", "three", "1");
}
@@ -1170,9 +1170,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->post_depend_string = "cat/two";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/three";
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "cat/one";
+ repo->add_version("cat", "one", "1")->deps_interface->set_post_depend("cat/two");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/three");
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("cat/one");
}
void populate_expected()
@@ -1192,7 +1192,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->ebuild_interface->provide_string = "cat/two";
+ repo->add_version("cat", "one", "1")->ebuild_interface->set_provide("cat/two");
}
void populate_expected()
@@ -1211,7 +1211,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( cat/two >=cat/three-2 )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( cat/two >=cat/three-2 )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "2");
installed_repo->add_version("cat", "three", "1");
@@ -1233,7 +1233,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "|| ( cat/two >=cat/three-3 )";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("|| ( cat/two >=cat/three-3 )");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "2");
installed_repo->add_version("cat", "three", "1");
@@ -1251,8 +1251,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->ebuild_interface->provide_string = "virtual/foo";
- repo->add_version("cat", "two", "2")->ebuild_interface->provide_string = "virtual/foo";
+ repo->add_version("cat", "one", "1")->ebuild_interface->set_provide("virtual/foo");
+ repo->add_version("cat", "two", "2")->ebuild_interface->set_provide("virtual/foo");
}
void populate_expected()
@@ -1282,13 +1282,13 @@ namespace test_cases
RepositoryName("installed_repo")));
env.package_database()->add_repository(2, destination_repo);
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/four";
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "cat/four cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/four");
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("cat/four cat/two");
repo->add_version("cat", "four", "1");
- repo->add_version("cat", "five", "1")->deps_interface->build_depend_string = "cat/six cat/seven";
+ repo->add_version("cat", "five", "1")->deps_interface->set_build_depend("cat/six cat/seven");
repo->add_version("cat", "six", "1");
- repo->add_version("cat", "seven", "1")->deps_interface->build_depend_string = "cat/doesnotexist";
+ repo->add_version("cat", "seven", "1")->deps_interface->set_build_depend("cat/doesnotexist");
DepList d(&env, DepListOptions());
d.add(PortageDepParser::parse_depend("cat/one", pds_pm_permissive), env.default_destinations());
@@ -1320,13 +1320,13 @@ namespace test_cases
RepositoryName("installed_repo")));
env.package_database()->add_repository(2, destination_repo);
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "cat/four";
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "cat/four cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("cat/four");
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("cat/four cat/two");
repo->add_version("cat", "four", "1");
- repo->add_version("cat", "five", "1")->deps_interface->build_depend_string = "cat/six cat/seven";
+ repo->add_version("cat", "five", "1")->deps_interface->set_build_depend("cat/six cat/seven");
repo->add_version("cat", "six", "1");
- repo->add_version("cat", "seven", "1")->deps_interface->post_depend_string = "cat/doesnotexist";
+ repo->add_version("cat", "seven", "1")->deps_interface->set_post_depend("cat/doesnotexist");
DepList d(&env, DepListOptions());
d.add(PortageDepParser::parse_depend("cat/one", pds_pm_permissive), env.default_destinations());
@@ -1381,7 +1381,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
new FakeInstalledRepository(&env, RepositoryName("installed_repo")));
@@ -1408,7 +1408,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
new FakeInstalledRepository(&env, RepositoryName("installed_repo")));
@@ -1436,7 +1436,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
new FakeInstalledRepository(&env, RepositoryName("installed_repo")));
@@ -1481,7 +1481,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
repo->add_version("cat", "two", "2");
std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
@@ -1514,8 +1514,8 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "zero", "1")->deps_interface->build_depend_string =
- "( cat/one cat/two cat/three-live cat/four-cvs cat/five-svn cat/six-darcs )";
+ repo->add_version("cat", "zero", "1")->deps_interface->set_build_depend(
+ "( cat/one cat/two cat/three-live cat/four-cvs cat/five-svn cat/six-darcs )");
repo->add_version("cat", "one", "scm");
repo->add_version("cat", "two", "2");
repo->add_version("cat", "three-live", "0");
diff --git a/paludis/dep_list/dep_list_TEST_blockers.cc b/paludis/dep_list/dep_list_TEST_blockers.cc
index dc88bd4..a01b41d 100644
--- a/paludis/dep_list/dep_list_TEST_blockers.cc
+++ b/paludis/dep_list/dep_list_TEST_blockers.cc
@@ -30,7 +30,7 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "!cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("!cat/two");
installed_repo->add_version("cat", "two", "1");
}
@@ -64,8 +64,8 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "!cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("!cat/two");
}
void populate_expected()
@@ -82,10 +82,10 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "1"));
- two_m->deps_interface->build_depend_string = "!virtual/two";
- two_m->ebuild_interface->provide_string = "virtual/two";
+ two_m->deps_interface->set_build_depend("!virtual/two");
+ two_m->ebuild_interface->set_provide("virtual/two");
}
void populate_expected()
@@ -103,11 +103,11 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "1"));
- two_m->deps_interface->build_depend_string = "!virtual/two";
- two_m->ebuild_interface->provide_string = "virtual/two";
- installed_repo->add_version("other", "two", "1")->ebuild_interface->provide_string = "virtual/two";
+ two_m->deps_interface->set_build_depend("!virtual/two");
+ two_m->ebuild_interface->set_provide("virtual/two");
+ installed_repo->add_version("other", "two", "1")->ebuild_interface->set_provide("virtual/two");
}
void populate_expected()
@@ -144,9 +144,9 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two cat/three");
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "!cat/two";
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("!cat/two");
}
void populate_expected()
@@ -171,9 +171,9 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = ">=cat/two-2 cat/three";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend(">=cat/two-2 cat/three");
repo->add_version("cat", "two", "2");
- repo->add_version("cat", "three", "1")->deps_interface->build_depend_string = "!<cat/two-2";
+ repo->add_version("cat", "three", "1")->deps_interface->set_build_depend("!<cat/two-2");
installed_repo->add_version("cat", "two", "1");
}
@@ -192,8 +192,8 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- repo->add_version("cat", "two", "1")->deps_interface->build_depend_string = "!cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
+ repo->add_version("cat", "two", "1")->deps_interface->set_build_depend("!cat/two");
installed_repo->add_version("cat", "two", "1");
}
@@ -212,12 +212,12 @@ namespace test_cases
void populate_repo()
{
std::tr1::shared_ptr<VersionMetadata> one_m(repo->add_version("cat", "one", "1"));
- one_m->ebuild_interface->provide_string = "virtual/one";
- one_m->deps_interface->build_depend_string = "!virtual/one";
- one_m->deps_interface->run_depend_string = "!virtual/one";
+ one_m->ebuild_interface->set_provide("virtual/one");
+ one_m->deps_interface->set_build_depend("!virtual/one");
+ one_m->deps_interface->set_run_depend("!virtual/one");
std::tr1::shared_ptr<VersionMetadata> i_one_m(installed_repo->add_version("cat", "one", "1"));
- i_one_m->ebuild_interface->provide_string = "virtual/one";
- i_one_m->deps_interface->run_depend_string = "!virtual/one";
+ i_one_m->ebuild_interface->set_provide("virtual/one");
+ i_one_m->deps_interface->set_run_depend("!virtual/one");
}
void populate_expected()
@@ -235,12 +235,12 @@ namespace test_cases
void populate_repo()
{
std::tr1::shared_ptr<VersionMetadata> one_m(repo->add_version("cat", "one", "1"));
- one_m->ebuild_interface->provide_string = "virtual/one";
- one_m->deps_interface->build_depend_string = "!virtual/one";
- one_m->deps_interface->run_depend_string = "!virtual/one";
+ one_m->ebuild_interface->set_provide("virtual/one");
+ one_m->deps_interface->set_build_depend("!virtual/one");
+ one_m->deps_interface->set_run_depend("!virtual/one");
std::tr1::shared_ptr<VersionMetadata> i_one_m(installed_repo->add_version("cat", "one", "1"));
- i_one_m->ebuild_interface->provide_string = "virtual/one";
- i_one_m->deps_interface->run_depend_string = "!virtual/one";
+ i_one_m->ebuild_interface->set_provide("virtual/one");
+ i_one_m->deps_interface->set_run_depend("!virtual/one");
}
void populate_expected()
@@ -262,11 +262,11 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "2"));
- two_m->ebuild_interface->provide_string = "virtual/two";
- two_m->deps_interface->build_depend_string = "!virtual/two";
- installed_repo->add_version("cat", "two", "1")->ebuild_interface->provide_string = "virtual/two";
+ two_m->ebuild_interface->set_provide("virtual/two");
+ two_m->deps_interface->set_build_depend("!virtual/two");
+ installed_repo->add_version("cat", "two", "1")->ebuild_interface->set_provide("virtual/two");
}
void populate_expected()
@@ -284,8 +284,8 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- repo->add_version("cat", "two", "2")->deps_interface->build_depend_string = "!<cat/two-2";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
+ repo->add_version("cat", "two", "2")->deps_interface->set_build_depend("!<cat/two-2");
installed_repo->add_version("cat", "two", "1");
}
@@ -311,11 +311,11 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "2"));
- two_m->deps_interface->build_depend_string = "!<virtual/two-2";
- two_m->ebuild_interface->provide_string = "virtual/two";
- installed_repo->add_version("cat", "two", "1")->ebuild_interface->provide_string = "virtual/two";
+ two_m->deps_interface->set_build_depend("!<virtual/two-2");
+ two_m->ebuild_interface->set_provide("virtual/two");
+ installed_repo->add_version("cat", "two", "1")->ebuild_interface->set_provide("virtual/two");
}
void populate_expected()
@@ -340,11 +340,11 @@ namespace test_cases
void populate_repo()
{
- repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
+ repo->add_version("cat", "one", "1")->deps_interface->set_build_depend("cat/two");
std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "2"));
- two_m->deps_interface->build_depend_string = "!<virtual/two-2";
- two_m->ebuild_interface->provide_string = "virtual/two";
- installed_repo->add_version("other", "two", "1")->ebuild_interface->provide_string = "virtual/two";
+ two_m->deps_interface->set_build_depend("!<virtual/two-2");
+ two_m->ebuild_interface->set_provide("virtual/two");
+ installed_repo->add_version("other", "two", "1")->ebuild_interface->set_provide("virtual/two");
}
void populate_expected()
diff --git a/paludis/dep_list/uninstall_list_TEST.cc b/paludis/dep_list/uninstall_list_TEST.cc
index a6aef2b..a40cb1a 100644
--- a/paludis/dep_list/uninstall_list_TEST.cc
+++ b/paludis/dep_list/uninstall_list_TEST.cc
@@ -201,7 +201,7 @@ namespace test_cases
void populate_repo()
{
- installed_repo->add_version("foo", "bar", "1")->deps_interface->build_depend_string = "foo/baz";
+ installed_repo->add_version("foo", "bar", "1")->deps_interface->set_build_depend("foo/baz");
installed_repo->add_version("foo", "baz", "2");
}
@@ -231,8 +231,8 @@ namespace test_cases
void populate_repo()
{
- installed_repo->add_version("foo", "bar", "1")->deps_interface->build_depend_string = "foo/baz";
- installed_repo->add_version("foo", "baz", "2")->deps_interface->build_depend_string = "foo/moo";
+ installed_repo->add_version("foo", "bar", "1")->deps_interface->set_build_depend("foo/baz");
+ installed_repo->add_version("foo", "baz", "2")->deps_interface->set_build_depend("foo/moo");
installed_repo->add_version("foo", "moo", "3");
}
@@ -263,9 +263,9 @@ namespace test_cases
void populate_repo()
{
- installed_repo->add_version("foo", "bar", "1")->deps_interface->build_depend_string = "foo/baz foo/oink";
+ installed_repo->add_version("foo", "bar", "1")->deps_interface->set_build_depend("foo/baz foo/oink");
installed_repo->add_version("foo", "baz", "2");
- installed_repo->add_version("foo", "moo", "3")->deps_interface->build_depend_string = "foo/oink";
+ installed_repo->add_version("foo", "moo", "3")->deps_interface->set_build_depend("foo/oink");
installed_repo->add_version("foo", "oink", "1");
}
@@ -297,9 +297,9 @@ namespace test_cases
void populate_repo()
{
- installed_repo->add_version("foo", "bar", "1")->deps_interface->build_depend_string = "foo/baz foo/oink";
+ installed_repo->add_version("foo", "bar", "1")->deps_interface->set_build_depend("foo/baz foo/oink");
installed_repo->add_version("foo", "baz", "2");
- installed_repo->add_version("foo", "moo", "3")->deps_interface->build_depend_string = "foo/oink";
+ installed_repo->add_version("foo", "moo", "3")->deps_interface->set_build_depend("foo/oink");
installed_repo->add_version("foo", "oink", "1");
}
@@ -336,7 +336,7 @@ namespace test_cases
void populate_repo()
{
- installed_repo->add_version("foo", "bar", "1")->deps_interface->build_depend_string = "foo/baz foo/moo";
+ installed_repo->add_version("foo", "bar", "1")->deps_interface->set_build_depend("foo/baz foo/moo");
installed_repo->add_version("foo", "baz", "2");
installed_repo->add_version("foo", "moo", "2");
}
@@ -372,7 +372,7 @@ namespace test_cases
void populate_repo()
{
- installed_repo->add_version("foo", "bar", "1")->deps_interface->build_depend_string = "foo/baz foo/moo";
+ installed_repo->add_version("foo", "bar", "1")->deps_interface->set_build_depend("foo/baz foo/moo");
installed_repo->add_version("foo", "baz", "2");
installed_repo->add_version("foo", "moo", "2");
}
diff --git a/paludis/environment_implementation_TEST.cc b/paludis/environment_implementation_TEST.cc
index 23ce2d6..327e3bb 100644
--- a/paludis/environment_implementation_TEST.cc
+++ b/paludis/environment_implementation_TEST.cc
@@ -41,10 +41,10 @@ namespace
std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(this, RepositoryName("repo")));
_package_database->add_repository(1, std::tr1::shared_ptr<Repository>(repo));
- repo->add_version("foo", "one", "0")->ebuild_interface->keywords_string = "test foo";
- repo->add_version("foo", "two", "0")->ebuild_interface->keywords_string = "~test foo";
- repo->add_version("foo", "three", "0")->ebuild_interface->keywords_string = "-test foo";
- repo->add_version("foo", "four", "0")->ebuild_interface->keywords_string = "-* foo";
+ repo->add_version("foo", "one", "0")->ebuild_interface->set_keywords("test foo");
+ repo->add_version("foo", "two", "0")->ebuild_interface->set_keywords("~test foo");
+ repo->add_version("foo", "three", "0")->ebuild_interface->set_keywords("-test foo");
+ repo->add_version("foo", "four", "0")->ebuild_interface->set_keywords("-* foo");
}
~EITestEnvironment()
diff --git a/paludis/name.cc b/paludis/name.cc
index 280c9fb..9090795 100644
--- a/paludis/name.cc
+++ b/paludis/name.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -20,6 +20,7 @@
#include <paludis/name.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/compare.hh>
+#include <paludis/util/log.hh>
#include <ostream>
/** \file
@@ -334,3 +335,87 @@ SetNameError::SetNameError(const std::string & name) throw () :
{
}
+namespace
+{
+ UseFlagName get_flag(const std::string & s)
+ {
+ Context c("When extracting USE flag name from IUSE flag '" + s + "':");
+ if (s.empty() || ('-' != s[0] && '+' != s[0]))
+ return UseFlagName(s);
+ else
+ return UseFlagName(s.substr(1));
+ }
+
+ UseFlagState get_state(const std::string & s, IUseFlagParseMode m)
+ {
+ Context c("When extracting USE flag state from IUSE flag '" + s + "':");
+
+ if (s.empty())
+ return use_unspecified;
+ if ('-' == s[0] || '+' == s[0])
+ {
+ switch (m)
+ {
+ case iuse_pm_eapi_0:
+ Log::get_instance()->message(ll_warning, lc_context,
+ "+/- prefixed IUSE flag names not allowed in this EAPI");
+
+ /* fall through */
+
+ case iuse_pm_permissive:
+ return '-' == s[0] ? use_disabled : use_enabled;
+
+ case iuse_pm_eapi_0_strict:
+ throw IUseFlagNameError(s, "+/- prefixed IUSE flag names not allowed in this EAPI");
+
+ case last_iuse_pm:
+ ;
+ }
+ }
+ return use_unspecified;
+ }
+}
+
+IUseFlag::IUseFlag(const std::string & s, IUseFlagParseMode m) try:
+ flag(get_flag(s)),
+ state(get_state(s, m))
+{
+}
+catch (const UseFlagNameError &)
+{
+ throw IUseFlagNameError(s);
+}
+
+IUseFlagNameError::IUseFlagNameError(const std::string & s) throw () :
+ NameError(s, "IUse flag")
+{
+}
+
+IUseFlagNameError::IUseFlagNameError(const std::string & s, const std::string & m) throw () :
+ NameError(s, "IUse flag", m)
+{
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & s, const IUseFlag & i)
+{
+ switch (i.state)
+ {
+ case use_enabled:
+ s << "+";
+ break;
+
+ case use_disabled:
+ s << "-";
+ break;
+
+ case use_unspecified:
+ case last_use:
+ break;
+ }
+
+ s << i.flag;
+
+ return s;
+}
+
diff --git a/paludis/name.hh b/paludis/name.hh
index 6a7340f..95dfc3e 100644
--- a/paludis/name.hh
+++ b/paludis/name.hh
@@ -131,65 +131,40 @@ namespace paludis
*/
typedef SortedCollection<CategoryNamePart> CategoryNamePartCollection;
-#include <paludis/name-sr.hh>
-
- /**
- * Output a QualifiedPackageName to a stream.
- *
- * \ingroup grpnames
- */
- std::ostream & operator<< (std::ostream &, const QualifiedPackageName &) PALUDIS_VISIBLE;
-
- /**
- * Holds a collection of QualifiedPackageName instances.
- *
- * \ingroup grpnames
- */
- typedef SortedCollection<QualifiedPackageName> QualifiedPackageNameCollection;
-
/**
- * A QualifiedPackageNameError may be thrown if an invalid name is
- * assigned to a QualifiedPackageName (alternatively, the exception
- * raised may be a PackageNamePartError or a CategoryNamePartError).
+ * A UseFlagNameError is thrown if an invalid value is assigned to
+ * a UseFlagName.
*
* \ingroup grpnames
* \ingroup grpexceptions
*/
- class PALUDIS_VISIBLE QualifiedPackageNameError : public NameError
+ class PALUDIS_VISIBLE UseFlagNameError : public NameError
{
public:
/**
* Constructor.
*/
- QualifiedPackageNameError(const std::string &) throw ();
+ UseFlagNameError(const std::string & name) throw ();
};
/**
- * Convenience operator to make a QualifiedPackageName from a
- * PackageNamePart and a CategoryNamePart.
- *
- * \ingroup grpnames
- */
- inline const QualifiedPackageName
- operator+ (const CategoryNamePart & c, const PackageNamePart & p)
- {
- return QualifiedPackageName(c, p);
- }
-
- /**
- * A UseFlagNameError is thrown if an invalid value is assigned to
- * a UseFlagName.
+ * An IUseFlagNameError is thrown if an invalid value is assigned to
+ * an IUseFlagName.
*
* \ingroup grpnames
* \ingroup grpexceptions
*/
- class PALUDIS_VISIBLE UseFlagNameError : public NameError
+ class PALUDIS_VISIBLE IUseFlagNameError : public NameError
{
public:
- /**
- * Constructor.
- */
- UseFlagNameError(const std::string & name) throw ();
+ ///\name Basic operations
+ ///\{
+
+ IUseFlagNameError(const std::string & name, const std::string & msg) throw ();
+
+ IUseFlagNameError(const std::string & name) throw ();
+
+ ///\}
};
/**
@@ -222,6 +197,60 @@ namespace paludis
*/
typedef SortedCollection<UseFlagName> UseFlagNameCollection;
+
+#include <paludis/name-se.hh>
+#include <paludis/name-sr.hh>
+
+ /**
+ * Output a QualifiedPackageName to a stream.
+ *
+ * \ingroup grpnames
+ */
+ std::ostream & operator<< (std::ostream &, const QualifiedPackageName &) PALUDIS_VISIBLE;
+
+ /**
+ * Output an IUseFlag to a stream.
+ *
+ * \ingroup grpnames
+ */
+ std::ostream & operator<< (std::ostream &, const IUseFlag &) PALUDIS_VISIBLE;
+
+ /**
+ * Holds a collection of QualifiedPackageName instances.
+ *
+ * \ingroup grpnames
+ */
+ typedef SortedCollection<QualifiedPackageName> QualifiedPackageNameCollection;
+
+ /**
+ * A QualifiedPackageNameError may be thrown if an invalid name is
+ * assigned to a QualifiedPackageName (alternatively, the exception
+ * raised may be a PackageNamePartError or a CategoryNamePartError).
+ *
+ * \ingroup grpnames
+ * \ingroup grpexceptions
+ */
+ class PALUDIS_VISIBLE QualifiedPackageNameError : public NameError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ QualifiedPackageNameError(const std::string &) throw ();
+ };
+
+ /**
+ * Convenience operator to make a QualifiedPackageName from a
+ * PackageNamePart and a CategoryNamePart.
+ *
+ * \ingroup grpnames
+ */
+ inline const QualifiedPackageName
+ operator+ (const CategoryNamePart & c, const PackageNamePart & p)
+ {
+ return QualifiedPackageName(c, p);
+ }
+
/**
* A SlotNameError is thrown if an invalid value is assigned to
* a SlotName.
@@ -370,8 +399,6 @@ namespace paludis
*/
typedef SortedCollection<KeywordName> KeywordNameCollection;
-#include <paludis/name-se.hh>
-
/**
* A SetNameValidator handles validation rules for the value of a
* SetName.
@@ -417,6 +444,20 @@ namespace paludis
* \ingroup grpnames
*/
typedef SortedCollection<SetName> SetNameCollection;
+
+ /**
+ * A collection of use flags.
+ *
+ * \ingroup grpnames
+ */
+ typedef SortedCollection<IUseFlag> IUseFlagCollection;
+
+ /**
+ * A collection of inherited packages.
+ *
+ * \ingroup grpnames
+ */
+ typedef SortedCollection<std::string> InheritedCollection;
}
#endif
diff --git a/paludis/name.se b/paludis/name.se
index 4daad11..67b5adf 100644
--- a/paludis/name.se
+++ b/paludis/name.se
@@ -17,3 +17,22 @@ make_enum_UseFlagState()
*/
END
}
+
+make_enum_IUseFlagParseMode()
+{
+ prefix iuse_pm
+
+ key iuse_pm_eapi_0 "EAPI-0"
+ key iuse_pm_eapi_0_strict "EAPI-0, errors for non-permitted things"
+ key iuse_pm_permissive "Permissive"
+
+ doxygen_comment << "END"
+ /**
+ * How to parse an IUSE flag string.
+ *
+ * \see IUseFlag
+ * \ingroup grpnames
+ */
+END
+}
+
diff --git a/paludis/name.sr b/paludis/name.sr
index 8579a0d..4c6bed5 100644
--- a/paludis/name.sr
+++ b/paludis/name.sr
@@ -24,3 +24,26 @@ END
END
}
+make_class_IUseFlag()
+{
+ visible
+
+ key flag UseFlagName
+ key state UseFlagState
+
+ comparison_operators all flag
+
+ extra_constructors <<END
+ IUseFlag(const std::string &, const IUseFlagParseMode);
+END
+
+ doxygen_comment << "END"
+ /**
+ * Represents an IUse flag.
+ *
+ * \ingroup grpnames
+ * \nosubgrouping
+ */
+END
+}
+
diff --git a/paludis/qa/dep_flags_check.cc b/paludis/qa/dep_flags_check.cc
index 72c007b..4d05328 100644
--- a/paludis/qa/dep_flags_check.cc
+++ b/paludis/qa/dep_flags_check.cc
@@ -22,9 +22,10 @@
#include <paludis/environment.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/qa/dep_flags_check.hh>
-#include <paludis/util/tokeniser.hh>
+#include <paludis/util/iterator.hh>
#include <paludis/qa/qa_environment.hh>
#include <set>
+#include <algorithm>
using namespace paludis;
using namespace paludis::qa;
@@ -139,8 +140,9 @@ DepFlagsCheck::operator() (const EbuildCheckData & e) const
else
{
std::set<UseFlagName> iuse;
- WhitespaceTokeniser::get_instance()->tokenise(metadata->ebuild_interface->
- iuse, create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
+ std::copy(metadata->ebuild_interface->iuse()->begin(), metadata->ebuild_interface->iuse()->end(),
+ transform_inserter(std::inserter(iuse, iuse.begin()),
+ SelectMember<IUseFlag, UseFlagName, &IUseFlag::flag>()));
iuse.insert(UseFlagName("bootstrap"));
iuse.insert(UseFlagName("build"));
diff --git a/paludis/qa/homepage_check.cc b/paludis/qa/homepage_check.cc
index 2dc7f23..99bb51f 100644
--- a/paludis/qa/homepage_check.cc
+++ b/paludis/qa/homepage_check.cc
@@ -25,6 +25,55 @@
using namespace paludis;
using namespace paludis::qa;
+namespace
+{
+ struct Checker :
+ DepSpecVisitorTypes::ConstVisitor,
+ DepSpecVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepSpec>,
+ DepSpecVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepSpec>
+ {
+ using DepSpecVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepSpec>::visit;
+ using DepSpecVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepSpec>::visit;
+
+ CheckResult & result;
+ bool found_one;
+
+ Checker(CheckResult & rr) :
+ result(rr),
+ found_one(false)
+ {
+ }
+
+ void visit(const PackageDepSpec * const)
+ {
+ result << Message(qal_major, "Got a PackageDepSpec in HOMEPAGE");
+ }
+
+ void visit(const PlainTextDepSpec * const t)
+ {
+ std::string text(t->text());
+
+ if (std::string::npos == text.find("http://") &&
+ std::string::npos == text.find("https://") &&
+ std::string::npos == text.find("ftp://"))
+ result << Message(qal_major, "HOMEPAGE part '" + text + "' doesn't look like a URL");
+
+ found_one = true;
+ }
+
+ void visit(const BlockDepSpec * const)
+ {
+ result << Message(qal_major, "Got a PackageDepSpec in HOMEPAGE");
+ }
+
+ void visit(const AnyDepSpec * const a)
+ {
+ result << Message(qal_major, "Got a || ( ) block in HOMEPAGE");
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+ };
+}
+
HomepageCheck::HomepageCheck()
{
}
@@ -42,15 +91,11 @@ HomepageCheck::operator() (const EbuildCheckData & e) const
std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- std::string homepage(metadata->homepage);
+ Checker c(result);
+ metadata->homepage()->accept(&c);
- if (homepage.empty())
+ if (! c.found_one)
result << Message(qal_major, "HOMEPAGE empty or unset");
-
- else if (std::string::npos == homepage.find("http://") &&
- std::string::npos == homepage.find("https://") &&
- std::string::npos == homepage.find("ftp://"))
- result << Message(qal_major, "HOMEPAGE doesn't look like a URL");
}
catch (const InternalError &)
{
diff --git a/paludis/qa/inherits_check.cc b/paludis/qa/inherits_check.cc
index 2d78105..5e89aba 100644
--- a/paludis/qa/inherits_check.cc
+++ b/paludis/qa/inherits_check.cc
@@ -50,10 +50,6 @@ InheritsCheck::operator() (const EbuildCheckData & e) const
std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- std::set<std::string> inherits;
- Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
- tokeniser.tokenise(metadata->ebuild_interface->inherited, std::inserter(inherits, inherits.begin()));
-
static std::set<std::string> inherits_blacklist;
if (inherits_blacklist.empty())
{
@@ -75,7 +71,7 @@ InheritsCheck::operator() (const EbuildCheckData & e) const
}
std::set<std::string> bad_inherits;
- std::set_intersection(inherits.begin(), inherits.end(),
+ std::set_intersection(metadata->ebuild_interface->inherited()->begin(), metadata->ebuild_interface->inherited()->end(),
inherits_blacklist.begin(), inherits_blacklist.end(),
std::inserter(bad_inherits, bad_inherits.begin()));
diff --git a/paludis/qa/iuse_check.cc b/paludis/qa/iuse_check.cc
index bd27f44..11cb6c3 100644
--- a/paludis/qa/iuse_check.cc
+++ b/paludis/qa/iuse_check.cc
@@ -27,7 +27,9 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/log.hh>
#include <paludis/util/system.hh>
+#include <paludis/util/iterator.hh>
#include <paludis/qa/qa_environment.hh>
+#include <algorithm>
using namespace paludis;
using namespace paludis::qa;
@@ -56,9 +58,9 @@ IuseCheck::operator() (const EbuildCheckData & e) const
try
{
std::set<UseFlagName> iuse;
- WhitespaceTokeniser::get_instance()->tokenise(metadata->ebuild_interface->
- iuse, create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
-
+ std::copy(metadata->ebuild_interface->iuse()->begin(), metadata->ebuild_interface->iuse()->end(),
+ transform_inserter(std::inserter(iuse, iuse.begin()),
+ SelectMember<IUseFlag, UseFlagName, &IUseFlag::flag>()));
static std::set<UseFlagName> iuse_blacklist;
if (iuse_blacklist.empty())
diff --git a/paludis/qa/keywords_check.cc b/paludis/qa/keywords_check.cc
index 617f22f..10a06f5 100644
--- a/paludis/qa/keywords_check.cc
+++ b/paludis/qa/keywords_check.cc
@@ -46,16 +46,11 @@ KeywordsCheck::operator() (const EbuildCheckData & e) const
try
{
- //std::set<KeywordName> keywords(metadata->begin_keywords(), metadata->end_keywords());
- std::set<KeywordName> keywords;
- WhitespaceTokeniser::get_instance()->tokenise(metadata->ebuild_interface->
- keywords_string, create_inserter<KeywordName>(std::inserter(keywords, keywords.begin())));
-
- if (keywords.end() != keywords.find(KeywordName("-*")) &&
- keywords.size() == 1)
+ if (metadata->ebuild_interface->keywords()->end() != metadata->ebuild_interface->keywords()->find(KeywordName("-*")) &&
+ metadata->ebuild_interface->keywords()->size() == 1)
result << Message(qal_major, "-* abuse (use package.mask and keyword properly)");
- else if (keywords.empty())
+ else if (metadata->ebuild_interface->keywords()->empty())
result << Message(qal_major, "KEYWORDS empty");
}
@@ -64,7 +59,7 @@ KeywordsCheck::operator() (const EbuildCheckData & e) const
result << Message(qal_major, "Bad entries in KEYWORDS");
}
- if (! metadata->ebuild_interface->eclass_keywords.empty())
+ if (! metadata->ebuild_interface->eclass_keywords()->empty())
result << Message(qal_major, "KEYWORDS was altered by an eclass");
}
catch (const InternalError &)
diff --git a/paludis/qa/license_check.cc b/paludis/qa/license_check.cc
index e3ebec1..0f20e6d 100644
--- a/paludis/qa/license_check.cc
+++ b/paludis/qa/license_check.cc
@@ -95,15 +95,10 @@ LicenseCheck::operator() (const EbuildCheckData & e) const
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- std::string license(metadata->license_interface->license_string);
-
- std::tr1::shared_ptr<const DepSpec> license_parts;
try
{
- license_parts = metadata->license_interface->license();
-
Checker checker(result, e.environment);
- license_parts->accept(&checker);
+ metadata->license_interface->license()->accept(&checker);
}
catch (const DepStringError & err)
{
diff --git a/paludis/qa/parse_deps_check.cc b/paludis/qa/parse_deps_check.cc
index 60a870d..58763fa 100644
--- a/paludis/qa/parse_deps_check.cc
+++ b/paludis/qa/parse_deps_check.cc
@@ -45,7 +45,7 @@ ParseDepsCheck::operator() (const EbuildCheckData & e) const
try
{
- std::string depend(metadata->deps_interface->build_depend_string);
+ std::string depend(metadata->deps_interface->get_raw_build_depend());
PortageDepParser::parse(depend, PortageDepParser::Policy::text_is_package_dep_spec(true,
metadata->eapi_as_package_dep_spec_parse_mode() == pds_pm_eapi_0 ?
pds_pm_eapi_0_strict : metadata->eapi_as_package_dep_spec_parse_mode()));
@@ -58,7 +58,7 @@ ParseDepsCheck::operator() (const EbuildCheckData & e) const
try
{
- std::string rdepend(metadata->deps_interface->run_depend_string);
+ std::string rdepend(metadata->deps_interface->get_raw_run_depend());
PortageDepParser::parse(rdepend, PortageDepParser::Policy::text_is_package_dep_spec(true,
metadata->eapi_as_package_dep_spec_parse_mode() == pds_pm_eapi_0 ?
pds_pm_eapi_0_strict : metadata->eapi_as_package_dep_spec_parse_mode()));
@@ -71,7 +71,7 @@ ParseDepsCheck::operator() (const EbuildCheckData & e) const
try
{
- std::string pdepend(metadata->deps_interface->post_depend_string);
+ std::string pdepend(metadata->deps_interface->get_raw_post_depend());
PortageDepParser::parse(pdepend, PortageDepParser::Policy::text_is_package_dep_spec(true,
metadata->eapi_as_package_dep_spec_parse_mode() == pds_pm_eapi_0 ?
pds_pm_eapi_0_strict : metadata->eapi_as_package_dep_spec_parse_mode()));
diff --git a/paludis/qa/restrict_check.cc b/paludis/qa/restrict_check.cc
index d8cc395..f950537 100644
--- a/paludis/qa/restrict_check.cc
+++ b/paludis/qa/restrict_check.cc
@@ -29,6 +29,49 @@
using namespace paludis;
using namespace paludis::qa;
+namespace
+{
+ struct Checker :
+ DepSpecVisitorTypes::ConstVisitor,
+ DepSpecVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepSpec>,
+ DepSpecVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepSpec>
+ {
+ using DepSpecVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepSpec>::visit;
+ using DepSpecVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepSpec>::visit;
+
+ CheckResult & result;
+ const std::set<std::string> & allowed;
+
+ Checker(CheckResult & rr, const std::set<std::string> & a) :
+ result(rr),
+ allowed(a)
+ {
+ }
+
+ void visit(const PackageDepSpec * const)
+ {
+ result << Message(qal_major, "Got a PackageDepSpec in RESTRICT");
+ }
+
+ void visit(const PlainTextDepSpec * const t)
+ {
+ if (allowed.end() == allowed.find(t->text()))
+ result << Message(qal_major, "Unrecognised RESTRICT value '" + t->text() + "'");
+ }
+
+ void visit(const BlockDepSpec * const)
+ {
+ result << Message(qal_major, "Got a PackageDepSpec in RESTRICT");
+ }
+
+ void visit(const AnyDepSpec * const a)
+ {
+ result << Message(qal_major, "Got a || ( ) block in RESTRICT");
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+ };
+}
+
RestrictCheck::RestrictCheck()
{
}
@@ -46,11 +89,6 @@ RestrictCheck::operator() (const EbuildCheckData & e) const
std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- std::set<std::string> restricts;
- Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
- tokeniser.tokenise(metadata->ebuild_interface->restrict_string,
- std::inserter(restricts, restricts.begin()));
-
static std::set<std::string> allowed_restricts;
if (allowed_restricts.empty())
{
@@ -65,15 +103,8 @@ RestrictCheck::operator() (const EbuildCheckData & e) const
allowed_restricts.insert("test");
}
- std::set<std::string> unknown;
- std::set_difference(restricts.begin(), restricts.end(),
- allowed_restricts.begin(), allowed_restricts.end(),
- std::inserter(unknown, unknown.begin()));
-
- if (! unknown.empty())
- result << Message(qal_major, "Unrecognised RESTRICT values '"
- + join(unknown.begin(), unknown.end(), "', '") + "'");
-
+ Checker c(result, allowed_restricts);
+ metadata->ebuild_interface->restrictions()->accept(&c);
}
catch (const InternalError &)
{
diff --git a/paludis/qa/src_uri_check.cc b/paludis/qa/src_uri_check.cc
index e46cd6e..7854340 100644
--- a/paludis/qa/src_uri_check.cc
+++ b/paludis/qa/src_uri_check.cc
@@ -40,12 +40,10 @@ namespace
using DepSpecVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepSpec>::visit;
CheckResult & result;
- bool fetch_restrict;
const QAEnvironment * const env;
- Checker(CheckResult & rr, bool f, const QAEnvironment * const e) :
+ Checker(CheckResult & rr, const QAEnvironment * const e) :
result(rr),
- fetch_restrict(f),
env(e)
{
}
@@ -56,11 +54,7 @@ namespace
return;
std::string::size_type p(std::string::npos);
- if (std::string::npos == ((p = a->text().find("://"))) && ! fetch_restrict)
- result << Message(qal_major, "No protocol found for '" + a->text() +
- "' and not fetch restricted");
-
- else if ((std::string::npos != p) &&
+ if ((std::string::npos != p) &&
(("http" != a->text().substr(0, p)) &&
("https" != a->text().substr(0, p)) &&
("mirror" != a->text().substr(0, p)) &&
@@ -142,22 +136,10 @@ SrcUriCheck::operator() (const EbuildCheckData & e) const
std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- std::string src_uri(metadata->ebuild_interface->src_uri_string);
-
- std::tr1::shared_ptr<const DepSpec> src_uri_parts;
try
{
- src_uri_parts = PortageDepParser::parse(src_uri,
- PortageDepParser::Policy::text_is_text_dep_spec(false));
-
- std::set<std::string> restricts;
- Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
- tokeniser.tokenise(metadata->ebuild_interface->restrict_string,
- std::inserter(restricts, restricts.begin()));
-
- bool fetch_restrict(restricts.end() != restricts.find("fetch"));
- Checker checker(result, fetch_restrict, e.environment);
- src_uri_parts->accept(&checker);
+ Checker checker(result, e.environment);
+ metadata->ebuild_interface->src_uri()->accept(&checker);
}
catch (const DepStringError & err)
{
diff --git a/paludis/repositories/cran/cran_description.cc b/paludis/repositories/cran/cran_description.cc
index d3f4658..4f9268c 100644
--- a/paludis/repositories/cran/cran_description.cc
+++ b/paludis/repositories/cran/cran_description.cc
@@ -47,7 +47,7 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f, bool
// Fill in default values
metadata->slot = SlotName("0");
- metadata->cran_interface->keywords_string = std::string("*");
+ metadata->cran_interface->set_keywords("*");
metadata->eapi = "CRAN-1";
std::string key;
@@ -70,7 +70,7 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f, bool
if (("Package" == key) || ("Bundle" == key))
{
metadata->cran_interface->package = value;
- metadata->homepage = "http://cran.r-project.org/src/contrib/Descriptions/" + value + ".html";
+ metadata->set_homepage("http://cran.r-project.org/src/contrib/Descriptions/" + value + ".html");
if ("Package" == key)
{
CRANDescription::normalise_name(value);
@@ -99,11 +99,11 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f, bool
value = "R";
else
value.append(", R");
- metadata->deps_interface->build_depend_string = value;
- metadata->deps_interface->run_depend_string = value;
+ metadata->deps_interface->set_build_depend(value);
+ metadata->deps_interface->set_run_depend(value);
}
else if ("Suggests" == key)
- metadata->deps_interface->suggested_depend_string = value;
+ metadata->deps_interface->set_suggested_depend(value);
}
}
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index c083ef4..95e4f22 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -354,13 +354,13 @@ CRANRepository::need_packages() const
CRANDescription d(*i, FSEntry(_imp->location / std::string(last_package_name + ".DESCRIPTION")), false);
- std::string dep(d.metadata->deps_interface->build_depend_string);
+ std::string dep(d.metadata->deps_interface->get_raw_build_depend());
std::string pkg(d.metadata->cran_interface->package);
if ("" == dep)
dep = pkg;
else
dep += "," + pkg;
- d.metadata->deps_interface->build_depend_string = dep;
+ d.metadata->deps_interface->set_build_depend(dep);
d.metadata->cran_interface->is_bundle_member = true;
_imp->package_names[d.name] = true;
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 4db9a5c..6eb12b2 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -100,8 +100,8 @@ FakeInstalledRepository::provided_package_version_metadata(const RepositoryProvi
m->slot, PackageDatabaseEntry(p.provided_by_name, p.version, name())));
result->eapi = m->eapi;
- result->deps_interface->build_depend_string = stringify(p.provided_by_name);
- result->deps_interface->run_depend_string = stringify(p.provided_by_name);
+ result->deps_interface->set_build_depend(stringify(p.provided_by_name));
+ result->deps_interface->set_run_depend(stringify(p.provided_by_name));
return result;
}
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 1331dab..8a99e2b 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -75,10 +75,10 @@ FakeRepository::virtual_package_version_metadata(
m->slot, PackageDatabaseEntry(*p.provided_by_spec->package_ptr(), v, name())));
result->eapi = m->eapi;
- result->deps_interface->build_depend_string = "=" + stringify(*p.provided_by_spec->package_ptr())
- + "-" + stringify(v);
- result->deps_interface->run_depend_string = "=" + stringify(*p.provided_by_spec->package_ptr())
- + "-" + stringify(v);
+ result->deps_interface->set_build_depend("=" + stringify(*p.provided_by_spec->package_ptr())
+ + "-" + stringify(v));
+ result->deps_interface->set_run_depend("=" + stringify(*p.provided_by_spec->package_ptr())
+ + "-" + stringify(v));
return result;
}
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index 78941e4..3499b64 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -305,7 +305,7 @@ FakeVersionMetadata::FakeVersionMetadata() :
VersionMetadataDepsInterface(&PortageDepParser::parse_depend),
VersionMetadataLicenseInterface(&PortageDepParser::parse_license)
{
- keywords_string = "test";
+ set_keywords("test");
}
FakeVersionMetadata::~FakeVersionMetadata()
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index 48329a7..3be4ea6 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -70,7 +70,7 @@ namespace paludis
g != g_end ; ++g)
{
std::tr1::shared_ptr<VersionMetadata> m(new GemsVersionMetadata(g->version));
- m->homepage = g->homepage;
+ m->set_homepage(g->homepage);
if (g->description.empty())
m->description = g->summary;
else
diff --git a/paludis/repositories/gentoo/ebin_entries.cc b/paludis/repositories/gentoo/ebin_entries.cc
index 3d82c4c..3084677 100644
--- a/paludis/repositories/gentoo/ebin_entries.cc
+++ b/paludis/repositories/gentoo/ebin_entries.cc
@@ -27,6 +27,8 @@
#include <paludis/util/strip.hh>
#include <paludis/util/log.hh>
#include <paludis/util/system.hh>
+#include <paludis/util/join.hh>
+#include <paludis/dep_spec_pretty_printer.hh>
#include <set>
#include <fstream>
@@ -75,28 +77,28 @@ EbinEntries::generate_version_metadata(const QualifiedPackageName & q,
KeyValueConfigFileOptions() + kvcfo_disallow_continuations + kvcfo_disallow_comments +
kvcfo_disallow_space_around_equals + kvcfo_disallow_source);
- result->run_depend_string = f.get("RDEPEND");
- result->post_depend_string = f.get("PDEPEND");
- result->suggested_depend_string = f.get("SDEPEND");
+ result->set_run_depend(f.get("RDEPEND"));
+ result->set_post_depend(f.get("PDEPEND"));
+ result->set_suggested_depend(f.get("SDEPEND"));
- result->license_string = f.get("LICENSE");
+ result->set_license(f.get("LICENSE"));
result->source.reset();
result->binary.reset();
result->slot = SlotName(f.get("SLOT"));
- result->homepage = f.get("HOMEPAGE");
+ result->set_homepage(f.get("HOMEPAGE"));
result->description = f.get("DESCRIPTION");
result->eapi = f.get("EAPI");
- result->provide_string = f.get("PROVIDE");
- result->src_uri_string = f.get("SRC_URI");
- result->restrict_string = f.get("RESTRICT");
- result->keywords_string = f.get("KEYWORDS");
- result->iuse = f.get("IUSE");
- result->inherited = f.get("INHERITED");
+ result->set_provide(f.get("PROVIDE"));
+ result->set_src_uri(f.get("SRC_URI"));
+ result->set_restrictions(f.get("RESTRICT"));
+ result->set_keywords(f.get("KEYWORDS"));
+ result->set_iuse(f.get("IUSE"));
+ result->set_inherited(f.get("INHERITED"));
- result->bin_uri_string = f.get("BIN_URI");
+ result->set_bin_uri(f.get("BIN_URI"));
return result;
}
@@ -371,27 +373,44 @@ EbinEntries::merge(const MergeOptions & m)
if (metadata->deps_interface)
{
- ebin_file << "RDEPEND=" << metadata->deps_interface->run_depend_string << std::endl;
- ebin_file << "PDEPEND=" << metadata->deps_interface->post_depend_string << std::endl;
- ebin_file << "SDEPEND=" << metadata->deps_interface->suggested_depend_string << std::endl;
+ DepSpecPrettyPrinter r(0, false), p(0, false), s(0, false);
+ metadata->deps_interface->run_depend()->accept(&r);
+ metadata->deps_interface->post_depend()->accept(&p);
+ metadata->deps_interface->suggested_depend()->accept(&s);
+ ebin_file << "RDEPEND=" << r << std::endl;
+ ebin_file << "PDEPEND=" << p << std::endl;
+ ebin_file << "SDEPEND=" << s << std::endl;
}
if (metadata->license_interface)
- ebin_file << "LICENSE=" << metadata->license_interface->license_string << std::endl;
+ {
+ DepSpecPrettyPrinter l(0, false);
+ metadata->license_interface->license()->accept(&l);
+ ebin_file << "LICENSE=" << l << std::endl;
+ }
ebin_file << "SLOT=" << metadata->slot << std::endl;
- ebin_file << "HOMEPAGE=" << metadata->homepage << std::endl;
+ DepSpecPrettyPrinter h(0, false);
+ metadata->homepage()->accept(&h);
+ ebin_file << "HOMEPAGE=" << h << std::endl;
ebin_file << "DESCRIPTION=" << metadata->description << std::endl;
ebin_file << "EAPI=" << metadata->eapi << std::endl;
if (metadata->ebuild_interface)
{
- ebin_file << "PROVIDE=" << metadata->ebuild_interface->provide_string << std::endl;
- ebin_file << "SRC_URI=" << metadata->ebuild_interface->src_uri_string << std::endl;
- ebin_file << "RESTRICT=" << metadata->ebuild_interface->restrict_string << std::endl;
- ebin_file << "KEYWORDS=" << metadata->ebuild_interface->keywords_string << std::endl;
- ebin_file << "IUSE=" << metadata->ebuild_interface->iuse << std::endl;
- ebin_file << "INHERITED=" << metadata->ebuild_interface->inherited << std::endl;
+ DepSpecPrettyPrinter p(0, false), s(0, false), r(0, false);
+ metadata->ebuild_interface->provide()->accept(&p);
+ metadata->ebuild_interface->src_uri()->accept(&s);
+ metadata->ebuild_interface->restrictions()->accept(&r);
+ ebin_file << "PROVIDE=" << p << std::endl;
+ ebin_file << "SRC_URI=" << s << std::endl;
+ ebin_file << "RESTRICT=" << r << std::endl;
+ ebin_file << "KEYWORDS=" << join(metadata->ebuild_interface->keywords()->begin(),
+ metadata->ebuild_interface->keywords()->end(), " ") << std::endl;
+ ebin_file << "IUSE=" << join(metadata->ebuild_interface->iuse()->begin(),
+ metadata->ebuild_interface->iuse()->end(), " ") << std::endl;
+ ebin_file << "INHERITED=" << join(metadata->ebuild_interface->inherited()->begin(),
+ metadata->ebuild_interface->inherited()->end(), " ") << std::endl;
}
FSEntry pkg_file_name(_imp->params.pkgdir / (
diff --git a/paludis/repositories/gentoo/ebuild.cc b/paludis/repositories/gentoo/ebuild.cc
index ce8d325..663f7f3 100644
--- a/paludis/repositories/gentoo/ebuild.cc
+++ b/paludis/repositories/gentoo/ebuild.cc
@@ -194,20 +194,20 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
bool ok(false);
try
{
- _metadata->build_depend_string = f.get("DEPEND");
- _metadata->run_depend_string = f.get("RDEPEND");
+ _metadata->set_build_depend(f.get("DEPEND"));
+ _metadata->set_run_depend(f.get("RDEPEND"));
_metadata->slot = SlotName(f.get("SLOT"));
- _metadata->src_uri_string = f.get("SRC_URI");
- _metadata->restrict_string = f.get("RESTRICT");
- _metadata->homepage = f.get("HOMEPAGE");
- _metadata->license_interface->license_string = f.get("LICENSE");
+ _metadata->set_src_uri(f.get("SRC_URI"));
+ _metadata->set_restrictions(f.get("RESTRICT"));
+ _metadata->set_homepage(f.get("HOMEPAGE"));
+ _metadata->license_interface->set_license(f.get("LICENSE"));
_metadata->description = f.get("DESCRIPTION");
- _metadata->keywords_string = f.get("KEYWORDS");
- _metadata->eclass_keywords = f.get("E_KEYWORDS");
- _metadata->inherited = f.get("INHERITED");
- _metadata->iuse = f.get("IUSE");
- _metadata->post_depend_string = f.get("PDEPEND");
- _metadata->provide_string = f.get("PROVIDE");
+ _metadata->set_keywords(f.get("KEYWORDS"));
+ _metadata->set_eclass_keywords(f.get("E_KEYWORDS"));
+ _metadata->set_inherited(f.get("INHERITED"));
+ _metadata->set_iuse(f.get("IUSE"));
+ _metadata->set_post_depend(f.get("PDEPEND"));
+ _metadata->set_provide(f.get("PROVIDE"));
_metadata->eapi = f.get("EAPI");
if (0 == prog.exit_status())
diff --git a/paludis/repositories/gentoo/ebuild_entries.cc b/paludis/repositories/gentoo/ebuild_entries.cc
index 4e3976b..731ca3b 100644
--- a/paludis/repositories/gentoo/ebuild_entries.cc
+++ b/paludis/repositories/gentoo/ebuild_entries.cc
@@ -38,6 +38,8 @@
#include <set>
#include <sys/types.h>
#include <grp.h>
+#include <tr1/functional>
+#include <functional>
using namespace paludis;
@@ -247,6 +249,8 @@ void
EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
const InstallOptions & o, std::tr1::shared_ptr<const PortageRepositoryProfile> p) const
{
+ using namespace std::tr1::placeholders;
+
Context context("When installing '" + stringify(q) + "-" + stringify(v) + "':");
if (! _imp->portage_repository->has_version(q, v))
@@ -261,15 +265,24 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
bool fetch_restrict(false), no_mirror(false), userpriv_restrict;
{
- std::list<std::string> restricts;
- WhitespaceTokeniser::get_instance()->tokenise(
- metadata->ebuild_interface->restrict_string, std::back_inserter(restricts));
- fetch_restrict = (restricts.end() != std::find(restricts.begin(), restricts.end(), "fetch")) ||
- (restricts.end() != std::find(restricts.begin(), restricts.end(), "nofetch"));
- userpriv_restrict = (restricts.end() != std::find(restricts.begin(), restricts.end(), "userpriv")) ||
- (restricts.end() != std::find(restricts.begin(), restricts.end(), "nouserpriv"));
- no_mirror = (restricts.end() != std::find(restricts.begin(), restricts.end(), "mirror")) ||
- (restricts.end() != std::find(restricts.begin(), restricts.end(), "nomirror"));
+ DepSpecFlattener restricts(_imp->params.environment, &e, metadata->ebuild_interface->restrictions());
+ fetch_restrict =
+ restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ std::tr1::bind(std::equal_to<std::string>(), std::tr1::bind(std::tr1::mem_fn(&StringDepSpec::text), _1), "fetch")) ||
+ restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ std::tr1::bind(std::equal_to<std::string>(), std::tr1::bind(std::tr1::mem_fn(&StringDepSpec::text), _1), "nofetch"));
+
+ userpriv_restrict =
+ restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ std::tr1::bind(std::equal_to<std::string>(), std::tr1::bind(std::tr1::mem_fn(&StringDepSpec::text), _1), "userpriv")) ||
+ restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ std::tr1::bind(std::equal_to<std::string>(), std::tr1::bind(std::tr1::mem_fn(&StringDepSpec::text), _1), "nouserpriv"));
+
+ no_mirror =
+ restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ std::tr1::bind(std::equal_to<std::string>(), std::tr1::bind(std::tr1::mem_fn(&StringDepSpec::text), _1), "mirror")) ||
+ restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ std::tr1::bind(std::equal_to<std::string>(), std::tr1::bind(std::tr1::mem_fn(&StringDepSpec::text), _1), "nomirror"));
}
std::string archives, all_archives, flat_src_uri;
@@ -389,15 +402,10 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
/* make use */
std::string use;
- {
- std::set<UseFlagName> iuse;
- WhitespaceTokeniser::get_instance()->tokenise(metadata->ebuild_interface->
- 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->params.environment->query_use(*iuse_it, e))
- use += (*iuse_it).data() + " ";
- }
+ for (IUseFlagCollection::Iterator i(metadata->ebuild_interface->iuse()->begin()),
+ i_end(metadata->ebuild_interface->iuse()->end()) ; i != i_end ; ++i)
+ if (_imp->params.environment->query_use(i->flag, e))
+ use += stringify(i->flag) + " ";
use += p->environment_variable("ARCH") + " ";
diff --git a/paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc b/paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc
index d5a379e..2edb530 100644
--- a/paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc
@@ -21,9 +21,13 @@
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/join.hh>
+#include <paludis/dep_spec_pretty_printer.hh>
#include <fstream>
#include <set>
#include <list>
+#include <tr1/functional>
+#include <functional>
+#include <algorithm>
using namespace paludis;
@@ -40,6 +44,8 @@ EbuildFlatMetadataCache::EbuildFlatMetadataCache(const FSEntry & f,
bool
EbuildFlatMetadataCache::load(std::tr1::shared_ptr<EbuildVersionMetadata> result)
{
+ using namespace std::tr1::placeholders;
+
Context context("When loading version metadata to '" + stringify(_filename) + "':");
std::ifstream cache(stringify(_filename).c_str());
@@ -47,43 +53,28 @@ EbuildFlatMetadataCache::load(std::tr1::shared_ptr<EbuildVersionMetadata> result
if (cache)
{
- std::getline(cache, line); result->build_depend_string = line;
- std::getline(cache, line); result->run_depend_string = line;
+ std::getline(cache, line); result->set_build_depend(line);
+ std::getline(cache, line); result->set_run_depend(line);
std::getline(cache, line); result->slot = SlotName(line);
- std::getline(cache, line); result->src_uri_string = line;
- std::getline(cache, line); result->restrict_string = line;
- std::getline(cache, line); result->homepage = line;
- std::getline(cache, line); result->license_string = line;
+ std::getline(cache, line); result->set_src_uri(line);
+ std::getline(cache, line); result->set_restrictions(line);
+ std::getline(cache, line); result->set_homepage(line);
+ std::getline(cache, line); result->set_license(line);
std::getline(cache, line); result->description = line;
- std::getline(cache, line); result->keywords_string = line;
- std::getline(cache, line); result->inherited = line;
- std::getline(cache, line); result->iuse = line;
+ std::getline(cache, line); result->set_keywords(line);
+ std::getline(cache, line); result->set_inherited(line);
+ std::getline(cache, line); result->set_iuse(line);
std::getline(cache, line);
- std::getline(cache, line); result->post_depend_string = line;
- std::getline(cache, line); result->provide_string = line;
+ std::getline(cache, line); result->set_post_depend(line);
+ std::getline(cache, line); result->set_provide(line);
std::getline(cache, line); result->eapi = line;
// check mtimes
time_t cache_time(std::max(_master_mtime, _filename.mtime()));
- bool ok = true;
-
- if (_ebuild.mtime() > cache_time)
- ok = false;
- else
- {
- std::set<std::string> inherits;
- WhitespaceTokeniser::get_instance()->tokenise(
- stringify(result->inherited),
- std::inserter(inherits, inherits.end()));
-
- for (std::set<std::string>::const_iterator i(inherits.begin()),
- i_end(inherits.end()) ; i != i_end ; ++i)
- if (_eclass_mtimes->mtime(*i) > cache_time)
- {
- ok = false;
- break;
- }
- }
+ bool ok = _ebuild.mtime() <= cache_time &&
+ result->inherited()->end() == std::find_if(result->inherited()->begin(), result->inherited()->end(),
+ std::tr1::bind(std::greater<time_t>(), std::tr1::bind(
+ std::tr1::mem_fn(&EclassMtimes::mtime), _eclass_mtimes.get(), _1), cache_time));
if (! ok)
Log::get_instance()->message(ll_warning, lc_no_context, "Stale cache file at '"
@@ -108,6 +99,13 @@ namespace
WhitespaceTokeniser::get_instance()->tokenise(stringify(s), std::back_inserter(tokens));
return join(tokens.begin(), tokens.end(), " ");
}
+
+ std::string normalise(std::tr1::shared_ptr<const DepSpec> d)
+ {
+ DepSpecPrettyPrinter p(0, false);
+ d->accept(&p);
+ return stringify(p);
+ }
}
void
@@ -128,20 +126,20 @@ EbuildFlatMetadataCache::save(std::tr1::shared_ptr<const EbuildVersionMetadata>
if (cache)
{
- cache << normalise(v->build_depend_string) << std::endl;
- cache << normalise(v->run_depend_string) << std::endl;
+ cache << normalise(v->build_depend()) << std::endl;
+ cache << normalise(v->run_depend()) << std::endl;
cache << normalise(v->slot) << std::endl;
- cache << normalise(v->src_uri_string) << std::endl;
- cache << normalise(v->restrict_string) << std::endl;
- cache << normalise(v->homepage) << std::endl;
- cache << normalise(v->license_string) << std::endl;
+ cache << normalise(v->src_uri()) << std::endl;
+ cache << normalise(v->restrictions()) << std::endl;
+ cache << normalise(v->homepage()) << std::endl;
+ cache << normalise(v->license()) << std::endl;
cache << normalise(v->description) << std::endl;
- cache << normalise(v->keywords_string) << std::endl;
- cache << normalise(v->inherited) << std::endl;
- cache << normalise(v->iuse) << std::endl;
+ cache << join(v->keywords()->begin(), v->keywords()->end(), " ") << std::endl;
+ cache << join(v->inherited()->begin(), v->inherited()->end(), " ") << std::endl;
+ cache << join(v->iuse()->begin(), v->iuse()->end(), " ") << std::endl;
cache << std::endl;
- cache << normalise(v->post_depend_string) << std::endl;
- cache << normalise(v->provide_string) << std::endl;
+ cache << normalise(v->post_depend()) << std::endl;
+ cache << normalise(v->provide()) << std::endl;
cache << normalise(v->eapi) << std::endl;
}
else
diff --git a/paludis/repositories/gentoo/portage_repository.cc b/paludis/repositories/gentoo/portage_repository.cc
index 5d1300c..68bf5ab 100644
--- a/paludis/repositories/gentoo/portage_repository.cc
+++ b/paludis/repositories/gentoo/portage_repository.cc
@@ -1067,8 +1067,8 @@ PortageRepository::virtual_package_version_metadata(const RepositoryVirtualsEntr
m->slot, PackageDatabaseEntry(*p.provided_by_spec->package_ptr(), v, name())));
result->eapi = m->eapi;
- result->build_depend_string = "=" + stringify(*p.provided_by_spec->package_ptr()) + "-" + stringify(v);
- result->run_depend_string = "=" + stringify(*p.provided_by_spec->package_ptr()) + "-" + stringify(v);
+ result->set_build_depend("=" + stringify(*p.provided_by_spec->package_ptr()) + "-" + stringify(v));
+ result->set_run_depend("=" + stringify(*p.provided_by_spec->package_ptr()) + "-" + stringify(v));
return result;
diff --git a/paludis/repositories/gentoo/vdb_repository.cc b/paludis/repositories/gentoo/vdb_repository.cc
index e143e51..49db7f1 100644
--- a/paludis/repositories/gentoo/vdb_repository.cc
+++ b/paludis/repositories/gentoo/vdb_repository.cc
@@ -24,6 +24,7 @@
#include <paludis/dep_spec.hh>
#include <paludis/dep_spec_flattener.hh>
+#include <paludis/dep_spec_pretty_printer.hh>
#include <paludis/repositories/gentoo/ebuild.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/hashed_containers.hh>
@@ -432,36 +433,36 @@ namespace paludis
{
Context local_context("When loading key 'DEPEND':");
- p->metadata->build_depend_string = file_contents(location, p->name, p->version, "DEPEND");
+ p->metadata->set_build_depend(file_contents(location, p->name, p->version, "DEPEND"));
}
{
Context local_context("When loading key 'RDEPEND':");
- p->metadata->run_depend_string = file_contents(location, p->name, p->version, "RDEPEND");
+ p->metadata->set_run_depend(file_contents(location, p->name, p->version, "RDEPEND"));
}
{
Context local_context("When loading key 'LICENSE':");
- p->metadata->license_string = file_contents(location, p->name, p->version, "LICENSE");
+ p->metadata->set_license(file_contents(location, p->name, p->version, "LICENSE"));
}
- p->metadata->keywords_string = "*";
+ p->metadata->set_keywords("*");
{
Context local_context("When loading key 'INHERITED':");
- p->metadata->inherited = file_contents(location, p->name, p->version, "INHERITED");
+ p->metadata->set_inherited(file_contents(location, p->name, p->version, "INHERITED"));
}
{
Context local_context("When loading key 'IUSE':");
- p->metadata->iuse = file_contents(location, p->name, p->version, "IUSE");
+ p->metadata->set_iuse(file_contents(location, p->name, p->version, "IUSE"));
}
{
Context local_context("When loading key 'PDEPEND':");
- p->metadata->post_depend_string = file_contents(location, p->name, p->version, "PDEPEND");
+ p->metadata->set_post_depend(file_contents(location, p->name, p->version, "PDEPEND"));
}
{
Context local_context("When loading key 'PROVIDE':");
- p->metadata->provide_string = file_contents(location, p->name, p->version, "PROVIDE");
+ p->metadata->set_provide(file_contents(location, p->name, p->version, "PROVIDE"));
}
{
Context local_context("When loading key 'SRC_URI':");
- p->metadata->src_uri_string = file_contents(location, p->name, p->version, "SRC_URI");
+ p->metadata->set_src_uri(file_contents(location, p->name, p->version, "SRC_URI"));
}
{
Context local_context("When loading key 'EAPI':");
@@ -469,7 +470,7 @@ namespace paludis
}
{
Context local_context("When loading key 'HOMEPAGE':");
- p->metadata->homepage = file_contents(location, p->name, p->version, "HOMEPAGE");
+ p->metadata->set_homepage(file_contents(location, p->name, p->version, "HOMEPAGE"));
}
{
Context local_context("When loading key 'DESCRIPTION':");
@@ -1239,8 +1240,8 @@ VDBRepository::provided_package_version_metadata(const RepositoryProvidesEntry &
m->slot, PackageDatabaseEntry(p.provided_by_name, p.version, name())));
result->eapi = m->eapi;
- result->build_depend_string = stringify(p.provided_by_name);
- result->run_depend_string = stringify(p.provided_by_name);
+ result->set_build_depend(stringify(p.provided_by_name));
+ result->set_run_depend(stringify(p.provided_by_name));
return result;
}
@@ -1352,19 +1353,13 @@ VDBRepository::load_provided_the_slow_way() const
try
{
- std::string provide_str;
+ std::tr1::shared_ptr<const DepSpec> provide;
if (e->metadata)
- provide_str = e->metadata->ebuild_interface->provide_string;
+ provide = e->metadata->ebuild_interface->provide();
else
- {
- // _imp->load_entry(e); slow
- provide_str = file_contents(_imp->location, e->name, e->version, "PROVIDE");
- }
- if (provide_str.empty())
- continue;
+ provide = PortageDepParser::parse(file_contents(_imp->location, e->name, e->version, "PROVIDE"),
+ PortageDepParser::Policy::text_is_package_dep_spec(false, pds_pm_permissive));
- std::tr1::shared_ptr<const DepSpec> provide(PortageDepParser::parse(provide_str,
- PortageDepParser::Policy::text_is_package_dep_spec(false, pds_pm_permissive)));
PackageDatabaseEntry dbe(e->name, e->version, name());
DepSpecFlattener f(_imp->env, &dbe, provide);
@@ -1437,13 +1432,16 @@ VDBRepository::regenerate_provides_cache() const
for (std::vector<VDBEntry>::const_iterator c(_imp->entries.begin()), c_end(_imp->entries.end()) ;
c != c_end ; ++c)
{
- std::string provide_str;
+ std::tr1::shared_ptr<const DepSpec> provide;
if (c->metadata)
- provide_str = c->metadata->ebuild_interface->provide_string;
+ provide = c->metadata->ebuild_interface->provide();
else
- provide_str = file_contents(_imp->location, c->name, c->version, "PROVIDE");
+ provide = PortageDepParser::parse(file_contents(_imp->location, c->name, c->version, "PROVIDE"),
+ PortageDepParser::Policy::text_is_package_dep_spec(false, pds_pm_permissive));
- provide_str = strip_leading(strip_trailing(provide_str, " \t\r\n"), " \t\r\n");
+ DepSpecPrettyPrinter p(0, false);
+ provide->accept(&p);
+ std::string provide_str(strip_leading(strip_trailing(stringify(p), " \t\r\n"), " \t\r\n"));
if (provide_str.empty())
continue;
diff --git a/paludis/util/iterator.hh b/paludis/util/iterator.hh
index 30ed9be..9d3db7a 100644
--- a/paludis/util/iterator.hh
+++ b/paludis/util/iterator.hh
@@ -426,35 +426,41 @@ namespace paludis
}
/**
- * Convenience class: select the first item of a pair.
+ * Convenience class: select a member of a class.
*
* \ingroup grpiterators
*/
- template <typename A_, typename B_>
- struct SelectFirst :
- std::unary_function<std::pair<A_, B_>, A_ >
+ template <typename T_, typename M_, M_ T_::* m_>
+ struct SelectMember :
+ std::unary_function<T_, M_>
{
/// Carry out the selection.
- A_ operator() (const std::pair<A_, B_> & p) const
+ M_ operator() (const T_ & p) const
{
- return p.first;
+ return p.*m_;
}
};
/**
+ * Convenience class: select the first item of a pair.
+ *
+ * \ingroup grpiterators
+ */
+ template <typename A_, typename B_>
+ struct SelectFirst :
+ SelectMember<std::pair<A_, B_>, A_, &std::pair<A_, B_>::first>
+ {
+ };
+
+ /**
* Convenience class: select the second item of a pair.
*
* \ingroup grpiterators
*/
template <typename A_, typename B_>
struct SelectSecond :
- std::unary_function<std::pair<A_, B_>, B_ >
+ SelectMember<std::pair<A_, B_>, B_, &std::pair<A_, B_>::second>
{
- /// Carry out the selection.
- B_ operator() (const std::pair<A_, B_> & p) const
- {
- return p.second;
- }
};
/**
diff --git a/paludis/version_metadata.cc b/paludis/version_metadata.cc
index 87c72b7..3f7de4b 100644
--- a/paludis/version_metadata.cc
+++ b/paludis/version_metadata.cc
@@ -34,130 +34,134 @@ using namespace paludis;
#include <paludis/version_metadata-sr.cc>
-std::tr1::shared_ptr<const DepSpec>
-VersionMetadataDepsInterface::build_depend() const
+VersionMetadataDepsInterface::VersionMetadataDepsInterface(const DepParserFunction & p) :
+ parser(p)
{
- return parser(build_depend_string, version_metadata()->eapi_as_package_dep_spec_parse_mode());
}
-std::tr1::shared_ptr<const DepSpec>
-VersionMetadataDepsInterface::run_depend() const
+VersionMetadata::~VersionMetadata()
{
- return parser(run_depend_string, version_metadata()->eapi_as_package_dep_spec_parse_mode());
}
-std::tr1::shared_ptr<const DepSpec>
-VersionMetadataDepsInterface::post_depend() const
+VersionMetadata::VersionMetadata(const VersionMetadataBase::NamedArguments<> & base, const VersionMetadataCapabilities & caps) :
+ VersionMetadataBase(base),
+ VersionMetadataCapabilities(caps)
{
- return parser(post_depend_string, version_metadata()->eapi_as_package_dep_spec_parse_mode());
}
-std::tr1::shared_ptr<const DepSpec>
-VersionMetadataDepsInterface::suggested_depend() const
+VersionMetadataOriginsInterface::VersionMetadataOriginsInterface()
{
- return parser(suggested_depend_string, version_metadata()->eapi_as_package_dep_spec_parse_mode());
}
-std::tr1::shared_ptr<const DepSpec>
-VersionMetadataEbuildInterface::src_uri() const
+VersionMetadataLicenseInterface::VersionMetadataLicenseInterface(const TextParserFunction & f) :
+ parser(f)
{
- return PortageDepParser::parse(src_uri_string,
- PortageDepParser::Policy::text_is_text_dep_spec(false));
}
-std::tr1::shared_ptr<const DepSpec>
-VersionMetadataEbinInterface::bin_uri() const
+VersionMetadataEbuildInterface::VersionMetadataEbuildInterface()
{
- return PortageDepParser::parse(bin_uri_string,
- PortageDepParser::Policy::text_is_text_dep_spec(false));
}
-std::tr1::shared_ptr<const KeywordNameCollection>
-VersionMetadataEbuildInterface::keywords() const
+VersionMetadataEbinInterface::VersionMetadataEbinInterface()
{
- Context context("When splitting up keyword string '" + keywords_string + "':");
-
- std::tr1::shared_ptr<KeywordNameCollection> result(new KeywordNameCollection::Concrete);
- WhitespaceTokeniser::get_instance()->tokenise(keywords_string,
- create_inserter<KeywordName>(result->inserter()));
- return result;
}
-std::tr1::shared_ptr<const KeywordNameCollection>
-VersionMetadataCRANInterface::keywords() const
+VersionMetadataHasInterfaces::VersionMetadataHasInterfaces()
{
- Context context("When splitting up keyword string '" + keywords_string + "':");
-
- std::tr1::shared_ptr<KeywordNameCollection> result(new KeywordNameCollection::Concrete);
- WhitespaceTokeniser::get_instance()->tokenise(keywords_string,
- create_inserter<KeywordName>(result->inserter()));
- return result;
}
-VersionMetadataDepsInterface::VersionMetadataDepsInterface(const DepParserFunction & p) :
- parser(p)
+VersionMetadataHasInterfaces::~VersionMetadataHasInterfaces()
{
}
-VersionMetadata::~VersionMetadata()
+PackageDepSpecParseMode
+VersionMetadata::eapi_as_package_dep_spec_parse_mode() const
{
+ if (eapi == "0" || eapi == "")
+ return pds_pm_eapi_0;
+ else if (eapi == "CRAN-1" || eapi == "paludis-1")
+ return pds_pm_permissive;
+ else
+ {
+ Log::get_instance()->message(ll_warning, lc_context,
+ "BUG! Don't know what parse mode to use for EAPI '" + stringify(eapi) + "'");
+ return pds_pm_permissive;
+ }
}
-VersionMetadata::VersionMetadata(const VersionMetadataBase::NamedArguments<> & base, const VersionMetadataCapabilities & caps) :
- VersionMetadataBase(base),
- VersionMetadataCapabilities(caps)
+IUseFlagParseMode
+VersionMetadata::eapi_as_iuse_flag_parse_mode() const
{
+ if (eapi == "0" || eapi == "")
+ return iuse_pm_eapi_0;
+ else if (eapi == "CRAN-1" || eapi == "paludis-1")
+ return iuse_pm_permissive;
+ else
+ {
+ Log::get_instance()->message(ll_warning, lc_context,
+ "BUG! Don't know what parse mode to use for EAPI '" + stringify(eapi) + "'");
+ return iuse_pm_permissive;
+ }
}
std::tr1::shared_ptr<const DepSpec>
-VersionMetadataEbuildInterface::provide() const
-{
- return PortageDepParser::parse(provide_string, PortageDepParser::Policy::text_is_package_dep_spec(
- false, version_metadata()->eapi_as_package_dep_spec_parse_mode()));}
-
-VersionMetadataOriginsInterface::VersionMetadataOriginsInterface()
+VersionMetadataDepsInterface::_make_depend(const std::string & s) const
{
+ return parser(s, version_metadata()->eapi_as_package_dep_spec_parse_mode());
}
-VersionMetadataLicenseInterface::VersionMetadataLicenseInterface(const TextParserFunction & f) :
- parser(f)
+std::tr1::shared_ptr<const DepSpec>
+VersionMetadataLicenseInterface::_make_license(const std::string & s) const
{
+ return parser(s);
}
std::tr1::shared_ptr<const DepSpec>
-VersionMetadataLicenseInterface::license() const
+VersionMetadataBase::_make_text(const std::string & s) const
{
- return parser(license_string);
+ return PortageDepParser::parse(s, PortageDepParser::Policy::text_is_text_dep_spec(false));
}
-VersionMetadataEbuildInterface::VersionMetadataEbuildInterface()
+std::tr1::shared_ptr<const DepSpec>
+VersionMetadataEbuildInterface::_make_text(const std::string & s) const
{
+ return PortageDepParser::parse(s, PortageDepParser::Policy::text_is_text_dep_spec(false));
}
-VersionMetadataEbinInterface::VersionMetadataEbinInterface()
+template <typename Item_, typename Container_>
+std::tr1::shared_ptr<const Container_>
+VersionMetadataEbuildInterface::_make_collection(const std::string & s) const
{
+ std::tr1::shared_ptr<Container_> result(new typename Container_::Concrete);
+ WhitespaceTokeniser::get_instance()->tokenise(s, create_inserter<Item_>(result->inserter()));
+ return result;
}
-VersionMetadataHasInterfaces::VersionMetadataHasInterfaces()
+std::tr1::shared_ptr<const IUseFlagCollection>
+VersionMetadataEbuildInterface::_make_iuse_collection(const std::string & s) const
{
+ std::tr1::shared_ptr<IUseFlagCollection> result(new IUseFlagCollection::Concrete);
+ std::list<std::string> t;
+ WhitespaceTokeniser::get_instance()->tokenise(s, std::back_inserter(t));
+ for (std::list<std::string>::const_iterator u(t.begin()), u_end(t.end()) ;
+ u != u_end ; ++u)
+ result->insert(IUseFlag(*u, version_metadata()->eapi_as_iuse_flag_parse_mode()));
+ return result;
}
-VersionMetadataHasInterfaces::~VersionMetadataHasInterfaces()
+std::tr1::shared_ptr<const DepSpec>
+VersionMetadataEbinInterface::_make_text(const std::string & s) const
{
+ return PortageDepParser::parse(s, PortageDepParser::Policy::text_is_text_dep_spec(false));
}
-PackageDepSpecParseMode
-VersionMetadata::eapi_as_package_dep_spec_parse_mode() const
+template <typename Item_, typename Container_>
+std::tr1::shared_ptr<const Container_>
+VersionMetadataCRANInterface::_make_collection(const std::string & s) const
{
- if (eapi == "0" || eapi == "")
- return pds_pm_eapi_0;
- else if (eapi == "CRAN-1" || eapi == "paludis-1")
- return pds_pm_permissive;
- else
- {
- Log::get_instance()->message(ll_warning, lc_context,
- "BUG! Don't know what parse mode to use for EAPI '" + stringify(eapi) + "'");
- return pds_pm_permissive;
- }
+ std::tr1::shared_ptr<Container_> result(new typename Container_::Concrete);
+ WhitespaceTokeniser::get_instance()->tokenise(s, create_inserter<Item_>(result->inserter()));
+ return result;
}
+
diff --git a/paludis/version_metadata.hh b/paludis/version_metadata.hh
index d066e00..9921ff3 100644
--- a/paludis/version_metadata.hh
+++ b/paludis/version_metadata.hh
@@ -105,6 +105,11 @@ namespace paludis
*/
PackageDepSpecParseMode eapi_as_package_dep_spec_parse_mode() const;
+ /**
+ * Return the appropriate IUseFlagParseMode for our EAPI.
+ */
+ IUseFlagParseMode eapi_as_iuse_flag_parse_mode() const;
+
protected:
///\name Basic operations
///\{
diff --git a/paludis/version_metadata.sr b/paludis/version_metadata.sr
index 66a895d..62569d3 100644
--- a/paludis/version_metadata.sr
+++ b/paludis/version_metadata.sr
@@ -34,35 +34,18 @@ make_class_VersionMetadataDepsInterface()
key parser DepParserFunction
- key build_depend_string std::string
- key run_depend_string std::string
- key post_depend_string std::string
- key suggested_depend_string std::string
+ cache_key build_depend std::string DepSpec _make_depend
+ cache_key run_depend std::string DepSpec _make_depend
+ cache_key post_depend std::string DepSpec _make_depend
+ cache_key suggested_depend std::string DepSpec _make_depend
extra_constructors <<END
VersionMetadataDepsInterface(const DepParserFunction &);
END
extra_methods <<END
- /**
- * Our build depends.
- */
- std::tr1::shared_ptr<const DepSpec> build_depend() const;
-
- /**
- * Our runtime depends.
- */
- std::tr1::shared_ptr<const DepSpec> run_depend() const;
-
- /**
- * Our post depends.
- */
- std::tr1::shared_ptr<const DepSpec> post_depend() const;
-
- /**
- * Our suggested depends.
- */
- std::tr1::shared_ptr<const DepSpec> suggested_depend() const;
+ private:
+ std::tr1::shared_ptr<const DepSpec> _make_depend(const std::string &) const;
END
doxygen_comment << "END"
@@ -82,20 +65,12 @@ make_class_VersionMetadataLicenseInterface()
inherit "public virtual VersionMetadataHasInterfaces"
key parser TextParserFunction
-
- key license_string std::string
+ cache_key license std::string DepSpec _make_license
extra_constructors <<END
VersionMetadataLicenseInterface(const TextParserFunction &);
END
- extra_methods <<END
- /**
- * Our licences.
- */
- std::tr1::shared_ptr<const DepSpec> license() const;
-END
-
doxygen_comment << "END"
/**
* License data for VersionMetadata.
@@ -104,6 +79,11 @@ END
* \ingroup grpversions
*/
END
+
+ extra_methods <<END
+ private:
+ std::tr1::shared_ptr<const DepSpec> _make_license(const std::string &) const;
+END
}
make_class_VersionMetadataOriginsInterface()
@@ -136,7 +116,7 @@ make_class_VersionMetadataBase()
inherit "public virtual VersionMetadataHasInterfaces"
key slot SlotName
- key homepage std::string
+ cache_key homepage std::string DepSpec _make_text
key description std::string
key eapi std::string
key interactive bool
@@ -151,6 +131,11 @@ make_class_VersionMetadataBase()
* \ingroup grpversions
*/
END
+
+ extra_methods <<END
+ private:
+ std::tr1::shared_ptr<const DepSpec> _make_text(const std::string &) const;
+END
}
make_class_VersionMetadataEbuildInterface()
@@ -159,35 +144,18 @@ make_class_VersionMetadataEbuildInterface()
inherit "public virtual VersionMetadataHasInterfaces"
- key provide_string std::string
- key src_uri_string std::string
- key restrict_string std::string
- key keywords_string std::string
- key eclass_keywords std::string
- key iuse std::string
- key inherited std::string
+ cache_key provide std::string DepSpec _make_text
+ cache_key src_uri std::string DepSpec _make_text
+ cache_key restrictions std::string DepSpec _make_text
+ cache_key keywords std::string KeywordNameCollection "_make_collection<KeywordName, KeywordNameCollection>"
+ cache_key eclass_keywords std::string KeywordNameCollection "_make_collection<KeywordName, KeywordNameCollection>"
+ cache_key iuse std::string IUseFlagCollection "_make_iuse_collection"
+ cache_key inherited std::string InheritedCollection "_make_collection<std::string, InheritedCollection>"
extra_constructors <<END
VersionMetadataEbuildInterface();
END
- extra_methods <<END
- /**
- * PROVIDE, as a dep atom.
- */
- std::tr1::shared_ptr<const DepSpec> provide() const;
-
- /**
- * SRC_URI, as a dep atom.
- */
- std::tr1::shared_ptr<const DepSpec> src_uri() const;
-
- /**
- * Our keywords.
- */
- std::tr1::shared_ptr<const KeywordNameCollection> keywords() const;
-END
-
allow_named_args
doxygen_comment << "END"
@@ -198,6 +166,16 @@ END
* \ingroup grpversions
*/
END
+
+ extra_methods <<END
+ private:
+ std::tr1::shared_ptr<const DepSpec> _make_text(const std::string &) const;
+
+ template <typename Item_, typename Container_>
+ std::tr1::shared_ptr<const Container_> _make_collection(const std::string &) const;
+
+ std::tr1::shared_ptr<const IUseFlagCollection> _make_iuse_collection(const std::string &) const;
+END
}
make_class_VersionMetadataEbinInterface()
@@ -206,16 +184,12 @@ make_class_VersionMetadataEbinInterface()
inherit "public virtual VersionMetadataHasInterfaces"
- key bin_uri_string std::string
+ cache_key bin_uri std::string DepSpec _make_text
extra_constructors <<END
VersionMetadataEbinInterface();
END
- extra_methods <<END
- std::tr1::shared_ptr<const DepSpec> bin_uri() const;
-END
-
allow_named_args
doxygen_comment << "END"
@@ -226,6 +200,11 @@ END
* \ingroup grpversions
*/
END
+
+ extra_methods <<END
+ private:
+ std::tr1::shared_ptr<const DepSpec> _make_text(const std::string &) const;
+END
}
make_class_VersionMetadataCRANInterface()
@@ -234,7 +213,7 @@ make_class_VersionMetadataCRANInterface()
inherit "public virtual VersionMetadataHasInterfaces"
- key keywords_string std::string
+ cache_key keywords std::string KeywordNameCollection "_make_collection<KeywordName, KeywordNameCollection>"
key package std::string
key version std::string
key is_bundle bool
@@ -252,10 +231,9 @@ make_class_VersionMetadataCRANInterface()
END
extra_methods <<END
- /**
- * Our keywords.
- */
- std::tr1::shared_ptr<const KeywordNameCollection> keywords() const;
+ private:
+ template <typename Item_, typename Container_>
+ std::tr1::shared_ptr<const Container_> _make_collection(const std::string &) const;
END
}
diff --git a/python/version_metadata.cc b/python/version_metadata.cc
index 0db833d..2b78ff2 100644
--- a/python/version_metadata.cc
+++ b/python/version_metadata.cc
@@ -81,9 +81,11 @@ void PALUDIS_VISIBLE expose_version_metadata()
vm.def_readonly("slot", &VersionMetadata::slot,
"[ro] SlotName"
);
+#ifdef CIARANM_REMOVED_THIS
vm.def_readonly("homepage", &VersionMetadata::homepage,
"[ro] string"
);
+#endif
vm.def_readonly("description", &VersionMetadata::description,
"[ro] string"
);
@@ -125,6 +127,8 @@ void PALUDIS_VISIBLE expose_version_metadata()
"Version metadata for ebuilds.",
bp::no_init
);
+
+#ifdef CIARANM_REMOVED_THIS
ebuild_i.def_readonly("provide_string", &VersionMetadataEbuildInterface::provide_string,
"[ro] string"
);
@@ -146,6 +150,7 @@ void PALUDIS_VISIBLE expose_version_metadata()
ebuild_i.def_readonly("inherited", &VersionMetadataEbuildInterface::inherited,
"[ro] string"
);
+#endif
bp::register_ptr_to_python<VersionMetadataEbinInterface *>();
bp::class_<VersionMetadataEbinInterface, boost::noncopyable>
@@ -153,9 +158,11 @@ void PALUDIS_VISIBLE expose_version_metadata()
"Version metadata for Ebins.",
bp::no_init
);
+#ifdef CIARANM_REMOVED_THIS
ebin_i.def_readonly("bin_uri_string", &VersionMetadataEbinInterface::bin_uri_string,
"[ro] string"
);
+#endif
bp::register_ptr_to_python<VersionMetadataCRANInterface *>();
bp::class_<VersionMetadataCRANInterface, boost::noncopyable>
@@ -179,6 +186,7 @@ void PALUDIS_VISIBLE expose_version_metadata()
"Dependency data for VersionMetadata.",
bp::no_init
);
+#ifdef CIARANM_REMOVED_THIS
deps_i.def_readonly("build_depend_string", &VersionMetadataDepsInterface::build_depend_string,
"[ro] string"
);
@@ -191,6 +199,7 @@ void PALUDIS_VISIBLE expose_version_metadata()
deps_i.def_readonly("suggested_depend_string", &VersionMetadataDepsInterface::suggested_depend_string,
"[ro] string"
);
+#endif
deps_i.add_property("build_depend", &VersionMetadataDepsInterface::build_depend,
"[ro] DepSpec"
);
@@ -235,7 +244,10 @@ void PALUDIS_VISIBLE expose_version_metadata()
"License data for VersionMetadata.",
bp::no_init
);
+#ifdef CIARANM_REMOVED_THIS
license_i.def_readonly("license_string", &VersionMetadataLicenseInterface::license_string,
"[ro] string"
);
+#endif
}
+
diff --git a/python/version_metadata_TEST.py b/python/version_metadata_TEST.py
index 6c5d96d..58083ae 100755
--- a/python/version_metadata_TEST.py
+++ b/python/version_metadata_TEST.py
@@ -48,7 +48,7 @@ class TestCase_VersionMetadata(unittest.TestCase):
vmd = self.vmd("1.0")
self.assertEquals(str(vmd.slot), "0")
- self.assertEquals(vmd.homepage, "http://paludis.pioto.org/")
+# self.assertEquals(vmd.homepage, "http://paludis.pioto.org/")
self.assertEquals(vmd.description, "Test package")
self.assertEquals(vmd.eapi, "0")
@@ -59,13 +59,13 @@ class TestCase_VersionMetadata(unittest.TestCase):
self.assert_(isinstance(ei, VersionMetadataEbuildInterface))
self.assert_(isinstance(ei2, VersionMetadataEbuildInterface))
- self.assertEquals(ei.provide_string, "")
- self.assertEquals(ei.src_uri_string, "http://example.com/bar-1.0.tar.bz2")
- self.assertEquals(ei.restrict_string, "monkey")
- self.assertEquals(ei.keywords_string, "test ")
- self.assertEquals(ei.eclass_keywords, "")
- self.assertEquals(ei.iuse, " ")
- self.assertEquals(ei.inherited, "")
+# self.assertEquals(ei.provide_string, "")
+# self.assertEquals(ei.src_uri_string, "http://example.com/bar-1.0.tar.bz2")
+# self.assertEquals(ei.restrict_string, "monkey")
+# self.assertEquals(ei.keywords_string, "test ")
+# self.assertEquals(ei.eclass_keywords, "")
+# self.assertEquals(ei.iuse, " ")
+# self.assertEquals(ei.inherited, "")
def test_05_ebin_interface_TODO(self):
pass
@@ -80,10 +80,10 @@ class TestCase_VersionMetadata(unittest.TestCase):
self.assert_(isinstance(di, VersionMetadataDepsInterface))
self.assert_(isinstance(di2, VersionMetadataDepsInterface))
- self.assertEquals(di.build_depend_string.strip(), "foo/bar")
- self.assertEquals(di.run_depend_string.strip(), "")
- self.assertEquals(di.post_depend_string.strip(), "")
- self.assertEquals(di.suggested_depend_string, "")
+# self.assertEquals(di.build_depend_string.strip(), "foo/bar")
+# self.assertEquals(di.run_depend_string.strip(), "")
+# self.assertEquals(di.post_depend_string.strip(), "")
+# self.assertEquals(di.suggested_depend_string, "")
self.assert_(isinstance(di.build_depend, AllDepSpec))
self.assert_(isinstance(di.run_depend, AllDepSpec))
@@ -108,8 +108,9 @@ class TestCase_VersionMetadata(unittest.TestCase):
self.assert_(isinstance(li, VersionMetadataLicenseInterface))
self.assert_(isinstance(li2, VersionMetadataLicenseInterface))
- self.assertEquals(li.license_string, "GPL-2")
- self.assertEquals(li2.license_string, "")
+# self.assertEquals(li.license_string, "GPL-2")
+# self.assertEquals(li2.license_string, "")
if __name__ == "__main__":
unittest.main()
+
diff --git a/ruby/version_metadata.cc b/ruby/version_metadata.cc
index 8d6bfde..f524298 100644
--- a/ruby/version_metadata.cc
+++ b/ruby/version_metadata.cc
@@ -125,6 +125,7 @@ namespace
return Qnil;
}
+#ifdef CIARANM_REMOVED_THIS
/*
* call-seq:
* license_string
@@ -141,6 +142,7 @@ namespace
else
return Qnil;
}
+#endif
/*
* Document-method: slot
@@ -158,6 +160,7 @@ namespace
*
* Our eapi
*/
+#ifdef CIARANM_REMOVED_THIS
/*
* Document-method: homepage
*
@@ -166,6 +169,7 @@ namespace
*
* Our homepage
*/
+#endif
/*
* Document-method: description
*
@@ -200,6 +204,7 @@ namespace
return (*self_ptr)-> interactive ? Qtrue : Qfalse;
}
+#ifdef CIARANM_REMOVED_THIS
/*
* Document-method: provide_string
*
@@ -262,6 +267,7 @@ namespace
return Qnil;
}
};
+#endif
/*
* Document-method: package
@@ -345,6 +351,7 @@ namespace
}
};
+#ifdef CIARANM_REMOVED_THIS
/*
* Document-method: build_depend_string
*
@@ -395,6 +402,7 @@ namespace
return Qnil;
}
};
+#endif
/*
* Document-method: origin_source
@@ -453,6 +461,7 @@ namespace
}
+#ifdef CIARANM_REMOVED_THIS
/*
* call-seq:
* keywords_string -> String
@@ -470,6 +479,7 @@ namespace
else
return Qnil;
}
+#endif
void do_register_version_metadata()
{
@@ -488,15 +498,20 @@ namespace
rb_define_method(c_version_metadata, "origins_interface", RUBY_FUNC_CAST(&version_metadata_origins_interface), 0);
rb_define_method(c_version_metadata, "license", RUBY_FUNC_CAST(&version_metadata_license), 0);
+#ifdef CIARANM_REMOVED_THIS
rb_define_method(c_version_metadata, "license_string", RUBY_FUNC_CAST(&version_metadata_license_string), 0);
+#endif
rb_define_method(c_version_metadata, "slot", RUBY_FUNC_CAST((&BaseValue<SlotName, &VersionMetadataBase::slot>::fetch)), 0);
rb_define_method(c_version_metadata, "eapi", RUBY_FUNC_CAST((&BaseValue<std::string, &VersionMetadataBase::eapi>::fetch)), 0);
+#ifdef CIARANM_REMOVED_THIS
rb_define_method(c_version_metadata, "homepage", RUBY_FUNC_CAST((&BaseValue<std::string, &VersionMetadataBase::homepage>::fetch)), 0);
+#endif
rb_define_method(c_version_metadata, "description", RUBY_FUNC_CAST((&BaseValue<std::string,
&VersionMetadataBase::description>::fetch)), 0);
rb_define_method(c_version_metadata, "interactive?", RUBY_FUNC_CAST(&version_metadata_interactive), 0);
+#ifdef CIARANM_REMOVED_THIS
rb_define_method(c_version_metadata, "provide_string", RUBY_FUNC_CAST((&EbuildValue<std::string,
&VersionMetadataEbuildInterface::provide_string>::fetch)), 0);
rb_define_method(c_version_metadata, "src_uri_string", RUBY_FUNC_CAST((&EbuildValue<std::string,
@@ -509,6 +524,7 @@ namespace
&VersionMetadataEbuildInterface::iuse>::fetch)), 0);
rb_define_method(c_version_metadata, "inherited", RUBY_FUNC_CAST((&EbuildValue<std::string,
&VersionMetadataEbuildInterface::inherited>::fetch)), 0);
+#endif
rb_define_method(c_version_metadata, "build_depend", RUBY_FUNC_CAST((&DependValue<
&VersionMetadataDepsInterface::build_depend>::fetch)), 0);
@@ -519,6 +535,7 @@ namespace
rb_define_method(c_version_metadata, "post_depend", RUBY_FUNC_CAST((&DependValue<
&VersionMetadataDepsInterface::post_depend>::fetch)), 0);
+#ifdef CIARANM_REMOVED_THIS
rb_define_method(c_version_metadata, "build_depend_string", RUBY_FUNC_CAST((&DependValueString<
&VersionMetadataDepsInterface::build_depend_string>::fetch)), 0);
rb_define_method(c_version_metadata, "run_depend_string", RUBY_FUNC_CAST((&DependValueString<
@@ -527,6 +544,7 @@ namespace
&VersionMetadataDepsInterface::suggested_depend_string>::fetch)), 0);
rb_define_method(c_version_metadata, "post_depend_string", RUBY_FUNC_CAST((&DependValueString<
&VersionMetadataDepsInterface::post_depend_string>::fetch)), 0);
+#endif
rb_define_method(c_version_metadata, "origin_source", RUBY_FUNC_CAST((&VMOrigins<
&VersionMetadataOriginsInterface::source>::fetch)), 0);
@@ -541,7 +559,9 @@ namespace
&VersionMetadataCRANInterface::version>::fetch)), 0);
rb_define_method(c_version_metadata, "is_bundle?", RUBY_FUNC_CAST(&version_metadata_is_bundle), 0);
+#ifdef CIARANM_REMOVED_THIS
rb_define_method(c_version_metadata, "keywords_string", RUBY_FUNC_CAST(&version_metadata_keywords_string), 0);
+#endif
}
}
diff --git a/ruby/version_metadata_TEST.rb b/ruby/version_metadata_TEST.rb
index f4217be..6eca20e 100644
--- a/ruby/version_metadata_TEST.rb
+++ b/ruby/version_metadata_TEST.rb
@@ -65,19 +65,19 @@ module Paludis
def test_members
assert_equal "Test package", vmd("1.0").description
- assert_equal "http://paludis.pioto.org/", vmd("1.0").homepage
+# assert_equal "http://paludis.pioto.org/", vmd("1.0").homepage
assert_equal "0", vmd("1.0").slot
assert_equal "0", vmd("1.0").eapi
- assert_equal "GPL-2", vmd("1.0").license_string
+# assert_equal "GPL-2", vmd("1.0").license_string
assert !vmd('1.0').interactive?
end
def test_ebuild_members
- assert_equal "", vmd("1.0").provide_string
- assert_equal "http://example.com/bar-1.0.tar.bz2", vmd("1.0").src_uri_string
- assert_equal "monkey", vmd("1.0").restrict_string
- assert_equal "test", vmd("1.0").keywords_string.gsub(%r/\s/, "")
- assert_equal "", vmd("1.0").iuse.gsub(%r/\s/, "")
+# assert_equal "", vmd("1.0").provide_string
+# assert_equal "http://example.com/bar-1.0.tar.bz2", vmd("1.0").src_uri_string
+# assert_equal "monkey", vmd("1.0").restrict_string
+# assert_equal "test", vmd("1.0").keywords_string.gsub(%r/\s/, "")
+# assert_equal "", vmd("1.0").iuse.gsub(%r/\s/, "")
end
def test_deps
@@ -91,10 +91,10 @@ module Paludis
assert vmd("1.0").suggested_depend.to_a.empty?
assert vmd("1.0").post_depend.to_a.empty?
- assert_equal "foo/bar", vmd("1.0").build_depend_string.gsub(/\s/, "")
- assert_equal "", vmd("1.0").run_depend_string.gsub(/\s/, "")
- assert_equal "", vmd("1.0").suggested_depend_string.gsub(/\s/, "")
- assert_equal "", vmd("1.0").post_depend_string.gsub(/\s/, "")
+# assert_equal "foo/bar", vmd("1.0").build_depend_string.gsub(/\s/, "")
+# assert_equal "", vmd("1.0").run_depend_string.gsub(/\s/, "")
+# assert_equal "", vmd("1.0").suggested_depend_string.gsub(/\s/, "")
+# assert_equal "", vmd("1.0").post_depend_string.gsub(/\s/, "")
end
def test_origin_source
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 623a732..d5ed361 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -198,7 +198,7 @@ ConsoleQueryTask::display_metadata(const PackageDepSpec &, const PackageDatabase
std::tr1::shared_ptr<const VersionMetadata> metadata(_imp->env->package_database()->fetch_repository(e.repository)->
version_metadata(e.name, e.version));
- display_metadata_key("Homepage", "HOMEPAGE", metadata->homepage);
+ display_metadata_dep("Homepage", "HOMEPAGE", metadata->homepage(), true);
display_metadata_key("Description", "DESCRIPTION", metadata->description);
if (metadata->license_interface)
@@ -227,12 +227,14 @@ ConsoleQueryTask::display_metadata(const PackageDepSpec &, const PackageDatabase
if (metadata->ebuild_interface)
{
display_metadata_dep("Provides", "PROVIDE", metadata->ebuild_interface->provide(), true);
- display_metadata_iuse("Use flags", "IUSE", metadata->ebuild_interface->iuse, e);
+ display_metadata_iuse("Use flags", "IUSE", join(metadata->ebuild_interface->iuse()->begin(),
+ metadata->ebuild_interface->iuse()->end(), " "), e);
if (want_raw())
{
- display_metadata_key("Keywords", "KEYWORDS", metadata->ebuild_interface->keywords_string);
- display_metadata_key("SRC_URI", "SRC_URI", metadata->ebuild_interface->src_uri_string);
- display_metadata_key("Restrict", "RESTRICT", metadata->ebuild_interface->restrict_string);
+ display_metadata_key("Keywords", "KEYWORDS", join(metadata->ebuild_interface->keywords()->begin(),
+ metadata->ebuild_interface->keywords()->end(), " "));
+ display_metadata_dep("SRC_URI", "SRC_URI", metadata->ebuild_interface->src_uri(), true);
+ display_metadata_dep("Restrict", "RESTRICT", metadata->ebuild_interface->restrictions(), true);
}
}
diff --git a/src/output/use_flag_pretty_printer.cc b/src/output/use_flag_pretty_printer.cc
index 7014ffc..65cc944 100644
--- a/src/output/use_flag_pretty_printer.cc
+++ b/src/output/use_flag_pretty_printer.cc
@@ -21,8 +21,8 @@
#include <paludis/version_metadata.hh>
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
-#include <paludis/util/tokeniser.hh>
#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/iterator.hh>
#include "colour.hh"
#include <iostream>
#include <set>
@@ -65,16 +65,18 @@ UseFlagPrettyPrinter::print_package_flags(const PackageDatabaseEntry & pkg,
if (! metadata->ebuild_interface)
return;
- WhitespaceTokeniser::get_instance()->tokenise(metadata->ebuild_interface->iuse,
- create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
+ std::copy(metadata->ebuild_interface->iuse()->begin(), metadata->ebuild_interface->iuse()->end(),
+ transform_inserter(std::inserter(iuse, iuse.begin()),
+ SelectMember<IUseFlag, UseFlagName, &IUseFlag::flag>()));
if (old_pkg)
{
std::tr1::shared_ptr<const VersionMetadata> old_metadata(environment()->package_database()->
fetch_repository(old_pkg->repository)->version_metadata(old_pkg->name, old_pkg->version));
if (old_metadata->ebuild_interface)
- WhitespaceTokeniser::get_instance()->tokenise(old_metadata->ebuild_interface->iuse,
- create_inserter<UseFlagName>(std::inserter(old_iuse, old_iuse.begin())));
+ std::copy(old_metadata->ebuild_interface->iuse()->begin(), old_metadata->ebuild_interface->iuse()->end(),
+ transform_inserter(std::inserter(old_iuse, old_iuse.begin()),
+ SelectMember<IUseFlag, UseFlagName, &IUseFlag::flag>()));
}
const RepositoryUseInterface * const use_interface(environment()->package_database()->