diff options
author | 2011-04-12 14:28:03 +0100 | |
---|---|---|
committer | 2011-04-12 14:45:22 +0100 | |
commit | 120c58323950219e16d8fe22693af221d2887f9b (patch) | |
tree | 2df48534abea1af807750dbbd0ce3ac9922bd44b | |
parent | 271074eb112e276d5ba25f91785431911ee3443f (diff) | |
download | paludis-120c58323950219e16d8fe22693af221d2887f9b.tar.gz paludis-120c58323950219e16d8fe22693af221d2887f9b.tar.xz |
MetadataKey value -> parse_value
178 files changed, 1589 insertions, 1332 deletions
diff --git a/doc/api/cplusplus/examples/example_contents.cc b/doc/api/cplusplus/examples/example_contents.cc index 8be11c197..8631987c2 100644 --- a/doc/api/cplusplus/examples/example_contents.cc +++ b/doc/api/cplusplus/examples/example_contents.cc @@ -35,23 +35,23 @@ namespace public: void visit(const ContentsFileEntry & d) { - cout << left << setw(10) << "file" << d.location_key()->value() << endl; + cout << left << setw(10) << "file" << d.location_key()->parse_value() << endl; } void visit(const ContentsDirEntry & d) { - cout << left << setw(10) << "dir" << d.location_key()->value() << endl; + cout << left << setw(10) << "dir" << d.location_key()->parse_value() << endl; } void visit(const ContentsSymEntry & d) { - cout << left << setw(10) << "sym" << d.location_key()->value() - << " -> " << d.target_key()->value() << endl; + cout << left << setw(10) << "sym" << d.location_key()->parse_value() + << " -> " << d.target_key()->parse_value() << endl; } void visit(const ContentsOtherEntry & d) { - cout << left << setw(10) << "other" << d.location_key()->value() << endl; + cout << left << setw(10) << "other" << d.location_key()->parse_value() << endl; } }; @@ -90,12 +90,13 @@ int main(int argc, char * argv[]) cout << "ID '" << **i << "' provides contents key:" << endl; /* Visit the contents key's value's entries with our visitor. We use - * indirect_iterator because value()->begin() and ->end() return + * indirect_iterator because choices->begin() and ->end() return * iterators to std::shared_ptr<>s rather than raw objects. */ ContentsPrinter p; + auto contents((*i)->contents_key()->parse_value()); std::for_each( - indirect_iterator((*i)->contents_key()->value()->begin()), - indirect_iterator((*i)->contents_key()->value()->end()), + indirect_iterator(contents->begin()), + indirect_iterator(contents->end()), accept_visitor(p)); } diff --git a/doc/api/cplusplus/examples/example_dep_label.cc b/doc/api/cplusplus/examples/example_dep_label.cc index 5514423c7..8edf02321 100644 --- a/doc/api/cplusplus/examples/example_dep_label.cc +++ b/doc/api/cplusplus/examples/example_dep_label.cc @@ -176,7 +176,7 @@ int main(int argc, char * argv[]) /* Create a visitor that will collect distfiles, and do the collecting. */ DistfilesCollector collector(results, is_initial_label_restricted.result); - (*i)->fetches_key()->value()->top()->accept(collector); + (*i)->fetches_key()->parse_value()->top()->accept(collector); } /* Display summary of results */ diff --git a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc index ce59d074f..f50884151 100644 --- a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc +++ b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc @@ -60,7 +60,7 @@ int main(int argc, char * argv[]) DepSpecFlattener<ProvideSpecTree, PackageDepSpec> provides(env.get(), *i); /* Populate it by making it visit the key's value */ - (*i)->provide_key()->value()->top()->accept(provides); + (*i)->provide_key()->parse_value()->top()->accept(provides); /* The results are available through DepSpecFlattener::begin() * and ::end(). These return an iterator to a std::shared_ptr<>, @@ -74,7 +74,7 @@ int main(int argc, char * argv[]) if ((*i)->homepage_key()) { DepSpecFlattener<SimpleURISpecTree, SimpleURIDepSpec> homepages(env.get(), *i); - (*i)->homepage_key()->value()->top()->accept(homepages); + (*i)->homepage_key()->parse_value()->top()->accept(homepages); cout << " " << left << setw(24) << "Homepages:" << " " << join(indirect_iterator(homepages.begin()), indirect_iterator(homepages.end()), " ") @@ -93,7 +93,7 @@ int main(int argc, char * argv[]) DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env.get(), *i); visitor_cast<const MetadataSpecTreeKey<PlainTextSpecTree> >( - **(*i)->find_metadata("RESTRICT"))->value()->top()->accept(restricts); + **(*i)->find_metadata("RESTRICT"))->parse_value()->top()->accept(restricts); cout << " " << left << setw(24) << "Restricts:" << " " << join(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()), " ") diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc index 17821ba7f..db98d2c76 100644 --- a/doc/api/cplusplus/examples/example_metadata_key.cc +++ b/doc/api/cplusplus/examples/example_metadata_key.cc @@ -58,45 +58,45 @@ namespace void visit(const MetadataValueKey<std::string> & key) { cout << indent << left << setw(30) << " Class:" << " " << "MetadataValueKey<std::string>" << endl; - cout << indent << left << setw(30) << " Value:" << " " << key.value() << endl; + cout << indent << left << setw(30) << " Value:" << " " << key.parse_value() << endl; } void visit(const MetadataValueKey<SlotName> & key) { cout << indent << left << setw(30) << " Class:" << " " << "MetadataValueKey<SlotName>" << endl; - cout << indent << left << setw(30) << " Value:" << " " << key.value() << endl; + cout << indent << left << setw(30) << " Value:" << " " << key.parse_value() << endl; } void visit(const MetadataValueKey<long> & key) { cout << indent << left << setw(30) << " Class:" << " " << "MetadataValueKey<long>" << endl; - cout << indent << left << setw(30) << " Value:" << " " << key.value() << endl; + cout << indent << left << setw(30) << " Value:" << " " << key.parse_value() << endl; } void visit(const MetadataValueKey<bool> & key) { cout << indent << left << setw(30) << " Class:" << " " << "MetadataValueKey<bool>" << endl; - cout << indent << left << setw(30) << " Value:" << " " << key.value() << endl; + cout << indent << left << setw(30) << " Value:" << " " << key.parse_value() << endl; } void visit(const MetadataValueKey<FSPath> & key) { cout << indent << left << setw(30) << " Class:" << " " << "MetadataValueKey<FSPath>" << endl; - cout << indent << left << setw(30) << " Value:" << " " << key.value() << endl; + cout << indent << left << setw(30) << " Value:" << " " << key.parse_value() << endl; } void visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & key) { cout << indent << left << setw(30) << " Class:" << " " << "MetadataValueKey<std::shared_ptr<const PackageID> >" << endl; - cout << indent << left << setw(30) << " Value:" << " " << *key.value() << endl; + cout << indent << left << setw(30) << " Value:" << " " << *key.parse_value() << endl; } void visit(const MetadataTimeKey & key) { cout << indent << left << setw(30) << " Class:" << " " << "MetadataTimeKey" << endl; - cout << indent << left << setw(30) << " Value:" << " " << pretty_print_time(key.value().seconds()) << endl; + cout << indent << left << setw(30) << " Value:" << " " << pretty_print_time(key.parse_value().seconds()) << endl; } void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) @@ -167,37 +167,41 @@ namespace void visit(const MetadataCollectionKey<Set<std::string> > & key) { + auto value(key.parse_value()); cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<Set<std::string> >" << endl; - cout << indent << left << setw(30) << " Value:" << " " << join(key.value()->begin(), key.value()->end(), " ") << endl; + cout << indent << left << setw(30) << " Value:" << " " << join(value->begin(), value->end(), " ") << endl; } void visit(const MetadataCollectionKey<Map<std::string, std::string> > & key) { + auto value(key.parse_value()); cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<Map<std::string, std::string> >" << endl; - cout << indent << left << setw(30) << " Value:" << " " << join( - key.value()->begin(), key.value()->end(), " ", stringify_string_pair) << endl; + cout << indent << left << setw(30) << " Value:" << " " << join(value->begin(), value->end(), " ", stringify_string_pair) << endl; } void visit(const MetadataCollectionKey<Sequence<std::string> > & key) { + auto value(key.parse_value()); cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<Sequence<std::string> >" << endl; - cout << indent << left << setw(30) << " Value:" << " " << join(key.value()->begin(), key.value()->end(), " ") << endl; + cout << indent << left << setw(30) << " Value:" << " " << join(value->begin(), value->end(), " ") << endl; } void visit(const MetadataCollectionKey<FSPathSequence> & key) { + auto value(key.parse_value()); cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<FSPathSequence>" << endl; - cout << indent << left << setw(30) << " Value:" << " " << join(key.value()->begin(), key.value()->end(), " ") << endl; + cout << indent << left << setw(30) << " Value:" << " " << join(value->begin(), value->end(), " ") << endl; } void visit(const MetadataCollectionKey<PackageIDSequence> & key) { + auto value(key.parse_value()); cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<PackageIDSequence>" << endl; /* Slight trickery: a PackageIDSequence stores shared pointers * to PackageID instances, so we need indirect_iterator to get * an extra level of dereferencing. */ - cout << indent << left << setw(30) << " Value:" << " " << join(indirect_iterator(key.value()->begin()), - indirect_iterator(key.value()->end()), " ") << endl; + cout << indent << left << setw(30) << " Value:" << " " << join(indirect_iterator(value->begin()), + indirect_iterator(value->end()), " ") << endl; } void visit(const MetadataSectionKey & key) diff --git a/doc/api/ruby/example_contents.rb b/doc/api/ruby/example_contents.rb index d653fe57a..0d5bb0906 100644 --- a/doc/api/ruby/example_contents.rb +++ b/doc/api/ruby/example_contents.rb @@ -30,20 +30,20 @@ ids.each do | id | puts "ID '#{id}' provides contents key:" # Contents is made up of a collection of ContentsEntry instances. - id.contents_key.value.each do | c | + id.contents_key.parse_value.each do | c | # Some ContentsEntry subclasses contain more information than others if c.kind_of? ContentsOtherEntry - puts "other #{c.location_key.value}" + puts "other #{c.location_key.parse_value}" elsif c.kind_of? ContentsFileEntry - puts "file #{c.location_key.value}" + puts "file #{c.location_key.parse_value}" elsif c.kind_of? ContentsDirEntry - puts "dir #{c.location_key.value}" + puts "dir #{c.location_key.parse_value}" elsif c.kind_of? ContentsSymEntry - puts "sym #{c.location_key.value} -> #{c.target_key.value}" + puts "sym #{c.location_key.parse_value} -> #{c.target_key.parse_value}" else puts "unknown #{c}" diff --git a/doc/api/ruby/example_dep_tree.rb b/doc/api/ruby/example_dep_tree.rb index 53d3a4817..ab56fdbcd 100644 --- a/doc/api/ruby/example_dep_tree.rb +++ b/doc/api/ruby/example_dep_tree.rb @@ -134,13 +134,13 @@ ids.each do | id | [ :build_dependencies_key, :run_dependencies_key, :post_dependencies_key, :suggested_dependencies_key ].each do | key | if id.send(key) - collect_dependencies(env, id, id.send(key).value, results) + collect_dependencies(env, id, id.send(key).parse_value, results) end end # And the same for '.zip' file extensions if id.fetches_key - collect_extensions(env, id, id.fetches_key.value, results) + collect_extensions(env, id, id.fetches_key.parse_value, results) end end diff --git a/paludis/broken_linkage_finder.cc b/paludis/broken_linkage_finder.cc index ba828c4f3..616cb6597 100644 --- a/paludis/broken_linkage_finder.cc +++ b/paludis/broken_linkage_finder.cc @@ -91,7 +91,7 @@ namespace paludis Imp(const Environment * the_env, const std::shared_ptr<const Sequence<std::string>> & the_libraries) : env(the_env), - config(the_env->preferred_root_key()->value()), + config(the_env->preferred_root_key()->parse_value()), libraries(the_libraries), has_files(false) { @@ -145,16 +145,16 @@ BrokenLinkageFinder::BrokenLinkageFinder(const Environment * env, const std::sha { using namespace std::placeholders; - Context ctx("When checking for broken linkage in '" + stringify(env->preferred_root_key()->value()) + "':"); + Context ctx("When checking for broken linkage in '" + stringify(env->preferred_root_key()->parse_value()) + "':"); - _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<ElfLinkageChecker>(env->preferred_root_key()->value(), libraries))); + _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<ElfLinkageChecker>(env->preferred_root_key()->parse_value(), libraries))); if (libraries->empty()) - _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<LibtoolLinkageChecker>(env->preferred_root_key()->value()))); + _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<LibtoolLinkageChecker>(env->preferred_root_key()->parse_value()))); std::vector<FSPath> search_dirs_nosyms, search_dirs_pruned; std::transform(_imp->config.begin_search_dirs(), _imp->config.end_search_dirs(), std::back_inserter(search_dirs_nosyms), - std::bind(realpath_with_current_and_root, _1, FSPath("/"), env->preferred_root_key()->value())); + std::bind(realpath_with_current_and_root, _1, FSPath("/"), env->preferred_root_key()->parse_value())); std::sort(search_dirs_nosyms.begin(), search_dirs_nosyms.end(), FSPathComparator()); for (std::vector<FSPath>::const_iterator it(search_dirs_nosyms.begin()), @@ -169,7 +169,7 @@ BrokenLinkageFinder::BrokenLinkageFinder(const Environment * env, const std::sha std::transform(_imp->config.begin_ld_so_conf(), _imp->config.end_ld_so_conf(), std::inserter(_imp->extra_lib_dirs, _imp->extra_lib_dirs.begin()), - std::bind(realpath_with_current_and_root, _1, FSPath("/"), env->preferred_root_key()->value())); + std::bind(realpath_with_current_and_root, _1, FSPath("/"), env->preferred_root_key()->parse_value())); std::for_each(search_dirs_pruned.begin(), search_dirs_pruned.end(), std::bind(&Imp<BrokenLinkageFinder>::search_directory, _imp.get(), _1)); @@ -178,9 +178,9 @@ BrokenLinkageFinder::BrokenLinkageFinder(const Environment * env, const std::sha it_end(_imp->extra_lib_dirs.end()); it_end != it; ++it) { Log::get_instance()->message("broken_linkage_finder.config", ll_debug, lc_context) - << "Need to check for extra libraries in '" << (env->preferred_root_key()->value() / *it) << "'"; + << "Need to check for extra libraries in '" << (env->preferred_root_key()->parse_value() / *it) << "'"; std::for_each(indirect_iterator(_imp->checkers.begin()), indirect_iterator(_imp->checkers.end()), - std::bind(&LinkageChecker::add_extra_lib_dir, _1, env->preferred_root_key()->value() / *it)); + std::bind(&LinkageChecker::add_extra_lib_dir, _1, env->preferred_root_key()->parse_value() / *it)); } std::function<void (const FSPath &, const std::string &)> callback( @@ -213,7 +213,7 @@ Imp<BrokenLinkageFinder>::search_directory(const FSPath & directory) } while (FSPath("/") != dir); - FSPath with_root(env->preferred_root_key()->value() / directory); + FSPath with_root(env->preferred_root_key()->parse_value() / directory); if (with_root.stat().is_directory()) walk_directory(with_root); else @@ -226,7 +226,7 @@ Imp<BrokenLinkageFinder>::walk_directory(const FSPath & directory) { using namespace std::placeholders; - FSPath without_root(directory.strip_leading(env->preferred_root_key()->value())); + FSPath without_root(directory.strip_leading(env->preferred_root_key()->parse_value())); if (config.dir_is_masked(without_root)) { Log::get_instance()->message("broken_linkage_finder.masked", ll_debug, lc_context) @@ -263,7 +263,7 @@ Imp<BrokenLinkageFinder>::check_file(const FSPath & file) if (file_stat.is_symlink()) { - FSPath target(dereference_with_root(file, env->preferred_root_key()->value())); + FSPath target(dereference_with_root(file, env->preferred_root_key()->parse_value())); if (target.stat().is_regular_file()) { std::for_each(indirect_iterator(checkers.begin()), indirect_iterator(checkers.end()), @@ -306,13 +306,13 @@ Imp<BrokenLinkageFinder>::add_breakage(const FSPath & file, const std::string & Context ctx("When building map from files to packages:"); std::shared_ptr<const PackageIDSequence> pkgs((*env)[selection::AllVersionsUnsorted( - generator::All() | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + generator::All() | filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); std::for_each(pkgs->begin(), pkgs->end(), std::bind(&Imp<BrokenLinkageFinder>::gather_package, this, _1)); } - FSPath without_root(file.strip_leading(env->preferred_root_key()->value())); + FSPath without_root(file.strip_leading(env->preferred_root_key()->parse_value())); std::pair<Files::const_iterator, Files::const_iterator> range(files.equal_range(without_root)); if (range.first == range.second) orphan_breakage[without_root].insert(req); @@ -334,7 +334,7 @@ Imp<BrokenLinkageFinder>::gather_package(const std::shared_ptr<const PackageID> std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > key(pkg->contents_key()); if (! key) return; - std::shared_ptr<const Contents> contents(key->value()); + std::shared_ptr<const Contents> contents(key->parse_value()); if (! contents) return; @@ -345,7 +345,7 @@ Imp<BrokenLinkageFinder>::gather_package(const std::shared_ptr<const PackageID> if (0 != file) { Lock l(mutex); - files.insert(std::make_pair(file->location_key()->value(), pkg)); + files.insert(std::make_pair(file->location_key()->parse_value(), pkg)); } } diff --git a/paludis/common_sets.cc b/paludis/common_sets.cc index f6339056a..a46d8a826 100644 --- a/paludis/common_sets.cc +++ b/paludis/common_sets.cc @@ -59,7 +59,7 @@ namespace result->top()->append(std::make_shared<PackageDepSpec>( MutablePackageDepSpecData({ }) .require_package((*i)->name()) - .require_exact_slot((*i)->slot_key()->value(), false) + .require_exact_slot((*i)->slot_key()->parse_value(), false) )); else result->top()->append(std::make_shared<PackageDepSpec>( diff --git a/paludis/elike_conditional_dep_spec.cc b/paludis/elike_conditional_dep_spec.cc index 3c3649898..dbb71eb18 100644 --- a/paludis/elike_conditional_dep_spec.cc +++ b/paludis/elike_conditional_dep_spec.cc @@ -55,12 +55,13 @@ namespace return false; } - const std::shared_ptr<const ChoiceValue> v(id.choices_key()->value()->find_by_name_with_prefix(f)); + auto choices(id.choices_key()->parse_value()); + auto v(choices->find_by_name_with_prefix(f)); if (v) return v->enabled(); if (! no_warning_for_unlisted) - if (! id.choices_key()->value()->has_matching_contains_every_value_prefix(f)) + if (! choices->has_matching_contains_every_value_prefix(f)) Log::get_instance()->message("elike_conditional_dep_spec.query", ll_warning, lc_context) << "ID '" << id << "' has no flag named '" << f << "'"; return false; @@ -75,12 +76,13 @@ namespace return false; } - const std::shared_ptr<const ChoiceValue> v(id.choices_key()->value()->find_by_name_with_prefix(f)); + auto choices(id.choices_key()->parse_value()); + auto v(choices->find_by_name_with_prefix(f)); if (v) return v->locked(); if (! no_warning_for_unlisted) - if (! id.choices_key()->value()->has_matching_contains_every_value_prefix(f)) + if (! choices->has_matching_contains_every_value_prefix(f)) Log::get_instance()->message("elike_conditional_dep_spec.query", ll_warning, lc_context) << "ID '" << id << "' has no flag named '" << f << "'"; return false; diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc index 8808a8444..dd56233d7 100644 --- a/paludis/elike_use_requirement.cc +++ b/paludis/elike_use_requirement.cc @@ -64,12 +64,12 @@ namespace return c.is_true(); } - const std::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(f)); + auto choices(id->choices_key()->parse_value()); + auto v(choices->find_by_name_with_prefix(f)); if (v) return v->enabled(); - if (default_value.is_indeterminate() && ! id->choices_key()->value()->has_matching_contains_every_value_prefix(f) && - options[euro_missing_is_qa]) + if (default_value.is_indeterminate() && ! choices->has_matching_contains_every_value_prefix(f) && options[euro_missing_is_qa]) Log::get_instance()->message("elike_use_requirement.query", ll_qa, lc_context) << "ID '" << *id << "' has no flag named '" << f << "'"; return default_value.is_true(); @@ -121,8 +121,9 @@ namespace ChoicePrefixName prefix((std::string::npos == p) ? "" : _flags.substr(0, p)); if (! id->choices_key()) return true; - Choices::ConstIterator k(id->choices_key()->value()->find(prefix)); - if (id->choices_key()->value()->end() == k) + auto choices(id->choices_key()->parse_value()); + Choices::ConstIterator k(choices->find(prefix)); + if (choices->end() == k) return true; if ((*k)->begin() == (*k)->end()) return true; @@ -160,8 +161,9 @@ namespace } ChoicePrefixName prefix(_flags.substr(0, _flags.length() - 2)); - Choices::ConstIterator cc(from_id->choices_key()->value()->find(prefix)); - if (cc == from_id->choices_key()->value()->end()) + auto choices(from_id->choices_key()->parse_value()); + Choices::ConstIterator cc(choices->find(prefix)); + if (cc == choices->end()) Log::get_instance()->message("elike_use_requirement.prefix_star_unmatching", ll_warning, lc_context) << "ID '" << *from_id << "' uses requirement '" << _flags << "' but has no choice prefix '" << prefix << "'"; else @@ -234,8 +236,9 @@ namespace } ChoicePrefixName prefix(_flags.substr(0, _flags.length() - 2)); - Choices::ConstIterator cc(from_id->choices_key()->value()->find(prefix)); - if (cc == from_id->choices_key()->value()->end()) + auto choices(from_id->choices_key()->parse_value()); + Choices::ConstIterator cc(choices->find(prefix)); + if (cc == choices->end()) Log::get_instance()->message("elike_use_requirement.prefix_star_unmatching", ll_warning, lc_context) << "ID '" << *from_id << "' uses requirement '" << _flags << "' but has no choice prefix '" << prefix << "'"; else @@ -260,7 +263,7 @@ namespace ChangedChoices & changed_choices, const ChoiceNameWithPrefix & flag) const { - const std::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(flag)); + const std::shared_ptr<const ChoiceValue> v(id->choices_key()->parse_value()->find_by_name_with_prefix(flag)); if (! v) { diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc index cfbec0860..0aa5b8457 100644 --- a/paludis/environment_implementation.cc +++ b/paludis/environment_implementation.cc @@ -444,7 +444,7 @@ namespace bool operator() (const QualifiedPackageName & qpn) const { return ! (*_env)[selection::SomeArbitraryVersion(generator::Package(qpn) | - filter::InstalledAtRoot(_env->preferred_root_key()->value()))]->empty(); + filter::InstalledAtRoot(_env->preferred_root_key()->parse_value()))]->empty(); } }; diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc index 8ec8153b9..29d735aaf 100644 --- a/paludis/environments/no_config/no_config_environment.cc +++ b/paludis/environments/no_config/no_config_environment.cc @@ -418,7 +418,7 @@ NoConfigEnvironment::accept_keywords( std::list<KeywordName> accepted; if (_imp->main_repo->accept_keywords_key()) - tokenise_whitespace(_imp->main_repo->accept_keywords_key()->value(), + tokenise_whitespace(_imp->main_repo->accept_keywords_key()->parse_value(), create_inserter<KeywordName>(std::back_inserter(accepted))); tokenise_whitespace(_imp->params.extra_accept_keywords(), diff --git a/paludis/environments/paludis/output_conf.cc b/paludis/environments/paludis/output_conf.cc index 2f3ebfaf3..0f68207a7 100644 --- a/paludis/environments/paludis/output_conf.cc +++ b/paludis/environments/paludis/output_conf.cc @@ -275,7 +275,7 @@ namespace m->insert("id", escape(stringify(*i.package_id()))); m->insert("full_name", escape(stringify(*i.package_id()))); if (i.package_id()->slot_key()) - m->insert("slot", stringify(i.package_id()->slot_key()->value())); + m->insert("slot", stringify(i.package_id()->slot_key()->parse_value())); m->insert("version", stringify(i.package_id()->version())); m->insert("repository", stringify(i.package_id()->repository_name())); m->insert("category", stringify(i.package_id()->name().category())); diff --git a/paludis/environments/paludis/paludis_environment_TEST.cc b/paludis/environments/paludis/paludis_environment_TEST.cc index ef5d28ab2..7421ba780 100644 --- a/paludis/environments/paludis/paludis_environment_TEST.cc +++ b/paludis/environments/paludis/paludis_environment_TEST.cc @@ -46,7 +46,7 @@ namespace { bool get_use(const std::string & f, const std::shared_ptr<const PackageID> & id) { - const std::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix(f))); + const std::shared_ptr<const ChoiceValue> v(id->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix(f))); if (! v) return false; return v->enabled(); @@ -92,7 +92,8 @@ TEST(PaludisEnvironment, KnownUse) PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", env.get(), { })), make_null_shared_ptr(), { }))]->begin()); std::shared_ptr<const Choice> foo_cards; - for (Choices::ConstIterator c(id1->choices_key()->value()->begin()), c_end(id1->choices_key()->value()->end()) ; + auto choices(id1->choices_key()->parse_value()); + for (Choices::ConstIterator c(choices->begin()), c_end(choices->end()) ; c != c_end ; ++c) if ((*c)->raw_name() == "FOO_CARDS") foo_cards = *c; diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc index 5899a7b64..b4345ed31 100644 --- a/paludis/environments/portage/portage_environment.cc +++ b/paludis/environments/portage/portage_environment.cc @@ -476,7 +476,7 @@ PortageEnvironment::_add_installed_virtuals_repository() { #ifdef ENABLE_VIRTUALS_REPOSITORY std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>()); - keys->insert("root", stringify(preferred_root_key()->value())); + keys->insert("root", stringify(preferred_root_key()->parse_value())); keys->insert("format", "installed_virtuals"); add_repository(-1, RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1))); #endif @@ -494,7 +494,7 @@ PortageEnvironment::_add_ebuild_repository(const FSPath & portdir, const std::st const std::string & sync, int importance) { std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>()); - keys->insert("root", stringify(preferred_root_key()->value())); + keys->insert("root", stringify(preferred_root_key()->parse_value())); keys->insert("location", stringify(portdir)); keys->insert("profiles", stringify((_imp->conf_dir / "make.profile").realpath()) + " " + ((_imp->conf_dir / "portage" / "profile").stat().is_directory() ? @@ -525,8 +525,8 @@ PortageEnvironment::_add_vdb_repository() Context context("When creating vdb repository:"); std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>()); - keys->insert("root", stringify(preferred_root_key()->value())); - keys->insert("location", stringify(preferred_root_key()->value() / "/var/db/pkg")); + keys->insert("root", stringify(preferred_root_key()->parse_value())); + keys->insert("location", stringify(preferred_root_key()->parse_value() / "/var/db/pkg")); keys->insert("format", "vdb"); keys->insert("names_cache", "/var/empty"); keys->insert("provides_cache", "/var/empty"); diff --git a/paludis/environments/portage/portage_environment_TEST.cc b/paludis/environments/portage/portage_environment_TEST.cc index 113a4e1a6..a1d8b708f 100644 --- a/paludis/environments/portage/portage_environment_TEST.cc +++ b/paludis/environments/portage/portage_environment_TEST.cc @@ -67,7 +67,7 @@ namespace bool get_use(const std::string & f, const Environment &, const std::shared_ptr<const PackageID> & id) { - const std::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix(f))); + const std::shared_ptr<const ChoiceValue> v(id->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix(f))); if (! v) throw InternalError(PALUDIS_HERE, "oops"); return v->enabled(); @@ -112,7 +112,8 @@ TEST(PortageEnvironment, KnownUseFlagNames) PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", &env, { })), make_null_shared_ptr(), { }))]->begin()); std::shared_ptr<const Choice> foo_cards; - for (Choices::ConstIterator c(id1->choices_key()->value()->begin()), c_end(id1->choices_key()->value()->end()) ; + auto choices(id1->choices_key()->parse_value()); + for (Choices::ConstIterator c(choices->begin()), c_end(choices->end()) ; c != c_end ; ++c) if ((*c)->raw_name() == "FOO_CARDS") foo_cards = *c; diff --git a/paludis/filter.cc b/paludis/filter.cc index 1ccf0dab1..664478c56 100644 --- a/paludis/filter.cc +++ b/paludis/filter.cc @@ -243,7 +243,7 @@ namespace r != r_end ; ++r) { const std::shared_ptr<const Repository> repo(env->fetch_repository(*r)); - if (repo->installed_root_key() && (equal == (root == repo->installed_root_key()->value()))) + if (repo->installed_root_key() && (equal == (root == repo->installed_root_key()->parse_value()))) result->insert(*r); } @@ -348,7 +348,7 @@ namespace i != i_end ; ++i) if (as_id->slot_key()) { - if ((*i)->slot_key() && (*i)->slot_key()->value() == as_id->slot_key()->value()) + if ((*i)->slot_key() && (*i)->slot_key()->parse_value() == as_id->slot_key()->parse_value()) result->insert(*i); } else @@ -389,7 +389,7 @@ namespace for (PackageIDSet::ConstIterator i(id->begin()), i_end(id->end()) ; i != i_end ; ++i) - if ((*i)->slot_key() && (*i)->slot_key()->value() == slot) + if ((*i)->slot_key() && (*i)->slot_key()->parse_value() == slot) result->insert(*i); return result; diff --git a/paludis/formatted_pretty_printer.cc b/paludis/formatted_pretty_printer.cc index 7612b3c50..99220f8b2 100644 --- a/paludis/formatted_pretty_printer.cc +++ b/paludis/formatted_pretty_printer.cc @@ -64,7 +64,7 @@ FormattedPrettyPrinter::prettify(const PackageDepSpec & v) const { { auto ids((*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(v, _imp->package_id, { }) | - filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]); + filter::InstalledAtRoot(_imp->env->preferred_root_key()->parse_value()))]); if (! ids->empty()) return format_installed(stringify(v)); } @@ -88,7 +88,7 @@ FormattedPrettyPrinter::prettify(const BlockDepSpec & v) const { { auto ids((*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(v.blocking(), _imp->package_id, { }) | - filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]); + filter::InstalledAtRoot(_imp->env->preferred_root_key()->parse_value()))]); if (! ids->empty()) return format_masked(stringify(v)); } diff --git a/paludis/generator.cc b/paludis/generator.cc index ef3932c78..22bd5228f 100644 --- a/paludis/generator.cc +++ b/paludis/generator.cc @@ -184,9 +184,12 @@ namespace std::shared_ptr<const PackageIDSequence> id(env->fetch_repository(*r)->package_ids(*q, x)); for (PackageIDSequence::ConstIterator i(id->begin()), i_end(id->end()) ; i != i_end ; ++i) - if ((*i)->from_repositories_key() && ((*i)->from_repositories_key()->value()->end() != - (*i)->from_repositories_key()->value()->find(stringify(name)))) - result->insert(*i); + if ((*i)->from_repositories_key()) + { + auto v((*i)->from_repositories_key()->parse_value()); + if (v->end() != v->find(stringify(name))) + result->insert(*i); + } } } @@ -333,7 +336,7 @@ namespace std::shared_ptr<const Repository> repo(env->fetch_repository(spec.in_repository_requirement()->name())); if (! repo->installed_root_key()) return result; - if (repo->installed_root_key()->value() != spec.installed_at_path_requirement()->path()) + if (repo->installed_root_key()->parse_value() != spec.installed_at_path_requirement()->path()) return result; } @@ -350,7 +353,7 @@ namespace if (! (*i)->installed_root_key()) continue; - if ((*i)->installed_root_key()->value() != spec.installed_at_path_requirement()->path()) + if ((*i)->installed_root_key()->parse_value() != spec.installed_at_path_requirement()->path()) continue; result->insert((*i)->name()); diff --git a/paludis/hooker.cc b/paludis/hooker.cc index 81e1845fa..314cd82de 100644 --- a/paludis/hooker.cc +++ b/paludis/hooker.cc @@ -172,7 +172,7 @@ BashHookFile::run( Process process(ProcessCommand({ "bash", stringify(file_name()) })); process - .setenv("ROOT", stringify(_env->preferred_root_key()->value())) + .setenv("ROOT", stringify(_env->preferred_root_key()->parse_value())) .setenv("HOOK", hook.name()) .setenv("HOOK_FILE", stringify(file_name())) .setenv("HOOK_LOG_LEVEL", stringify(Log::get_instance()->log_level())) @@ -233,7 +233,7 @@ FancyHookFile::run(const Hook & hook, "/hooker.bash '" + stringify(file_name()) + "' 'hook_run_" + stringify(hook.name()) + "'" })); process - .setenv("ROOT", stringify(_env->preferred_root_key()->value())) + .setenv("ROOT", stringify(_env->preferred_root_key()->parse_value())) .setenv("HOOK", hook.name()) .setenv("HOOK_FILE", stringify(file_name())) .setenv("HOOK_LOG_LEVEL", stringify(Log::get_instance()->log_level())) @@ -294,7 +294,7 @@ FancyHookFile::auto_hook_names() const "/hooker.bash '" + stringify(file_name()) + "' 'hook_auto_names'" })); process - .setenv("ROOT", stringify(_env->preferred_root_key()->value())) + .setenv("ROOT", stringify(_env->preferred_root_key()->parse_value())) .setenv("HOOK_FILE", stringify(file_name())) .setenv("HOOK_LOG_LEVEL", stringify(Log::get_instance()->log_level())) .setenv("PALUDIS_EBUILD_DIR", getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis")) @@ -351,7 +351,7 @@ FancyHookFile::_add_dependency_class(const Hook & hook, DirectedGraph<std::strin stringify(hook.name()) + "'" })); process - .setenv("ROOT", stringify(_env->preferred_root_key()->value())) + .setenv("ROOT", stringify(_env->preferred_root_key()->parse_value())) .setenv("HOOK", hook.name()) .setenv("HOOK_FILE", stringify(file_name())) .setenv("HOOK_LOG_LEVEL", stringify(Log::get_instance()->log_level())) diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc index e5991a8b8..5bfbb6012 100644 --- a/paludis/literal_metadata_key.cc +++ b/paludis/literal_metadata_key.cc @@ -136,7 +136,7 @@ LiteralMetadataFSPathSequenceKey::~LiteralMetadataFSPathSequenceKey() } const std::shared_ptr<const FSPathSequence> -LiteralMetadataFSPathSequenceKey::value() const +LiteralMetadataFSPathSequenceKey::parse_value() const { return _imp->value; } @@ -145,7 +145,7 @@ const std::string LiteralMetadataFSPathSequenceKey::pretty_print_value( const PrettyPrinter & p, const PrettyPrintOptions &) const { - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p)); + return join(_imp->value->begin(), _imp->value->end(), " ", CallPrettyPrinter(p)); } const std::string @@ -177,7 +177,7 @@ LiteralMetadataStringSetKey::~LiteralMetadataStringSetKey() } const std::shared_ptr<const Set<std::string> > -LiteralMetadataStringSetKey::value() const +LiteralMetadataStringSetKey::parse_value() const { return _imp->value; } @@ -193,7 +193,7 @@ LiteralMetadataStringStringMapKey::~LiteralMetadataStringStringMapKey() } const std::shared_ptr<const Map<std::string, std::string> > -LiteralMetadataStringStringMapKey::value() const +LiteralMetadataStringStringMapKey::parse_value() const { return _imp->value; } @@ -209,7 +209,7 @@ LiteralMetadataStringSequenceKey::~LiteralMetadataStringSequenceKey() } const std::shared_ptr<const Sequence<std::string> > -LiteralMetadataStringSequenceKey::value() const +LiteralMetadataStringSequenceKey::parse_value() const { return _imp->value; } @@ -236,21 +236,21 @@ const std::string LiteralMetadataStringSetKey::pretty_print_value( const PrettyPrinter & p, const PrettyPrintOptions &) const { - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p)); + return join(_imp->value->begin(), _imp->value->end(), " ", CallPrettyPrinter(p)); } const std::string LiteralMetadataStringStringMapKey::pretty_print_value( const PrettyPrinter & p, const PrettyPrintOptions &) const { - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p)); + return join(_imp->value->begin(), _imp->value->end(), " ", CallPrettyPrinter(p)); } const std::string LiteralMetadataStringSequenceKey::pretty_print_value( const PrettyPrinter & p, const PrettyPrintOptions &) const { - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p)); + return join(_imp->value->begin(), _imp->value->end(), " ", CallPrettyPrinter(p)); } const std::string @@ -331,7 +331,7 @@ LiteralMetadataValueKey<T_>::~LiteralMetadataValueKey() template <typename T_> const T_ -LiteralMetadataValueKey<T_>::value() const +LiteralMetadataValueKey<T_>::parse_value() const { return _imp->value; } @@ -342,7 +342,7 @@ PrettyPrintableLiteralMetadataValueKey<T_>::pretty_print_value( const PrettyPrinter & printer, const PrettyPrintOptions &) const { - return printer.prettify(this->value()); + return printer.prettify(this->parse_value()); } namespace paludis @@ -394,7 +394,7 @@ LiteralMetadataTimeKey::type() const } Timestamp -LiteralMetadataTimeKey::value() const +LiteralMetadataTimeKey::parse_value() const { return _imp->value; } diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh index 8e60953c3..9a581cb18 100644 --- a/paludis/literal_metadata_key.hh +++ b/paludis/literal_metadata_key.hh @@ -72,7 +72,7 @@ namespace paludis ///\} - virtual const T_ value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual const T_ parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -107,7 +107,7 @@ namespace paludis ///\} - virtual const std::shared_ptr<const FSPathSequence> value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual const std::shared_ptr<const FSPathSequence> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -141,7 +141,7 @@ namespace paludis ///\} - virtual const std::shared_ptr<const Set<std::string> > value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual const std::shared_ptr<const Set<std::string> > parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -175,7 +175,7 @@ namespace paludis ///\} - virtual const std::shared_ptr<const Sequence<std::string> > value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual const std::shared_ptr<const Sequence<std::string> > parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -209,7 +209,7 @@ namespace paludis ///\} - virtual Timestamp value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual Timestamp parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -239,7 +239,7 @@ namespace paludis ///\} - virtual const std::shared_ptr<const Map<std::string, std::string> > value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual const std::shared_ptr<const Map<std::string, std::string> > parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/match_package.cc b/paludis/match_package.cc index d15aca579..da30f295d 100644 --- a/paludis/match_package.cc +++ b/paludis/match_package.cc @@ -98,8 +98,8 @@ paludis::match_package_with_maybe_changes( if (! id->from_repositories_key()) return false; - if (id->from_repositories_key()->value()->end() == id->from_repositories_key()->value()->find( - stringify(spec.from_repository_requirement()->name()))) + auto v(id->from_repositories_key()->parse_value()); + if (v->end() == v->find(stringify(spec.from_repository_requirement()->name()))) return false; } @@ -108,7 +108,7 @@ paludis::match_package_with_maybe_changes( auto repo(env.fetch_repository(id->repository_name())); if (! repo->installed_root_key()) return false; - if (repo->installed_root_key()->value() != spec.installed_at_path_requirement()->path()) + if (repo->installed_root_key()->parse_value() != spec.installed_at_path_requirement()->path()) return false; } @@ -144,7 +144,7 @@ paludis::match_package_with_maybe_changes( continue; if (! (*d)->installed_root_key()) continue; - if ((*d)->installed_root_key()->value() != spec.installable_to_path_requirement()->path()) + if ((*d)->installed_root_key()->parse_value() != spec.installable_to_path_requirement()->path()) continue; if (! (*d)->destination_interface()->is_suitable_destination_for(id)) continue; @@ -159,7 +159,7 @@ paludis::match_package_with_maybe_changes( if (spec.exact_slot_requirement()) { - if ((! id->slot_key()) || (id->slot_key()->value() != spec.exact_slot_requirement()->name())) + if ((! id->slot_key()) || (id->slot_key()->parse_value() != spec.exact_slot_requirement()->name())) return false; } diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh index 3a88d2705..080f5763e 100644 --- a/paludis/metadata_key.hh +++ b/paludis/metadata_key.hh @@ -74,9 +74,8 @@ namespace paludis * should be displayed when outputting information about a package ID * or Repository. * - * Subclasses provide additional information, including the 'value' of the - * key. A ConstVisitor using MetadataKeyVisitorTypes can be used to get more - * detail. + * Subclasses provide additional information, including the value of the + * key via a 'parse_value' method. A visitor can be used to get more detail. * * The header \ref paludis/literal_metadata_key.hh "literal_metadata_key.hh" * contains various concrete implementations of MetadataKey subclasses. @@ -231,8 +230,10 @@ namespace paludis /** * Fetch our value. + * + * \since 0.61 is called parse_value */ - virtual const C_ value() const + virtual const C_ parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0; }; @@ -255,8 +256,9 @@ namespace paludis * Fetch our value. * * \since 0.44 Timestamp instead of time_t + * \since 0.61 is called parse_value */ - virtual Timestamp value() const + virtual Timestamp parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0; }; @@ -277,9 +279,12 @@ namespace paludis virtual ~MetadataCollectionKey() = 0; /** - * Fetch our value. + * Fetch our value, parse not necessarily cached (so + * multiple calls may return different shared_ptrs). + * + * \since 0.61 */ - virtual const std::shared_ptr<const C_> value() const + virtual const std::shared_ptr<const C_> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0; }; @@ -300,9 +305,12 @@ namespace paludis virtual ~MetadataSpecTreeKey() = 0; /** - * Fetch our value. + * Fetch our value, parse not necessarily cached (so + * multiple calls may return different shared_ptrs). + * + * \since 0.61 */ - virtual const std::shared_ptr<const C_> value() const + virtual const std::shared_ptr<const C_> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0; }; @@ -326,9 +334,12 @@ namespace paludis virtual ~MetadataSpecTreeKey() = 0; /** - * Fetch our value. + * Fetch our value, parse not necessarily cached (so + * multiple calls may return different shared_ptrs). + * + * \since 0.61 */ - virtual const std::shared_ptr<const FetchableURISpecTree> value() const + virtual const std::shared_ptr<const FetchableURISpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0; /** @@ -359,9 +370,12 @@ namespace paludis virtual ~MetadataSpecTreeKey() = 0; /** - * Fetch our value. + * Fetch our value, parse not necessarily cached (so + * multiple calls may return different shared_ptrs). + * + * \since 0.61 */ - virtual const std::shared_ptr<const DependencySpecTree> value() const + virtual const std::shared_ptr<const DependencySpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0; /** diff --git a/paludis/ndbam.cc b/paludis/ndbam.cc index 1caa507db..62fea4d66 100644 --- a/paludis/ndbam.cc +++ b/paludis/ndbam.cc @@ -444,7 +444,7 @@ NDBAM::parse_contents(const PackageID & id, if (! id.fs_location_key()) throw InternalError(PALUDIS_HERE, "No id.fs_location_key"); - FSPath ff(id.fs_location_key()->value() / "contents"); + FSPath ff(id.fs_location_key()->parse_value() / "contents"); if (! ff.stat().is_regular_file_or_symlink_to_regular_file()) { Log::get_instance()->message("ndbam.contents.skipping", ll_warning, lc_context) diff --git a/paludis/ndbam_merger.cc b/paludis/ndbam_merger.cc index e94ae8368..a57794a01 100644 --- a/paludis/ndbam_merger.cc +++ b/paludis/ndbam_merger.cc @@ -103,7 +103,7 @@ NDBAMMerger::extend_hook(const Hook & h) std::string pn(stringify(_imp->params.package_id()->name().package())); std::string pvr(stringify(_imp->params.package_id()->version())); std::string pv(stringify(_imp->params.package_id()->version().remove_revision())); - std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->value()) : ""); + std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->parse_value()) : ""); return FSMerger::extend_hook(h) ("P", pn + "-" + pv) diff --git a/paludis/ndbam_unmerger.cc b/paludis/ndbam_unmerger.cc index 72ded34fb..6966b5e1f 100644 --- a/paludis/ndbam_unmerger.cc +++ b/paludis/ndbam_unmerger.cc @@ -101,7 +101,7 @@ NDBAMUnmerger::extend_hook(const Hook & h) const std::string pn(stringify(_imp->options.package_id()->name().package())); std::string pvr(stringify(_imp->options.package_id()->version())); std::string pv(stringify(_imp->options.package_id()->version().remove_revision())); - std::string slot(_imp->options.package_id()->slot_key() ? stringify(_imp->options.package_id()->slot_key()->value()) : ""); + std::string slot(_imp->options.package_id()->slot_key() ? stringify(_imp->options.package_id()->slot_key()->parse_value()) : ""); return result ("P", pn + "-" + pv) @@ -205,7 +205,7 @@ namespace bool NDBAMUnmerger::check_file(const std::shared_ptr<const ContentsEntry> & e) const { - const FSPath f(e->location_key()->value()); + const FSPath f(e->location_key()->parse_value()); const FSPath root_f(_imp->options.root() / f); const FSStat root_f_stat(root_f); @@ -213,7 +213,7 @@ NDBAMUnmerger::check_file(const std::shared_ptr<const ContentsEntry> & e) const display("--- [gone ] " + stringify(f)); else if (! root_f_stat.is_regular_file()) display("--- [!type] " + stringify(f)); - else if (root_f_stat.mtim().seconds() != require_key<MetadataTimeKey>(*e, "mtime").value().seconds()) + else if (root_f_stat.mtim().seconds() != require_key<MetadataTimeKey>(*e, "mtime").parse_value().seconds()) display("--- [!time] " + stringify(f)); else { @@ -223,7 +223,7 @@ NDBAMUnmerger::check_file(const std::shared_ptr<const ContentsEntry> & e) const Log::get_instance()->message("ndbam.unmerger.md5_failed", ll_warning, lc_no_context) << "Cannot get md5 for '" << root_f << "'"; display("--- [!md5?] " + stringify(f)); } - else if (MD5(md5_file).hexsum() != require_key<MetadataValueKey<std::string> >(*e, "md5").value()) + else if (MD5(md5_file).hexsum() != require_key<MetadataValueKey<std::string> >(*e, "md5").parse_value()) display("--- [!md5 ] " + stringify(f)); else if (config_protected(root_f)) display("--- [cfgpr] " + stringify(f)); @@ -237,7 +237,7 @@ NDBAMUnmerger::check_file(const std::shared_ptr<const ContentsEntry> & e) const bool NDBAMUnmerger::check_sym(const std::shared_ptr<const ContentsEntry> & e) const { - const FSPath f(e->location_key()->value()); + const FSPath f(e->location_key()->parse_value()); const FSPath root_f(_imp->options.root() / f); const FSStat root_f_stat(root_f); @@ -245,9 +245,9 @@ NDBAMUnmerger::check_sym(const std::shared_ptr<const ContentsEntry> & e) const display("--- [gone ] " + stringify(f)); else if (! root_f_stat.is_symlink()) display("--- [!type] " + stringify(f)); - else if (root_f_stat.mtim().seconds() != require_key<MetadataTimeKey>(*e, "mtime").value().seconds()) + else if (root_f_stat.mtim().seconds() != require_key<MetadataTimeKey>(*e, "mtime").parse_value().seconds()) display("--- [!time] " + stringify(f)); - else if (root_f.readlink() != require_key<MetadataValueKey<std::string> >(*e, "target").value()) + else if (root_f.readlink() != require_key<MetadataValueKey<std::string> >(*e, "target").parse_value()) display("--- [!dest] " + stringify(f)); else return true; @@ -264,7 +264,7 @@ NDBAMUnmerger::check_misc(const std::shared_ptr<const ContentsEntry> &) const bool NDBAMUnmerger::check_dir(const std::shared_ptr<const ContentsEntry> & e) const { - const FSPath f(e->location_key()->value()); + const FSPath f(e->location_key()->parse_value()); const FSPath root_f(_imp->options.root() / f); const FSStat root_f_stat(root_f); diff --git a/paludis/package_dep_spec_requirement.cc b/paludis/package_dep_spec_requirement.cc index ee1d8101f..cdf2b7ae1 100644 --- a/paludis/package_dep_spec_requirement.cc +++ b/paludis/package_dep_spec_requirement.cc @@ -343,7 +343,7 @@ namespace { std::string stringify_contents_entry(const ContentsEntry & e) { - return stringify(e.location_key()->value()); + return stringify(e.location_key()->parse_value()); } struct StringifyEqual @@ -486,13 +486,13 @@ namespace switch (op) { case kro_equals: - return pattern == stringify(k.value().seconds()); + return pattern == stringify(k.parse_value().seconds()); case kro_tilde: - return std::string::npos != stringify(k.value().seconds()).find(pattern); + return std::string::npos != stringify(k.parse_value().seconds()).find(pattern); case kro_less_than: - return k.value().seconds() < destringify<time_t>(pattern); + return k.parse_value().seconds() < destringify<time_t>(pattern); case kro_greater_than: - return k.value().seconds() > destringify<time_t>(pattern); + return k.parse_value().seconds() > destringify<time_t>(pattern); case kro_question: case last_kro: break; @@ -506,9 +506,9 @@ namespace switch (op) { case kro_equals: - return pattern == stringify(k.value()); + return pattern == stringify(k.parse_value()); case kro_tilde: - return std::string::npos != stringify(k.value()).find(pattern); + return std::string::npos != stringify(k.parse_value()).find(pattern); case kro_less_than: case kro_greater_than: case kro_question: @@ -524,9 +524,9 @@ namespace switch (op) { case kro_equals: - return pattern == stringify(k.value()); + return pattern == stringify(k.parse_value()); case kro_tilde: - return std::string::npos != stringify(k.value()).find(pattern); + return std::string::npos != stringify(k.parse_value()).find(pattern); case kro_less_than: case kro_greater_than: case kro_question: @@ -542,9 +542,9 @@ namespace switch (op) { case kro_equals: - return pattern == stringify(k.value()); + return pattern == stringify(k.parse_value()); case kro_tilde: - return std::string::npos != stringify(k.value()).find(pattern); + return std::string::npos != stringify(k.parse_value()).find(pattern); case kro_less_than: case kro_greater_than: case kro_question: @@ -560,9 +560,9 @@ namespace switch (op) { case kro_equals: - return pattern == stringify(k.value()); + return pattern == stringify(k.parse_value()); case kro_tilde: - return std::string::npos != stringify(k.value()).find(pattern); + return std::string::npos != stringify(k.parse_value()).find(pattern); case kro_less_than: case kro_greater_than: case kro_question: @@ -578,13 +578,13 @@ namespace switch (op) { case kro_equals: - return pattern == stringify(k.value()); + return pattern == stringify(k.parse_value()); case kro_tilde: - return std::string::npos != stringify(k.value()).find(pattern); + return std::string::npos != stringify(k.parse_value()).find(pattern); case kro_less_than: - return k.value() < destringify<long>(pattern); + return k.parse_value() < destringify<long>(pattern); case kro_greater_than: - return k.value() > destringify<long>(pattern); + return k.parse_value() > destringify<long>(pattern); case kro_question: case last_kro: break; @@ -600,15 +600,16 @@ namespace bool visit(const MetadataValueKey<std::shared_ptr<const Contents> > & s) const { + auto v(s.parse_value()); switch (op) { case kro_equals: - return pattern == join(indirect_iterator(s.value()->begin()), indirect_iterator(s.value()->end()), " ", + return pattern == join(indirect_iterator(v->begin()), indirect_iterator(v->end()), " ", stringify_contents_entry); case kro_less_than: - return indirect_iterator(s.value()->end()) != std::find_if( - indirect_iterator(s.value()->begin()), - indirect_iterator(s.value()->end()), + return indirect_iterator(v->end()) != std::find_if( + indirect_iterator(v->begin()), + indirect_iterator(v->end()), StringifyEqual(pattern)); case kro_greater_than: @@ -626,9 +627,9 @@ namespace switch (op) { case kro_equals: - return pattern == stringify(*k.value()); + return pattern == stringify(*k.parse_value()); case kro_tilde: - return std::string::npos != stringify(*k.value()).find(pattern); + return std::string::npos != stringify(*k.parse_value()).find(pattern); case kro_less_than: case kro_greater_than: case kro_question: @@ -646,7 +647,7 @@ namespace case kro_equals: return false; case kro_less_than: - return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); + return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); case kro_tilde: case kro_greater_than: @@ -665,7 +666,7 @@ namespace case kro_equals: return false; case kro_less_than: - return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); + return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); case kro_tilde: case kro_greater_than: @@ -684,7 +685,7 @@ namespace case kro_equals: return false; case kro_less_than: - return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); + return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); case kro_tilde: case kro_greater_than: @@ -703,7 +704,7 @@ namespace case kro_equals: return false; case kro_less_than: - return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); + return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); case kro_tilde: case kro_greater_than: @@ -722,7 +723,7 @@ namespace case kro_equals: return false; case kro_less_than: - return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); + return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); case kro_tilde: case kro_greater_than: @@ -741,7 +742,7 @@ namespace case kro_equals: return false; case kro_less_than: - return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); + return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); case kro_tilde: case kro_greater_than: @@ -760,7 +761,7 @@ namespace case kro_equals: return false; case kro_less_than: - return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); + return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); case kro_tilde: case kro_greater_than: @@ -779,7 +780,7 @@ namespace case kro_equals: return false; case kro_less_than: - return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); + return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern)); case kro_tilde: case kro_greater_than: @@ -793,13 +794,13 @@ namespace bool visit(const MetadataCollectionKey<FSPathSequence> & s) const { + auto v(s.parse_value()); switch (op) { case kro_equals: - return pattern == join(s.value()->begin(), s.value()->end(), " "); + return pattern == join(v->begin(), v->end(), " "); case kro_less_than: - return s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(), - StringifyEqual(pattern)); + return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern)); case kro_tilde: case kro_greater_than: @@ -813,14 +814,15 @@ namespace bool visit(const MetadataCollectionKey<PackageIDSequence> & s) const { + auto v(s.parse_value()); switch (op) { case kro_equals: - return pattern == join(indirect_iterator(s.value()->begin()), indirect_iterator(s.value()->end()), " "); + return pattern == join(indirect_iterator(v->begin()), indirect_iterator(v->end()), " "); case kro_less_than: - return indirect_iterator(s.value()->end()) != std::find_if( - indirect_iterator(s.value()->begin()), - indirect_iterator(s.value()->end()), + return indirect_iterator(v->end()) != std::find_if( + indirect_iterator(v->begin()), + indirect_iterator(v->end()), StringifyEqual(pattern)); case kro_tilde: @@ -835,13 +837,13 @@ namespace bool visit(const MetadataCollectionKey<Sequence<std::string> > & s) const { + auto v(s.parse_value()); switch (op) { case kro_equals: - return pattern == join(s.value()->begin(), s.value()->end(), " "); + return pattern == join(v->begin(), v->end(), " "); case kro_less_than: - return s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(), - StringifyEqual(pattern)); + return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern)); case kro_tilde: case kro_greater_than: @@ -855,13 +857,13 @@ namespace bool visit(const MetadataCollectionKey<Set<std::string> > & s) const { + auto v(s.parse_value()); switch (op) { case kro_equals: - return pattern == join(s.value()->begin(), s.value()->end(), " "); + return pattern == join(v->begin(), v->end(), " "); case kro_less_than: - return s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(), - StringifyEqual(pattern)); + return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern)); case kro_tilde: case kro_greater_than: @@ -880,13 +882,13 @@ namespace bool visit(const MetadataCollectionKey<KeywordNameSet> & s) const { + auto v(s.parse_value()); switch (op) { case kro_equals: - return pattern == join(s.value()->begin(), s.value()->end(), " "); + return pattern == join(v->begin(), v->end(), " "); case kro_less_than: - return s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(), - StringifyEqual(pattern)); + return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern)); case kro_tilde: case kro_greater_than: diff --git a/paludis/repositories/accounts/accounts_dep_key.cc b/paludis/repositories/accounts/accounts_dep_key.cc index 633768286..0bc9bd574 100644 --- a/paludis/repositories/accounts/accounts_dep_key.cc +++ b/paludis/repositories/accounts/accounts_dep_key.cc @@ -113,7 +113,7 @@ AccountsDepKey::type() const } const std::shared_ptr<const DependencySpecTree> -AccountsDepKey::value() const +AccountsDepKey::parse_value() const { return _imp->tree; } diff --git a/paludis/repositories/accounts/accounts_dep_key.hh b/paludis/repositories/accounts/accounts_dep_key.hh index d4c3decd0..49721cab2 100644 --- a/paludis/repositories/accounts/accounts_dep_key.hh +++ b/paludis/repositories/accounts/accounts_dep_key.hh @@ -42,7 +42,7 @@ namespace paludis virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual const std::shared_ptr<const DependencySpecTree> value() const + virtual const std::shared_ptr<const DependencySpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc index c84bf10ab..0a9b5fd6c 100644 --- a/paludis/repositories/accounts/accounts_id.cc +++ b/paludis/repositories/accounts/accounts_id.cc @@ -175,7 +175,7 @@ AccountsID::_need_file_keys() const Lock lock(_imp->mutex); - KeyValueConfigFile k(_imp->fs_location_key->value(), { }, + KeyValueConfigFile k(_imp->fs_location_key->parse_value(), { }, &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation); /* also need to change the handlers if any of the raw names are changed */ @@ -507,7 +507,7 @@ AccountsID::perform_action(Action & action) const n::build_start_time() = build_start_time, n::check() = true, n::environment_file() = FSPath("/dev/null"), - n::image_dir() = fs_location_key()->value(), + n::image_dir() = fs_location_key()->parse_value(), n::merged_entries() = std::make_shared<FSPathSet>(), n::options() = MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs, n::output_manager() = output_manager, @@ -561,7 +561,7 @@ AccountsID::perform_action(Action & action) const { Context local_context("When cleaning '" + stringify(**i) + "':"); auto repo(_imp->env->fetch_repository((*i)->repository_name())); - if (repo->format_key() && repo->format_key()->value() == "installed-accounts" + if (repo->format_key() && repo->format_key()->parse_value() == "installed-accounts" && (*i)->name() == name()) continue; else diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc index 55e8560a0..8ca6b7b0e 100644 --- a/paludis/repositories/accounts/accounts_repository.cc +++ b/paludis/repositories/accounts/accounts_repository.cc @@ -397,7 +397,7 @@ AccountsRepository::is_suitable_destination_for(const std::shared_ptr<const Pack { auto env(_imp->params_if_installed ? _imp->params_if_installed->environment() : _imp->params_if_not_installed->environment()); auto repo(env->fetch_repository(id->repository_name())); - std::string f(repo->format_key() ? repo->format_key()->value() : ""); + std::string f(repo->format_key() ? repo->format_key()->parse_value() : ""); return _imp->handler_if_installed && f == "accounts"; } @@ -405,7 +405,7 @@ bool AccountsRepository::is_default_destination() const { return _imp->handler_if_installed && - _imp->params_if_installed->environment()->preferred_root_key()->value() == installed_root_key()->value(); + _imp->params_if_installed->environment()->preferred_root_key()->parse_value() == installed_root_key()->parse_value(); } bool diff --git a/paludis/repositories/accounts/accounts_repository_store.cc b/paludis/repositories/accounts/accounts_repository_store.cc index 879c224c3..c9ecefa9f 100644 --- a/paludis/repositories/accounts/accounts_repository_store.cc +++ b/paludis/repositories/accounts/accounts_repository_store.cc @@ -121,7 +121,7 @@ AccountsRepositoryStore::_load(const RepositoryName & repository_name) continue; } - FSPath dir(k->value()); + FSPath dir(k->parse_value()); if (! dir.stat().is_directory_or_symlink_to_directory()) { Log::get_instance()->message("accounts.empty_key_from_repository", ll_warning, lc_context) << diff --git a/paludis/repositories/accounts/passwd_accounts_handler.cc b/paludis/repositories/accounts/passwd_accounts_handler.cc index bac2cb24b..15195adc7 100644 --- a/paludis/repositories/accounts/passwd_accounts_handler.cc +++ b/paludis/repositories/accounts/passwd_accounts_handler.cc @@ -66,7 +66,7 @@ PasswdAccountsHandler::merge_user(const MergeParams & params) if (! k) throw ActionFailedError("Key 'username' for '" + stringify(*params.package_id()) + "' is not a string key"); - username = k->value(); + username = k->parse_value(); if (0 != getpwnam(username.c_str())) throw ActionFailedError("User '" + username + "' already exists"); @@ -83,7 +83,7 @@ PasswdAccountsHandler::merge_user(const MergeParams & params) if (! k) throw ActionFailedError("Key 'gecos' for '" + stringify(*params.package_id()) + "' is not a string key"); - gecos = k->value(); + gecos = k->parse_value(); if (std::string::npos != gecos.find('\'')) throw ActionFailedError("Value for key 'gecos' for '" + stringify(*params.package_id()) + "' must not contain a quote"); @@ -103,7 +103,7 @@ PasswdAccountsHandler::merge_user(const MergeParams & params) if (! k) throw ActionFailedError("Key 'preferred_uid' for '" + stringify(*params.package_id()) + "' is not a string key"); - preferred_uid = k->value(); + preferred_uid = k->parse_value(); if (std::string::npos != preferred_uid.find_first_not_of("0123456789")) throw ActionFailedError("Value for key 'preferred_uid' for '" + stringify(*params.package_id()) + "' must be a number"); @@ -130,7 +130,7 @@ PasswdAccountsHandler::merge_user(const MergeParams & params) if (! k) throw ActionFailedError("Key 'primary_group' for '" + stringify(*params.package_id()) + "' is not a string key"); - primary_group = k->value(); + primary_group = k->parse_value(); if (std::string::npos != primary_group.find('\'')) throw ActionFailedError("Value for key 'primary_group' for '" + stringify(*params.package_id()) + "' must not contain a quote"); @@ -150,7 +150,8 @@ PasswdAccountsHandler::merge_user(const MergeParams & params) if (! k) throw ActionFailedError("Key 'extra_groups' for '" + stringify(*params.package_id()) + "' is not a string set key"); - extra_groups = join(k->value()->begin(), k->value()->end(), ","); + auto v(k->parse_value()); + extra_groups = join(v->begin(), v->end(), ","); if (std::string::npos != extra_groups.find('\'')) throw ActionFailedError("Value for key 'extra_groups' for '" + stringify(*params.package_id()) + "' must not contain a quote"); @@ -170,7 +171,7 @@ PasswdAccountsHandler::merge_user(const MergeParams & params) if (! k) throw ActionFailedError("Key 'shell' for '" + stringify(*params.package_id()) + "' is not a string key"); - shell = k->value(); + shell = k->parse_value(); if (std::string::npos != shell.find('\'')) throw ActionFailedError("Value for key 'shell' for '" + stringify(*params.package_id()) + "' must not contain a quote"); @@ -190,7 +191,7 @@ PasswdAccountsHandler::merge_user(const MergeParams & params) if (! k) throw ActionFailedError("Key 'home' for '" + stringify(*params.package_id()) + "' is not a string key"); - home = k->value(); + home = k->parse_value(); if (std::string::npos != home.find('\'')) throw ActionFailedError("Value for key 'home' for '" + stringify(*params.package_id()) + "' must not contain a quote"); @@ -222,7 +223,7 @@ PasswdAccountsHandler::merge_group(const MergeParams & params) if (! k) throw ActionFailedError("Key 'groupname' for '" + stringify(*params.package_id()) + "' is not a string key"); - groupname = k->value(); + groupname = k->parse_value(); if (0 != getgrnam(groupname.c_str())) throw ActionFailedError("Group '" + groupname + "' already exists"); @@ -239,7 +240,7 @@ PasswdAccountsHandler::merge_group(const MergeParams & params) if (! k) throw ActionFailedError("Key 'preferred_gid' for '" + stringify(*params.package_id()) + "' is not a string key"); - preferred_gid = k->value(); + preferred_gid = k->parse_value(); if (std::string::npos != preferred_gid.find_first_not_of("0123456789")) throw ActionFailedError("Value for key 'preferred_gid' for '" + stringify(*params.package_id()) + "' must be a number"); diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am index 8f7545fb3..28dc795fb 100644 --- a/paludis/repositories/e/Makefile.am +++ b/paludis/repositories/e/Makefile.am @@ -72,6 +72,7 @@ noinst_HEADERS = \ fix_locked_dependencies.hh \ glsa.hh \ layout.hh \ + make_archive_strings.hh \ make_use.hh \ manifest2_reader.hh \ mask_info.hh \ @@ -150,6 +151,7 @@ libpaludiserepository_la_SOURCES = \ fix_locked_dependencies.cc \ glsa.cc \ layout.cc \ + make_archive_strings.cc \ make_use.cc \ manifest2_reader.cc \ mask_info.cc \ diff --git a/paludis/repositories/e/can_skip_phase.cc b/paludis/repositories/e/can_skip_phase.cc index 9fc3e5f85..7ce33054b 100644 --- a/paludis/repositories/e/can_skip_phase.cc +++ b/paludis/repositories/e/can_skip_phase.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2009, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -94,14 +94,15 @@ paludis::erepository::can_skip_phase( if (id->fetches_key()) { FindAnyFetchesFinder f(env, id); - id->fetches_key()->value()->top()->accept(f); + id->fetches_key()->parse_value()->top()->accept(f); if (! f.result) return false; } } else { - if (id->defined_phases_key()->value()->end() != id->defined_phases_key()->value()->find(*i)) + auto d(id->defined_phases_key()->parse_value()); + if (d->end() != d->find(*i)) return false; } } diff --git a/paludis/repositories/e/do_fetch_action.cc b/paludis/repositories/e/do_fetch_action.cc index d79ec5653..9c790c260 100644 --- a/paludis/repositories/e/do_fetch_action.cc +++ b/paludis/repositories/e/do_fetch_action.cc @@ -28,6 +28,7 @@ #include <paludis/repositories/e/make_use.hh> #include <paludis/repositories/e/can_skip_phase.hh> #include <paludis/repositories/e/ebuild.hh> +#include <paludis/repositories/e/make_archive_strings.hh> #include <paludis/util/strip.hh> #include <paludis/util/make_named_values.hh> @@ -63,7 +64,7 @@ paludis::erepository::do_fetch_action( { DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env, id); if (id->restrict_key()) - id->restrict_key()->value()->top()->accept(restricts); + id->restrict_key()->parse_value()->top()->accept(restricts); for (DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec>::ConstIterator i(restricts.begin()), i_end(restricts.end()) ; i != i_end ; ++i) @@ -82,47 +83,7 @@ paludis::erepository::do_fetch_action( id->eapi()->supported()->userpriv_cannot_use_root())); std::string archives, all_archives; - { - std::set<std::string> already_in_archives; - - /* make A */ - AFinder f(env, id); - if (id->fetches_key()) - id->fetches_key()->value()->top()->accept(f); - - for (AFinder::ConstIterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i) - { - const FetchableURIDepSpec * const spec(static_cast<const FetchableURIDepSpec *>(i->first)); - - if (already_in_archives.end() == already_in_archives.find(spec->filename())) - { - archives.append(spec->filename()); - already_in_archives.insert(spec->filename()); - } - archives.append(" "); - } - - /* make AA */ - if (! id->eapi()->supported()->ebuild_environment_variables()->env_aa().empty()) - { - AAVisitor g; - if (id->fetches_key()) - id->fetches_key()->value()->top()->accept(g); - std::set<std::string> already_in_all_archives; - - for (AAVisitor::ConstIterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg) - { - if (already_in_all_archives.end() == already_in_all_archives.find(*gg)) - { - all_archives.append(*gg); - already_in_all_archives.insert(*gg); - } - all_archives.append(" "); - } - } - else - all_archives = "AA-not-set-for-this-EAPI"; - } + std::tie(archives, all_archives) = make_archives_strings(env, id); /* Strip trailing space. Some ebuilds rely upon this. From kde-meta.eclass: * [[ -n ${A/${TARBALL}/} ]] && unpack ${A/${TARBALL}/} @@ -143,6 +104,8 @@ paludis::erepository::do_fetch_action( if (id->fetches_key()) { + auto fetches(id->fetches_key()->parse_value()); + /* always use mirror://gentoo/, where gentoo is the name of our first master repository, * or our name if there's no master. */ std::string mirrors_name( @@ -157,10 +120,10 @@ paludis::erepository::do_fetch_action( fetch_userpriv_ok, mirrors_name, id->fetches_key()->initial_label(), fetch_action.options.safe_resume(), output_manager, std::bind(&ERepository::get_mirrors, repo, std::placeholders::_1)); - id->fetches_key()->value()->top()->accept(f); + fetches->top()->accept(f); } - id->fetches_key()->value()->top()->accept(c); + fetches->top()->accept(c); } if ( (fetch_action.options.fetch_parts()[fp_extras]) && ((c.need_nofetch()) || @@ -218,7 +181,7 @@ paludis::erepository::do_fetch_action( n::commands() = join(phase->begin_commands(), phase->end_commands(), " "), n::distdir() = repo->params().distdir(), n::ebuild_dir() = repo->layout()->package_directory(id->name()), - n::ebuild_file() = id->fs_location_key()->value(), + n::ebuild_file() = id->fs_location_key()->parse_value(), n::eclassdirs() = repo->params().eclassdirs(), n::environment() = env, n::exlibsdirs() = exlibsdirs, @@ -242,7 +205,7 @@ paludis::erepository::do_fetch_action( n::loadsaveenv_dir() = package_builddir / "temp", n::profiles() = repo->params().profiles(), n::profiles_with_parents() = repo->profile()->profiles_with_parents(), - n::slot() = id->slot_key() ? stringify(id->slot_key()->value()) : "", + n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value()) : "", n::use() = use, n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "), n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ") @@ -265,7 +228,7 @@ paludis::erepository::do_fetch_action( n::commands() = join(phase->begin_commands(), phase->end_commands(), " "), n::distdir() = repo->params().distdir(), n::ebuild_dir() = repo->layout()->package_directory(id->name()), - n::ebuild_file() = id->fs_location_key()->value(), + n::ebuild_file() = id->fs_location_key()->parse_value(), n::eclassdirs() = repo->params().eclassdirs(), n::environment() = env, n::exlibsdirs() = exlibsdirs, diff --git a/paludis/repositories/e/do_info_action.cc b/paludis/repositories/e/do_info_action.cc index 2d89dfe99..d03737586 100644 --- a/paludis/repositories/e/do_info_action.cc +++ b/paludis/repositories/e/do_info_action.cc @@ -57,7 +57,7 @@ paludis::erepository::do_info_action( { DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env, id); if (id->restrict_key()) - id->restrict_key()->value()->top()->accept(restricts); + id->restrict_key()->parse_value()->top()->accept(restricts); userpriv_restrict = indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()), @@ -91,7 +91,7 @@ paludis::erepository::do_info_action( n::commands() = join(phase->begin_commands(), phase->end_commands(), " "), n::distdir() = repo->params().distdir(), n::ebuild_dir() = repo->layout()->package_directory(id->name()), - n::ebuild_file() = id->fs_location_key()->value(), + n::ebuild_file() = id->fs_location_key()->parse_value(), n::eclassdirs() = repo->params().eclassdirs(), n::environment() = env, n::exlibsdirs() = exlibsdirs, @@ -102,7 +102,7 @@ paludis::erepository::do_info_action( n::portdir() = (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ? (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(), - n::root() = stringify(env->preferred_root_key()->value()), + n::root() = stringify(env->preferred_root_key()->parse_value()), n::sandbox() = phase->option("sandbox"), n::sydbox() = phase->option("sydbox"), n::userpriv() = phase->option("userpriv") && userpriv_ok @@ -112,7 +112,7 @@ paludis::erepository::do_info_action( make_named_values<EbuildInfoCommandParams>( n::expand_vars() = expand_vars, n::info_vars() = repo->info_vars_key() ? - repo->info_vars_key()->value() : std::make_shared<const Set<std::string>>(), + repo->info_vars_key()->parse_value() : std::make_shared<const Set<std::string>>(), n::load_environment() = static_cast<const FSPath *>(0), n::profiles() = repo->params().profiles(), n::profiles_with_parents() = repo->profile()->profiles_with_parents(), diff --git a/paludis/repositories/e/do_install_action.cc b/paludis/repositories/e/do_install_action.cc index 6ed6d2a00..38273e0b3 100644 --- a/paludis/repositories/e/do_install_action.cc +++ b/paludis/repositories/e/do_install_action.cc @@ -28,6 +28,7 @@ #include <paludis/repositories/e/can_skip_phase.hh> #include <paludis/repositories/e/e_stripper.hh> #include <paludis/repositories/e/ebuild.hh> +#include <paludis/repositories/e/make_archive_strings.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/accept_visitor.hh> @@ -97,7 +98,7 @@ namespace const std::shared_ptr<const PackageID> & b) { if (a->slot_key()) - return b->slot_key() && a->slot_key()->value() == b->slot_key()->value(); + return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value(); else return ! b->slot_key(); } @@ -133,7 +134,7 @@ paludis::erepository::do_install_action( { DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env, id); if (id->restrict_key()) - id->restrict_key()->value()->top()->accept(restricts); + id->restrict_key()->parse_value()->top()->accept(restricts); userpriv_restrict = indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()), @@ -153,59 +154,19 @@ paludis::erepository::do_install_action( } std::string archives, all_archives, accept_license; - { - std::set<std::string> already_in_archives; - - /* make A */ - AFinder f(env, id); - if (id->fetches_key()) - id->fetches_key()->value()->top()->accept(f); - - for (AFinder::ConstIterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i) - { - const FetchableURIDepSpec * const spec(static_cast<const FetchableURIDepSpec *>(i->first)); + std::tie(archives, all_archives) = make_archives_strings(env, id); - if (already_in_archives.end() == already_in_archives.find(spec->filename())) - { - archives.append(spec->filename()); - already_in_archives.insert(spec->filename()); - } - archives.append(" "); - } - - /* make AA */ - if (! id->eapi()->supported()->ebuild_environment_variables()->env_aa().empty()) - { - AAVisitor g; - if (id->fetches_key()) - id->fetches_key()->value()->top()->accept(g); - std::set<std::string> already_in_all_archives; - - for (AAVisitor::ConstIterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg) - { - if (already_in_all_archives.end() == already_in_all_archives.find(*gg)) - { - all_archives.append(*gg); - already_in_all_archives.insert(*gg); - } - all_archives.append(" "); - } - } - else - all_archives = "AA-not-set-for-this-EAPI"; - - /* make ACCEPT_LICENSE */ - if (! id->eapi()->supported()->ebuild_environment_variables()->env_accept_license().empty()) - { - AcceptLicenseFinder g(env, id); - if (id->license_key()) - id->license_key()->value()->top()->accept(g); + /* make ACCEPT_LICENSE */ + if (! id->eapi()->supported()->ebuild_environment_variables()->env_accept_license().empty()) + { + AcceptLicenseFinder g(env, id); + if (id->license_key()) + id->license_key()->parse_value()->top()->accept(g); - accept_license = g.s.str(); - } - else - accept_license = "ACCEPT_LICENSE-not-set-for-this-EAPI"; + accept_license = g.s.str(); } + else + accept_license = "ACCEPT_LICENSE-not-set-for-this-EAPI"; /* Strip trailing space. Some ebuilds rely upon this. From kde-meta.eclass: * [[ -n ${A/${TARBALL}/} ]] && unpack ${A/${TARBALL}/} @@ -233,9 +194,8 @@ paludis::erepository::do_install_action( std::string used_config_protect; auto merged_entries(std::make_shared<FSPathSet>()); - std::shared_ptr<const ChoiceValue> preserve_work_choice( - id->choices_key()->value()->find_by_name_with_prefix( - ELikePreserveWorkChoiceValue::canonical_name_with_prefix())); + auto choices(id->choices_key()->parse_value()); + std::shared_ptr<const ChoiceValue> preserve_work_choice(choices->find_by_name_with_prefix(ELikePreserveWorkChoiceValue::canonical_name_with_prefix())); EAPIPhases phases(id->eapi()->supported()->ebuild_phases()->ebuild_install()); for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ; @@ -313,7 +273,7 @@ paludis::erepository::do_install_action( { std::string libdir("lib"); FSPath root(install_action.options.destination()->installed_root_key() ? - stringify(install_action.options.destination()->installed_root_key()->value()) : "/"); + stringify(install_action.options.destination()->installed_root_key()->parse_value()) : "/"); if ((root / "usr" / "lib").stat().is_symlink()) { libdir = (root / "usr" / "lib").readlink(); @@ -323,7 +283,7 @@ paludis::erepository::do_install_action( Log::get_instance()->message("e.ebuild.libdir", ll_debug, lc_context) << "Using '" << libdir << "' for libdir"; - std::shared_ptr<const ChoiceValue> symbols_choice(id->choices_key()->value()->find_by_name_with_prefix( + std::shared_ptr<const ChoiceValue> symbols_choice(choices->find_by_name_with_prefix( ELikeSymbolsChoiceValue::canonical_name_with_prefix())); EStripper stripper(make_named_values<EStripperOptions>( @@ -348,7 +308,7 @@ paludis::erepository::do_install_action( if (test_restrict) continue; - std::shared_ptr<const ChoiceValue> choice(id->choices_key()->value()->find_by_name_with_prefix( + std::shared_ptr<const ChoiceValue> choice(choices->find_by_name_with_prefix( ELikeOptionalTestsChoiceValue::canonical_name_with_prefix())); if (choice && ! choice->enabled()) continue; @@ -358,14 +318,14 @@ paludis::erepository::do_install_action( if (test_restrict) continue; - std::shared_ptr<const ChoiceValue> choice(id->choices_key()->value()->find_by_name_with_prefix( + std::shared_ptr<const ChoiceValue> choice(choices->find_by_name_with_prefix( ELikeRecommendedTestsChoiceValue::canonical_name_with_prefix())); if (choice && ! choice->enabled()) continue; } else if (phase->option("expensive_tests")) { - std::shared_ptr<const ChoiceValue> choice(id->choices_key()->value()->find_by_name_with_prefix( + std::shared_ptr<const ChoiceValue> choice(choices->find_by_name_with_prefix( ELikeExpensiveTestsChoiceValue::canonical_name_with_prefix())); if (choice && ! choice->enabled()) continue; @@ -377,7 +337,7 @@ paludis::erepository::do_install_action( n::commands() = join(phase->begin_commands(), phase->end_commands(), " "), n::distdir() = repo->params().distdir(), n::ebuild_dir() = repo->layout()->package_directory(id->name()), - n::ebuild_file() = id->fs_location_key()->value(), + n::ebuild_file() = id->fs_location_key()->parse_value(), n::eclassdirs() = repo->params().eclassdirs(), n::environment() = env, n::exlibsdirs() = exlibsdirs, @@ -389,7 +349,7 @@ paludis::erepository::do_install_action( (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ? (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(), n::root() = install_action.options.destination()->installed_root_key() ? - stringify(install_action.options.destination()->installed_root_key()->value()) : + stringify(install_action.options.destination()->installed_root_key()->parse_value()) : "/", n::sandbox() = phase->option("sandbox"), n::sydbox() = phase->option("sydbox"), @@ -410,7 +370,7 @@ paludis::erepository::do_install_action( n::profiles() = repo->params().profiles(), n::profiles_with_parents() = repo->profile()->profiles_with_parents(), n::replacing_ids() = install_action.options.replacing(), - n::slot() = id->slot_key() ? stringify(id->slot_key()->value()) : "", + n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value()) : "", n::use() = use, n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "), n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ") diff --git a/paludis/repositories/e/do_pretend_action.cc b/paludis/repositories/e/do_pretend_action.cc index a282dc306..f514e5229 100644 --- a/paludis/repositories/e/do_pretend_action.cc +++ b/paludis/repositories/e/do_pretend_action.cc @@ -66,7 +66,7 @@ paludis::erepository::do_pretend_action( { DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env, id); if (id->restrict_key()) - id->restrict_key()->value()->top()->accept(restricts); + id->restrict_key()->parse_value()->top()->accept(restricts); userpriv_restrict = indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()), @@ -88,7 +88,7 @@ paludis::erepository::do_pretend_action( if (id->raw_myoptions_key()) { MyOptionsRequirementsVerifier verifier(env, id); - id->raw_myoptions_key()->value()->top()->accept(verifier); + id->raw_myoptions_key()->parse_value()->top()->accept(verifier); if (verifier.unmet_requirements() && ! verifier.unmet_requirements()->empty()) { @@ -108,7 +108,7 @@ paludis::erepository::do_pretend_action( n::commands() = join(phase->begin_commands(), phase->end_commands(), " "), n::distdir() = repo->params().distdir(), n::ebuild_dir() = repo->layout()->package_directory(id->name()), - n::ebuild_file() = id->fs_location_key()->value(), + n::ebuild_file() = id->fs_location_key()->parse_value(), n::eclassdirs() = repo->params().eclassdirs(), n::environment() = env, n::exlibsdirs() = exlibsdirs, @@ -120,7 +120,7 @@ paludis::erepository::do_pretend_action( (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ? (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(), n::root() = a.options.destination()->installed_root_key() ? - stringify(a.options.destination()->installed_root_key()->value()) : + stringify(a.options.destination()->installed_root_key()->parse_value()) : "/", n::sandbox() = phase->option("sandbox"), n::sydbox() = phase->option("sydbox"), @@ -149,7 +149,7 @@ paludis::erepository::do_pretend_action( if (id->required_use_key()) { RequiredUseVerifier verifier(env, id); - id->required_use_key()->value()->top()->accept(verifier); + id->required_use_key()->parse_value()->top()->accept(verifier); if (verifier.unmet_requirements() && ! verifier.unmet_requirements()->empty()) { @@ -169,7 +169,7 @@ paludis::erepository::do_pretend_action( n::commands() = join(phase->begin_commands(), phase->end_commands(), " "), n::distdir() = repo->params().distdir(), n::ebuild_dir() = repo->layout()->package_directory(id->name()), - n::ebuild_file() = id->fs_location_key()->value(), + n::ebuild_file() = id->fs_location_key()->parse_value(), n::eclassdirs() = repo->params().eclassdirs(), n::environment() = env, n::exlibsdirs() = exlibsdirs, @@ -181,7 +181,7 @@ paludis::erepository::do_pretend_action( (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ? (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(), n::root() = a.options.destination()->installed_root_key() ? - stringify(a.options.destination()->installed_root_key()->value()) : + stringify(a.options.destination()->installed_root_key()->parse_value()) : "/", n::sandbox() = phase->option("sandbox"), n::sydbox() = phase->option("sydbox"), @@ -228,7 +228,7 @@ paludis::erepository::do_pretend_action( n::commands() = join(phase->begin_commands(), phase->end_commands(), " "), n::distdir() = repo->params().distdir(), n::ebuild_dir() = repo->layout()->package_directory(id->name()), - n::ebuild_file() = id->fs_location_key()->value(), + n::ebuild_file() = id->fs_location_key()->parse_value(), n::eclassdirs() = repo->params().eclassdirs(), n::environment() = env, n::exlibsdirs() = exlibsdirs, @@ -240,7 +240,7 @@ paludis::erepository::do_pretend_action( (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ? (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(), n::root() = a.options.destination()->installed_root_key() ? - stringify(a.options.destination()->installed_root_key()->value()) : + stringify(a.options.destination()->installed_root_key()->parse_value()) : "/", n::sandbox() = phase->option("sandbox"), n::sydbox() = phase->option("sydbox"), diff --git a/paludis/repositories/e/do_pretend_fetch_action.cc b/paludis/repositories/e/do_pretend_fetch_action.cc index e455b0357..9dacf5d95 100644 --- a/paludis/repositories/e/do_pretend_fetch_action.cc +++ b/paludis/repositories/e/do_pretend_fetch_action.cc @@ -44,7 +44,7 @@ paludis::erepository::do_pretend_fetch_action( PretendFetchVisitor f(env, id, *id->eapi(), repo->params().distdir(), a.options.fetch_parts()[fp_unneeded], id->fetches_key()->initial_label(), a); - id->fetches_key()->value()->top()->accept(f); + id->fetches_key()->parse_value()->top()->accept(f); } } diff --git a/paludis/repositories/e/e_choices_key.cc b/paludis/repositories/e/e_choices_key.cc index 0bd3f29df..43c2b23a3 100644 --- a/paludis/repositories/e/e_choices_key.cc +++ b/paludis/repositories/e/e_choices_key.cc @@ -255,7 +255,7 @@ namespace } const std::shared_ptr<const Choices> -EChoicesKey::value() const +EChoicesKey::parse_value() const { Lock l(_imp->mutex); if (_imp->value) @@ -293,15 +293,16 @@ EChoicesKey::populate_myoptions() const std::shared_ptr<const Set<std::string> > hidden; if (_imp->id->raw_use_expand_hidden_key()) - hidden = _imp->id->raw_use_expand_hidden_key()->value(); + hidden = _imp->id->raw_use_expand_hidden_key()->parse_value(); /* yay. myoptions is easy. */ MyOptionsFinder myoptions; - _imp->id->raw_myoptions_key()->value()->top()->accept(myoptions); + _imp->id->raw_myoptions_key()->parse_value()->top()->accept(myoptions); if (_imp->id->raw_use_expand_key()) - for (Set<std::string>::ConstIterator u(_imp->id->raw_use_expand_key()->value()->begin()), - u_end(_imp->id->raw_use_expand_key()->value()->end()) ; + { + auto raw_use_expand(_imp->id->raw_use_expand_key()->parse_value()); + for (Set<std::string>::ConstIterator u(raw_use_expand->begin()), u_end(raw_use_expand->end()) ; u != u_end ; ++u) { Context local_local_context("When using raw_use_expand_key value '" + *u + "' to populate choices:"); @@ -328,6 +329,7 @@ EChoicesKey::populate_myoptions() const myoptions.prefixes.erase(p); } } + } MyOptionsFinder::Prefixes::iterator p(myoptions.prefixes.find(ChoicePrefixName(""))); if (myoptions.prefixes.end() != p) @@ -369,7 +371,7 @@ EChoicesKey::populate_iuse() const std::shared_ptr<const Set<std::string> > hidden; if (_imp->id->raw_use_expand_hidden_key()) - hidden = _imp->id->raw_use_expand_hidden_key()->value(); + hidden = _imp->id->raw_use_expand_hidden_key()->parse_value(); /* ugh. iuse and all that mess. */ @@ -383,15 +385,19 @@ EChoicesKey::populate_iuse() const std::map<ChoiceNameWithPrefix, ChoiceOptions> values; std::map<std::string, bool> iuse_with_implicit; - for (Set<std::string>::ConstIterator u(_imp->id->raw_iuse_key()->value()->begin()), u_end(_imp->id->raw_iuse_key()->value()->end()) ; + auto raw_iuse(_imp->id->raw_iuse_key()->parse_value()); + for (Set<std::string>::ConstIterator u(raw_iuse->begin()), u_end(raw_iuse->end()) ; u != u_end ; ++u) iuse_with_implicit.insert(std::make_pair(*u, false)); if (_imp->id->raw_iuse_effective_key()) - for (Set<std::string>::ConstIterator u(_imp->id->raw_iuse_effective_key()->value()->begin()), - u_end(_imp->id->raw_iuse_effective_key()->value()->end()) ; + { + auto raw_iuse_effective(_imp->id->raw_iuse_effective_key()->parse_value()); + for (Set<std::string>::ConstIterator u(raw_iuse_effective->begin()), + u_end(raw_iuse_effective->end()) ; u != u_end ; ++u) iuse_with_implicit.insert(std::make_pair(*u, true)); + } for (std::map<std::string, bool>::const_iterator u(iuse_with_implicit.begin()), u_end(iuse_with_implicit.end()) ; u != u_end ; ++u) @@ -403,13 +409,19 @@ EChoicesKey::populate_iuse() const )); iuse_sanitised.insert(stringify(flag.first)); - if (_imp->id->raw_use_expand_key() && - _imp->id->raw_use_expand_key()->value()->end() != std::find_if( - _imp->id->raw_use_expand_key()->value()->begin(), - _imp->id->raw_use_expand_key()->value()->end(), - IsExpand(flag.first, delim))) - add_choice_to_map(i_values, flag_with_options, _imp->id->raw_iuse_key()); - else + + bool was_expand(false); + if (_imp->id->raw_use_expand_key()) + { + auto raw_use_expand(_imp->id->raw_use_expand_key()->parse_value()); + if (raw_use_expand->end() != std::find_if(raw_use_expand->begin(), raw_use_expand->end(), IsExpand(flag.first, delim))) + { + add_choice_to_map(i_values, flag_with_options, _imp->id->raw_iuse_key()); + was_expand = true; + } + } + + if (! was_expand) { if (stringify(flag.first) == _imp->id->eapi()->supported()->choices_options()->fancy_test_flag()) /* have to add this right at the end, after build_options is there */ @@ -432,7 +444,8 @@ EChoicesKey::populate_iuse() const * even if x86 isn't listed in IUSE. */ if (_imp->id->raw_use_key() && ! _imp->id->eapi()->supported()->choices_options()->profile_iuse_injection()) { - for (Set<std::string>::ConstIterator u(_imp->id->raw_use_key()->value()->begin()), u_end(_imp->id->raw_use_key()->value()->end()) ; + auto raw_use(_imp->id->raw_use_key()->parse_value()); + for (Set<std::string>::ConstIterator u(raw_use->begin()), u_end(raw_use->end()) ; u != u_end ; ++u) { if (iuse_sanitised.end() != iuse_sanitised.find(*u)) @@ -444,11 +457,15 @@ EChoicesKey::populate_iuse() const else flag = std::make_pair(ChoiceNameWithPrefix(*u), true); - if (_imp->id->raw_use_expand_key() && - _imp->id->raw_use_expand_key()->value()->end() != std::find_if( - _imp->id->raw_use_expand_key()->value()->begin(), - _imp->id->raw_use_expand_key()->value()->end(), - IsExpand(flag.first, delim))) + bool was_expand(false); + if (_imp->id->raw_use_expand_key()) + { + auto raw_use_expand(_imp->id->raw_use_expand_key()->parse_value()); + if (raw_use_expand->end() != std::find_if(raw_use_expand->begin(), raw_use_expand->end(), IsExpand(flag.first, delim))) + was_expand = true; + } + + if (was_expand) { /* don't need to worry */ } @@ -480,8 +497,8 @@ EChoicesKey::populate_iuse() const if (_imp->id->raw_use_expand_key()) { - for (Set<std::string>::ConstIterator u(_imp->id->raw_use_expand_key()->value()->begin()), - u_end(_imp->id->raw_use_expand_key()->value()->end()) ; + auto raw_use_expand(_imp->id->raw_use_expand_key()->parse_value()); + for (Set<std::string>::ConstIterator u(raw_use_expand->begin()), u_end(raw_use_expand->end()) ; u != u_end ; ++u) { std::string lower_u; @@ -513,8 +530,8 @@ EChoicesKey::populate_iuse() const if (_imp->id->raw_use_key()) { - for (Set<std::string>::ConstIterator it(_imp->id->raw_use_key()->value()->begin()), - it_end(_imp->id->raw_use_key()->value()->end()); it_end != it; ++it) + auto raw_use(_imp->id->raw_use_key()->parse_value()); + for (Set<std::string>::ConstIterator it(raw_use->begin()), it_end(raw_use->end()); it_end != it; ++it) { std::string flag(0 == it->compare(0, 1, "-", 0, 1) ? it->substr(1) : *it); if (IsExpand(ChoiceNameWithPrefix(flag), delim)(*u)) diff --git a/paludis/repositories/e/e_choices_key.hh b/paludis/repositories/e/e_choices_key.hh index 1cbd48e4d..795e15268 100644 --- a/paludis/repositories/e/e_choices_key.hh +++ b/paludis/repositories/e/e_choices_key.hh @@ -54,7 +54,7 @@ namespace paludis ~EChoicesKey(); - const std::shared_ptr<const Choices> value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + const std::shared_ptr<const Choices> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc index 4c07d8ad0..e12e1aa98 100644 --- a/paludis/repositories/e/e_installed_repository.cc +++ b/paludis/repositories/e/e_installed_repository.cc @@ -143,14 +143,14 @@ bool EInstalledRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const { auto repo(_imp->params.environment()->fetch_repository(id->repository_name())); - std::string f(repo->format_key() ? repo->format_key()->value() : ""); + std::string f(repo->format_key() ? repo->format_key()->parse_value() : ""); return f == "e" || f == "ebuild" || f == "exheres" || f == "portage"; } bool EInstalledRepository::is_default_destination() const { - return _imp->params.environment()->preferred_root_key()->value() == installed_root_key()->value(); + return _imp->params.environment()->preferred_root_key()->parse_value() == installed_root_key()->parse_value(); } bool @@ -193,7 +193,7 @@ EInstalledRepository::get_environment_variable( Context context("When fetching environment variable '" + var + "' for '" + stringify(*id) + "':"); - FSPath ver_dir(id->fs_location_key()->value()); + FSPath ver_dir(id->fs_location_key()->parse_value()); if (! ver_dir.stat().is_directory_or_symlink_to_directory()) throw ActionFailedError("Could not find Exndbam entry for '" + stringify(*id) + "'"); @@ -235,7 +235,7 @@ EInstalledRepository::perform_config( std::shared_ptr<OutputManager> output_manager(a.options.make_output_manager()(a)); - FSPath ver_dir(id->fs_location_key()->value()); + FSPath ver_dir(id->fs_location_key()->parse_value()); std::shared_ptr<FSPathSequence> eclassdirs(std::make_shared<FSPathSequence>()); eclassdirs->push_back(ver_dir); @@ -290,7 +290,7 @@ EInstalledRepository::perform_info( std::shared_ptr<OutputManager> output_manager(a.options.make_output_manager()(a)); - FSPath ver_dir(id->fs_location_key()->value()); + FSPath ver_dir(id->fs_location_key()->parse_value()); auto eclassdirs(std::make_shared<FSPathSequence>()); eclassdirs->push_back(ver_dir); @@ -309,8 +309,8 @@ EInstalledRepository::perform_info( std::shared_ptr<const Set<std::string> > i; if (id->from_repositories_key()) { - for (Set<std::string>::ConstIterator o(id->from_repositories_key()->value()->begin()), - o_end(id->from_repositories_key()->value()->end()) ; + auto fr(id->from_repositories_key()->parse_value()); + for (Set<std::string>::ConstIterator o(fr->begin()), o_end(fr->end()) ; o != o_end ; ++o) { RepositoryName rn(*o); @@ -325,7 +325,7 @@ EInstalledRepository::perform_info( visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**m)); if (mm) { - i = mm->value(); + i = mm->parse_value(); break; } } @@ -346,7 +346,7 @@ EInstalledRepository::perform_info( visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**m)); if (mm) { - i = mm->value(); + i = mm->parse_value(); break; } } diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc index da4b28cfd..ca18675b7 100644 --- a/paludis/repositories/e/e_installed_repository_id.cc +++ b/paludis/repositories/e/e_installed_repository_id.cc @@ -601,14 +601,14 @@ EInstalledRepositoryID::canonical_form(const PackageIDCanonicalForm f) const { case idcf_full: if (_imp->keys && _imp->keys->slot) - return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->keys->slot->value()) + "::" + + return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->keys->slot->parse_value()) + "::" + stringify(repository_name()); return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository_name()); case idcf_no_version: if (_imp->keys && _imp->keys->slot) - return stringify(name()) + ":" + stringify(_imp->keys->slot->value()) + "::" + + return stringify(name()) + ":" + stringify(_imp->keys->slot->parse_value()) + "::" + stringify(repository_name()); return stringify(name()) + "::" + stringify(repository_name()); @@ -618,7 +618,7 @@ EInstalledRepositoryID::canonical_form(const PackageIDCanonicalForm f) const case idcf_no_name: if (_imp->keys && _imp->keys->slot) - return stringify(version()) + ":" + stringify(_imp->keys->slot->value()) + "::" + + return stringify(version()) + ":" + stringify(_imp->keys->slot->parse_value()) + "::" + stringify(repository_name()); return stringify(version()) + "::" + stringify(repository_name()); @@ -634,7 +634,7 @@ PackageDepSpec EInstalledRepositoryID::uniquely_identifying_spec() const { return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + - (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository_name()), + (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()), _imp->environment, { }); } @@ -1060,7 +1060,10 @@ EInstalledRepositoryID::make_choice_value(const std::shared_ptr<const Choice> & bool enabled(false); if (raw_use_key()) - enabled = (raw_use_key()->value()->end() != raw_use_key()->value()->find(name_with_prefix)); + { + auto ru(raw_use_key()->parse_value()); + enabled = (ru->end() != ru->find(name_with_prefix)); + } return create_e_choice_value(make_named_values<EChoiceValueParams>( n::choice_name_with_prefix() = ChoiceNameWithPrefix(name_with_prefix), diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc index b0eebba0f..10831c2c2 100644 --- a/paludis/repositories/e/e_key.cc +++ b/paludis/repositories/e/e_key.cc @@ -108,7 +108,7 @@ EDependenciesKey::~EDependenciesKey() } const std::shared_ptr<const DependencySpecTree> -EDependenciesKey::value() const +EDependenciesKey::parse_value() const { Lock l(_imp->value_mutex); if (_imp->value) @@ -131,7 +131,7 @@ EDependenciesKey::pretty_print_value( const PrettyPrintOptions & options) const { SpecTreePrettyPrinter p(pretty_printer, options); - value()->top()->accept(p); + parse_value()->top()->accept(p); return stringify(p); } @@ -200,7 +200,7 @@ ELicenseKey::~ELicenseKey() } const std::shared_ptr<const LicenseSpecTree> -ELicenseKey::value() const +ELicenseKey::parse_value() const { Lock l(_imp->value_mutex); if (_imp->value) @@ -217,7 +217,7 @@ ELicenseKey::pretty_print_value( const PrettyPrintOptions & options) const { SpecTreePrettyPrinter p(pretty_printer, options); - value()->top()->accept(p); + parse_value()->top()->accept(p); return stringify(p); } @@ -279,7 +279,7 @@ EFetchableURIKey::~EFetchableURIKey() } const std::shared_ptr<const FetchableURISpecTree> -EFetchableURIKey::value() const +EFetchableURIKey::parse_value() const { Lock l(_imp->value_mutex); @@ -297,7 +297,7 @@ EFetchableURIKey::pretty_print_value( const PrettyPrintOptions & options) const { SpecTreePrettyPrinter p(pretty_printer, options); - value()->top()->accept(p); + parse_value()->top()->accept(p); return stringify(p); } @@ -310,7 +310,7 @@ EFetchableURIKey::initial_label() const { DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> f(_imp->env, _imp->id); if (_imp->id->restrict_key()) - _imp->id->restrict_key()->value()->top()->accept(f); + _imp->id->restrict_key()->parse_value()->top()->accept(f); for (DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec>::ConstIterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i) { @@ -399,7 +399,7 @@ ESimpleURIKey::~ESimpleURIKey() } const std::shared_ptr<const SimpleURISpecTree> -ESimpleURIKey::value() const +ESimpleURIKey::parse_value() const { Lock l(_imp->value_mutex); @@ -417,7 +417,7 @@ ESimpleURIKey::pretty_print_value( const PrettyPrintOptions & options) const { SpecTreePrettyPrinter p(pretty_printer, options); - value()->top()->accept(p); + parse_value()->top()->accept(p); return stringify(p); } @@ -482,7 +482,7 @@ EPlainTextSpecKey::~EPlainTextSpecKey() } const std::shared_ptr<const PlainTextSpecTree> -EPlainTextSpecKey::value() const +EPlainTextSpecKey::parse_value() const { Lock l(_imp->value_mutex); @@ -500,7 +500,7 @@ EPlainTextSpecKey::pretty_print_value( const PrettyPrintOptions & options) const { SpecTreePrettyPrinter p(pretty_printer, options); - value()->top()->accept(p); + parse_value()->top()->accept(p); return stringify(p); } @@ -568,7 +568,7 @@ EMyOptionsKey::~EMyOptionsKey() } const std::shared_ptr<const PlainTextSpecTree> -EMyOptionsKey::value() const +EMyOptionsKey::parse_value() const { Lock l(_imp->value_mutex); if (_imp->value) @@ -585,7 +585,7 @@ EMyOptionsKey::pretty_print_value( const PrettyPrintOptions & options) const { SpecTreePrettyPrinter p(pretty_printer, options); - value()->top()->accept(p); + parse_value()->top()->accept(p); return stringify(p); } @@ -654,7 +654,7 @@ ERequiredUseKey::~ERequiredUseKey() } const std::shared_ptr<const RequiredUseSpecTree> -ERequiredUseKey::value() const +ERequiredUseKey::parse_value() const { Lock l(_imp->value_mutex); if (_imp->value) @@ -671,7 +671,7 @@ ERequiredUseKey::pretty_print_value( const PrettyPrintOptions & options) const { SpecTreePrettyPrinter p(pretty_printer, options); - value()->top()->accept(p); + parse_value()->top()->accept(p); return stringify(p); } @@ -738,7 +738,7 @@ EProvideKey::~EProvideKey() } const std::shared_ptr<const ProvideSpecTree> -EProvideKey::value() const +EProvideKey::parse_value() const { Lock l(_imp->value_mutex); if (_imp->value) @@ -755,7 +755,7 @@ EProvideKey::pretty_print_value( const PrettyPrintOptions & options) const { SpecTreePrettyPrinter p(pretty_printer, options); - value()->top()->accept(p); + parse_value()->top()->accept(p); return stringify(p); } @@ -810,7 +810,7 @@ EContentsKey::~EContentsKey() } const std::shared_ptr<const Contents> -EContentsKey::value() const +EContentsKey::parse_value() const { Lock l(_imp->value_mutex); @@ -927,7 +927,7 @@ EMTimeKey::~EMTimeKey() } Timestamp -EMTimeKey::value() const +EMTimeKey::parse_value() const { Lock l(_imp->value_mutex); diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh index 5720d0b32..b1f781a6f 100644 --- a/paludis/repositories/e/e_key.hh +++ b/paludis/repositories/e/e_key.hh @@ -48,7 +48,7 @@ namespace paludis const MetadataKeyType); ~EDependenciesKey(); - virtual const std::shared_ptr<const DependencySpecTree> value() const + virtual const std::shared_ptr<const DependencySpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const @@ -77,7 +77,7 @@ namespace paludis const MetadataKeyType); ~EFetchableURIKey(); - virtual const std::shared_ptr<const FetchableURISpecTree> value() const + virtual const std::shared_ptr<const FetchableURISpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::shared_ptr<const URILabel> initial_label() const @@ -106,7 +106,7 @@ namespace paludis const bool is_installed); ~ESimpleURIKey(); - virtual const std::shared_ptr<const SimpleURISpecTree> value() const + virtual const std::shared_ptr<const SimpleURISpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -132,7 +132,7 @@ namespace paludis bool is_installed); ~EPlainTextSpecKey(); - virtual const std::shared_ptr<const PlainTextSpecTree> value() const + virtual const std::shared_ptr<const PlainTextSpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -158,7 +158,7 @@ namespace paludis bool); ~EMyOptionsKey(); - virtual const std::shared_ptr<const PlainTextSpecTree> value() const + virtual const std::shared_ptr<const PlainTextSpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -184,7 +184,7 @@ namespace paludis bool i); ~ERequiredUseKey(); - virtual const std::shared_ptr<const RequiredUseSpecTree> value() const + virtual const std::shared_ptr<const RequiredUseSpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -210,7 +210,7 @@ namespace paludis const bool is_installed); ~EProvideKey(); - virtual const std::shared_ptr<const ProvideSpecTree> value() const + virtual const std::shared_ptr<const ProvideSpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -237,7 +237,7 @@ namespace paludis bool is_installed); ~ELicenseKey(); - virtual const std::shared_ptr<const LicenseSpecTree> value() const + virtual const std::shared_ptr<const LicenseSpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -259,7 +259,7 @@ namespace paludis EContentsKey(const std::string &, const std::string &, const FSPath &, const MetadataKeyType); ~EContentsKey(); - const std::shared_ptr<const Contents> value() const + const std::shared_ptr<const Contents> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -277,7 +277,7 @@ namespace paludis EMTimeKey(const std::string &, const std::string &, const FSPath &, const MetadataKeyType); ~EMTimeKey(); - Timestamp value() const + Timestamp parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/repositories/e/e_keywords_key.cc b/paludis/repositories/e/e_keywords_key.cc index 65e4f48f4..07933b390 100644 --- a/paludis/repositories/e/e_keywords_key.cc +++ b/paludis/repositories/e/e_keywords_key.cc @@ -63,7 +63,7 @@ namespace { } - const std::shared_ptr<const Set<KeywordName> > value() const + const std::shared_ptr<const Set<KeywordName> > parse_value() const { return parsed_value; } @@ -87,7 +87,7 @@ namespace const PrettyPrinter & p, const PrettyPrintOptions &) const { - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p)); + return join(parsed_value->begin(), parsed_value->end(), " ", CallPrettyPrinter(p)); } }; diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc index 1728edf46..34e5d68ab 100644 --- a/paludis/repositories/e/e_repository.cc +++ b/paludis/repositories/e/e_repository.cc @@ -150,7 +150,7 @@ namespace result = std::make_shared<FSPathSequence>(); for (ERepositorySequence::ConstIterator e(r->begin()), e_end(r->end()) ; e != e_end ; ++e) - result->push_back((*e)->location_key()->value()); + result->push_back((*e)->location_key()->parse_value()); } return result; @@ -927,7 +927,7 @@ bool ERepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const { auto repo(_imp->params.environment()->fetch_repository(id->repository_name())); - std::string f(repo->format_key() ? repo->format_key()->value() : ""); + std::string f(repo->format_key() ? repo->format_key()->parse_value() : ""); if (f == "e") return static_cast<const ERepositoryID &>(*id).eapi()->supported()->can_be_pbin(); else @@ -1082,7 +1082,7 @@ ERepository::make_manifest(const QualifiedPackageName & qpn) if (! id->fetches_key()) continue; AAVisitor aa; - id->fetches_key()->value()->top()->accept(aa); + id->fetches_key()->parse_value()->top()->accept(aa); for (AAVisitor::ConstIterator d(aa.begin()) ; d != aa.end() ; ++d) @@ -1218,7 +1218,7 @@ ERepository::repository_factory_create( std::string format("unknown"); if (master_repository_uncasted->format_key()) - format = master_repository_uncasted->format_key()->value(); + format = master_repository_uncasted->format_key()->parse_value(); if (format != "e") throw ERepositoryConfigurationError("Master repository format is '" + stringify(format) + "', not 'ebuild'"); @@ -1252,7 +1252,7 @@ ERepository::repository_factory_create( std::string format("unknown"); if (master_repository_uncasted->format_key()) - format = master_repository_uncasted->format_key()->value(); + format = master_repository_uncasted->format_key()->parse_value(); if (format != "e") throw ERepositoryConfigurationError("Master repository format is '" + stringify(format) + "', not 'ebuild'"); @@ -1705,7 +1705,7 @@ ERepository::get_environment_variable( DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(_imp->params.environment(), id_uncasted); if (id->restrict_key()) - id->restrict_key()->value()->top()->accept(restricts); + id->restrict_key()->parse_value()->top()->accept(restricts); userpriv_restrict = indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()), @@ -1724,7 +1724,7 @@ ERepository::get_environment_variable( n::commands() = join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " "), n::distdir() = _imp->params.distdir(), n::ebuild_dir() = layout()->package_directory(id->name()), - n::ebuild_file() = id->fs_location_key()->value(), + n::ebuild_file() = id->fs_location_key()->parse_value(), n::eclassdirs() = _imp->params.eclassdirs(), n::environment() = _imp->params.environment(), n::exlibsdirs() = exlibsdirs, @@ -1818,9 +1818,10 @@ ERepository::merge(const MergeParams & m) std::string binary_keywords; if (m.package_id()->keywords_key()) { - for (auto k(m.package_id()->keywords_key()->value()->begin()), k_end(m.package_id()->keywords_key()->value()->end()) ; - k != k_end ; ++k) - if (_imp->binary_keywords_filter->value()->end() != _imp->binary_keywords_filter->value()->find(stringify(*k))) + auto kk(m.package_id()->keywords_key()->parse_value()); + auto binary_keywords_filter(_imp->binary_keywords_filter->parse_value()); + for (auto k(kk->begin()), k_end(kk->end()) ; k != k_end ; ++k) + if (binary_keywords_filter->end() != binary_keywords_filter->find(stringify(*k))) { if (! binary_keywords.empty()) binary_keywords.append(" "); @@ -1852,9 +1853,9 @@ ERepository::merge(const MergeParams & m) if (is_replace) { /* 0.1 replacing 00.1 etc */ - if (is_replace->fs_location_key()->value() != binary_ebuild_location) + if (is_replace->fs_location_key()->parse_value() != binary_ebuild_location) { - FSPath p(is_replace->fs_location_key()->value()); + FSPath p(is_replace->fs_location_key()->parse_value()); m.output_manager()->stdout_stream() << "Deleting replaced pbin " << p << std::endl; p.unlink(); } @@ -1871,7 +1872,7 @@ ERepository::merge(const MergeParams & m) if ((*r)->repository_name() != name()) continue; - FSPath p((*r)->fs_location_key()->value()); + FSPath p((*r)->fs_location_key()->parse_value()); FSStat p_stat(p); if (p_stat.exists()) { diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc index a96268de2..24eef92f8 100644 --- a/paludis/repositories/e/e_repository_TEST.cc +++ b/paludis/repositories/e/e_repository_TEST.cc @@ -406,17 +406,17 @@ TEST(ERepository, MetadataUncached) EXPECT_TRUE(id1->end_metadata() != id1->find_metadata("EAPI")); EXPECT_TRUE(visitor_cast<const MetadataValueKey<std::string> >(**id1->find_metadata("EAPI"))); - EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id1->find_metadata("EAPI"))->value()); + EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id1->find_metadata("EAPI"))->parse_value()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Description", id1->short_description_key()->value()); + EXPECT_EQ("The Description", id1->short_description_key()->parse_value()); UnformattedPrettyPrinter ff; erepository::SpecTreePrettyPrinter pd(ff, { }); ASSERT_TRUE(bool(id1->build_dependencies_key())); - id1->build_dependencies_key()->value()->top()->accept(pd); + id1->build_dependencies_key()->parse_value()->top()->accept(pd); EXPECT_EQ("foo/bar", stringify(pd)); erepository::SpecTreePrettyPrinter pr(ff, { }); ASSERT_TRUE(bool(id1->run_dependencies_key())); - id1->run_dependencies_key()->value()->top()->accept(pr); + id1->run_dependencies_key()->parse_value()->top()->accept(pr); EXPECT_EQ("foo/bar", stringify(pr)); const std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne(generator::Matches( @@ -425,14 +425,14 @@ TEST(ERepository, MetadataUncached) ASSERT_TRUE(id2->end_metadata() != id2->find_metadata("EAPI")); ASSERT_TRUE(bool(id2->short_description_key())); - EXPECT_EQ("dquote \" squote ' backslash \\ dollar $", id2->short_description_key()->value()); + EXPECT_EQ("dquote \" squote ' backslash \\ dollar $", id2->short_description_key()->parse_value()); erepository::SpecTreePrettyPrinter pd2(ff, { }); ASSERT_TRUE(bool(id2->build_dependencies_key())); - id2->build_dependencies_key()->value()->top()->accept(pd2); + id2->build_dependencies_key()->parse_value()->top()->accept(pd2); EXPECT_EQ("foo/bar bar/baz", stringify(pd2)); erepository::SpecTreePrettyPrinter pr2(ff, { }); ASSERT_TRUE(bool(id2->run_dependencies_key())); - id2->run_dependencies_key()->value()->top()->accept(pr2); + id2->run_dependencies_key()->parse_value()->top()->accept(pr2); EXPECT_EQ("foo/bar", stringify(pr2)); const std::shared_ptr<const PackageID> id3(*env[selection::RequireExactlyOne(generator::Matches( @@ -441,9 +441,9 @@ TEST(ERepository, MetadataUncached) ASSERT_TRUE(id3->end_metadata() != id3->find_metadata("EAPI")); ASSERT_TRUE(bool(id3->short_description_key())); - EXPECT_EQ("This is the short description", id3->short_description_key()->value()); + EXPECT_EQ("This is the short description", id3->short_description_key()->parse_value()); ASSERT_TRUE(bool(id3->long_description_key())); - EXPECT_EQ("This is the long description", id3->long_description_key()->value()); + EXPECT_EQ("This is the long description", id3->long_description_key()->parse_value()); } } } @@ -480,7 +480,7 @@ namespace { void test_choice(const std::shared_ptr<const PackageID> & p, const std::string & n, bool enabled, bool enabled_by_default, bool locked, const std::string & u = "") { - std::shared_ptr<const ChoiceValue> choice(p->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix(n))); + std::shared_ptr<const ChoiceValue> choice(p->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix(n))); ASSERT_TRUE(bool(choice)); EXPECT_EQ(choice->unprefixed_name(), UnprefixedChoiceName(u.empty() ? n : u)); EXPECT_EQ(enabled, choice->enabled()); @@ -783,7 +783,7 @@ TEST(ERepository, Fetch) &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(no_files_id)); ASSERT_TRUE(bool(no_files_id->short_description_key())); - EXPECT_EQ("The Short Description", no_files_id->short_description_key()->value()); + EXPECT_EQ("The Short Description", no_files_id->short_description_key()->parse_value()); no_files_id->perform_action(action); } diff --git a/paludis/repositories/e/e_repository_TEST_0.cc b/paludis/repositories/e/e_repository_TEST_0.cc index b988786ea..7f20dcc5c 100644 --- a/paludis/repositories/e/e_repository_TEST_0.cc +++ b/paludis/repositories/e/e_repository_TEST_0.cc @@ -262,7 +262,7 @@ TEST(ERepository, InstallEAPI0) PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-0", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); ASSERT_THROW(id->perform_action(action), ActionFailedError); } @@ -271,7 +271,7 @@ TEST(ERepository, InstallEAPI0) PackageDepSpec(parse_user_package_dep_spec("=cat/doman-0", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -280,7 +280,7 @@ TEST(ERepository, InstallEAPI0) PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-0", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -289,7 +289,7 @@ TEST(ERepository, InstallEAPI0) PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-0", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -338,7 +338,7 @@ TEST(ERepository, InstallEAPI0) PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-0", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } diff --git a/paludis/repositories/e/e_repository_TEST_1.cc b/paludis/repositories/e/e_repository_TEST_1.cc index 40e8ee1c7..cffc50d5f 100644 --- a/paludis/repositories/e/e_repository_TEST_1.cc +++ b/paludis/repositories/e/e_repository_TEST_1.cc @@ -128,7 +128,7 @@ TEST(ERepository, InstallEAPI1) PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-1", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -137,7 +137,7 @@ TEST(ERepository, InstallEAPI1) PackageDepSpec(parse_user_package_dep_spec("=cat/dosym-success-1", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -146,7 +146,7 @@ TEST(ERepository, InstallEAPI1) PackageDepSpec(parse_user_package_dep_spec("=cat/doman-1", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -155,7 +155,7 @@ TEST(ERepository, InstallEAPI1) PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-1", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -164,7 +164,7 @@ TEST(ERepository, InstallEAPI1) PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-1", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("1", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } } diff --git a/paludis/repositories/e/e_repository_TEST_2.cc b/paludis/repositories/e/e_repository_TEST_2.cc index f8ed5831b..0319a56da 100644 --- a/paludis/repositories/e/e_repository_TEST_2.cc +++ b/paludis/repositories/e/e_repository_TEST_2.cc @@ -128,7 +128,7 @@ TEST(ERepository, InstallEAPI2) PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-2", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -137,7 +137,7 @@ TEST(ERepository, InstallEAPI2) PackageDepSpec(parse_user_package_dep_spec("=cat/doman-2", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -146,7 +146,7 @@ TEST(ERepository, InstallEAPI2) PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-2", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); ASSERT_THROW(id->perform_action(action), ActionFailedError); } @@ -155,7 +155,7 @@ TEST(ERepository, InstallEAPI2) PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-2", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); ASSERT_THROW(id->perform_action(action), ActionFailedError); } @@ -164,7 +164,7 @@ TEST(ERepository, InstallEAPI2) PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_configure-2", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -173,7 +173,7 @@ TEST(ERepository, InstallEAPI2) PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_compile-2", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -182,7 +182,7 @@ TEST(ERepository, InstallEAPI2) PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_compile-2", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -191,7 +191,7 @@ TEST(ERepository, InstallEAPI2) PackageDepSpec(parse_user_package_dep_spec("=cat/src_compile-via-default-func-2", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("2", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } } diff --git a/paludis/repositories/e/e_repository_TEST_3.cc b/paludis/repositories/e/e_repository_TEST_3.cc index ff1008719..522db226c 100644 --- a/paludis/repositories/e/e_repository_TEST_3.cc +++ b/paludis/repositories/e/e_repository_TEST_3.cc @@ -128,7 +128,7 @@ TEST(ERepository, InstallEAPI3) PackageDepSpec(parse_user_package_dep_spec("=cat/prefix-3", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("3", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("3", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } } diff --git a/paludis/repositories/e/e_repository_TEST_4.cc b/paludis/repositories/e/e_repository_TEST_4.cc index df126c3c6..051bd12e1 100644 --- a/paludis/repositories/e/e_repository_TEST_4.cc +++ b/paludis/repositories/e/e_repository_TEST_4.cc @@ -135,7 +135,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(! pretend_action.failed()); } @@ -145,7 +145,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-failure-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(pretend_action.failed()); } @@ -155,7 +155,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_install-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -164,7 +164,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/docompress-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -173,7 +173,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/dodoc-r-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -182,7 +182,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/doins-symlink-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -191,7 +191,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/banned-functions-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); EXPECT_THROW(id->perform_action(action), ActionFailedError); } @@ -200,7 +200,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-4_beta", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -209,7 +209,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -218,7 +218,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/global-scope-use-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -227,7 +227,7 @@ TEST(ERepository, InstallEAPI4) PackageDepSpec(parse_user_package_dep_spec("=cat/doman-4", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -284,7 +284,7 @@ TEST(ERepository, EAPI4MergeType) PackageDepSpec(parse_user_package_dep_spec("=cat/merge-type-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } } @@ -355,7 +355,7 @@ TEST(ERepository, EAPI4MergeTypeBin) PackageDepSpec(parse_user_package_dep_spec("=cat/merge-type-bin-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } @@ -373,7 +373,7 @@ TEST(ERepository, EAPI4MergeTypeBin) PackageDepSpec(parse_user_package_dep_spec("=cat/merge-type-bin-4::binrepo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("pbin-1+4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("pbin-1+4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(action); } } @@ -420,7 +420,7 @@ TEST(ERepository, RequiredUse) PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-all-good-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(! pretend_action.failed()); } @@ -436,7 +436,7 @@ TEST(ERepository, RequiredUse) PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-all-empty-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(! pretend_action.failed()); } @@ -452,7 +452,7 @@ TEST(ERepository, RequiredUse) PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-all-one-not-good-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(pretend_action.failed()); } @@ -468,7 +468,7 @@ TEST(ERepository, RequiredUse) PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-any-good-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(! pretend_action.failed()); } @@ -484,7 +484,7 @@ TEST(ERepository, RequiredUse) PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-any-empty-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(! pretend_action.failed()); } @@ -500,7 +500,7 @@ TEST(ERepository, RequiredUse) PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-any-none-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(pretend_action.failed()); } @@ -516,7 +516,7 @@ TEST(ERepository, RequiredUse) PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-one-none-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(pretend_action.failed()); } @@ -532,7 +532,7 @@ TEST(ERepository, RequiredUse) PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-one-none-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(pretend_action.failed()); } @@ -548,7 +548,7 @@ TEST(ERepository, RequiredUse) PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-one-good-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(pretend_action); ASSERT_TRUE(! pretend_action.failed()); } diff --git a/paludis/repositories/e/e_repository_TEST_pbin.cc b/paludis/repositories/e/e_repository_TEST_pbin.cc index 8667ee043..ffca839f9 100644 --- a/paludis/repositories/e/e_repository_TEST_pbin.cc +++ b/paludis/repositories/e/e_repository_TEST_pbin.cc @@ -164,7 +164,7 @@ TEST_P(ERepositoryInstallEAPIPBinTest, Works) PackageDepSpec(parse_user_package_dep_spec("=cat/simple-1", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ(base_eapi, visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ(base_eapi, visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(bin_action); } @@ -184,7 +184,7 @@ TEST_P(ERepositoryInstallEAPIPBinTest, Works) PackageDepSpec(parse_user_package_dep_spec("=cat/simple-1::binrepo" + base_eapi, &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("pbin-1+" + base_eapi, visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("pbin-1+" + base_eapi, visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(install_action); } @@ -264,7 +264,7 @@ TEST(Symlinks, Works) PackageDepSpec(parse_user_package_dep_spec("=cat/symlinks-1", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("exheres-0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("exheres-0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(bin_action); } @@ -286,7 +286,7 @@ TEST(Symlinks, Works) PackageDepSpec(parse_user_package_dep_spec("=cat/symlinks-1::binrepoexheres-0", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ("pbin-1+exheres-0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); + EXPECT_EQ("pbin-1+exheres-0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); id->perform_action(install_action); } diff --git a/paludis/repositories/e/e_repository_TEST_phases.cc b/paludis/repositories/e/e_repository_TEST_phases.cc index f3b69f87d..e108d7951 100644 --- a/paludis/repositories/e/e_repository_TEST_phases.cc +++ b/paludis/repositories/e/e_repository_TEST_phases.cc @@ -168,7 +168,7 @@ TEST_P(PhasesTest, Works) PackageDepSpec(parse_user_package_dep_spec("cat/" + info.test, &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); - EXPECT_EQ(info.expect_expensive_test, !! id->choices_key()->value()->find_by_name_with_prefix( + EXPECT_EQ(info.expect_expensive_test, !! id->choices_key()->parse_value()->find_by_name_with_prefix( ChoiceNameWithPrefix("build_options:expensive_tests"))); if (info.expect_pass) diff --git a/paludis/repositories/e/e_repository_TEST_replacing.cc b/paludis/repositories/e/e_repository_TEST_replacing.cc index e0a14f762..7c28a0a71 100644 --- a/paludis/repositories/e/e_repository_TEST_replacing.cc +++ b/paludis/repositories/e/e_repository_TEST_replacing.cc @@ -141,7 +141,7 @@ TEST_P(ReplacingTest, Works) const std::shared_ptr<const PackageIDSequence> rlist(env[selection::AllVersionsSorted(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(info.replacing, &env, { })), make_null_shared_ptr(), { }) | - filter::InstalledAtRoot(env.preferred_root_key()->value()))]); + filter::InstalledAtRoot(env.preferred_root_key()->parse_value()))]); InstallAction action(make_named_values<InstallActionOptions>( n::destination() = installed_repo, diff --git a/paludis/repositories/e/e_repository_news.cc b/paludis/repositories/e/e_repository_news.cc index f30e47547..138a16936 100644 --- a/paludis/repositories/e/e_repository_news.cc +++ b/paludis/repositories/e/e_repository_news.cc @@ -82,9 +82,9 @@ namespace paludis news_directory(EExtraDistributionData::get_instance()->data_from_distribution( *DistributionData::get_instance()->distribution_from_string( e->distribution()))->news_directory()), - skip_file(e->preferred_root_key()->value() / news_directory / + skip_file(e->preferred_root_key()->parse_value() / news_directory / ("news-" + stringify(e_repository->name()) + ".skip")), - unread_file(e->preferred_root_key()->value() / news_directory / + unread_file(e->preferred_root_key()->parse_value() / news_directory / ("news-" + stringify(e_repository->name()) + ".unread")) { } @@ -178,7 +178,7 @@ ERepositoryNews::update_news() const generator::Matches(PackageDepSpec(parse_elike_package_dep_spec(*i, eapi.supported()->package_dep_spec_parse_options(), eapi.supported()->version_spec_options())), make_null_shared_ptr(), { }) | - filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]->empty()) + filter::InstalledAtRoot(_imp->environment->preferred_root_key()->parse_value()))]->empty()) local_show = true; show &= local_show; } @@ -205,7 +205,7 @@ ERepositoryNews::update_news() const { std::string profile(strip_leading_string(strip_trailing_string( strip_leading_string(stringify(p->realpath()), - stringify(_imp->e_repository->location_key()->value().realpath() / "profiles")), "/"), "/")); + stringify(_imp->e_repository->location_key()->parse_value().realpath() / "profiles")), "/"), "/")); Log::get_instance()->message("e.news.profile_path", ll_debug, lc_no_context) << "Profile path is '" << profile << "'"; for (NewsFile::DisplayIfProfileConstIterator i(news.begin_display_if_profile()), diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc index bae7c8022..23fe2df73 100644 --- a/paludis/repositories/e/e_repository_sets.cc +++ b/paludis/repositories/e/e_repository_sets.cc @@ -173,7 +173,7 @@ namespace { try { - if ((! e.slot_key()) || (e.slot_key()->value() != SlotName(r.slot()))) + if ((! e.slot_key()) || (e.slot_key()->parse_value() != SlotName(r.slot()))) return false; } catch (const SlotNameError &) @@ -282,7 +282,7 @@ ERepositorySets::security_set(bool insecurity) const else candidates = (*_imp->environment)[selection::AllVersionsSorted( generator::Package(glsa_pkg->name()) | - filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]; + filter::InstalledAtRoot(_imp->environment->preferred_root_key()->parse_value()))]; for (PackageIDSequence::ConstIterator c(candidates->begin()), c_end(candidates->end()) ; c != c_end ; ++c) @@ -302,7 +302,7 @@ ERepositorySets::security_set(bool insecurity) const else { Context local_local_local_context("When finding upgrade for '" + stringify(glsa_pkg->name()) + ":" - + ((*c)->slot_key() ? stringify((*c)->slot_key()->value()) : "(none)") + "'"); + + ((*c)->slot_key() ? stringify((*c)->slot_key()->parse_value()) : "(none)") + "'"); /* we need to find the best not vulnerable installable package that isn't masked * that's in the same slot as our vulnerable installed package. */ diff --git a/paludis/repositories/e/e_slot_key.cc b/paludis/repositories/e/e_slot_key.cc index b3918776c..661d1af3c 100644 --- a/paludis/repositories/e/e_slot_key.cc +++ b/paludis/repositories/e/e_slot_key.cc @@ -53,7 +53,7 @@ namespace { } - virtual const SlotName value() const + virtual const SlotName parse_value() const { return slot_value; } diff --git a/paludis/repositories/e/e_string_set_key.cc b/paludis/repositories/e/e_string_set_key.cc index 76cb65bbb..b2cde9a24 100644 --- a/paludis/repositories/e/e_string_set_key.cc +++ b/paludis/repositories/e/e_string_set_key.cc @@ -62,7 +62,7 @@ namespace { } - const std::shared_ptr<const Set<std::string> > value() const + const std::shared_ptr<const Set<std::string> > parse_value() const { return parsed_value; } @@ -86,7 +86,7 @@ namespace const PrettyPrinter & p, const PrettyPrintOptions &) const { - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p)); + return join(parsed_value->begin(), parsed_value->end(), " ", CallPrettyPrinter(p)); } }; diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc index bea3b9598..4e5ea3889 100644 --- a/paludis/repositories/e/ebuild.cc +++ b/paludis/repositories/e/ebuild.cc @@ -96,8 +96,7 @@ namespace { std::shared_ptr<const ChoiceValue> choice; if (id->choices_key()) - choice = id->choices_key()->value()->find_by_name_with_prefix( - ELikeJobsChoiceValue::canonical_name_with_prefix()); + choice = id->choices_key()->parse_value()->find_by_name_with_prefix(ELikeJobsChoiceValue::canonical_name_with_prefix()); if (choice && choice->enabled()) return choice->parameter(); else @@ -108,8 +107,7 @@ namespace { std::shared_ptr<const ChoiceValue> choice; if (id->choices_key()) - choice = id->choices_key()->value()->find_by_name_with_prefix( - ELikeTraceChoiceValue::canonical_name_with_prefix()); + choice = id->choices_key()->parse_value()->find_by_name_with_prefix(ELikeTraceChoiceValue::canonical_name_with_prefix()); return choice && choice->enabled(); } } @@ -298,9 +296,10 @@ EbuildCommand::operator() () if (! params.package_id()->eapi()->supported()->ebuild_metadata_variables()->iuse_effective()->name().empty()) if (params.package_id()->raw_iuse_effective_key()) - process.setenv(params.package_id()->eapi()->supported()->ebuild_metadata_variables()->iuse_effective()->name(), - join(params.package_id()->raw_iuse_effective_key()->value()->begin(), - params.package_id()->raw_iuse_effective_key()->value()->end(), " ")); + { + auto iu(params.package_id()->raw_iuse_effective_key()->parse_value()); + process.setenv(params.package_id()->eapi()->supported()->ebuild_metadata_variables()->iuse_effective()->name(), join(iu->begin(), iu->end(), " ")); + } if (params.package_id()->eapi()->supported()->ebuild_options()->support_eclasses()) process @@ -1059,14 +1058,16 @@ WriteVDBEntryCommand::operator() () if (! params.package_id()->eapi()->supported()->ebuild_metadata_variables()->iuse_effective()->name().empty()) if (params.package_id()->raw_iuse_effective_key()) + { + auto iu(params.package_id()->raw_iuse_effective_key()->parse_value()); process.setenv(params.package_id()->eapi()->supported()->ebuild_metadata_variables()->iuse_effective()->name(), - join(params.package_id()->raw_iuse_effective_key()->value()->begin(), - params.package_id()->raw_iuse_effective_key()->value()->end(), " ")); + join(iu->begin(), iu->end(), " ")); + } if (! params.package_id()->eapi()->supported()->ebuild_metadata_variables()->scm_revision()->name().empty()) if (params.package_id()->scm_revision_key()) process.setenv(params.package_id()->eapi()->supported()->ebuild_metadata_variables()->scm_revision()->name(), - params.package_id()->scm_revision_key()->value());; + params.package_id()->scm_revision_key()->parse_value());; if (params.maybe_output_manager()) process @@ -1077,8 +1078,10 @@ WriteVDBEntryCommand::operator() () std::string defined_phases(params.package_id()->eapi()->supported()->ebuild_metadata_variables()->defined_phases()->name()); if (! defined_phases.empty()) if (params.package_id()->defined_phases_key()) - process.setenv(defined_phases, join(params.package_id()->defined_phases_key()->value()->begin(), - params.package_id()->defined_phases_key()->value()->end(), " ")); + { + auto dp(params.package_id()->defined_phases_key()->parse_value()); + process.setenv(defined_phases, join(dp->begin(), dp->end(), " ")); + } if (0 != process.run().wait()) throw ActionFailedError("Write VDB Entry command failed"); @@ -1311,7 +1314,7 @@ WriteBinaryEbuildCommand::operator() () if (! params.package_id()->eapi()->supported()->ebuild_metadata_variables()->scm_revision()->name().empty()) if (params.package_id()->scm_revision_key()) process.setenv(params.package_id()->eapi()->supported()->ebuild_metadata_variables()->scm_revision()->name(), - params.package_id()->scm_revision_key()->value());; + params.package_id()->scm_revision_key()->parse_value());; if (0 != process.run().wait()) throw ActionFailedError("Write binary command failed"); diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc index 6402848a3..391d1be52 100644 --- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc +++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc @@ -135,7 +135,7 @@ namespace std::set<std::string> tokens; tokenise_whitespace(lines[m.inherited()->flat_list_index()], std::inserter(tokens, tokens.begin())); auto repo(_imp->env->fetch_repository(id->repository_name())); - FSPath eclassdir((repo->location_key()->value() / "eclass").realpath_if_exists()); + FSPath eclassdir((repo->location_key()->parse_value() / "eclass").realpath_if_exists()); for (std::set<std::string>::const_iterator it(tokens.begin()), it_end(tokens.end()); it_end != it; ++it) { @@ -403,7 +403,7 @@ EbuildFlatMetadataCache::load(const std::shared_ptr<const EbuildID> & id, const std::vector<std::string> eclasses; tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(keys["_eclasses_"], "\t", "", std::back_inserter(eclasses)); auto repo(_imp->env->fetch_repository(id->repository_name())); - FSPath eclassdir((repo->location_key()->value() / "eclass").realpath_if_exists()); + FSPath eclassdir((repo->location_key()->parse_value() / "eclass").realpath_if_exists()); for (std::vector<std::string>::const_iterator it(eclasses.begin()), it_end(eclasses.end()); it_end != it; ++it) { @@ -742,8 +742,9 @@ EbuildFlatMetadataCache::save(const std::shared_ptr<const EbuildID> & id) if (id->eapi()->supported()->ebuild_options()->support_eclasses() && id->inherited_key()) { std::vector<std::string> eclasses; - for (Set<std::string>::ConstIterator it(id->inherited_key()->value()->begin()), - it_end(id->inherited_key()->value()->end()); it_end != it; ++it) + auto inherited(id->inherited_key()->parse_value()); + for (auto it(inherited->begin()), it_end(inherited->end()) ; + it != it_end ; ++it) { auto eclass(_imp->eclass_mtimes->eclass(*it)); if (! eclass) @@ -758,8 +759,9 @@ EbuildFlatMetadataCache::save(const std::shared_ptr<const EbuildID> & id) else if (id->eapi()->supported()->ebuild_options()->support_exlibs() && id->inherited_key()) { std::vector<std::string> exlibs; - for (Set<std::string>::ConstIterator it(id->inherited_key()->value()->begin()), - it_end(id->inherited_key()->value()->end()); it_end != it; ++it) + auto inherited(id->inherited_key()->parse_value()); + for (auto it(inherited->begin()), it_end(inherited->end()) ; + it != it_end ; ++it) { auto exlib(_imp->eclass_mtimes->exlib(*it, id->name())); if (! exlib) @@ -780,104 +782,117 @@ EbuildFlatMetadataCache::save(const std::shared_ptr<const EbuildID> & id) std::string s; if (id->dependencies_key()) - s.append(flatten(id->dependencies_key()->value())); + s.append(flatten(id->dependencies_key()->parse_value())); else { if (id->build_dependencies_key()) - s.append(flatten(id->build_dependencies_key()->value()) + " "); + s.append(flatten(id->build_dependencies_key()->parse_value()) + " "); if (id->run_dependencies_key()) - s.append(flatten(id->run_dependencies_key()->value()) + " "); + s.append(flatten(id->run_dependencies_key()->parse_value()) + " "); if (id->post_dependencies_key()) - s.append(flatten(id->post_dependencies_key()->value()) + " "); + s.append(flatten(id->post_dependencies_key()->parse_value()) + " "); } write_kv(cache, m.dependencies()->name(), s); } if (! m.use()->name().empty() && id->raw_use_key()) - write_kv(cache, m.use()->name(), join(id->raw_use_key()->value()->begin(), id->raw_use_key()->value()->end(), " ")); + { + auto v(id->raw_use_key()->parse_value()); + write_kv(cache, m.use()->name(), join(v->begin(), v->end(), " ")); + } if (! m.build_depend()->name().empty() && id->build_dependencies_key()) - write_kv(cache, m.build_depend()->name(), flatten(id->build_dependencies_key()->value())); + write_kv(cache, m.build_depend()->name(), flatten(id->build_dependencies_key()->parse_value())); if (! m.run_depend()->name().empty() && id->run_dependencies_key()) - write_kv(cache, m.run_depend()->name(), flatten(id->run_dependencies_key()->value())); + write_kv(cache, m.run_depend()->name(), flatten(id->run_dependencies_key()->parse_value())); if (! m.slot()->name().empty() && id->slot_key()) - write_kv(cache, m.slot()->name(), normalise(id->slot_key()->value())); + write_kv(cache, m.slot()->name(), normalise(id->slot_key()->parse_value())); if (! m.src_uri()->name().empty() && id->fetches_key()) - write_kv(cache, m.src_uri()->name(), flatten(id->fetches_key()->value())); + write_kv(cache, m.src_uri()->name(), flatten(id->fetches_key()->parse_value())); if (! m.restrictions()->name().empty() && id->restrict_key()) - write_kv(cache, m.restrictions()->name(), flatten(id->restrict_key()->value())); + write_kv(cache, m.restrictions()->name(), flatten(id->restrict_key()->parse_value())); if (! m.properties()->name().empty() && id->properties_key()) - write_kv(cache, m.properties()->name(), flatten(id->properties_key()->value())); + write_kv(cache, m.properties()->name(), flatten(id->properties_key()->parse_value())); if (! m.homepage()->name().empty() && id->homepage_key()) - write_kv(cache, m.homepage()->name(), flatten(id->homepage_key()->value())); + write_kv(cache, m.homepage()->name(), flatten(id->homepage_key()->parse_value())); if (! m.license()->name().empty() && id->license_key()) - write_kv(cache, m.license()->name(), flatten(id->license_key()->value())); + write_kv(cache, m.license()->name(), flatten(id->license_key()->parse_value())); if (! m.short_description()->name().empty() && id->short_description_key()) - write_kv(cache, m.short_description()->name(), normalise(id->short_description_key()->value())); + write_kv(cache, m.short_description()->name(), normalise(id->short_description_key()->parse_value())); if (! m.keywords()->name().empty() && id->keywords_key()) - write_kv(cache, m.keywords()->name(), join(id->keywords_key()->value()->begin(), id->keywords_key()->value()->end(), " ")); + { + auto v(id->keywords_key()->parse_value()); + write_kv(cache, m.keywords()->name(), join(v->begin(), v->end(), " ")); + } if (! m.iuse()->name().empty() && id->raw_iuse_key()) - write_kv(cache, m.iuse()->name(), join(id->raw_iuse_key()->value()->begin(), id->raw_iuse_key()->value()->end(), " ")); + { + auto v(id->raw_iuse_key()->parse_value()); + write_kv(cache, m.iuse()->name(), join(v->begin(), v->end(), " ")); + } if (! m.myoptions()->name().empty() && id->raw_myoptions_key()) - write_kv(cache, m.myoptions()->name(), flatten(id->raw_myoptions_key()->value())); + write_kv(cache, m.myoptions()->name(), flatten(id->raw_myoptions_key()->parse_value())); if (! m.required_use()->name().empty() && id->required_use_key()) - write_kv(cache, m.required_use()->name(), flatten(id->required_use_key()->value())); + write_kv(cache, m.required_use()->name(), flatten(id->required_use_key()->parse_value())); if (! m.pdepend()->name().empty() && id->post_dependencies_key()) - write_kv(cache, m.pdepend()->name(), flatten(id->post_dependencies_key()->value())); + write_kv(cache, m.pdepend()->name(), flatten(id->post_dependencies_key()->parse_value())); if (! m.provide()->name().empty() && id->provide_key()) - write_kv(cache, m.provide()->name(), flatten(id->provide_key()->value())); + write_kv(cache, m.provide()->name(), flatten(id->provide_key()->parse_value())); write_kv(cache, "EAPI", normalise(id->eapi()->name())); if (! m.long_description()->name().empty() && id->long_description_key()) - write_kv(cache, m.long_description()->name(), normalise(id->long_description_key()->value())); + write_kv(cache, m.long_description()->name(), normalise(id->long_description_key()->parse_value())); if (! m.bugs_to()->name().empty() && id->bugs_to_key()) - write_kv(cache, m.bugs_to()->name(), flatten(id->bugs_to_key()->value())); + write_kv(cache, m.bugs_to()->name(), flatten(id->bugs_to_key()->parse_value())); if (! m.remote_ids()->name().empty() && id->remote_ids_key()) - write_kv(cache, m.remote_ids()->name(), flatten(id->remote_ids_key()->value())); + write_kv(cache, m.remote_ids()->name(), flatten(id->remote_ids_key()->parse_value())); if (! m.generated_using()->name().empty() && id->generated_using_key()) - write_kv(cache, m.generated_using()->name(), id->generated_using_key()->value()); + write_kv(cache, m.generated_using()->name(), id->generated_using_key()->parse_value()); if (! m.generated_time()->name().empty() && id->generated_time_key()) - write_kv(cache, m.generated_time()->name(), stringify(id->generated_time_key()->value().seconds())); + write_kv(cache, m.generated_time()->name(), stringify(id->generated_time_key()->parse_value().seconds())); if (! m.generated_from()->name().empty() && id->generated_from_key()) - write_kv(cache, m.generated_from()->name(), join(id->generated_from_key()->value()->begin(), - id->generated_from_key()->value()->end(), " ")); + { + auto v(id->generated_from_key()->parse_value()); + write_kv(cache, m.generated_from()->name(), join(v->begin(), v->end(), " ")); + } if (! m.upstream_changelog()->name().empty() && id->upstream_changelog_key()) - write_kv(cache, m.upstream_changelog()->name(), flatten(id->upstream_changelog_key()->value())); + write_kv(cache, m.upstream_changelog()->name(), flatten(id->upstream_changelog_key()->parse_value())); if (! m.upstream_documentation()->name().empty() && id->upstream_documentation_key()) - write_kv(cache, m.upstream_documentation()->name(), flatten(id->upstream_documentation_key()->value())); + write_kv(cache, m.upstream_documentation()->name(), flatten(id->upstream_documentation_key()->parse_value())); if (! m.upstream_release_notes()->name().empty() && id->upstream_release_notes_key()) - write_kv(cache, m.upstream_release_notes()->name(), flatten(id->upstream_release_notes_key()->value())); + write_kv(cache, m.upstream_release_notes()->name(), flatten(id->upstream_release_notes_key()->parse_value())); if (! m.defined_phases()->name().empty() && id->defined_phases_key()) - write_kv(cache, m.defined_phases()->name(), join(id->defined_phases_key()->value()->begin(), - id->defined_phases_key()->value()->end(), " ")); + { + auto v(id->defined_phases_key()->parse_value()); + write_kv(cache, m.defined_phases()->name(), join(v->begin(), v->end(), " ")); + } if (! m.scm_revision()->name().empty() && id->scm_revision_key()) - write_kv(cache, m.scm_revision()->name(), id->scm_revision_key()->value()); + write_kv(cache, m.scm_revision()->name(), id->scm_revision_key()->parse_value()); } catch (const InternalError &) diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc index 62dfb1c7c..13a2a2bd5 100644 --- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc +++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc @@ -85,7 +85,7 @@ TEST(EbuildFlatMetadataCache, FlatList) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_list", id->short_description_key()->value()); + EXPECT_EQ("the-description-flat_list", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, FlatListStale) @@ -107,7 +107,7 @@ TEST(EbuildFlatMetadataCache, FlatListStale) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_list-stale", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_list-stale", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, GuessedEAPI) @@ -130,7 +130,7 @@ TEST(EbuildFlatMetadataCache, GuessedEAPI) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_list-guessed-eapi", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_list-guessed-eapi", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, EclassCached) @@ -152,10 +152,10 @@ TEST(EbuildFlatMetadataCache, EclassCached) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_list-eclass", id->short_description_key()->value()); - ASSERT_EQ("foo", join( - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(), - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " ")); + EXPECT_EQ("the-description-flat_list-eclass", id->short_description_key()->parse_value()); + + auto v(visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->parse_value()); + ASSERT_EQ("foo", join(v->begin(), v->end(), " ")); } TEST(EbuildFlatMetadataCache, EclassStale) @@ -177,7 +177,7 @@ TEST(EbuildFlatMetadataCache, EclassStale) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_list-eclass-stale", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_list-eclass-stale", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, EclassWrong) @@ -199,7 +199,7 @@ TEST(EbuildFlatMetadataCache, EclassWrong) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_list-eclass-wrong", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_list-eclass-wrong", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, EclassGone) @@ -221,7 +221,7 @@ TEST(EbuildFlatMetadataCache, EclassGone) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_list-eclass-gone", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_list-eclass-gone", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, FlatListDetection) @@ -243,7 +243,7 @@ TEST(EbuildFlatMetadataCache, FlatListDetection) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_list-detection", id->short_description_key()->value()); + EXPECT_EQ("the-description-flat_list-detection", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, FlatHash) @@ -265,7 +265,7 @@ TEST(EbuildFlatMetadataCache, FlatHash) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_hash", id->short_description_key()->value()); + EXPECT_EQ("the-description-flat_hash", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, FlatHashGuessedEAPI) @@ -288,7 +288,7 @@ TEST(EbuildFlatMetadataCache, FlatHashGuessedEAPI) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-guessed-eapi", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-guessed-eapi", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, FlatHashGuessedExtension) @@ -310,7 +310,7 @@ TEST(EbuildFlatMetadataCache, FlatHashGuessedExtension) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-guessed-eapi-extension", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-guessed-eapi-extension", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, FlatHashNoGuessedEAPI) @@ -332,7 +332,7 @@ TEST(EbuildFlatMetadataCache, FlatHashNoGuessedEAPI) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_hash-no-guessed-eapi", id->short_description_key()->value()); + EXPECT_EQ("the-description-flat_hash-no-guessed-eapi", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, EmptyValue) @@ -354,8 +354,8 @@ TEST(EbuildFlatMetadataCache, EmptyValue) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("", id->short_description_key()->value()); - EXPECT_EQ("the-slot", stringify(id->slot_key()->value())); + EXPECT_EQ("", id->short_description_key()->parse_value()); + EXPECT_EQ("the-slot", stringify(id->slot_key()->parse_value())); } TEST(EbuildFlatMetadataCache, HashStale) @@ -377,7 +377,7 @@ TEST(EbuildFlatMetadataCache, HashStale) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-stale", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-stale", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashNoMTime) @@ -399,7 +399,7 @@ TEST(EbuildFlatMetadataCache, HashNoMTime) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("the-description-flat_hash-no-mtime", id1->short_description_key()->value()); + EXPECT_EQ("the-description-flat_hash-no-mtime", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashNoMTimeStale) @@ -421,7 +421,7 @@ TEST(EbuildFlatMetadataCache, HashNoMTimeStale) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-no-mtime-stale", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-no-mtime-stale", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashBadMtime) @@ -443,7 +443,7 @@ TEST(EbuildFlatMetadataCache, HashBadMtime) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-bad-mtime", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-bad-mtime", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashNoEAPI) @@ -465,7 +465,7 @@ TEST(EbuildFlatMetadataCache, HashNoEAPI) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-no-eapi", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-no-eapi", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashDuplicateKey) @@ -487,7 +487,7 @@ TEST(EbuildFlatMetadataCache, HashDuplicateKey) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id1->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-duplicate-key", id1->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-duplicate-key", id1->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashEclass) @@ -509,10 +509,9 @@ TEST(EbuildFlatMetadataCache, HashEclass) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_hash-eclass", id->short_description_key()->value()); - ASSERT_EQ("foo", join( - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(), - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " ")); + EXPECT_EQ("the-description-flat_hash-eclass", id->short_description_key()->parse_value()); + auto v(visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->parse_value()); + ASSERT_EQ("foo", join(v->begin(), v->end(), " ")); } TEST(EbuildFlatMetadataCache, HashEclassStale) @@ -534,7 +533,7 @@ TEST(EbuildFlatMetadataCache, HashEclassStale) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-eclass-stale", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-eclass-stale", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashEclassWrong) @@ -556,7 +555,7 @@ TEST(EbuildFlatMetadataCache, HashEclassWrong) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-eclass-wrong", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-eclass-wrong", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashEclassGone) @@ -577,7 +576,7 @@ TEST(EbuildFlatMetadataCache, HashEclassGone) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-eclass-gone", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-eclass-gone", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashFullEclass) @@ -599,10 +598,9 @@ TEST(EbuildFlatMetadataCache, HashFullEclass) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_hash-full-eclass", id->short_description_key()->value()); - ASSERT_EQ("foo", join( - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(), - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " ")); + EXPECT_EQ("the-description-flat_hash-full-eclass", id->short_description_key()->parse_value()); + auto v(visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->parse_value()); + ASSERT_EQ("foo", join(v->begin(), v->end(), " ")); } TEST(EbuildFlatMetadataCache, HashFullEclassNonStandard) @@ -624,10 +622,9 @@ TEST(EbuildFlatMetadataCache, HashFullEclassNonStandard) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_hash-full-eclass-nonstandard", id->short_description_key()->value()); - ASSERT_EQ("bar foo", join( - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(), - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " ")); + EXPECT_EQ("the-description-flat_hash-full-eclass-nonstandard", id->short_description_key()->parse_value()); + auto v(visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->parse_value()); + ASSERT_EQ("bar foo", join(v->begin(), v->end(), " ")); } TEST(EbuildFlatMetadataCache, HashFullEclassStale) @@ -649,7 +646,7 @@ TEST(EbuildFlatMetadataCache, HashFullEclassStale) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-full-eclass-stale", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-full-eclass-stale", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashFullEclassWrong) @@ -671,7 +668,7 @@ TEST(EbuildFlatMetadataCache, HashFullEclassWrong) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-full-eclass-wrong", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-full-eclass-wrong", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashFullEclassGone) @@ -693,7 +690,7 @@ TEST(EbuildFlatMetadataCache, HashFullEclassGone) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-full-eclass-gone", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-full-eclass-gone", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashEclassTruncated) @@ -715,14 +712,14 @@ TEST(EbuildFlatMetadataCache, HashEclassTruncated) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-eclasses-truncated", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-eclasses-truncated", id->short_description_key()->parse_value()); std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclasses-truncated-2", &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id2->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-eclasses-truncated-2", id2->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-eclasses-truncated-2", id2->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashEclassBadMtime) @@ -744,7 +741,7 @@ TEST(EbuildFlatMetadataCache, HashEclassBadMtime) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-eclasses-bad-mtime", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-eclasses-bad-mtime", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashEclassSpaces) @@ -766,7 +763,7 @@ TEST(EbuildFlatMetadataCache, HashEclassSpaces) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-eclasses-spaces", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-eclasses-spaces", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashExlib) @@ -789,10 +786,9 @@ TEST(EbuildFlatMetadataCache, HashExlib) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_hash-exlib", id->short_description_key()->value()); - ASSERT_EQ("foo", join( - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(), - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " ")); + EXPECT_EQ("the-description-flat_hash-exlib", id->short_description_key()->parse_value()); + auto v(visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->parse_value()); + ASSERT_EQ("foo", join(v->begin(), v->end(), " ")); } TEST(EbuildFlatMetadataCache, HashExlibPerCategory) @@ -815,10 +811,9 @@ TEST(EbuildFlatMetadataCache, HashExlibPerCategory) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("the-description-flat_hash-exlib-percat", id->short_description_key()->value()); - ASSERT_EQ("bar foo", join( - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(), - visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " ")); + EXPECT_EQ("the-description-flat_hash-exlib-percat", id->short_description_key()->parse_value()); + auto v(visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->parse_value()); + ASSERT_EQ("bar foo", join(v->begin(), v->end(), " ")); } TEST(EbuildFlatMetadataCache, HashExlibStale) @@ -841,7 +836,7 @@ TEST(EbuildFlatMetadataCache, HashExlibStale) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-exlib-stale", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-exlib-stale", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashExlibWrong) @@ -864,7 +859,7 @@ TEST(EbuildFlatMetadataCache, HashExlibWrong) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-exlib-wrong", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-exlib-wrong", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashExlibGone) @@ -887,7 +882,7 @@ TEST(EbuildFlatMetadataCache, HashExlibGone) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-exlib-gone", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-exlib-gone", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashExlibTruncated) @@ -910,14 +905,14 @@ TEST(EbuildFlatMetadataCache, HashExlibTruncated) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-exlibs-truncated", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-exlibs-truncated", id->short_description_key()->parse_value()); std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlibs-truncated-2", &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id2->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-exlibs-truncated-2", id2->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-exlibs-truncated-2", id2->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashExlibBadMtime) @@ -940,7 +935,7 @@ TEST(EbuildFlatMetadataCache, HashExlibBadMtime) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-exlibs-bad-mtime", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-exlibs-bad-mtime", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, HashExlibSpaces) @@ -963,7 +958,7 @@ TEST(EbuildFlatMetadataCache, HashExlibSpaces) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(id->short_description_key())); - EXPECT_EQ("The Generated Description flat_hash-exlibs-spaces", id->short_description_key()->value()); + EXPECT_EQ("The Generated Description flat_hash-exlibs-spaces", id->short_description_key()->parse_value()); } TEST(EbuildFlatMetadataCache, Write) diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc index 6e776da37..81db23f56 100644 --- a/paludis/repositories/e/ebuild_id.cc +++ b/paludis/repositories/e/ebuild_id.cc @@ -258,7 +258,7 @@ EbuildID::need_keys_added() const bool ok(false); if (e_repo->params().cache().basename() != "empty") { - EbuildFlatMetadataCache metadata_cache(_imp->environment, cache_file, _imp->fs_location->value(), _imp->master_mtime, _imp->eclass_mtimes, false); + EbuildFlatMetadataCache metadata_cache(_imp->environment, cache_file, _imp->fs_location->parse_value(), _imp->master_mtime, _imp->eclass_mtimes, false); if (metadata_cache.load(shared_from_this(), false)) ok = true; } @@ -266,7 +266,7 @@ EbuildID::need_keys_added() const if ((! ok) && e_repo->params().write_cache().basename() != "empty") { EbuildFlatMetadataCache write_metadata_cache(_imp->environment, - write_cache_file, _imp->fs_location->value(), _imp->master_mtime, _imp->eclass_mtimes, true); + write_cache_file, _imp->fs_location->parse_value(), _imp->master_mtime, _imp->eclass_mtimes, true); if (write_metadata_cache.load(shared_from_this(), false)) ok = true; else if (write_cache_file.stat().exists()) @@ -311,7 +311,7 @@ EbuildID::need_keys_added() const n::commands() = join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " "), n::distdir() = e_repo->params().distdir(), n::ebuild_dir() = e_repo->layout()->package_directory(name()), - n::ebuild_file() = _imp->fs_location->value(), + n::ebuild_file() = _imp->fs_location->parse_value(), n::eclassdirs() = e_repo->params().eclassdirs(), n::environment() = _imp->environment, n::exlibsdirs() = e_repo->layout()->exlibsdirs(name()), @@ -339,7 +339,7 @@ EbuildID::need_keys_added() const if (e_repo->params().write_cache().basename() != "empty" && _imp->eapi->supported()) { - EbuildFlatMetadataCache metadata_cache(_imp->environment, write_cache_file, _imp->fs_location->value(), _imp->master_mtime, + EbuildFlatMetadataCache metadata_cache(_imp->environment, write_cache_file, _imp->fs_location->parse_value(), _imp->master_mtime, _imp->eclass_mtimes, false); metadata_cache.save(shared_from_this()); } @@ -368,7 +368,7 @@ EbuildID::need_keys_added() const e_repo->profile()->use_expand_hidden()); std::shared_ptr<const MetadataXML> m(MetadataXMLPool::get_instance()->metadata_if_exists( - _imp->fs_location->value().dirname() / "metadata.xml")); + _imp->fs_location->parse_value().dirname() / "metadata.xml")); if (m) { if (! m->long_description().empty()) @@ -387,7 +387,8 @@ EbuildID::need_keys_added() const if (! _imp->raw_iuse) throw InternalError(PALUDIS_HERE, "no raw_iuse?"); - std::copy(_imp->raw_iuse->value()->begin(), _imp->raw_iuse->value()->end(), iuse_effective->inserter()); + auto iu(_imp->raw_iuse->parse_value()); + std::copy(iu->begin(), iu->end(), iuse_effective->inserter()); std::copy(e_repo->profile()->iuse_implicit()->begin(), e_repo->profile()->iuse_implicit()->end(), iuse_effective->inserter()); @@ -532,14 +533,14 @@ EbuildID::need_masks_added() const if (keywords_key()) { - if (! _imp->environment->accept_keywords(keywords_key()->value(), shared_from_this())) + auto keywords(keywords_key()->parse_value()); + if (! _imp->environment->accept_keywords(keywords, shared_from_this())) { add_mask(create_e_unaccepted_mask('K', DistributionData::get_instance()->distribution_from_string( _imp->environment->distribution())->concept_keyword(), keywords_key()->raw_name())); } - else if (keywords_key()->value()->end() == std::find_if(keywords_key()->value()->begin(), - keywords_key()->value()->end(), &is_stable_keyword)) + else if (keywords->end() == std::find_if(keywords->begin(), keywords->end(), &is_stable_keyword)) { add_overridden_mask(std::make_shared<OverriddenMask>( make_named_values<OverriddenMask>( @@ -554,7 +555,7 @@ EbuildID::need_masks_added() const if (license_key()) { LicenceChecker c(_imp->environment, &Environment::accept_license, shared_from_this()); - license_key()->value()->top()->accept(c); + license_key()->parse_value()->top()->accept(c); if (! c.ok) add_mask(create_e_unaccepted_mask('L', DistributionData::get_instance()->distribution_from_string( @@ -621,14 +622,14 @@ EbuildID::canonical_form(const PackageIDCanonicalForm f) const { case idcf_full: if (_imp->slot) - return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->slot->value()) + + return stringify(name()) + "-" + stringify(version()) + ":" + stringify(_imp->slot->parse_value()) + "::" + stringify(repository_name()); return stringify(name()) + "-" + stringify(version()) + "::" + stringify(repository_name()); case idcf_no_version: if (_imp->slot) - return stringify(name()) + ":" + stringify(_imp->slot->value()) + + return stringify(name()) + ":" + stringify(_imp->slot->parse_value()) + "::" + stringify(repository_name()); return stringify(name()) + "::" + stringify(repository_name()); @@ -638,7 +639,7 @@ EbuildID::canonical_form(const PackageIDCanonicalForm f) const case idcf_no_name: if (_imp->slot) - return stringify(version()) + ":" + stringify(_imp->slot->value()) + "::" + + return stringify(version()) + ":" + stringify(_imp->slot->parse_value()) + "::" + stringify(repository_name()); return stringify(version()) + "::" + stringify(repository_name()); @@ -654,7 +655,7 @@ PackageDepSpec EbuildID::uniquely_identifying_spec() const { return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + - (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository_name()), + (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()), _imp->environment, { }); } @@ -1448,7 +1449,8 @@ EbuildID::make_choice_value( if (raw_use_key()) { locked = true; - enabled = enabled_by_default = (raw_use_key()->value()->end() != raw_use_key()->value()->find(name_with_prefix_s)); + auto raw_use(raw_use_key()->parse_value()); + enabled = enabled_by_default = (raw_use->end() != raw_use->find(name_with_prefix_s)); } else { @@ -1558,7 +1560,7 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const if (restrict_key()) { UnconditionalRestrictFinder f; - restrict_key()->value()->top()->accept(f); + restrict_key()->parse_value()->top()->accept(f); may_be_unrestricted_test = f.s.end() == f.s.find("test"); may_be_unrestricted_strip = f.s.end() == f.s.find("strip"); } @@ -1586,7 +1588,8 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const { if (phase->option("expensive_tests")) { - if (_imp->defined_phases->value()->end() != _imp->defined_phases->value()->find(phase->equal_option("skipname"))) + auto defined_phases(_imp->defined_phases->parse_value()); + if (defined_phases->end() != defined_phases->find(phase->equal_option("skipname"))) { has_expensive_test_phase = true; break; @@ -1640,7 +1643,7 @@ EbuildID::purge_invalid_cache() const if (e_repo->params().write_cache().basename() != "empty") { EbuildFlatMetadataCache write_metadata_cache(_imp->environment, - write_cache_file, _imp->fs_location->value(), _imp->master_mtime, _imp->eclass_mtimes, true); + write_cache_file, _imp->fs_location->parse_value(), _imp->master_mtime, _imp->eclass_mtimes, true); if (! write_metadata_cache.load(shared_from_this(), true)) write_cache_file.unlink(); } @@ -1650,7 +1653,7 @@ EbuildID::purge_invalid_cache() const bool EbuildID::might_be_binary() const { - auto path(stringify(_imp->fs_location->value())); + auto path(stringify(_imp->fs_location->parse_value())); auto dot_pos(path.rfind('.')); if (std::string::npos != dot_pos) diff --git a/paludis/repositories/e/exndbam_id.cc b/paludis/repositories/e/exndbam_id.cc index 51ed86447..7cc08faa6 100644 --- a/paludis/repositories/e/exndbam_id.cc +++ b/paludis/repositories/e/exndbam_id.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2009, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -47,7 +47,7 @@ namespace { } - const std::shared_ptr<const Contents> value() const + const std::shared_ptr<const Contents> parse_value() const { Lock l(_mutex); if (_v) diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc index 92e9977a2..87b0955f6 100644 --- a/paludis/repositories/e/exndbam_repository.cc +++ b/paludis/repositories/e/exndbam_repository.cc @@ -316,7 +316,7 @@ namespace const std::shared_ptr<const PackageID> & b) { if (a->slot_key()) - return b->slot_key() && a->slot_key()->value() == b->slot_key()->value(); + return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value(); else return ! b->slot_key(); } @@ -359,7 +359,7 @@ ExndbamRepository::merge(const MergeParams & m) FSPath uid_dir(_imp->params.location()); if (if_same_name_id) - uid_dir = if_same_name_id->fs_location_key()->value().dirname(); + uid_dir = if_same_name_id->fs_location_key()->parse_value().dirname(); else { std::string uid(stringify(m.package_id()->name().category()) + "---" + stringify(m.package_id()->name().package())); @@ -372,7 +372,7 @@ ExndbamRepository::merge(const MergeParams & m) } FSPath target_ver_dir(uid_dir); - target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->value()) + ":" + cookie()); + target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->parse_value()) + ":" + cookie()); if (target_ver_dir.stat().exists()) throw ActionFailedError("Temporary merge directory '" + stringify(target_ver_dir) + "' already exists, probably " @@ -433,7 +433,7 @@ ExndbamRepository::merge(const MergeParams & m) n::options() = m.options(), n::output_manager() = m.output_manager(), n::package_id() = m.package_id(), - n::root() = installed_root_key()->value() + n::root() = installed_root_key()->parse_value() )); (m.used_this_for_config_protect())(config_protect); @@ -471,7 +471,7 @@ ExndbamRepository::merge(const MergeParams & m) it_end(replace_candidates->end()); it_end != it; ++it) { std::shared_ptr<const ERepositoryID> candidate(std::static_pointer_cast<const ERepositoryID>(*it)); - if (candidate != if_overwritten_id && candidate->fs_location_key()->value() != target_ver_dir && slot_is_same(candidate, m.package_id())) + if (candidate != if_overwritten_id && candidate->fs_location_key()->parse_value() != target_ver_dir && slot_is_same(candidate, m.package_id())) { UninstallActionOptions uo(make_named_values<UninstallActionOptions>( n::config_protect() = config_protect, @@ -489,7 +489,7 @@ ExndbamRepository::merge(const MergeParams & m) VDBPostMergeUnmergeCommand post_merge_command( make_named_values<VDBPostMergeUnmergeCommandParams>( - n::root() = installed_root_key()->value() + n::root() = installed_root_key()->parse_value() )); post_merge_command(); } @@ -511,7 +511,7 @@ ExndbamRepository::perform_uninstall( std::shared_ptr<OutputManager> output_manager(a.options.make_output_manager()(a)); - FSPath ver_dir(id->fs_location_key()->value().realpath()); + FSPath ver_dir(id->fs_location_key()->parse_value().realpath()); std::shared_ptr<FSPath> load_env(std::make_shared<FSPath>(ver_dir / "environment.bz2")); auto eclassdirs(std::make_shared<FSPathSequence>()); @@ -566,14 +566,14 @@ ExndbamRepository::perform_uninstall( n::ndbam() = &_imp->ndbam, n::output_manager() = output_manager, n::package_id() = id, - n::root() = installed_root_key()->value() + n::root() = installed_root_key()->parse_value() )); unmerger.unmerge(); VDBPostMergeUnmergeCommand post_unmerge_command( make_named_values<VDBPostMergeUnmergeCommandParams>( - n::root() = installed_root_key()->value() + n::root() = installed_root_key()->parse_value() )); post_unmerge_command(); } diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc index 8f1a90f0d..f674d9835 100644 --- a/paludis/repositories/e/fix_locked_dependencies.cc +++ b/paludis/repositories/e/fix_locked_dependencies.cc @@ -106,7 +106,7 @@ namespace break; std::shared_ptr<const PackageIDSequence> matches((*env)[selection::AllVersionsSorted( - generator::Matches(*node.spec(), id, { }) | filter::InstalledAtRoot(env->system_root_key()->value()))]); + generator::Matches(*node.spec(), id, { }) | filter::InstalledAtRoot(env->system_root_key()->parse_value()))]); if (matches->empty()) break; @@ -114,7 +114,7 @@ namespace { PackageDepSpec new_s(MutablePackageDepSpecData(*node.spec()->data()) .unrequire_any_slot() - .require_exact_slot((*matches->last())->slot_key()->value(), true)); + .require_exact_slot((*matches->last())->slot_key()->parse_value(), true)); c = std::make_shared<PackageDepSpec>(new_s); } } while (false); diff --git a/paludis/repositories/e/info_metadata_key.cc b/paludis/repositories/e/info_metadata_key.cc index f90ecb9e5..2776f51a6 100644 --- a/paludis/repositories/e/info_metadata_key.cc +++ b/paludis/repositories/e/info_metadata_key.cc @@ -99,7 +99,7 @@ InfoVarsMetadataKey::~InfoVarsMetadataKey() } const std::shared_ptr<const Set<std::string> > -InfoVarsMetadataKey::value() const +InfoVarsMetadataKey::parse_value() const { Lock l(_imp->mutex); @@ -189,7 +189,7 @@ InfoPkgsMetadataKey::need_keys_added() const generator::Matches(parse_elike_package_dep_spec(i->first, eapi->supported()->package_dep_spec_parse_options(), eapi->supported()->version_spec_options()), make_null_shared_ptr(), { }) | - filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]); + filter::InstalledAtRoot(_imp->env->preferred_root_key()->parse_value()))]); if (q->empty()) key = std::make_shared<LiteralMetadataValueKey<std::string>>(i->first, i->first, mkt_normal, "(none)"); @@ -215,7 +215,8 @@ InfoVarsMetadataKey::pretty_print_value( const PrettyPrintOptions &) const { using namespace std::placeholders; - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(pretty_printer)); + auto v(parse_value()); + return join(v->begin(), v->end(), " ", CallPrettyPrinter(pretty_printer)); } const std::string diff --git a/paludis/repositories/e/info_metadata_key.hh b/paludis/repositories/e/info_metadata_key.hh index f63058f1b..c988eaadc 100644 --- a/paludis/repositories/e/info_metadata_key.hh +++ b/paludis/repositories/e/info_metadata_key.hh @@ -44,7 +44,7 @@ namespace paludis InfoVarsMetadataKey(const std::shared_ptr<const FSPathSequence> &); ~InfoVarsMetadataKey(); - const std::shared_ptr<const Set<std::string> > value() const; + const std::shared_ptr<const Set<std::string> > parse_value() const; virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/repositories/e/make_archive_strings.cc b/paludis/repositories/e/make_archive_strings.cc new file mode 100644 index 000000000..b1cea06e7 --- /dev/null +++ b/paludis/repositories/e/make_archive_strings.cc @@ -0,0 +1,85 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/repositories/e/make_archive_strings.hh> +#include <paludis/repositories/e/a_finder.hh> +#include <paludis/repositories/e/aa_visitor.hh> +#include <paludis/repositories/e/eapi.hh> + +#include <paludis/metadata_key.hh> +#include <paludis/package_id.hh> + +#include <set> + +using namespace paludis; +using namespace paludis::erepository; + +std::pair<std::string, std::string> +paludis::erepository::make_archives_strings( + const Environment * const env, + const std::shared_ptr<const ERepositoryID> & id) +{ + std::string archives, all_archives; + std::set<std::string> already_in_archives; + + std::shared_ptr<const FetchableURISpecTree> fetches; + if (id->fetches_key()) + fetches = id->fetches_key()->parse_value(); + + /* make A */ + AFinder f(env, id); + if (fetches) + fetches->top()->accept(f); + + for (AFinder::ConstIterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i) + { + const FetchableURIDepSpec * const spec(static_cast<const FetchableURIDepSpec *>(i->first)); + + if (already_in_archives.end() == already_in_archives.find(spec->filename())) + { + archives.append(spec->filename()); + already_in_archives.insert(spec->filename()); + } + archives.append(" "); + } + + /* make AA */ + if (! id->eapi()->supported()->ebuild_environment_variables()->env_aa().empty()) + { + AAVisitor g; + if (fetches) + fetches->top()->accept(g); + std::set<std::string> already_in_all_archives; + + for (AAVisitor::ConstIterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg) + { + if (already_in_all_archives.end() == already_in_all_archives.find(*gg)) + { + all_archives.append(*gg); + already_in_all_archives.insert(*gg); + } + all_archives.append(" "); + } + } + else + all_archives = "AA-not-set-for-this-EAPI"; + + return std::make_pair(archives, all_archives); +} + diff --git a/paludis/repositories/e/make_archive_strings.hh b/paludis/repositories/e/make_archive_strings.hh new file mode 100644 index 000000000..cf31a2cf4 --- /dev/null +++ b/paludis/repositories/e/make_archive_strings.hh @@ -0,0 +1,37 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_MAKE_ARCHIVE_STRINGS_HH +#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_MAKE_ARCHIVE_STRINGS_HH 1 + +#include <paludis/repositories/e/e_repository_id.hh> +#include <paludis/package_id-fwd.hh> +#include <paludis/environment-fwd.hh> + +namespace paludis +{ + namespace erepository + { + std::pair<std::string, std::string> make_archives_strings( + const Environment * const, + const std::shared_ptr<const ERepositoryID> &); + } +} + +#endif diff --git a/paludis/repositories/e/make_use.cc b/paludis/repositories/e/make_use.cc index 220a43562..c056b16c2 100644 --- a/paludis/repositories/e/make_use.cc +++ b/paludis/repositories/e/make_use.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010 Ciaran McCreesh + * Copyright (c) 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -45,8 +45,8 @@ paludis::erepository::make_use(const Environment * const, if (id.choices_key()) { - for (Choices::ConstIterator k(id.choices_key()->value()->begin()), - k_end(id.choices_key()->value()->end()) ; + auto choices(id.choices_key()->parse_value()); + for (Choices::ConstIterator k(choices->begin()), k_end(choices->end()) ; k != k_end ; ++k) { if ((*k)->prefix() == canonical_build_options_prefix()) @@ -82,15 +82,17 @@ paludis::erepository::make_expand(const Environment * const, if (! e.choices_key()) return expand_vars; + auto choices(e.choices_key()->parse_value()); + for (Set<std::string>::ConstIterator x(profile->use_expand()->begin()), x_end(profile->use_expand()->end()) ; x != x_end ; ++x) { expand_vars->insert(stringify(*x), ""); - Choices::ConstIterator k(std::find_if(e.choices_key()->value()->begin(), e.choices_key()->value()->end(), + Choices::ConstIterator k(std::find_if(choices->begin(), choices->end(), std::bind(std::equal_to<std::string>(), *x, std::bind(std::mem_fn(&Choice::raw_name), std::placeholders::_1)))); - if (k == e.choices_key()->value()->end()) + if (k == choices->end()) continue; for (Choice::ConstIterator i((*k)->begin()), i_end((*k)->end()) ; @@ -113,3 +115,4 @@ paludis::erepository::make_expand(const Environment * const, return expand_vars; } + diff --git a/paludis/repositories/e/myoptions_requirements_verifier.cc b/paludis/repositories/e/myoptions_requirements_verifier.cc index 6105e52e4..50e3f9236 100644 --- a/paludis/repositories/e/myoptions_requirements_verifier.cc +++ b/paludis/repositories/e/myoptions_requirements_verifier.cc @@ -99,8 +99,10 @@ namespace const ChoiceNameWithPrefix & name_with_prefix) { if (id->choices_key()) - for (Choices::ConstIterator k(id->choices_key()->value()->begin()), - k_end(id->choices_key()->value()->end()) ; + { + auto choices(id->choices_key()->parse_value()); + for (Choices::ConstIterator k(choices->begin()), + k_end(choices->end()) ; k != k_end ; ++k) { if ((*k)->prefix() != prefix) @@ -111,6 +113,7 @@ namespace if ((*i)->name_with_prefix() == name_with_prefix) return *i; } + } return make_null_shared_ptr(); } @@ -192,8 +195,9 @@ MyOptionsRequirementsVerifier::verify_one( std::shared_ptr<const ChoiceValue> choice_value; if (_imp->id->choices_key()) - for (Choices::ConstIterator k(_imp->id->choices_key()->value()->begin()), - k_end(_imp->id->choices_key()->value()->end()) ; + { + auto choices(_imp->id->choices_key()->parse_value()); + for (Choices::ConstIterator k(choices->begin()), k_end(choices->end()) ; k != k_end && ! choice_value ; ++k) { if ((*k)->prefix() != prefix) @@ -204,6 +208,7 @@ MyOptionsRequirementsVerifier::verify_one( if ((*i)->unprefixed_name() == suffix) choice_value = *i; } + } if (choice_value) { diff --git a/paludis/repositories/e/parse_dependency_label.cc b/paludis/repositories/e/parse_dependency_label.cc index 0cb185772..6ab886654 100644 --- a/paludis/repositories/e/parse_dependency_label.cc +++ b/paludis/repositories/e/parse_dependency_label.cc @@ -59,7 +59,7 @@ namespace return false; } - const std::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(n)); + const std::shared_ptr<const ChoiceValue> v(id->choices_key()->parse_value()->find_by_name_with_prefix(n)); if (! v) { Log::get_instance()->message("e.dep_parser.label_enabled.no_choice", ll_warning, lc_context) diff --git a/paludis/repositories/e/pbin_merger.cc b/paludis/repositories/e/pbin_merger.cc index 16a9c421d..24052d12e 100644 --- a/paludis/repositories/e/pbin_merger.cc +++ b/paludis/repositories/e/pbin_merger.cc @@ -96,7 +96,7 @@ PbinMerger::extend_hook(const Hook & h) std::string pn(stringify(_imp->params.package_id()->name().package())); std::string pvr(stringify(_imp->params.package_id()->version())); std::string pv(stringify(_imp->params.package_id()->version().remove_revision())); - std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->value()) : ""); + std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->parse_value()) : ""); return TarMerger::extend_hook(h) ("P", pn + "-" + pv) diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc index c8754ecdf..ec6f3562f 100644 --- a/paludis/repositories/e/pipe_command_handler.cc +++ b/paludis/repositories/e/pipe_command_handler.cc @@ -155,8 +155,7 @@ namespace if ((! seen_description) && (id->choices_key()) && (! desc_from.empty())) { - const std::shared_ptr<const ChoiceValue> choice( - id->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix(desc_from))); + auto choice(id->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix(desc_from))); if (choice && (! choice->description().empty()) && (! description_annotation.empty())) { if (! done_brackets) @@ -312,9 +311,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment Filter root((filter::All())); if (tokens[2] == "--slash") - root = filter::InstalledAtRoot(environment->system_root_key()->value()); + root = filter::InstalledAtRoot(environment->system_root_key()->parse_value()); else if (tokens[2] == "--root") - root = filter::InstalledAtRoot(environment->preferred_root_key()->value()); + root = filter::InstalledAtRoot(environment->preferred_root_key()->parse_value()); else return "Ebad BEST_VERSION " + tokens[2] + " argument"; @@ -328,10 +327,10 @@ paludis::erepository::pipe_command_handler(const Environment * const environment { Log::get_instance()->message("e.pipe_commands.best_version.is_virtual", ll_qa, lc_context) << "best-version of '" << spec << "' resolves to '" << **entries->last() << "', which is a virtual for '" - << *(*entries->last())->virtual_for_key()->value() << "'. This will break with " + << *(*entries->last())->virtual_for_key()->parse_value() << "'. This will break with " "new style virtuals."; std::shared_ptr<PackageIDSequence> new_entries(std::make_shared<PackageIDSequence>()); - new_entries->push_back((*entries->last())->virtual_for_key()->value()); + new_entries->push_back((*entries->last())->virtual_for_key()->parse_value()); entries = new_entries; } @@ -361,9 +360,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment Filter root((filter::All())); if (tokens[2] == "--slash") - root = filter::InstalledAtRoot(environment->system_root_key()->value()); + root = filter::InstalledAtRoot(environment->system_root_key()->parse_value()); else if (tokens[2] == "--root") - root = filter::InstalledAtRoot(environment->preferred_root_key()->value()); + root = filter::InstalledAtRoot(environment->preferred_root_key()->parse_value()); else return "Ebad HAS_VERSION " + tokens[2] + " argument"; @@ -395,7 +394,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment eapi->supported()->package_dep_spec_parse_options(), eapi->supported()->version_spec_options())); std::shared_ptr<const PackageIDSequence> entries((*environment)[selection::AllVersionsSorted( - generator::Matches(spec, package_id, { }) | filter::InstalledAtRoot(environment->preferred_root_key()->value()))]); + generator::Matches(spec, package_id, { }) | filter::InstalledAtRoot(environment->preferred_root_key()->parse_value()))]); if (eapi->supported()->pipe_commands()->rewrite_virtuals() && (! entries->empty())) { std::shared_ptr<PackageIDSequence> new_entries(std::make_shared<PackageIDSequence>()); @@ -406,9 +405,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment { Log::get_instance()->message("e.pipe_commands.match.is_virtual", ll_qa, lc_context) << "match of '" << spec << "' resolves to '" << **i << "', which is a virtual for '" - << *(*i)->virtual_for_key()->value() << "'. This will break with " + << *(*i)->virtual_for_key()->parse_value() << "'. This will break with " "new style virtuals."; - new_entries->push_back((*i)->virtual_for_key()->value()); + new_entries->push_back((*i)->virtual_for_key()->parse_value()); } else new_entries->push_back(*i); @@ -444,7 +443,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment return "Einstalled repository has no location key"; if (! visitor_cast<const MetadataValueKey<FSPath> >(**key)) return "Einstalled repository location key is not a MetadataValueKey<FSPath> "; - return "O0;" + stringify(visitor_cast<const MetadataValueKey<FSPath> >(**key)->value()); + return "O0;" + stringify(visitor_cast<const MetadataValueKey<FSPath> >(**key)->parse_value()); } } else if (tokens[0] == "OPTIONQ") @@ -467,10 +466,11 @@ paludis::erepository::pipe_command_handler(const Environment * const environment return "EOPTIONQ ID " + stringify(*package_id) + " has no choices"; ChoiceNameWithPrefix name(tokens[2]); - std::shared_ptr<const ChoiceValue> value(package_id->choices_key()->value()->find_by_name_with_prefix(name)); + auto choices(package_id->choices_key()->parse_value()); + auto value(choices->find_by_name_with_prefix(name)); if (! value) { - if (package_id->choices_key()->value()->has_matching_contains_every_value_prefix(name)) + if (choices->has_matching_contains_every_value_prefix(name)) return "O1;"; return "EOPTIONQ ID " + stringify(*package_id) + " has no choice named '" + stringify(name) + "'"; @@ -512,9 +512,8 @@ paludis::erepository::pipe_command_handler(const Environment * const environment if (! mm) throw InternalError(PALUDIS_HERE, "oops. key '" + var + "' isn't a DependencySpecTree key"); - std::shared_ptr<const DependencySpecTree> before(mm->value()); - std::shared_ptr<const DependencySpecTree> after(fix_locked_dependencies( - environment, *eapi, package_id, before)); + std::shared_ptr<const DependencySpecTree> before(mm->parse_value()); + std::shared_ptr<const DependencySpecTree> after(fix_locked_dependencies(environment, *eapi, package_id, before)); UnformattedPrettyPrinter ff; SpecTreePrettyPrinter p(ff, { }); after->top()->accept(p); @@ -536,7 +535,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment MyOptionsRewriter p(package_id, eapi->supported()->annotations()->general_description(), std::string(1, eapi->supported()->choices_options()->use_expand_separator())); - mm->value()->top()->accept(p); + mm->parse_value()->top()->accept(p); return "O0;" + p.str.str(); } diff --git a/paludis/repositories/e/pretend_fetch_visitor.cc b/paludis/repositories/e/pretend_fetch_visitor.cc index 0f2f3c601..a07effa6c 100644 --- a/paludis/repositories/e/pretend_fetch_visitor.cc +++ b/paludis/repositories/e/pretend_fetch_visitor.cc @@ -73,7 +73,7 @@ namespace paludis fetch_unneeded(f), default_label(n), action(a), - manifest(id->fs_location_key()->value().dirname() / "Manifest") + manifest(id->fs_location_key()->parse_value().dirname() / "Manifest") { labels.push_front(default_label.get()); } diff --git a/paludis/repositories/e/required_use_verifier.cc b/paludis/repositories/e/required_use_verifier.cc index 23f4c3b91..cdac1ca7a 100644 --- a/paludis/repositories/e/required_use_verifier.cc +++ b/paludis/repositories/e/required_use_verifier.cc @@ -92,7 +92,7 @@ RequiredUseVerifier::matches(const std::string & s) return false; } - auto c(_imp->id->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix(s))); + auto c(_imp->id->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix(s))); if (! c) { Log::get_instance()->message("e.required_use.no_choice", ll_warning, lc_context) diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc index 9be7542a4..79eb55459 100644 --- a/paludis/repositories/e/vdb_id.cc +++ b/paludis/repositories/e/vdb_id.cc @@ -53,6 +53,6 @@ VDBID::contents_filename() const std::shared_ptr<MetadataValueKey<std::shared_ptr<const Contents> > > VDBID::make_contents_key() const { - return std::make_shared<EContentsKey>("CONTENTS", "Contents", fs_location_key()->value() / "CONTENTS", mkt_internal); + return std::make_shared<EContentsKey>("CONTENTS", "Contents", fs_location_key()->parse_value() / "CONTENTS", mkt_internal); } diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc index b67d3b081..ebe05681a 100644 --- a/paludis/repositories/e/vdb_merger.cc +++ b/paludis/repositories/e/vdb_merger.cc @@ -117,7 +117,7 @@ VDBMerger::extend_hook(const Hook & h) std::string pn(stringify(_imp->params.package_id()->name().package())); std::string pvr(stringify(_imp->params.package_id()->version())); std::string pv(stringify(_imp->params.package_id()->version().remove_revision())); - std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->value()) : ""); + std::string slot(_imp->params.package_id()->slot_key() ? stringify(_imp->params.package_id()->slot_key()->parse_value()) : ""); return FSMerger::extend_hook(h) ("P", pn + "-" + pv) diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc index 7ccb5d5f3..a300a77ba 100644 --- a/paludis/repositories/e/vdb_repository.cc +++ b/paludis/repositories/e/vdb_repository.cc @@ -469,7 +469,7 @@ VDBRepository::perform_uninstall( std::shared_ptr<const Contents> contents(a.options.override_contents()); if (! contents) - contents = id->contents_key()->value(); + contents = id->contents_key()->parse_value(); /* unmerge */ VDBUnmerger unmerger( @@ -481,13 +481,13 @@ VDBRepository::perform_uninstall( n::ignore() = a.options.ignore_for_unmerge(), n::output_manager() = output_manager, n::package_id() = id, - n::root() = installed_root_key()->value() + n::root() = installed_root_key()->parse_value() )); unmerger.unmerge(); VDBPostMergeUnmergeCommand post_unmerge_command( make_named_values<VDBPostMergeUnmergeCommandParams>( - n::root() = installed_root_key()->value() + n::root() = installed_root_key()->parse_value() )); post_unmerge_command(); } @@ -713,7 +713,7 @@ VDBRepository::provides_from_package_id(const std::shared_ptr<const PackageID> & if (! id->provide_key()) return; - std::shared_ptr<const ProvideSpecTree> provide(id->provide_key()->value()); + std::shared_ptr<const ProvideSpecTree> provide(id->provide_key()->parse_value()); DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->params.environment(), id); provide->top()->accept(f); @@ -871,7 +871,7 @@ namespace const std::shared_ptr<const PackageID> & b) { if (a->slot_key()) - return b->slot_key() && a->slot_key()->value() == b->slot_key()->value(); + return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value(); else return ! b->slot_key(); } @@ -957,7 +957,7 @@ VDBRepository::merge(const MergeParams & m) n::options() = m.options(), n::output_manager() = m.output_manager(), n::package_id() = m.package_id(), - n::root() = installed_root_key()->value() + n::root() = installed_root_key()->parse_value() )); (m.used_this_for_config_protect())(config_protect); @@ -972,10 +972,7 @@ VDBRepository::merge(const MergeParams & m) std::shared_ptr<const Contents> is_replace_contents; if (is_replace) { - /* hack: before we nuke its vdb dir, preload CONTENTS */ - if (! is_replace->contents_key()) - throw InternalError(PALUDIS_HERE, "No contents key in " + stringify(*is_replace) + ". How did that happen?"); - is_replace_contents = is_replace->contents_key()->value(); + is_replace_contents = is_replace->contents_key()->parse_value(); FSPath old_vdb_dir(_imp->params.location()); old_vdb_dir /= stringify(is_replace->name().category()); @@ -1049,7 +1046,7 @@ VDBRepository::merge(const MergeParams & m) VDBPostMergeUnmergeCommand post_merge_command( make_named_values<VDBPostMergeUnmergeCommandParams>( - n::root() = installed_root_key()->value() + n::root() = installed_root_key()->parse_value() )); post_merge_command(); @@ -1314,7 +1311,7 @@ namespace const DepRewrites & rewrites) { DepRewriter v(rewrites); - key->value()->top()->accept(v); + key->parse_value()->top()->accept(v); if (v.changed) { std::cout << " Rewriting " << f << std::endl; @@ -1402,7 +1399,7 @@ VDBRepository::perform_updates() continue; } - FSPath dir(k->value()); + FSPath dir(k->parse_value()); if (! dir.stat().is_directory_or_symlink_to_directory()) { Log::get_instance()->message("e.vdb.updates.bad_key", ll_warning, lc_context) << @@ -1410,7 +1407,7 @@ VDBRepository::perform_updates() continue; } - for (FSIterator d(k->value(), { fsio_want_regular_files, fsio_deref_symlinks_for_wants }), d_end ; d != d_end ; ++d) + for (FSIterator d(k->parse_value(), { fsio_want_regular_files, fsio_deref_symlinks_for_wants }), d_end ; d != d_end ; ++d) { Context context_3("When performing updates from '" + stringify(*d) + "':"); @@ -1517,7 +1514,7 @@ VDBRepository::perform_updates() FSPath target_cat_dir(_imp->params.location() / stringify(m->second.category())); target_cat_dir.mkdir(0755, { fspmkdo_ok_if_exists }); - FSPath from_dir(m->first->fs_location_key()->value()); + FSPath from_dir(m->first->fs_location_key()->parse_value()); FSPath to_dir(target_cat_dir / ((stringify(m->second.package()) + "-" + stringify(m->first->version())))); if (to_dir.stat().exists()) @@ -1572,7 +1569,7 @@ VDBRepository::perform_updates() { std::cout << " " << *m->first << " to " << m->second << std::endl; - SafeOFStream f(m->first->fs_location_key()->value() / "SLOT", -1, true); + SafeOFStream f(m->first->fs_location_key()->parse_value() / "SLOT", -1, true); f << m->second << std::endl; } } @@ -1604,16 +1601,16 @@ VDBRepository::perform_updates() i != i_end ; ++i) { if ((*i)->build_dependencies_key()) - rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->value() / (*i)->build_dependencies_key()->raw_name(), + rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->parse_value() / (*i)->build_dependencies_key()->raw_name(), (*i)->build_dependencies_key(), dep_rewrites); if ((*i)->run_dependencies_key()) - rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->value() / (*i)->run_dependencies_key()->raw_name(), + rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->parse_value() / (*i)->run_dependencies_key()->raw_name(), (*i)->run_dependencies_key(), dep_rewrites); if ((*i)->post_dependencies_key()) - rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->value() / (*i)->post_dependencies_key()->raw_name(), + rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->parse_value() / (*i)->post_dependencies_key()->raw_name(), (*i)->post_dependencies_key(), dep_rewrites); if ((*i)->suggested_dependencies_key()) - rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->value() / (*i)->suggested_dependencies_key()->raw_name(), + rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->parse_value() / (*i)->suggested_dependencies_key()->raw_name(), (*i)->suggested_dependencies_key(), dep_rewrites); } diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc index 1c077d127..5458320df 100644 --- a/paludis/repositories/e/vdb_repository_TEST.cc +++ b/paludis/repositories/e/vdb_repository_TEST.cc @@ -97,30 +97,30 @@ namespace void visit(const ContentsFileEntry & e) { _str += "file\n"; - _str += stringify(e.location_key()->value()); + _str += stringify(e.location_key()->parse_value()); _str += '\n'; } void visit(const ContentsDirEntry & e) { _str += "directory\n"; - _str += stringify(e.location_key()->value()); + _str += stringify(e.location_key()->parse_value()); _str += '\n'; } void visit(const ContentsSymEntry & e) { _str += "symlink\n"; - _str += stringify(e.location_key()->value()); + _str += stringify(e.location_key()->parse_value()); _str += '\n'; - _str += stringify(e.target_key()->value()); + _str += stringify(e.target_key()->parse_value()); _str += '\n'; } void visit(const ContentsOtherEntry & e) { _str += "other\n"; - _str += stringify(e.location_key()->value()); + _str += stringify(e.location_key()->parse_value()); _str += '\n'; } }; @@ -197,15 +197,15 @@ TEST(VDBRepository, QueryUse) &env, { })), make_null_shared_ptr(), { }))]->begin()); ASSERT_TRUE(bool(e1->choices_key())); - ASSERT_TRUE(bool(e1->choices_key()->value())); - ASSERT_TRUE(bool(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag1")))); - EXPECT_TRUE(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag1"))->enabled()); - EXPECT_TRUE(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag2"))->enabled()); - EXPECT_TRUE(! e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->enabled()); - EXPECT_TRUE(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test"))->enabled()); - EXPECT_TRUE(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("kernel_linux"))->enabled()); - EXPECT_TRUE(! e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test2"))); - EXPECT_TRUE(! e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("kernel_freebsd"))); + ASSERT_TRUE(bool(e1->choices_key()->parse_value())); + ASSERT_TRUE(bool(e1->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag1")))); + EXPECT_TRUE(e1->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag1"))->enabled()); + EXPECT_TRUE(e1->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag2"))->enabled()); + EXPECT_TRUE(! e1->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->enabled()); + EXPECT_TRUE(e1->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test"))->enabled()); + EXPECT_TRUE(e1->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix("kernel_linux"))->enabled()); + EXPECT_TRUE(! e1->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test2"))); + EXPECT_TRUE(! e1->choices_key()->parse_value()->find_by_name_with_prefix(ChoiceNameWithPrefix("kernel_freebsd"))); } TEST(VDBRepository, Contents) @@ -226,8 +226,9 @@ TEST(VDBRepository, Contents) PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", &env, { })), make_null_shared_ptr(), { }))]->begin()); ContentsGatherer gatherer; - std::for_each(indirect_iterator(e1->contents_key()->value()->begin()), - indirect_iterator(e1->contents_key()->value()->end()), + auto contents(e1->contents_key()->parse_value()); + std::for_each(indirect_iterator(contents->begin()), + indirect_iterator(contents->end()), accept_visitor(gatherer)); EXPECT_EQ( "directory\n/directory\n" diff --git a/paludis/repositories/e/vdb_repository_TEST_cache.cc b/paludis/repositories/e/vdb_repository_TEST_cache.cc index 0091c953f..07d091f57 100644 --- a/paludis/repositories/e/vdb_repository_TEST_cache.cc +++ b/paludis/repositories/e/vdb_repository_TEST_cache.cc @@ -383,7 +383,7 @@ TEST(ProvidesCache, Works) for (auto i(seq->begin()), i_end(seq->end()) ; i != i_end ; ++i) - ASSERT_TRUE(! stringify(i->provided_by()->slot_key()->value()).empty()); + ASSERT_TRUE(! stringify(i->provided_by()->slot_key()->parse_value()).empty()); RepositoryProvidesInterface::ProvidesSequence::ConstIterator it(seq->begin()); EXPECT_EQ("virtual/foo", stringify(it->virtual_name())); diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc index 9178010db..cb3b4d4fb 100644 --- a/paludis/repositories/e/vdb_unmerger.cc +++ b/paludis/repositories/e/vdb_unmerger.cc @@ -101,7 +101,7 @@ VDBUnmerger::extend_hook(const Hook & h) const std::string pn(stringify(_imp->options.package_id()->name().package())); std::string pvr(stringify(_imp->options.package_id()->version())); std::string pv(stringify(_imp->options.package_id()->version().remove_revision())); - std::string slot(_imp->options.package_id()->slot_key() ? stringify(_imp->options.package_id()->slot_key()->value()) : ""); + std::string slot(_imp->options.package_id()->slot_key() ? stringify(_imp->options.package_id()->slot_key()->parse_value()) : ""); return result ("P", pn + "-" + pv) @@ -216,21 +216,21 @@ namespace bool VDBUnmerger::check_file(const std::shared_ptr<const ContentsEntry> & e) const { - const FSPath f(e->location_key()->value()); + const FSPath f(e->location_key()->parse_value()); const FSPath root_f(_imp->options.root() / f); const FSStat root_f_stat(root_f); if (! root_f_stat.exists()) display("--- [gone ] " + stringify(f)); else if (! root_f_stat.is_regular_file()) display("--- [!type] " + stringify(f)); - else if (root_f_stat.mtim().seconds() != require_key<MetadataTimeKey>(*e, "mtime").value().seconds()) + else if (root_f_stat.mtim().seconds() != require_key<MetadataTimeKey>(*e, "mtime").parse_value().seconds()) display("--- [!time] " + stringify(f)); else { try { SafeIFStream md5_file(_imp->options.root() / f); - if (MD5(md5_file).hexsum() != require_key<MetadataValueKey<std::string> >(*e, "md5").value()) + if (MD5(md5_file).hexsum() != require_key<MetadataValueKey<std::string> >(*e, "md5").parse_value()) display("--- [!md5 ] " + stringify(f)); else if (config_protected(_imp->options.root() / f)) display("--- [cfgpr] " + stringify(f)); @@ -251,7 +251,7 @@ VDBUnmerger::check_file(const std::shared_ptr<const ContentsEntry> & e) const bool VDBUnmerger::check_sym(const std::shared_ptr<const ContentsEntry> & e) const { - const FSPath f(e->location_key()->value()); + const FSPath f(e->location_key()->parse_value()); const FSPath root_f(_imp->options.root() / f); const FSStat root_f_stat(root_f); @@ -259,9 +259,9 @@ VDBUnmerger::check_sym(const std::shared_ptr<const ContentsEntry> & e) const display("--- [gone ] " + stringify(f)); else if (! root_f_stat.is_symlink()) display("--- [!type] " + stringify(f)); - else if (root_f_stat.mtim().seconds() != require_key<MetadataTimeKey>(*e, "mtime").value().seconds()) + else if (root_f_stat.mtim().seconds() != require_key<MetadataTimeKey>(*e, "mtime").parse_value().seconds()) display("--- [!time] " + stringify(f)); - else if (root_f.readlink() != require_key<MetadataValueKey<std::string> >(*e, "target").value()) + else if (root_f.readlink() != require_key<MetadataValueKey<std::string> >(*e, "target").parse_value()) display("--- [!dest] " + stringify(f)); else return true; @@ -272,7 +272,7 @@ VDBUnmerger::check_sym(const std::shared_ptr<const ContentsEntry> & e) const bool VDBUnmerger::check_misc(const std::shared_ptr<const ContentsEntry> & e) const { - const FSPath f(e->location_key()->value()); + const FSPath f(e->location_key()->parse_value()); const FSPath root_f(_imp->options.root() / f); const FSStat root_f_stat(root_f); @@ -284,7 +284,7 @@ VDBUnmerger::check_misc(const std::shared_ptr<const ContentsEntry> & e) const bool VDBUnmerger::check_dir(const std::shared_ptr<const ContentsEntry> & e) const { - const FSPath f(e->location_key()->value()); + const FSPath f(e->location_key()->parse_value()); const FSPath root_f(_imp->options.root() / f); const FSStat root_f_stat(root_f); diff --git a/paludis/repositories/e/vdb_unmerger_TEST.cc b/paludis/repositories/e/vdb_unmerger_TEST.cc index 9ce2c823d..0482761af 100644 --- a/paludis/repositories/e/vdb_unmerger_TEST.cc +++ b/paludis/repositories/e/vdb_unmerger_TEST.cc @@ -123,7 +123,7 @@ namespace unmerger = std::make_shared<VDBUnmergerNoDisplay>(make_named_values<VDBUnmergerOptions>( n::config_protect() = "/protected_file /protected_dir", n::config_protect_mask() = "/protected_dir/unprotected_file /protected_dir/unprotected_dir", - n::contents() = id->contents_key()->value(), + n::contents() = id->contents_key()->parse_value(), n::environment() = &env, n::ignore() = &ignore_nothing, n::output_manager() = std::make_shared<StandardOutputManager>(), diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc index 16c1d94f2..494192467 100644 --- a/paludis/repositories/fake/fake_installed_repository.cc +++ b/paludis/repositories/fake/fake_installed_repository.cc @@ -103,7 +103,7 @@ FakeInstalledRepository::provided_packages() const continue; DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(environment(), *v); - (*v)->provide_key()->value()->top()->accept(f); + (*v)->provide_key()->parse_value()->top()->accept(f); for (DepSpecFlattener<ProvideSpecTree, PackageDepSpec>::ConstIterator q(f.begin()), q_end(f.end()) ; q != q_end ; ++q) result->push_back(make_named_values<RepositoryProvidesEntry>( @@ -120,7 +120,7 @@ FakeInstalledRepository::provided_packages() const bool FakeInstalledRepository::is_default_destination() const { - return environment()->preferred_root_key()->value() == installed_root_key()->value(); + return environment()->preferred_root_key()->parse_value() == installed_root_key()->parse_value(); } bool diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc index 9789db4c0..fdb13e560 100644 --- a/paludis/repositories/fake/fake_package_id.cc +++ b/paludis/repositories/fake/fake_package_id.cc @@ -99,7 +99,7 @@ FakeMetadataCollectionKey<C_>::~FakeMetadataCollectionKey() template <typename C_> const std::shared_ptr<const C_> -FakeMetadataCollectionKey<C_>::value() const +FakeMetadataCollectionKey<C_>::parse_value() const { return this->_imp->collection; } @@ -131,7 +131,7 @@ FakeMetadataCollectionKey<C_>::pretty_print_value( const PrettyPrinter & pretty_printer, const PrettyPrintOptions &) const { - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(pretty_printer)); + return join(_imp->collection->begin(), _imp->collection->end(), " ", CallPrettyPrinter(pretty_printer)); } FakeMetadataKeywordSetKey::FakeMetadataKeywordSetKey(const std::string & r, @@ -243,7 +243,7 @@ FakeMetadataSpecTreeKey<C_>::set_from_string(const std::string & s) template <typename C_> const std::shared_ptr<const C_> -FakeMetadataSpecTreeKey<C_>::value() const +FakeMetadataSpecTreeKey<C_>::parse_value() const { return _imp->value; } @@ -314,7 +314,7 @@ FakeMetadataSpecTreeKey<FetchableURISpecTree>::type() const } const std::shared_ptr<const FetchableURISpecTree> -FakeMetadataSpecTreeKey<FetchableURISpecTree>::value() const +FakeMetadataSpecTreeKey<FetchableURISpecTree>::parse_value() const { return _imp->value; } @@ -351,7 +351,7 @@ FakeMetadataSpecTreeKey<DependencySpecTree>::set_from_string(const std::string & } const std::shared_ptr<const DependencySpecTree> -FakeMetadataSpecTreeKey<DependencySpecTree>::value() const +FakeMetadataSpecTreeKey<DependencySpecTree>::parse_value() const { return _imp->value; } @@ -507,7 +507,7 @@ FakeMetadataChoicesKey::add(const std::string & n, const std::string & v) } const std::shared_ptr<const Choices> -FakeMetadataChoicesKey::value() const +FakeMetadataChoicesKey::parse_value() const { return _imp->value; } @@ -689,17 +689,17 @@ FakePackageID::canonical_form(const PackageIDCanonicalForm f) const switch (f) { case idcf_full: - return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + stringify(_imp->slot->value()) + return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + stringify(_imp->slot->parse_value()) + "::" + stringify(repository_name()); case idcf_version: return stringify(_imp->version); case idcf_no_version: - return stringify(_imp->name) + ":" + stringify(_imp->slot->value()) + "::" + stringify(repository_name()); + return stringify(_imp->name) + ":" + stringify(_imp->slot->parse_value()) + "::" + stringify(repository_name()); case idcf_no_name: - return stringify(_imp->version) + ":" + stringify(_imp->slot->value()) + return stringify(_imp->version) + ":" + stringify(_imp->slot->parse_value()) + "::" + stringify(repository_name()); case last_idcf: @@ -713,7 +713,7 @@ PackageDepSpec FakePackageID::uniquely_identifying_spec() const { return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + - (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository_name()), + (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()), _imp->env, { }); } @@ -910,7 +910,7 @@ FakePackageID::set_slot(const SlotName & s) bool FakePackageID::arbitrary_less_than_comparison(const PackageID & other) const { - return slot_key()->value().value() < (other.slot_key() ? stringify(other.slot_key()->value()) : ""); + return slot_key()->parse_value().value() < (other.slot_key() ? stringify(other.slot_key()->parse_value()) : ""); } void @@ -979,7 +979,7 @@ FakePackageID::need_keys_added() const std::size_t FakePackageID::extra_hash_value() const { - return Hash<SlotName>()(slot_key()->value()); + return Hash<SlotName>()(slot_key()->parse_value()); } bool @@ -1060,13 +1060,13 @@ FakePackageID::need_masks_added() const Context context("When generating masks for ID '" + canonical_form(idcf_full) + "':"); if (keywords_key()) - if (! _imp->env->accept_keywords(keywords_key()->value(), shared_from_this())) + if (! _imp->env->accept_keywords(keywords_key()->parse_value(), shared_from_this())) add_mask(std::make_shared<FakeUnacceptedMask>('K', "keywords", keywords_key()->raw_name())); if (license_key()) { LicenceChecker c(_imp->env, &Environment::accept_license, shared_from_this()); - license_key()->value()->top()->accept(c); + license_key()->parse_value()->top()->accept(c); if (! c.ok) add_mask(std::make_shared<FakeUnacceptedMask>('L', "license", license_key()->raw_name())); } @@ -1214,7 +1214,7 @@ const std::string FakeMetadataKeywordSetKey::pretty_print_value( const PrettyPrinter & pretty_printer, const PrettyPrintOptions &) const { - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(pretty_printer)); + return join(_imp->collection->begin(), _imp->collection->end(), " ", CallPrettyPrinter(pretty_printer)); } const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > > diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh index 2b324de6e..590d34245 100644 --- a/paludis/repositories/fake/fake_package_id.hh +++ b/paludis/repositories/fake/fake_package_id.hh @@ -43,7 +43,7 @@ namespace paludis public: ~FakeMetadataCollectionKey(); - virtual const std::shared_ptr<const C_> value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual const std::shared_ptr<const C_> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -80,7 +80,7 @@ namespace paludis const std::function<const std::shared_ptr<const C_> (const std::string &)> &, const MetadataKeyType); ~FakeMetadataSpecTreeKey(); - virtual const std::shared_ptr<const C_> value() const + virtual const std::shared_ptr<const C_> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); void set_from_string(const std::string &); @@ -107,7 +107,7 @@ namespace paludis const MetadataKeyType); ~FakeMetadataSpecTreeKey(); - virtual const std::shared_ptr<const FetchableURISpecTree> value() const + virtual const std::shared_ptr<const FetchableURISpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); void set_from_string(const std::string &); @@ -138,7 +138,7 @@ namespace paludis const MetadataKeyType); ~FakeMetadataSpecTreeKey(); - virtual const std::shared_ptr<const DependencySpecTree> value() const + virtual const std::shared_ptr<const DependencySpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); void set_from_string(const std::string &); @@ -168,7 +168,7 @@ namespace paludis ~FakeMetadataChoicesKey(); void add(const std::string &, const std::string &); - const std::shared_ptr<const Choices> value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + const std::shared_ptr<const Choices> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc index deccd1357..a8e4bd554 100644 --- a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc +++ b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc @@ -244,7 +244,7 @@ GemcutterDependenciesKey::GemcutterDependenciesKey(const Environment * const e, GemcutterDependenciesKey::~GemcutterDependenciesKey() = default; const std::shared_ptr<const DependencySpecTree> -GemcutterDependenciesKey::value() const +GemcutterDependenciesKey::parse_value() const { return _imp->value; } diff --git a/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh b/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh index 26ee818d5..39097c62d 100644 --- a/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh +++ b/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh @@ -55,7 +55,7 @@ namespace paludis ///\} - virtual const std::shared_ptr<const DependencySpecTree> value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual const std::shared_ptr<const DependencySpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/repositories/gemcutter/gemcutter_uri_key.cc b/paludis/repositories/gemcutter/gemcutter_uri_key.cc index 9bcd1944f..c675608d5 100644 --- a/paludis/repositories/gemcutter/gemcutter_uri_key.cc +++ b/paludis/repositories/gemcutter/gemcutter_uri_key.cc @@ -122,7 +122,7 @@ GemcutterURIKey::GemcutterURIKey(const std::string * const r, const std::string GemcutterURIKey::~GemcutterURIKey() = default; const std::shared_ptr<const SimpleURISpecTree> -GemcutterURIKey::value() const +GemcutterURIKey::parse_value() const { return _imp->value; } diff --git a/paludis/repositories/gemcutter/gemcutter_uri_key.hh b/paludis/repositories/gemcutter/gemcutter_uri_key.hh index 984093191..eba98ae01 100644 --- a/paludis/repositories/gemcutter/gemcutter_uri_key.hh +++ b/paludis/repositories/gemcutter/gemcutter_uri_key.hh @@ -44,7 +44,7 @@ namespace paludis ///\} - virtual const std::shared_ptr<const SimpleURISpecTree> value() const PALUDIS_ATTRIBUTE((warn_unused_result)); + virtual const std::shared_ptr<const SimpleURISpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/repositories/repository/repository_repository.cc b/paludis/repositories/repository/repository_repository.cc index 00a5e83a6..dfa6c2d0d 100644 --- a/paludis/repositories/repository/repository_repository.cc +++ b/paludis/repositories/repository/repository_repository.cc @@ -336,7 +336,7 @@ bool RepositoryRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const { auto repo(_imp->params.environment()->fetch_repository(id->repository_name())); - std::string f(repo->format_key() ? repo->format_key()->value() : ""); + std::string f(repo->format_key() ? repo->format_key()->parse_value() : ""); return f == "unavailable"; } @@ -364,7 +364,7 @@ namespace if (! ii) return ""; - return ii->value(); + return ii->parse_value(); } std::string replace_vars( @@ -442,8 +442,8 @@ RepositoryRepository::merge(const MergeParams & m) if (repo_format.empty()) throw InternalError(PALUDIS_HERE, "no REPOSITORY_FORMAT in " + stringify(*m.package_id())); - std::string config_template(_imp->config_template_key->value()); - std::string config_filename(_imp->config_filename_key->value()); + std::string config_template(_imp->config_template_key->parse_value()); + std::string config_filename(_imp->config_filename_key->parse_value()); config_template = replace_vars(config_template, repo_sync, repo_format, repo_name); config_filename = replace_vars(config_filename, repo_sync, repo_format, repo_name); diff --git a/paludis/repositories/unavailable/unavailable_package_id.cc b/paludis/repositories/unavailable/unavailable_package_id.cc index 3f2498ac1..e83d04c17 100644 --- a/paludis/repositories/unavailable/unavailable_package_id.cc +++ b/paludis/repositories/unavailable/unavailable_package_id.cc @@ -106,22 +106,22 @@ UnavailablePackageID::canonical_form(const PackageIDCanonicalForm f) const { case idcf_full: return stringify(_imp->name) + "-" + stringify(_imp->version) + - ":" + stringify(_imp->slot_key->value()) + "::" + stringify(_imp->repository_name) + - " (in ::" + *_imp->from_repositories_key->value()->begin() + ")"; + ":" + stringify(_imp->slot_key->parse_value()) + "::" + stringify(_imp->repository_name) + + " (in ::" + *_imp->from_repositories_key->parse_value()->begin() + ")"; case idcf_no_version: - return stringify(_imp->name) + ":" + stringify(_imp->slot_key->value()) + + return stringify(_imp->name) + ":" + stringify(_imp->slot_key->parse_value()) + "::" + stringify(_imp->repository_name) + - " (in ::" + *_imp->from_repositories_key->value()->begin() + ")"; + " (in ::" + *_imp->from_repositories_key->parse_value()->begin() + ")"; case idcf_version: return stringify(_imp->version) + - " (in ::" + *_imp->from_repositories_key->value()->begin() + ")"; + " (in ::" + *_imp->from_repositories_key->parse_value()->begin() + ")"; case idcf_no_name: return stringify(_imp->version) + - ":" + stringify(_imp->slot_key->value()) + "::" + stringify(_imp->repository_name) + - " (in ::" + *_imp->from_repositories_key->value()->begin() + ")"; + ":" + stringify(_imp->slot_key->parse_value()) + "::" + stringify(_imp->repository_name) + + " (in ::" + *_imp->from_repositories_key->parse_value()->begin() + ")"; case last_idcf: break; @@ -134,8 +134,8 @@ PackageDepSpec UnavailablePackageID::uniquely_identifying_spec() const { return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + - (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository_name()) + - "[." + _imp->from_repositories_key->raw_name() + "=" + *_imp->from_repositories_key->value()->begin() + "]", + (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()) + + "[." + _imp->from_repositories_key->raw_name() + "=" + *_imp->from_repositories_key->parse_value()->begin() + "]", _imp->env, { }); } @@ -181,25 +181,27 @@ UnavailablePackageID::arbitrary_less_than_comparison(const PackageID & other) co if (! other.slot_key()) return false; - if (slot_key()->value() < other.slot_key()->value()) + if (slot_key()->parse_value() < other.slot_key()->parse_value()) return true; - if (slot_key()->value() > other.slot_key()->value()) + if (slot_key()->parse_value() > other.slot_key()->parse_value()) return false; std::shared_ptr<const MetadataCollectionKey<Set<std::string > > > k(other.from_repositories_key()); if (! k) throw InternalError(PALUDIS_HERE, "other has no from_repositories_key()"); - if (1 != k->value()->size()) + + auto v(k->parse_value()); + if (1 != v->size()) throw InternalError(PALUDIS_HERE, "other has bad from_repositories_key"); - return *_imp->from_repositories_key->value()->begin() < *k->value()->begin(); + return *_imp->from_repositories_key->parse_value()->begin() < *v->begin(); } std::size_t UnavailablePackageID::extra_hash_value() const { return Hash<std::pair<SlotName, std::string> >()(std::make_pair( - slot_key()->value(), *_imp->from_repositories_key->value()->begin())); + slot_key()->parse_value(), *_imp->from_repositories_key->parse_value()->begin())); } const std::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > diff --git a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc index 8e19a74c3..9b5839ab1 100644 --- a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc +++ b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc @@ -84,7 +84,7 @@ UnavailableRepositoryDependenciesKey::~UnavailableRepositoryDependenciesKey() } const std::shared_ptr<const DependencySpecTree> -UnavailableRepositoryDependenciesKey::value() const +UnavailableRepositoryDependenciesKey::parse_value() const { return _imp->value; } diff --git a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh index 7813ab446..45ea6b46a 100644 --- a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh +++ b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh @@ -40,7 +40,7 @@ namespace paludis const std::string & v); ~UnavailableRepositoryDependenciesKey(); - const std::shared_ptr<const DependencySpecTree> value() const; + const std::shared_ptr<const DependencySpecTree> parse_value() const; virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc index e59cc6f41..ea98f5106 100644 --- a/paludis/repositories/unpackaged/installed_id.cc +++ b/paludis/repositories/unpackaged/installed_id.cc @@ -94,7 +94,7 @@ namespace { } - const FSPath value() const + const FSPath parse_value() const { return _location; } @@ -131,7 +131,7 @@ namespace { } - const std::shared_ptr<const Contents> value() const + const std::shared_ptr<const Contents> parse_value() const { Lock l(_mutex); if (_v) @@ -175,7 +175,7 @@ namespace { } - Timestamp value() const + Timestamp parse_value() const { return _time; } @@ -217,7 +217,7 @@ namespace { } - const std::string value() const + const std::string parse_value() const { Lock l(_mutex); if (_v) @@ -271,7 +271,7 @@ namespace _f.push_back(f); } - const std::shared_ptr<const Set<std::string> > value() const + const std::shared_ptr<const Set<std::string> > parse_value() const { Lock l(_mutex); if (_v) @@ -307,7 +307,8 @@ namespace const PrettyPrinter & pretty_printer, const PrettyPrintOptions &) const { - return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(pretty_printer)); + auto v(parse_value()); + return join(v->begin(), v->end(), " ", CallPrettyPrinter(pretty_printer)); } }; @@ -338,7 +339,7 @@ namespace { } - const std::shared_ptr<const DependencySpecTree> value() const + const std::shared_ptr<const DependencySpecTree> parse_value() const { Lock l(_mutex); if (_v) @@ -377,7 +378,7 @@ namespace const PrettyPrintOptions & options) const { CommaSeparatedDepPrettyPrinter p(printer, options); - value()->top()->accept(p); + parse_value()->top()->accept(p); return p.result(); } }; @@ -497,18 +498,18 @@ InstalledUnpackagedID::canonical_form(const PackageIDCanonicalForm f) const { case idcf_full: return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + - stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name); + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name); case idcf_version: return stringify(_imp->version); case idcf_no_version: - return stringify(_imp->name) + ":" + stringify(slot_key()->value()) + "::" + + return stringify(_imp->name) + ":" + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name); case idcf_no_name: return stringify(_imp->version) + ":" + - stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name); + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name); case last_idcf: break; @@ -521,7 +522,7 @@ PackageDepSpec InstalledUnpackagedID::uniquely_identifying_spec() const { return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + - (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository_name()), + (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()), _imp->env, { }); } @@ -682,7 +683,7 @@ InstalledUnpackagedTransientKey::InstalledUnpackagedTransientKey( std::string InstalledUnpackagedTransientKey::pretty_print() const { - return stringify(value()); + return stringify(parse_value()); } const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > @@ -804,13 +805,13 @@ InstalledUnpackagedID::breaks_portage() const bool InstalledUnpackagedID::arbitrary_less_than_comparison(const PackageID & other) const { - return slot_key()->value().value() < (other.slot_key() ? stringify(other.slot_key()->value()) : ""); + return slot_key()->parse_value().value() < (other.slot_key() ? stringify(other.slot_key()->parse_value()) : ""); } std::size_t InstalledUnpackagedID::extra_hash_value() const { - return Hash<SlotName>()(slot_key()->value()); + return Hash<SlotName>()(slot_key()->parse_value()); } namespace @@ -846,7 +847,7 @@ InstalledUnpackagedID::uninstall(const bool replace, throw ActionFailedError("Couldn't uninstall '" + stringify(*this) + "' because root ('" + stringify(_imp->root) + "') is not a directory"); - FSPath ver_dir(fs_location_key()->value()); + FSPath ver_dir(fs_location_key()->parse_value()); NDBAMUnmerger unmerger( make_named_values<NDBAMUnmergerOptions>( @@ -869,7 +870,7 @@ InstalledUnpackagedID::uninstall(const bool replace, if (last) { - FSPath pkg_dir(fs_location_key()->value().dirname()); + FSPath pkg_dir(fs_location_key()->parse_value().dirname()); pkg_dir.rmdir(); std::static_pointer_cast<const InstalledUnpackagedRepository>(repo)->deindex(name()); diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc index 252c20c90..562144d8a 100644 --- a/paludis/repositories/unpackaged/installed_repository.cc +++ b/paludis/repositories/unpackaged/installed_repository.cc @@ -128,7 +128,7 @@ InstalledUnpackagedRepository::package_ids(const QualifiedPackageName & q, const Lock l(*(*e).mutex()); if (! (*e).package_id()) (*e).package_id() = std::make_shared<InstalledUnpackagedID>(_imp->params.environment(), (*e).name(), (*e).version(), - (*e).slot(), name(), (*e).fs_location(), (*e).magic(), installed_root_key()->value(), &_imp->ndbam); + (*e).slot(), name(), (*e).fs_location(), (*e).magic(), installed_root_key()->parse_value(), &_imp->ndbam); result->push_back((*e).package_id()); } @@ -255,7 +255,7 @@ namespace const std::shared_ptr<const PackageID> & b) { if (a->slot_key()) - return b->slot_key() && a->slot_key()->value() == b->slot_key()->value(); + return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value(); else return ! b->slot_key(); } @@ -281,7 +281,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m) const MetadataValueKey<FSPath> * kk(visitor_cast<const MetadataValueKey<FSPath> >(**k)); if (! kk) throw ActionFailedError("Fetched install_under key but did not get an FSPath key from owning repository"); - install_under = kk->value(); + install_under = kk->parse_value(); } int rewrite_ids_over_to_root(-1); @@ -292,7 +292,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m) const MetadataValueKey<long> * kk(visitor_cast<const MetadataValueKey<long> >(**k)); if (! kk) throw ActionFailedError("Fetched rewrite_ids_over_to_root key but did not get a long key from owning repository"); - rewrite_ids_over_to_root = kk->value(); + rewrite_ids_over_to_root = kk->parse_value(); } std::shared_ptr<const PackageID> if_overwritten_id, if_same_name_id; @@ -312,7 +312,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m) FSPath uid_dir(_imp->params.location()); if (if_same_name_id) - uid_dir = if_same_name_id->fs_location_key()->value().dirname(); + uid_dir = if_same_name_id->fs_location_key()->parse_value().dirname(); else { std::string uid(stringify(m.package_id()->name().category()) + "---" + stringify(m.package_id()->name().package())); @@ -327,7 +327,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m) } FSPath target_ver_dir(uid_dir); - target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->value()) + ":" + cookie()); + target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot_key()->parse_value()) + ":" + cookie()); if (target_ver_dir.stat().exists()) throw ActionFailedError("Temporary merge directory '" + stringify(target_ver_dir) + "' already exists, probably " @@ -346,7 +346,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m) if (m.package_id()->short_description_key()) { SafeOFStream description_file(target_ver_dir / "description", -1, true); - description_file << m.package_id()->short_description_key()->value() << std::endl; + description_file << m.package_id()->short_description_key()->parse_value() << std::endl; } if (m.package_id()->build_dependencies_key()) @@ -377,7 +377,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m) n::options() = m.options(), n::output_manager() = m.output_manager(), n::package_id() = m.package_id(), - n::root() = installed_root_key()->value() + n::root() = installed_root_key()->parse_value() )); if (m.check()) @@ -402,14 +402,14 @@ bool InstalledUnpackagedRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const { auto repo(_imp->params.environment()->fetch_repository(id->repository_name())); - std::string f(repo->format_key() ? repo->format_key()->value() : ""); + std::string f(repo->format_key() ? repo->format_key()->parse_value() : ""); return f == "unpackaged"; } bool InstalledUnpackagedRepository::is_default_destination() const { - return _imp->params.environment()->preferred_root_key()->value() == installed_root_key()->value(); + return _imp->params.environment()->preferred_root_key()->parse_value() == installed_root_key()->parse_value(); } bool diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc index 81a58549e..72c5e2a7c 100644 --- a/paludis/repositories/unpackaged/installed_repository_TEST.cc +++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc @@ -68,22 +68,22 @@ namespace void visit(const ContentsFileEntry & f) { - s << "file<" << f.location_key()->value() << ">"; + s << "file<" << f.location_key()->parse_value() << ">"; } void visit(const ContentsDirEntry & f) { - s << "dir<" << f.location_key()->value() << ">"; + s << "dir<" << f.location_key()->parse_value() << ">"; } void visit(const ContentsSymEntry & f) { - s << "sym<" << f.location_key()->value() << "=" << f.target_key()->value() << ">"; + s << "sym<" << f.location_key()->parse_value() << "=" << f.target_key()->parse_value() << ">"; } void visit(const ContentsOtherEntry & f) { - s << "other<" << f.location_key()->value() << ">"; + s << "other<" << f.location_key()->parse_value() << ">"; } }; @@ -133,16 +133,16 @@ TEST(InstalledRepository, Metadata) &env, { }), make_null_shared_ptr(), { }))]->begin()); EXPECT_EQ(id1->version(), VersionSpec("1", { })); - EXPECT_EQ(SlotName("0"), id1->slot_key()->value()); + EXPECT_EQ(SlotName("0"), id1->slot_key()->parse_value()); EXPECT_EQ(QualifiedPackageName("cat-one/foo"), id1->name()); EXPECT_EQ(RepositoryName("installed-unpackaged"), id1->repository_name()); EXPECT_TRUE(bool(id1->fs_location_key())); - EXPECT_EQ(id1->fs_location_key()->value(), FSPath::cwd() / "installed_repository_TEST_dir/repo1/data/giant-space-weasel/1:0:foo/"); + EXPECT_EQ(id1->fs_location_key()->parse_value(), FSPath::cwd() / "installed_repository_TEST_dir/repo1/data/giant-space-weasel/1:0:foo/"); EXPECT_TRUE(bool(id1->contents_key())); ContentsDumper d1; - std::for_each(indirect_iterator(id1->contents_key()->value()->begin()), - indirect_iterator(id1->contents_key()->value()->end()), accept_visitor(d1)); + auto contents1(id1->contents_key()->parse_value()); + std::for_each(indirect_iterator(contents1->begin()), indirect_iterator(contents1->end()), accept_visitor(d1)); EXPECT_EQ("dir</fnord>", d1.s.str()); const std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne( @@ -150,16 +150,16 @@ TEST(InstalledRepository, Metadata) &env, { }), make_null_shared_ptr(), { }))]->begin()); EXPECT_EQ(id2->version(), VersionSpec("2", { })); - EXPECT_EQ(SlotName("1"), id2->slot_key()->value()); + EXPECT_EQ(SlotName("1"), id2->slot_key()->parse_value()); EXPECT_EQ(QualifiedPackageName("cat-one/foo"), id2->name()); EXPECT_EQ(RepositoryName("installed-unpackaged"), id2->repository_name()); EXPECT_TRUE(bool(id2->fs_location_key())); - EXPECT_EQ(id2->fs_location_key()->value(), FSPath::cwd() / "installed_repository_TEST_dir/repo1/data/giant-space-weasel/2:1:bar/"); + EXPECT_EQ(id2->fs_location_key()->parse_value(), FSPath::cwd() / "installed_repository_TEST_dir/repo1/data/giant-space-weasel/2:1:bar/"); EXPECT_TRUE(bool(id2->contents_key())); ContentsDumper d2; - std::for_each(indirect_iterator(id2->contents_key()->value()->begin()), - indirect_iterator(id2->contents_key()->value()->end()), accept_visitor(d2)); + auto contents2(id2->contents_key()->parse_value()); + std::for_each(indirect_iterator(contents2->begin()), indirect_iterator(contents2->end()), accept_visitor(d2)); EXPECT_EQ("dir</stilton>file</stilton/cheese>file</stilton/is delicious>", d2.s.str()); } diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc index 940b2f890..8bb4284b7 100644 --- a/paludis/repositories/unpackaged/unpackaged_id.cc +++ b/paludis/repositories/unpackaged/unpackaged_id.cc @@ -157,18 +157,18 @@ UnpackagedID::canonical_form(const PackageIDCanonicalForm f) const { case idcf_full: return stringify(_imp->name) + "-" + stringify(_imp->version) + ":" + - stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name); + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name); case idcf_version: return stringify(_imp->version); case idcf_no_version: - return stringify(_imp->name) + ":" + stringify(slot_key()->value()) + "::" + + return stringify(_imp->name) + ":" + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name); case idcf_no_name: return stringify(_imp->version) + ":" + - stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name); + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name); case last_idcf: break; @@ -181,7 +181,7 @@ PackageDepSpec UnpackagedID::uniquely_identifying_spec() const { return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + - (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository_name()), + (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()), _imp->env, { }); } @@ -347,7 +347,7 @@ namespace const PackageID * const b) { if (a->slot_key()) - return b->slot_key() && a->slot_key()->value() == b->slot_key()->value(); + return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value(); else return ! b->slot_key(); } @@ -390,7 +390,7 @@ UnpackagedID::perform_action(Action & action) const std::string libdir("lib"); FSPath root(install_action->options.destination()->installed_root_key() ? - stringify(install_action->options.destination()->installed_root_key()->value()) : "/"); + stringify(install_action->options.destination()->installed_root_key()->parse_value()) : "/"); if ((root / "usr" / "lib").stat().is_symlink()) { libdir = (root / "usr" / "lib").readlink(); @@ -400,10 +400,9 @@ UnpackagedID::perform_action(Action & action) const Log::get_instance()->message("unpackaged.libdir", ll_debug, lc_context) << "Using '" << libdir << "' for libdir"; - std::shared_ptr<const ChoiceValue> symbols_choice(choices_key()->value()->find_by_name_with_prefix( - ELikeSymbolsChoiceValue::canonical_name_with_prefix())); - std::shared_ptr<const ChoiceValue> preserve_work_choice(choices_key()->value()->find_by_name_with_prefix( - ELikePreserveWorkChoiceValue::canonical_name_with_prefix())); + auto choices(choices_key()->parse_value()); + auto symbols_choice(choices->find_by_name_with_prefix(ELikeSymbolsChoiceValue::canonical_name_with_prefix())); + auto preserve_work_choice(choices->find_by_name_with_prefix(ELikePreserveWorkChoiceValue::canonical_name_with_prefix())); std::string used_config_protect; @@ -414,8 +413,8 @@ UnpackagedID::perform_action(Action & action) const UnpackagedStripper stripper(make_named_values<UnpackagedStripperOptions>( n::compress_splits() = symbols_choice && symbols_choice->enabled() && ELikeSymbolsChoiceValue::should_compress( symbols_choice->parameter()), - n::debug_dir() = fs_location_key()->value() / "usr" / libdir / "debug", - n::image_dir() = fs_location_key()->value(), + n::debug_dir() = fs_location_key()->parse_value() / "usr" / libdir / "debug", + n::image_dir() = fs_location_key()->parse_value(), n::output_manager() = output_manager, n::package_id() = shared_from_this(), n::split() = symbols_choice && symbols_choice->enabled() && ELikeSymbolsChoiceValue::should_split(symbols_choice->parameter()), @@ -444,7 +443,7 @@ UnpackagedID::perform_action(Action & action) const n::build_start_time() = build_start_time, n::check() = true, n::environment_file() = FSPath("/dev/null"), - n::image_dir() = fs_location_key()->value(), + n::image_dir() = fs_location_key()->parse_value(), n::merged_entries() = std::make_shared<FSPathSet>(), n::options() = (MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs) | extra_merger_options, @@ -526,13 +525,13 @@ UnpackagedID::breaks_portage() const bool UnpackagedID::arbitrary_less_than_comparison(const PackageID & other) const { - return slot_key()->value().value() < (other.slot_key() ? stringify(other.slot_key()->value()) : ""); + return slot_key()->parse_value().value() < (other.slot_key() ? stringify(other.slot_key()->parse_value()) : ""); } std::size_t UnpackagedID::extra_hash_value() const { - return Hash<SlotName>()(slot_key()->value()); + return Hash<SlotName>()(slot_key()->parse_value()); } const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > > diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc index 31842b65f..024d6d4a1 100644 --- a/paludis/repositories/unpackaged/unpackaged_key.cc +++ b/paludis/repositories/unpackaged/unpackaged_key.cc @@ -72,7 +72,7 @@ UnpackagedDependencyKey::~UnpackagedDependencyKey() } const std::shared_ptr<const DependencySpecTree> -UnpackagedDependencyKey::value() const +UnpackagedDependencyKey::parse_value() const { return _imp->value; } @@ -148,7 +148,7 @@ UnpackagedChoicesKey::~UnpackagedChoicesKey() } const std::shared_ptr<const Choices> -UnpackagedChoicesKey::value() const +UnpackagedChoicesKey::parse_value() const { Lock lock(_imp->mutex); if (! _imp->value) @@ -166,14 +166,14 @@ UnpackagedChoicesKey::value() const Tribool strip(indeterminate); if (_imp->id->strip_key()) - strip = _imp->id->strip_key()->value(); + strip = _imp->id->strip_key()->parse_value(); build_options->add(std::make_shared<ELikeSymbolsChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options, strip.is_true() ? escvp_strip : strip.is_false() ? escvp_preserve : last_escvp)); Tribool preserve_work(indeterminate); if (_imp->id->preserve_work_key()) - preserve_work = _imp->id->preserve_work_key()->value(); + preserve_work = _imp->id->preserve_work_key()->parse_value(); build_options->add(std::make_shared<ELikePreserveWorkChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options, preserve_work)); diff --git a/paludis/repositories/unpackaged/unpackaged_key.hh b/paludis/repositories/unpackaged/unpackaged_key.hh index 2eedd90cd..5abade20c 100644 --- a/paludis/repositories/unpackaged/unpackaged_key.hh +++ b/paludis/repositories/unpackaged/unpackaged_key.hh @@ -42,7 +42,7 @@ namespace paludis const std::string & v); ~UnpackagedDependencyKey(); - const std::shared_ptr<const DependencySpecTree> value() const; + const std::shared_ptr<const DependencySpecTree> parse_value() const; virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const PALUDIS_ATTRIBUTE((warn_unused_result)); @@ -68,7 +68,7 @@ namespace paludis const UnpackagedID * const id); ~UnpackagedChoicesKey(); - virtual const std::shared_ptr<const Choices> value() const; + virtual const std::shared_ptr<const Choices> parse_value() const; virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc index 86d09db83..78ad9b62b 100644 --- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc +++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc @@ -116,11 +116,11 @@ TEST(UnpackagedRepository, Metadata) *env[selection::RequireExactlyOne(generator::All())]->begin()); EXPECT_EQ(id->version(), VersionSpec("1.0", { })); - EXPECT_EQ(SlotName("foo"), id->slot_key()->value()); + EXPECT_EQ(SlotName("foo"), id->slot_key()->parse_value()); EXPECT_EQ(QualifiedPackageName("cat/pkg"), id->name()); EXPECT_EQ(RepositoryName("unpackaged"), id->repository_name()); ASSERT_TRUE(bool(id->fs_location_key())); - EXPECT_EQ(FSPath("unpackaged_repository_TEST_dir/pkg"), id->fs_location_key()->value()); + EXPECT_EQ(FSPath("unpackaged_repository_TEST_dir/pkg"), id->fs_location_key()->parse_value()); } TEST(UnpackagedRepository, Masks) diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc index 470705d75..e6d8bbfb4 100644 --- a/paludis/repositories/unwritten/unwritten_id.cc +++ b/paludis/repositories/unwritten/unwritten_id.cc @@ -128,10 +128,10 @@ UnwrittenID::canonical_form(const PackageIDCanonicalForm f) const { case idcf_full: return stringify(_imp->name) + "-" + stringify(_imp->version) + - ":" + stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name); + ":" + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name); case idcf_no_version: - return stringify(_imp->name) + ":" + stringify(slot_key()->value()) + + return stringify(_imp->name) + ":" + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name); case idcf_version: @@ -139,7 +139,7 @@ UnwrittenID::canonical_form(const PackageIDCanonicalForm f) const case idcf_no_name: return stringify(_imp->version) + - ":" + stringify(slot_key()->value()) + "::" + stringify(_imp->repository_name); + ":" + stringify(slot_key()->parse_value()) + "::" + stringify(_imp->repository_name); case last_idcf: break; @@ -152,7 +152,7 @@ PackageDepSpec UnwrittenID::uniquely_identifying_spec() const { return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + - (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository_name()), + (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()), _imp->env, { }); } @@ -195,13 +195,13 @@ UnwrittenID::breaks_portage() const bool UnwrittenID::arbitrary_less_than_comparison(const PackageID & other) const { - return slot_key()->value().value() < (other.slot_key() ? stringify(other.slot_key()->value()) : ""); + return slot_key()->parse_value().value() < (other.slot_key() ? stringify(other.slot_key()->parse_value()) : ""); } std::size_t UnwrittenID::extra_hash_value() const { - return Hash<SlotName>()(slot_key()->value()); + return Hash<SlotName>()(slot_key()->parse_value()); } const std::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > diff --git a/paludis/repositories/unwritten/unwritten_repository_TEST.cc b/paludis/repositories/unwritten/unwritten_repository_TEST.cc index 019ed700b..3de8479a4 100644 --- a/paludis/repositories/unwritten/unwritten_repository_TEST.cc +++ b/paludis/repositories/unwritten/unwritten_repository_TEST.cc @@ -46,7 +46,7 @@ namespace { std::string visit(const PackageID & id) { - return id.short_description_key()->value(); + return id.short_description_key()->parse_value(); } } diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc index 33ecfae85..51b51a31a 100644 --- a/paludis/repositories/unwritten/unwritten_repository_file.cc +++ b/paludis/repositories/unwritten/unwritten_repository_file.cc @@ -134,7 +134,7 @@ namespace { } - const std::shared_ptr<const SimpleURISpecTree> value() const + const std::shared_ptr<const SimpleURISpecTree> parse_value() const { return vv; } @@ -159,7 +159,7 @@ namespace const PrettyPrintOptions &) const { UnwrittenHomepagePrettyPrinter p(pretty_printer); - value()->top()->accept(p); + parse_value()->top()->accept(p); return p.s.str(); } }; diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc index 88ee2a538..8aeb5811e 100644 --- a/paludis/repositories/virtuals/installed_virtuals_repository.cc +++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc @@ -355,7 +355,7 @@ bool InstalledVirtualsRepository::is_suitable_destination_for(const std::shared_ptr<const PackageID> & id) const { auto repo(_imp->env->fetch_repository(id->repository_name())); - std::string f(repo->format_key() ? repo->format_key()->value() : ""); + std::string f(repo->format_key() ? repo->format_key()->parse_value() : ""); return f == "virtuals"; } diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc index f90a77995..419c7bf94 100644 --- a/paludis/repositories/virtuals/package_id.cc +++ b/paludis/repositories/virtuals/package_id.cc @@ -75,7 +75,7 @@ namespace paludis MutablePackageDepSpecData({ }) .require_package(v->name()) .require_version(vrc_and, vo_equal, v->version()) - .require_exact_slot(v->slot_key() ? v->slot_key()->value() : SlotName("UNKNOWN"), false) + .require_exact_slot(v->slot_key() ? v->slot_key()->parse_value() : SlotName("UNKNOWN"), false) .require_in_repository(v->repository_name())) : std::make_shared<PackageDepSpec>( @@ -104,7 +104,7 @@ VirtualsDepKey::~VirtualsDepKey() } const std::shared_ptr<const DependencySpecTree> -VirtualsDepKey::value() const +VirtualsDepKey::parse_value() const { return _imp->value; } @@ -217,18 +217,18 @@ VirtualsPackageID::canonical_form(const PackageIDCanonicalForm f) const { case idcf_full: return stringify(_imp->name) + "-" + stringify(_imp->version) + "::" + stringify(_imp->repository_name) + - " (virtual for " + stringify(*_imp->virtual_for->value()) + ")"; + " (virtual for " + stringify(*_imp->virtual_for->parse_value()) + ")"; case idcf_no_version: return stringify(_imp->name) + "::" + stringify(_imp->repository_name) + - " (virtual for " + _imp->virtual_for->value()->canonical_form(idcf_no_version) + ")"; + " (virtual for " + _imp->virtual_for->parse_value()->canonical_form(idcf_no_version) + ")"; case idcf_version: - return stringify(_imp->version) + " (for " + stringify(_imp->virtual_for->value()->canonical_form(idcf_no_version)) + ")"; + return stringify(_imp->version) + " (for " + stringify(_imp->virtual_for->parse_value()->canonical_form(idcf_no_version)) + ")"; case idcf_no_name: return stringify(_imp->version) + "::" + stringify(_imp->repository_name) + - " (virtual for " + stringify(*_imp->virtual_for->value()) + ")"; + " (virtual for " + stringify(*_imp->virtual_for->parse_value()) + ")"; case last_idcf: break; @@ -241,10 +241,10 @@ PackageDepSpec VirtualsPackageID::uniquely_identifying_spec() const { /* hack: ensure the slot key's loaded, so that stringify returns the full form */ - _imp->virtual_for->value()->slot_key(); + _imp->virtual_for->parse_value()->slot_key(); return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) + - (slot_key() ? ":" + stringify(slot_key()->value()) : "") + "::" + stringify(repository_name()) + - "[." + _imp->virtual_for->raw_name() + "=" + stringify(*_imp->virtual_for->value()) + "]", + (slot_key() ? ":" + stringify(slot_key()->parse_value()) : "") + "::" + stringify(repository_name()) + + "[." + _imp->virtual_for->raw_name() + "=" + stringify(*_imp->virtual_for->parse_value()) + "]", _imp->env, { }); } @@ -360,14 +360,14 @@ bool VirtualsPackageID::arbitrary_less_than_comparison(const PackageID & a) const { if (a.virtual_for_key()) - return PackageIDSetComparator()(_imp->virtual_for->value(), a.virtual_for_key()->value()); + return PackageIDSetComparator()(_imp->virtual_for->parse_value(), a.virtual_for_key()->parse_value()); return false; } std::size_t VirtualsPackageID::extra_hash_value() const { - return Hash<PackageID>()(*_imp->virtual_for->value()); + return Hash<PackageID>()(*_imp->virtual_for->parse_value()); } void @@ -493,8 +493,8 @@ VirtualsPackageID::need_masks_added() const if (_imp->has_masks) return; - if (_imp->virtual_for->value()->masked()) - add_mask(std::make_shared<VirtualsAssociationMask>(_imp->virtual_for->value()->uniquely_identifying_spec())); + if (_imp->virtual_for->parse_value()->masked()) + add_mask(std::make_shared<VirtualsAssociationMask>(_imp->virtual_for->parse_value()->uniquely_identifying_spec())); _imp->has_masks = true; } @@ -526,7 +526,7 @@ VirtualsPackageID::fs_location_key() const const std::shared_ptr<const MetadataValueKey<SlotName> > VirtualsPackageID::slot_key() const { - return _imp->virtual_for->value()->slot_key(); + return _imp->virtual_for->parse_value()->slot_key(); } const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh index 3c179158d..ca54e941b 100644 --- a/paludis/repositories/virtuals/package_id.hh +++ b/paludis/repositories/virtuals/package_id.hh @@ -41,7 +41,7 @@ namespace paludis const bool); ~VirtualsDepKey(); - virtual const std::shared_ptr<const DependencySpecTree> value() const + virtual const std::shared_ptr<const DependencySpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)); virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am index 9f19ca853..db3a1a5ce 100644 --- a/paludis/resolver/Makefile.am +++ b/paludis/resolver/Makefile.am @@ -61,6 +61,7 @@ noinst_HEADERS = \ get_initial_constraints_for_helper.hh get_initial_constraints_for_helper-fwd.hh \ get_resolvents_for_helper.hh get_resolvents_for_helper-fwd.hh \ get_use_existing_nothing_helper.hh get_use_existing_nothing_helper-fwd.hh \ + has_behaviour.hh has_behaviour-fwd.hh \ interest_in_spec_helper.hh interest_in_spec_helper-fwd.hh \ job.hh job-fwd.hh \ job_list.hh job_list-fwd.hh \ @@ -134,6 +135,7 @@ libpaludisresolver_a_SOURCES = \ get_initial_constraints_for_helper.cc \ get_resolvents_for_helper.cc \ get_use_existing_nothing_helper.cc \ + has_behaviour.cc \ interest_in_spec_helper.cc \ job.cc \ job_list.cc \ diff --git a/paludis/resolver/collect_depped_upon.cc b/paludis/resolver/collect_depped_upon.cc index 3d97cdc2b..04a558072 100644 --- a/paludis/resolver/collect_depped_upon.cc +++ b/paludis/resolver/collect_depped_upon.cc @@ -121,7 +121,7 @@ namespace MutablePackageDepSpecData part_spec(*s.spec()->data()); part_spec .unrequire_exact_slot() - .require_exact_slot(best_eventual_id->slot_key()->value(), false); + .require_exact_slot(best_eventual_id->slot_key()->parse_value(), false); spec = std::make_shared<PackageDepSpec>(part_spec); } } @@ -184,17 +184,17 @@ paludis::resolver::dependent_upon( { DependentChecker<ChangeByResolventSequence> c(env, id, going_away, staying, not_changing_slots); if (id->dependencies_key()) - id->dependencies_key()->value()->top()->accept(c); + id->dependencies_key()->parse_value()->top()->accept(c); else { if (id->build_dependencies_key()) - id->build_dependencies_key()->value()->top()->accept(c); + id->build_dependencies_key()->parse_value()->top()->accept(c); if (id->run_dependencies_key()) - id->run_dependencies_key()->value()->top()->accept(c); + id->run_dependencies_key()->parse_value()->top()->accept(c); if (id->post_dependencies_key()) - id->post_dependencies_key()->value()->top()->accept(c); + id->post_dependencies_key()->parse_value()->top()->accept(c); if (id->suggested_dependencies_key()) - id->suggested_dependencies_key()->value()->top()->accept(c); + id->suggested_dependencies_key()->parse_value()->top()->accept(c); } return c.result; @@ -209,17 +209,17 @@ paludis::resolver::collect_depped_upon( { DependentChecker<PackageIDSequence> c(env, id, candidates, std::make_shared<PackageIDSequence>(), not_changing_slots); if (id->dependencies_key()) - id->dependencies_key()->value()->top()->accept(c); + id->dependencies_key()->parse_value()->top()->accept(c); else { if (id->build_dependencies_key()) - id->build_dependencies_key()->value()->top()->accept(c); + id->build_dependencies_key()->parse_value()->top()->accept(c); if (id->run_dependencies_key()) - id->run_dependencies_key()->value()->top()->accept(c); + id->run_dependencies_key()->parse_value()->top()->accept(c); if (id->post_dependencies_key()) - id->post_dependencies_key()->value()->top()->accept(c); + id->post_dependencies_key()->parse_value()->top()->accept(c); if (id->suggested_dependencies_key()) - id->suggested_dependencies_key()->value()->top()->accept(c); + id->suggested_dependencies_key()->parse_value()->top()->accept(c); } const std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>()); @@ -245,17 +245,17 @@ paludis::resolver::collect_dependents( std::make_shared<PackageIDSequence>(), std::make_shared<PackageIDSequence>()); if ((*i)->dependencies_key()) - (*i)->dependencies_key()->value()->top()->accept(c); + (*i)->dependencies_key()->parse_value()->top()->accept(c); else { if ((*i)->build_dependencies_key()) - (*i)->build_dependencies_key()->value()->top()->accept(c); + (*i)->build_dependencies_key()->parse_value()->top()->accept(c); if ((*i)->run_dependencies_key()) - (*i)->run_dependencies_key()->value()->top()->accept(c); + (*i)->run_dependencies_key()->parse_value()->top()->accept(c); if ((*i)->post_dependencies_key()) - (*i)->post_dependencies_key()->value()->top()->accept(c); + (*i)->post_dependencies_key()->parse_value()->top()->accept(c); if ((*i)->suggested_dependencies_key()) - (*i)->suggested_dependencies_key()->value()->top()->accept(c); + (*i)->suggested_dependencies_key()->parse_value()->top()->accept(c); } if (! c.result->empty()) diff --git a/paludis/resolver/collect_installed.cc b/paludis/resolver/collect_installed.cc index 2b94800a4..ffcaccf9f 100644 --- a/paludis/resolver/collect_installed.cc +++ b/paludis/resolver/collect_installed.cc @@ -39,7 +39,7 @@ paludis::resolver::collect_installed( Context context("When collecting installed packages:"); const std::shared_ptr<const PackageIDSequence> q((*env)[selection::AllVersionsUnsorted( - generator::All() | filter::InstalledAtRoot(env->system_root_key()->value()))]); + generator::All() | filter::InstalledAtRoot(env->system_root_key()->parse_value()))]); const std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>()); std::copy(q->begin(), q->end(), result->inserter()); diff --git a/paludis/resolver/collect_provided.cc b/paludis/resolver/collect_provided.cc index a9c741efe..d4a7ea2f4 100644 --- a/paludis/resolver/collect_provided.cc +++ b/paludis/resolver/collect_provided.cc @@ -47,7 +47,7 @@ paludis::resolver::collect_provided( if (id->provide_key()) { DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(env, id); - id->provide_key()->value()->top()->accept(f); + id->provide_key()->parse_value()->top()->accept(f); for (DepSpecFlattener<ProvideSpecTree, PackageDepSpec>::ConstIterator v(f.begin()), v_end(f.end()) ; v != v_end ; ++v) diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc index 3d5148157..c70a248ce 100644 --- a/paludis/resolver/decider.cc +++ b/paludis/resolver/decider.cc @@ -40,6 +40,7 @@ #include <paludis/resolver/same_slot.hh> #include <paludis/resolver/reason_utils.hh> #include <paludis/resolver/make_uninstall_blocker.hh> +#include <paludis/resolver/has_behaviour-fwd.hh> #include <paludis/util/exception.hh> #include <paludis/util/stringify.hh> @@ -403,7 +404,7 @@ Decider::_collect_staying(const std::shared_ptr<const ChangeByResolventSequence> Context context("When collecting staying packages:"); const std::shared_ptr<const PackageIDSequence> existing((*_imp->env)[selection::AllVersionsUnsorted( - generator::All() | filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); + generator::All() | filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]); const std::shared_ptr<PackageIDSequence> result(std::make_shared<PackageIDSequence>()); for (PackageIDSequence::ConstIterator x(existing->begin()), x_end(existing->end()) ; @@ -1389,7 +1390,7 @@ Decider::find_any_score( const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly( generator::Matches(spec, our_id, { }) | - filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); + filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]); if (! installed_ids->empty() ^ is_block) return std::make_pair(acs_already_installed, operator_bias); } @@ -1421,7 +1422,7 @@ Decider::find_any_score( const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly( generator::Matches(spec, our_id, { }) | - filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); + filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]); if (! installed_ids->empty()) return std::make_pair(acs_blocks_installed, operator_bias); } @@ -1515,7 +1516,7 @@ Decider::_get_error_resolvents_for( if (! ids->empty()) resolvent.slot() = make_named_values<SlotNameOrNull>( n::name_or_null() = (*ids->rbegin())->slot_key() ? - make_shared_copy((*ids->rbegin())->slot_key()->value()) : + make_shared_copy((*ids->rbegin())->slot_key()->parse_value()) : make_null_shared_ptr(), n::null_means_unknown() = true ); @@ -1574,8 +1575,7 @@ Decider::_try_to_find_decision_for( else if (existing_id && ! installable_id) { /* there's nothing installable. this may or may not be ok. */ - bool is_transient(existing_id->behaviours_key() && existing_id->behaviours_key()->value()->end() != - existing_id->behaviours_key()->value()->find("transient")); + bool is_transient(has_behaviour(existing_id, "transient")); switch (resolution->constraints()->strictest_use_existing()) { @@ -1633,11 +1633,16 @@ Decider::_try_to_find_decision_for( is_same = true; std::set<ChoiceNameWithPrefix> common; + std::shared_ptr<const Choices> installable_choices; + std::shared_ptr<const Choices> existing_choices; + if (existing_id->choices_key() && installable_id->choices_key()) { + installable_choices = installable_id->choices_key()->parse_value(); + existing_choices = existing_id->choices_key()->parse_value(); + std::set<ChoiceNameWithPrefix> i_common, u_common; - for (Choices::ConstIterator k(installable_id->choices_key()->value()->begin()), - k_end(installable_id->choices_key()->value()->end()) ; + for (Choices::ConstIterator k(installable_choices->begin()), k_end(installable_choices->end()) ; k != k_end ; ++k) { if (! (*k)->consider_added_or_changed()) @@ -1649,8 +1654,7 @@ Decider::_try_to_find_decision_for( i_common.insert((*i)->name_with_prefix()); } - for (Choices::ConstIterator k(existing_id->choices_key()->value()->begin()), - k_end(existing_id->choices_key()->value()->end()) ; + for (Choices::ConstIterator k(existing_choices->begin()), k_end(existing_choices->end()) ; k != k_end ; ++k) { if (! (*k)->consider_added_or_changed()) @@ -1670,16 +1674,15 @@ Decider::_try_to_find_decision_for( for (std::set<ChoiceNameWithPrefix>::const_iterator f(common.begin()), f_end(common.end()) ; f != f_end ; ++f) - if (installable_id->choices_key()->value()->find_by_name_with_prefix(*f)->enabled() != - existing_id->choices_key()->value()->find_by_name_with_prefix(*f)->enabled()) + if (installable_choices->find_by_name_with_prefix(*f)->enabled() != + existing_choices->find_by_name_with_prefix(*f)->enabled()) { is_same = false; break; } } - bool is_transient(existing_id->behaviours_key() && existing_id->behaviours_key()->value()->end() != - existing_id->behaviours_key()->value()->find("transient")); + bool is_transient(has_behaviour(existing_id, "transient")); /* we've got existing and installable. do we have any reason not to pick the existing id? */ const std::shared_ptr<Decision> existing(std::make_shared<ExistingNoChangeDecision>( @@ -1971,8 +1974,7 @@ Decider::_get_unmatching_constraints( if (existing) { - bool is_transient(id->behaviours_key() && id->behaviours_key()->value()->end() != - id->behaviours_key()->value()->find("transient")); + bool is_transient(has_behaviour(id, "transient")); decision = std::make_shared<ExistingNoChangeDecision>( resolution->resolvent(), id, @@ -2072,9 +2074,7 @@ Decider::purge() { _imp->env->trigger_notifier_callback(NotifierCallbackResolverStepEvent()); - if (((*i)->behaviours_key() && (*i)->behaviours_key()->value()->end() != - (*i)->behaviours_key()->value()->find("used")) || - (! (*i)->supports_action(SupportsActionTest<UninstallAction>()))) + if (has_behaviour(*i, "used") || ! (*i)->supports_action(SupportsActionTest<UninstallAction>())) continue; Resolvent resolvent(*i, dt_install_to_slash); @@ -2140,7 +2140,7 @@ Decider::_package_dep_spec_already_met(const PackageDepSpec & spec, const std::s const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::AllVersionsUnsorted( generator::Matches(spec, from_id, { }) | - filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); + filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]); if (installed_ids->empty()) return false; else @@ -2162,7 +2162,7 @@ Decider::_block_dep_spec_already_met(const BlockDepSpec & spec, const std::share const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::SomeArbitraryVersion( generator::Matches(spec.blocking(), from_id, { }) | make_slot_filter(resolvent) | - filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); + filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]); return installed_ids->empty(); } @@ -2341,8 +2341,7 @@ Decider::_resolve_purges() { _imp->env->trigger_notifier_callback(NotifierCallbackResolverStepEvent()); - if (((*i)->behaviours_key() && (*i)->behaviours_key()->value()->end() != - (*i)->behaviours_key()->value()->find("used")) || + if (has_behaviour(*i, "used") || (! (*i)->supports_action(SupportsActionTest<UninstallAction>()))) continue; diff --git a/paludis/resolver/destination_utils.cc b/paludis/resolver/destination_utils.cc index 85f78a838..0e42da8e6 100644 --- a/paludis/resolver/destination_utils.cc +++ b/paludis/resolver/destination_utils.cc @@ -38,7 +38,8 @@ paludis::resolver::can_make_binary_for(const std::shared_ptr<const PackageID> & { if (! id->behaviours_key()) return true; - return id->behaviours_key()->value()->end() == id->behaviours_key()->value()->find("unbinaryable"); + auto v(id->behaviours_key()->parse_value()); + return v->end() == v->find("unbinaryable"); } bool @@ -46,7 +47,8 @@ paludis::resolver::is_already_binary(const std::shared_ptr<const PackageID> & id { if (! id->behaviours_key()) return false; - return id->behaviours_key()->value()->end() != id->behaviours_key()->value()->find("binary"); + auto v(id->behaviours_key()->parse_value()); + return v->end() != v->find("binary"); } bool @@ -54,7 +56,8 @@ paludis::resolver::can_chroot(const std::shared_ptr<const PackageID> & id) { if (! id->behaviours_key()) return true; - return id->behaviours_key()->value()->end() == id->behaviours_key()->value()->find("unchrootable"); + auto v(id->behaviours_key()->parse_value()); + return v->end() == v->find("unchrootable"); } namespace @@ -102,10 +105,10 @@ paludis::resolver::destination_filtered_generator( switch (t) { case dt_install_to_slash: - return g | filter::InstalledAtRoot(env->system_root_key()->value()); + return g | filter::InstalledAtRoot(env->system_root_key()->parse_value()); case dt_install_to_chroot: - return g | filter::InstalledNotAtRoot(env->system_root_key()->value()); + return g | filter::InstalledNotAtRoot(env->system_root_key()->parse_value()); case dt_create_binary: return g & BinaryDestinationGenerator(); diff --git a/paludis/resolver/find_replacing_helper.cc b/paludis/resolver/find_replacing_helper.cc index 79aeedb83..d9c77000c 100644 --- a/paludis/resolver/find_replacing_helper.cc +++ b/paludis/resolver/find_replacing_helper.cc @@ -80,7 +80,7 @@ FindReplacingHelper::operator() ( for (auto r(_imp->env->begin_repositories()), r_end(_imp->env->end_repositories()) ; r != r_end ; ++r) if ((*r)->installed_root_key() && - (*r)->installed_root_key()->value() == repo->installed_root_key()->value()) + (*r)->installed_root_key()->parse_value() == repo->installed_root_key()->parse_value()) repos.insert((*r)->name()); } else diff --git a/paludis/resolver/find_repository_for_helper.cc b/paludis/resolver/find_repository_for_helper.cc index 1951b0e49..67f560b9d 100644 --- a/paludis/resolver/find_repository_for_helper.cc +++ b/paludis/resolver/find_repository_for_helper.cc @@ -62,7 +62,7 @@ namespace { bool is_fake(const std::shared_ptr<const Repository> & repo) { - return repo->format_key() && repo->format_key()->value() == "installed_fake"; + return repo->format_key() && repo->format_key()->parse_value() == "installed_fake"; } } @@ -79,12 +79,12 @@ FindRepositoryForHelper::operator() ( switch (resolution->resolvent().destination_type()) { case dt_install_to_slash: - if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() != _imp->env->system_root_key()->value())) + if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->parse_value() != _imp->env->system_root_key()->parse_value())) continue; break; case dt_install_to_chroot: - if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() == _imp->env->system_root_key()->value())) + if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->parse_value() == _imp->env->system_root_key()->parse_value())) continue; break; diff --git a/paludis/resolver/get_constraints_for_dependent_helper.cc b/paludis/resolver/get_constraints_for_dependent_helper.cc index ea12ac55f..cf3b441fe 100644 --- a/paludis/resolver/get_constraints_for_dependent_helper.cc +++ b/paludis/resolver/get_constraints_for_dependent_helper.cc @@ -86,7 +86,7 @@ GetConstraintsForDependentHelper::operator() ( MutablePackageDepSpecData partial_spec({ }); partial_spec.require_package(id->name()); if (id->slot_key()) - partial_spec.require_exact_slot(id->slot_key()->value(), false); + partial_spec.require_exact_slot(id->slot_key()->parse_value(), false); spec = std::make_shared<PackageDepSpec>(partial_spec); } diff --git a/paludis/resolver/get_constraints_for_purge_helper.cc b/paludis/resolver/get_constraints_for_purge_helper.cc index 1234ce9cd..af0bb9374 100644 --- a/paludis/resolver/get_constraints_for_purge_helper.cc +++ b/paludis/resolver/get_constraints_for_purge_helper.cc @@ -81,7 +81,7 @@ GetConstraintsForPurgeHelper::operator() ( MutablePackageDepSpecData partial_spec({ }); partial_spec.require_package(id->name()); if (id->slot_key()) - partial_spec.require_exact_slot(id->slot_key()->value(), false); + partial_spec.require_exact_slot(id->slot_key()->parse_value(), false); PackageDepSpec spec(partial_spec); const std::shared_ptr<WasUsedByReason> reason(std::make_shared<WasUsedByReason>(was_used_by_ids)); diff --git a/paludis/resolver/get_initial_constraints_for_helper.cc b/paludis/resolver/get_initial_constraints_for_helper.cc index ef1fa0c27..1360a1ebe 100644 --- a/paludis/resolver/get_initial_constraints_for_helper.cc +++ b/paludis/resolver/get_initial_constraints_for_helper.cc @@ -184,7 +184,7 @@ namespace static Timestamp current_time(Timestamp::now()); /* static to avoid weirdness */ time_t installed_time(current_time.seconds()); if (id->installed_time_key()) - installed_time = id->installed_time_key()->value().seconds(); + installed_time = id->installed_time_key()->parse_value().seconds(); return (current_time.seconds() - installed_time) > (24 * 60 * 60 * n); } diff --git a/paludis/resolver/get_resolvents_for_helper.cc b/paludis/resolver/get_resolvents_for_helper.cc index 2288b92f2..c11bc87c5 100644 --- a/paludis/resolver/get_resolvents_for_helper.cc +++ b/paludis/resolver/get_resolvents_for_helper.cc @@ -285,8 +285,8 @@ GetResolventsForHelper::operator() ( auto installed_ids((*_imp->env)[selection::BestVersionInEachSlot( generator::Matches(spec, from_id, { }) | (_imp->target_destination_type == dt_install_to_chroot ? - Filter(filter::InstalledNotAtRoot(_imp->env->system_root_key()->value())) : - Filter(filter::InstalledAtRoot(_imp->env->system_root_key()->value()))))]); + Filter(filter::InstalledNotAtRoot(_imp->env->system_root_key()->parse_value())) : + Filter(filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))))]); auto target(is_target(reason)); auto want_installed(target ? _imp->want_installed_slots_for_targets : _imp->want_installed_slots_otherwise); diff --git a/paludis/resolver/has_behaviour-fwd.hh b/paludis/resolver/has_behaviour-fwd.hh new file mode 100644 index 000000000..abfcb7f99 --- /dev/null +++ b/paludis/resolver/has_behaviour-fwd.hh @@ -0,0 +1,35 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_HAS_BEHAVIOUR_FWD_HH +#define PALUDIS_GUARD_PALUDIS_RESOLVER_HAS_BEHAVIOUR_FWD_HH 1 + +#include <paludis/package_id-fwd.hh> + +namespace paludis +{ + namespace resolver + { + bool has_behaviour( + const std::shared_ptr<const PackageID> &, + const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result)); + } +} + +#endif diff --git a/paludis/resolver/has_behaviour.cc b/paludis/resolver/has_behaviour.cc new file mode 100644 index 000000000..f7ebc0d1e --- /dev/null +++ b/paludis/resolver/has_behaviour.cc @@ -0,0 +1,39 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/resolver/has_behaviour.hh> + +#include <paludis/package_id.hh> +#include <paludis/metadata_key.hh> + +using namespace paludis; +using namespace paludis::resolver; + +bool +paludis::resolver::has_behaviour( + const std::shared_ptr<const PackageID> & id, + const std::string & b) +{ + if (! id->behaviours_key()) + return false; + + auto behaviours(id->behaviours_key()->parse_value()); + return behaviours->end() != behaviours->find(b); +} + diff --git a/paludis/resolver/has_behaviour.hh b/paludis/resolver/has_behaviour.hh new file mode 100644 index 000000000..a0cf0d7e9 --- /dev/null +++ b/paludis/resolver/has_behaviour.hh @@ -0,0 +1,25 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2011 Ciaran McCreesh + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_HAS_BEHAVIOUR_HH +#define PALUDIS_GUARD_PALUDIS_RESOLVER_HAS_BEHAVIOUR_HH 1 + +#include <paludis/resolver/has_behaviour-fwd.hh> + +#endif diff --git a/paludis/resolver/interest_in_spec_helper.cc b/paludis/resolver/interest_in_spec_helper.cc index ab0436c93..fc56b3713 100644 --- a/paludis/resolver/interest_in_spec_helper.cc +++ b/paludis/resolver/interest_in_spec_helper.cc @@ -206,7 +206,7 @@ namespace const std::shared_ptr<const PackageIDSequence> installed_ids( (*env)[selection::SomeArbitraryVersion( generator::Matches(*dep.spec().if_package(), dep.from_id(), { }) | - filter::InstalledAtRoot(env->system_root_key()->value()))]); + filter::InstalledAtRoot(env->system_root_key()->parse_value()))]); if (installed_ids->empty()) return false; } @@ -344,7 +344,7 @@ InterestInSpecHelper::operator() ( const std::shared_ptr<const PackageIDSequence> installed_ids( (*_imp->env)[selection::SomeArbitraryVersion( generator::Matches(*dep.spec().if_package(), dep.from_id(), { }) | - filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); + filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))]); if (! installed_ids->empty()) return si_take; } diff --git a/paludis/resolver/resolvent.cc b/paludis/resolver/resolvent.cc index 758264818..1b0617405 100644 --- a/paludis/resolver/resolvent.cc +++ b/paludis/resolver/resolvent.cc @@ -132,7 +132,7 @@ Resolvent::Resolvent( package(id->name()), slot(make_named_values<SlotNameOrNull>( n::name_or_null() = id->slot_key() ? - std::make_shared<SlotName>(id->slot_key()->value()) : + std::make_shared<SlotName>(id->slot_key()->parse_value()) : make_null_shared_ptr(), n::null_means_unknown() = false )) diff --git a/paludis/resolver/same_slot.cc b/paludis/resolver/same_slot.cc index 7cd9bcfd5..ee80d9f98 100644 --- a/paludis/resolver/same_slot.cc +++ b/paludis/resolver/same_slot.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010 Ciaran McCreesh + * Copyright (c) 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -32,7 +32,7 @@ paludis::resolver::same_slot( const std::shared_ptr<const PackageID> & b) { if (a->slot_key()) - return b->slot_key() && a->slot_key()->value() == b->slot_key()->value(); + return b->slot_key() && a->slot_key()->parse_value() == b->slot_key()->parse_value(); else return ! b->slot_key(); } diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc index c24a151b1..e0e682e61 100644 --- a/paludis/resolver/sanitised_dependencies.cc +++ b/paludis/resolver/sanitised_dependencies.cc @@ -491,7 +491,7 @@ SanitisedDependencies::_populate_one( Finder f(env, decider, resolution, id, changed, *this, ((*id).*pmf)()->initial_labels(), ((*id).*pmf)()->raw_name(), ((*id).*pmf)()->human_name(), ""); - ((*id).*pmf)()->value()->top()->accept(f); + ((*id).*pmf)()->parse_value()->top()->accept(f); } void diff --git a/paludis/resolver/spec_rewriter.cc b/paludis/resolver/spec_rewriter.cc index a6c637e7f..1e0f1af4b 100644 --- a/paludis/resolver/spec_rewriter.cc +++ b/paludis/resolver/spec_rewriter.cc @@ -173,7 +173,7 @@ SpecRewriter::_need_rewrites() const if (! ((*i)->virtual_for_key())) throw InternalError(PALUDIS_HERE, "huh? " + stringify(**i) + " has no virtual_for_key"); _imp->rewrites.insert(std::make_pair((*i)->name(), std::set<QualifiedPackageName>())).first->second.insert( - (*i)->virtual_for_key()->value()->name()); + (*i)->virtual_for_key()->parse_value()->name()); } #endif } diff --git a/paludis/selection.cc b/paludis/selection.cc index 30f97fca6..a39681f6b 100644 --- a/paludis/selection.cc +++ b/paludis/selection.cc @@ -102,7 +102,7 @@ namespace std::string slot_as_string(const std::shared_ptr<const PackageID> & id) { if (id->slot_key()) - return stringify(id->slot_key()->value()); + return stringify(id->slot_key()->parse_value()); else return "(none)"; } diff --git a/paludis/set_file.cc b/paludis/set_file.cc index ec866953b..4fa3db573 100644 --- a/paludis/set_file.cc +++ b/paludis/set_file.cc @@ -258,7 +258,7 @@ namespace << "Line '" << line << "' uses ? operator but no environment is available"; else if (! (*params.environment())[selection::SomeArbitraryVersion( generator::Package(spec->package_name_requirement()->name()) | - filter::InstalledAtRoot(params.environment()->preferred_root_key()->value()))]->empty()) + filter::InstalledAtRoot(params.environment()->preferred_root_key()->parse_value()))]->empty()) result->top()->append(spec); } else @@ -282,7 +282,7 @@ namespace << "Line '" << line << "' uses ?: operator but no environment is available"; else if (! (*params.environment())[selection::SomeArbitraryVersion(generator::Matches( name_and_slot(*spec), make_null_shared_ptr(), { }) | - filter::InstalledAtRoot(params.environment()->preferred_root_key()->value()))]->empty()) + filter::InstalledAtRoot(params.environment()->preferred_root_key()->parse_value()))]->empty()) result->top()->append(spec); } else @@ -541,7 +541,7 @@ PaludisBashHandler::PaludisBashHandler(const SetFileParams & p) : std::stringstream s; Process process(ProcessCommand({ "bash", stringify(_p.file_name()) })); process - .setenv("ROOT", _p.environment() ? stringify(_p.environment()->preferred_root_key()->value()) : "/") + .setenv("ROOT", _p.environment() ? stringify(_p.environment()->preferred_root_key()->parse_value()) : "/") .setenv("SET", stringify(_p.file_name())) .setenv("SET_LOG_LEVEL", stringify(Log::get_instance()->log_level())) .setenv("PALUDIS_EBUILD_DIR", getenv_with_default(env_vars::ebuild_dir, LIBEXECDIR "/paludis")) diff --git a/paludis/unchoices_key.cc b/paludis/unchoices_key.cc index 61d6e8dcd..ceca78f73 100644 --- a/paludis/unchoices_key.cc +++ b/paludis/unchoices_key.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2009, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -53,7 +53,7 @@ namespace { } - const std::shared_ptr<const Choices> value() const + const std::shared_ptr<const Choices> parse_value() const { return _value; } diff --git a/paludis/unmerger.cc b/paludis/unmerger.cc index 7b48e3873..e94bb4bf1 100644 --- a/paludis/unmerger.cc +++ b/paludis/unmerger.cc @@ -70,7 +70,7 @@ Unmerger::~Unmerger() void Unmerger::add_unmerge_entry(const EntryType et, const std::shared_ptr<const ContentsEntry> & e) { - _imp->unmerge_entries.insert(std::make_pair(stringify(e->location_key()->value()), std::make_pair(et, e))); + _imp->unmerge_entries.insert(std::make_pair(stringify(e->location_key()->parse_value()), std::make_pair(et, e))); } void @@ -123,7 +123,7 @@ Unmerger::unmerge() void Unmerger::unmerge_file(const std::shared_ptr<const ContentsEntry> & e) const { - FSPath f_real(_imp->options.root() / e->location_key()->value()); + FSPath f_real(_imp->options.root() / e->location_key()->parse_value()); HookResult hr(_imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_file_override") @@ -132,19 +132,19 @@ Unmerger::unmerge_file(const std::shared_ptr<const ContentsEntry> & e) const _imp->options.maybe_output_manager())); if (hr.max_exit_status() != 0) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); else if (hr.output() == "skip") - display("--- [skip ] " + stringify(e->location_key()->value())); + display("--- [skip ] " + stringify(e->location_key()->parse_value())); else if (hr.output() == "force") { - display("<<< [force] " + stringify(e->location_key()->value())); + display("<<< [force] " + stringify(e->location_key()->parse_value())); unlink_file(f_real, e); } else if (_imp->options.ignore()(FSPath(stringify(f_real)))) - display("--- [ignor] " + stringify(e->location_key()->value())); + display("--- [ignor] " + stringify(e->location_key()->parse_value())); else if (check_file(e)) { - display("<<< " + stringify(e->location_key()->value())); + display("<<< " + stringify(e->location_key()->parse_value())); unlink_file(f_real, e); } } @@ -152,7 +152,7 @@ Unmerger::unmerge_file(const std::shared_ptr<const ContentsEntry> & e) const void Unmerger::unmerge_sym(const std::shared_ptr<const ContentsEntry> & e) const { - FSPath f_real(_imp->options.root() / e->location_key()->value()); + FSPath f_real(_imp->options.root() / e->location_key()->parse_value()); HookResult hr(_imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_sym_override") @@ -161,19 +161,19 @@ Unmerger::unmerge_sym(const std::shared_ptr<const ContentsEntry> & e) const _imp->options.maybe_output_manager())); if (hr.max_exit_status() != 0) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); else if (hr.output() == "skip") - display("--- [skip ] " + stringify(e->location_key()->value())); + display("--- [skip ] " + stringify(e->location_key()->parse_value())); else if (hr.output() == "force") { - display("<<< [force] " + stringify(e->location_key()->value())); + display("<<< [force] " + stringify(e->location_key()->parse_value())); unlink_sym(f_real, e); } else if (_imp->options.ignore()(FSPath(stringify(f_real)))) - display("--- [ignor] " + stringify(e->location_key()->value())); + display("--- [ignor] " + stringify(e->location_key()->parse_value())); else if (check_sym(e)) { - display("<<< " + stringify(e->location_key()->value())); + display("<<< " + stringify(e->location_key()->parse_value())); unlink_sym(f_real, e); } } @@ -181,7 +181,7 @@ Unmerger::unmerge_sym(const std::shared_ptr<const ContentsEntry> & e) const void Unmerger::unmerge_dir(const std::shared_ptr<const ContentsEntry> & e) const { - FSPath f_real(_imp->options.root() / e->location_key()->value()); + FSPath f_real(_imp->options.root() / e->location_key()->parse_value()); HookResult hr(_imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_dir_override") @@ -190,14 +190,14 @@ Unmerger::unmerge_dir(const std::shared_ptr<const ContentsEntry> & e) const _imp->options.maybe_output_manager())); if (hr.max_exit_status() != 0) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); else if (hr.output() == "skip") - display("--- [skip ] " + stringify(e->location_key()->value())); + display("--- [skip ] " + stringify(e->location_key()->parse_value())); else if (_imp->options.ignore()(FSPath(stringify(f_real)))) - display("--- [ignor] " + stringify(e->location_key()->value())); + display("--- [ignor] " + stringify(e->location_key()->parse_value())); else if (check_dir(e)) { - display("<<< " + stringify(e->location_key()->value())); + display("<<< " + stringify(e->location_key()->parse_value())); unlink_dir(f_real, e); } } @@ -205,7 +205,7 @@ Unmerger::unmerge_dir(const std::shared_ptr<const ContentsEntry> & e) const void Unmerger::unmerge_misc(const std::shared_ptr<const ContentsEntry> & e) const { - FSPath f_real(_imp->options.root() / e->location_key()->value()); + FSPath f_real(_imp->options.root() / e->location_key()->parse_value()); HookResult hr(_imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_misc_override") @@ -214,19 +214,19 @@ Unmerger::unmerge_misc(const std::shared_ptr<const ContentsEntry> & e) const _imp->options.maybe_output_manager())); if (hr.max_exit_status() != 0) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); else if (hr.output() == "skip") - display("--- [skip ] " + stringify(e->location_key()->value())); + display("--- [skip ] " + stringify(e->location_key()->parse_value())); else if (hr.output() == "force") { - display("<<< [force] " + stringify(e->location_key()->value())); + display("<<< [force] " + stringify(e->location_key()->parse_value())); unlink_misc(f_real, e); } else if (_imp->options.ignore()(FSPath(stringify(f_real)))) - display("--- [ignor] " + stringify(e->location_key()->value())); + display("--- [ignor] " + stringify(e->location_key()->parse_value())); else if (check_misc(e)) { - display("<<< " + stringify(e->location_key()->value())); + display("<<< " + stringify(e->location_key()->parse_value())); unlink_misc(f_real, e); } } @@ -236,9 +236,9 @@ Unmerger::unlink_file(FSPath f, const std::shared_ptr<const ContentsEntry> & e) { if (0 != _imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_file_pre") - ("UNLINK_TARGET", stringify(e->location_key()->value()))), + ("UNLINK_TARGET", stringify(e->location_key()->parse_value()))), _imp->options.maybe_output_manager()).max_exit_status()) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); FSStat f_stat(f); if (f_stat.is_regular_file()) @@ -255,9 +255,9 @@ Unmerger::unlink_file(FSPath f, const std::shared_ptr<const ContentsEntry> & e) if (0 != _imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_file_post") - ("UNLINK_TARGET", stringify(e->location_key()->value()))), + ("UNLINK_TARGET", stringify(e->location_key()->parse_value()))), _imp->options.maybe_output_manager()).max_exit_status()) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); } void @@ -265,17 +265,17 @@ Unmerger::unlink_sym(FSPath f, const std::shared_ptr<const ContentsEntry> & e) c { if (0 != _imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_sym_pre") - ("UNLINK_TARGET", stringify(e->location_key()->value()))), + ("UNLINK_TARGET", stringify(e->location_key()->parse_value()))), _imp->options.maybe_output_manager()).max_exit_status()) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); f.unlink(); if (0 != _imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_sym_post") - ("UNLINK_TARGET", stringify(e->location_key()->value()))), + ("UNLINK_TARGET", stringify(e->location_key()->parse_value()))), _imp->options.maybe_output_manager()).max_exit_status()) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); } void @@ -283,17 +283,17 @@ Unmerger::unlink_dir(FSPath f, const std::shared_ptr<const ContentsEntry> & e) c { if (0 != _imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_dir_pre") - ("UNLINK_TARGET", stringify(e->location_key()->value()))), + ("UNLINK_TARGET", stringify(e->location_key()->parse_value()))), _imp->options.maybe_output_manager()).max_exit_status()) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); f.rmdir(); if (0 != _imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_dir_post") - ("UNLINK_TARGET", stringify(e->location_key()->value()))), + ("UNLINK_TARGET", stringify(e->location_key()->parse_value()))), _imp->options.maybe_output_manager()).max_exit_status()) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); } void @@ -301,17 +301,17 @@ Unmerger::unlink_misc(FSPath f, const std::shared_ptr<const ContentsEntry> & e) { if (0 != _imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_misc_pre") - ("UNLINK_TARGET", stringify(e->location_key()->value()))), + ("UNLINK_TARGET", stringify(e->location_key()->parse_value()))), _imp->options.maybe_output_manager()).max_exit_status()) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); f.unlink(); if (0 != _imp->options.environment()->perform_hook(extend_hook( Hook("unmerger_unlink_misc_post") - ("UNLINK_TARGET", stringify(e->location_key()->value()))), + ("UNLINK_TARGET", stringify(e->location_key()->parse_value()))), _imp->options.maybe_output_manager()).max_exit_status()) - throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook"); + throw UnmergerError("Unmerge of '" + stringify(e->location_key()->parse_value()) + "' aborted by hook"); } Hook diff --git a/python/additional_tests.cc b/python/additional_tests.cc index 68e08bf0b..6f906dac5 100644 --- a/python/additional_tests.cc +++ b/python/additional_tests.cc @@ -138,13 +138,13 @@ namespace metadata_key void test_metadata_package_id_key(const MetadataValueKey<std::shared_ptr<const PackageID> > & m) { test_metadata_key(m); - m.value(); + m.parse_value(); } void test_metadata_string_key(const MetadataValueKey<std::string> & m) { test_metadata_key(m); - m.value(); + m.parse_value(); } void test_metadata_section_key(const MetadataSectionKey & m) @@ -157,40 +157,40 @@ namespace metadata_key void test_metadata_time_key(const MetadataTimeKey & m) { test_metadata_key(m); - Timestamp PALUDIS_ATTRIBUTE((unused)) t(m.value()); + Timestamp PALUDIS_ATTRIBUTE((unused)) t(m.parse_value()); } void test_metadata_contents_key(const MetadataValueKey<std::shared_ptr<const Contents> > & m) { test_metadata_key(m); - m.value(); + m.parse_value(); } void test_metadata_choices_key(const MetadataValueKey<std::shared_ptr<const Choices> > & m) { test_metadata_key(m); - m.value(); + m.parse_value(); } template <typename C_> void test_metadata_set_key(const MetadataCollectionKey<C_> & m) { test_metadata_key(m); - m.value(); + m.parse_value(); } template <typename C_> void test_metadata_spec_tree_key(const MetadataSpecTreeKey<C_> & m) { test_metadata_key(m); - m.value(); + m.parse_value(); } template <> void test_metadata_spec_tree_key(const MetadataSpecTreeKey<FetchableURISpecTree> & m) { test_metadata_key(m); - m.value(); + m.parse_value(); m.initial_label(); } } diff --git a/python/choices_TEST.py b/python/choices_TEST.py index ad69d1f64..7e9f9476f 100644 --- a/python/choices_TEST.py +++ b/python/choices_TEST.py @@ -33,7 +33,7 @@ class TestCase_01_Choices(unittest.TestCase): def setUp(self): self.e = NoConfigEnvironment(repo_path, "/var/empty") self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next() - self.choices = self.pid.find_metadata("PALUDIS_CHOICES").value() + self.choices = self.pid.find_metadata("PALUDIS_CHOICES").parse_value() def test_01_choices(self): self.assert_(isinstance(self.choices, Choices), self.choices.__class__) @@ -59,7 +59,7 @@ class TestCase_02_Choice(unittest.TestCase): def setUp(self): self.e = NoConfigEnvironment(repo_path, "/var/empty") self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next() - self.choices = self.pid.find_metadata("PALUDIS_CHOICES").value() + self.choices = self.pid.find_metadata("PALUDIS_CHOICES").parse_value() self.use = None self.linguas = None for f in self.choices: @@ -108,7 +108,7 @@ class TestCase_03_ChoiceValue(unittest.TestCase): def setUp(self): self.e = NoConfigEnvironment(repo_path, "/var/empty") self.pid = iter(self.e.fetch_repository("testrepo").package_ids("foo/bar", [])).next() - self.choices = self.pid.find_metadata("PALUDIS_CHOICES").value() + self.choices = self.pid.find_metadata("PALUDIS_CHOICES").parse_value() self.use_testflag = self.choices.find_by_name_with_prefix("testflag") self.linguas_en = self.choices.find_by_name_with_prefix("linguas_en") diff --git a/python/contents_TEST.py b/python/contents_TEST.py index 6cadb9b3d..3e2c49bfb 100755 --- a/python/contents_TEST.py +++ b/python/contents_TEST.py @@ -29,26 +29,26 @@ class TestCase_Contents(unittest.TestCase): e = ContentsFileEntry("/foo") self.assert_(isinstance(e, ContentsEntry)) - self.assertEquals(e.location_key().value(), "/foo") + self.assertEquals(e.location_key().parse_value(), "/foo") def test_03_dir_entry(self): e = ContentsDirEntry("/foo") self.assert_(isinstance(e, ContentsEntry)) - self.assertEquals(e.location_key().value(), "/foo") + self.assertEquals(e.location_key().parse_value(), "/foo") def test_04_other_entry(self): e = ContentsOtherEntry("/foo") self.assert_(isinstance(e, ContentsEntry)) - self.assertEquals(e.location_key().value(), "/foo") + self.assertEquals(e.location_key().parse_value(), "/foo") def test_07_sym_entry(self): e = ContentsSymEntry("/foo", "/blah") self.assert_(isinstance(e, ContentsEntry)) - self.assertEquals(e.location_key().value(), "/foo") - self.assertEquals(e.target_key().value(), "/blah") + self.assertEquals(e.location_key().parse_value(), "/foo") + self.assertEquals(e.target_key().parse_value(), "/blah") def test_08_contents(self): entries = [] @@ -62,10 +62,10 @@ class TestCase_Contents(unittest.TestCase): c.add(entry) for (i, entry) in enumerate(c): - self.assertEquals(entry.location_key().value(), entries[i].location_key().value()) + self.assertEquals(entry.location_key().parse_value(), entries[i].location_key().parse_value()) self.assertEquals(type(entry), type(entries[i])) if i==0: - self.assertEquals(entry.target_key().value(), entries[i].target_key().value()) + self.assertEquals(entry.target_key().parse_value(), entries[i].target_key().parse_value()) if i>3: self.assertEquals("TOO MANY ENTRIES", "OK") diff --git a/python/metadata_key.cc b/python/metadata_key.cc index 6d2aa5710..6a2dc0e10 100644 --- a/python/metadata_key.cc +++ b/python/metadata_key.cc @@ -181,15 +181,15 @@ struct MetadataPackageIDKeyWrapper : MetadataValueKey<std::shared_ptr<const PackageID> > , bp::wrapper<MetadataValueKey<std::shared_ptr<const PackageID> > > { - virtual const std::shared_ptr<const PackageID> value() const + virtual const std::shared_ptr<const PackageID> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = get_override("value")) + if (bp::override f = get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataPackageIDKey", "value"); + throw PythonMethodNotImplemented("MetadataPackageIDKey", "parse_value"); } virtual const std::string raw_name() const @@ -234,15 +234,15 @@ struct MetadataStringKeyWrapper : MetadataValueKey<std::string> , bp::wrapper<MetadataValueKey<std::string> > { - virtual const std::string value() const + virtual const std::string parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = get_override("value")) + if (bp::override f = get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataStringKey", "value"); + throw PythonMethodNotImplemented("MetadataStringKey", "parse_value"); } virtual const std::string raw_name() const @@ -280,15 +280,15 @@ struct MetadataSlotNameKeyWrapper : MetadataValueKey<SlotName> , bp::wrapper<MetadataValueKey<SlotName> > { - virtual const SlotName value() const + virtual const SlotName parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = get_override("value")) + if (bp::override f = get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataSlotNameKey", "value"); + throw PythonMethodNotImplemented("MetadataSlotNameKey", "parse_value"); } virtual const std::string raw_name() const @@ -391,15 +391,15 @@ struct MetadataTimeKeyWrapper : MetadataTimeKey, bp::wrapper<MetadataTimeKey> { - virtual Timestamp value() const + virtual Timestamp parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = get_override("value")) + if (bp::override f = get_override("parse_value")) return Timestamp(f(), 0); else - throw PythonMethodNotImplemented("MetadataTimeKey", "value"); + throw PythonMethodNotImplemented("MetadataTimeKey", "parse_value"); } virtual const std::string raw_name() const @@ -437,15 +437,15 @@ struct MetadataContentsKeyWrapper : MetadataValueKey<std::shared_ptr<const Contents> > , bp::wrapper<MetadataValueKey<std::shared_ptr<const Contents> > > { - virtual const std::shared_ptr<const Contents> value() const + virtual const std::shared_ptr<const Contents> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = get_override("value")) + if (bp::override f = get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataContentsKey", "value"); + throw PythonMethodNotImplemented("MetadataContentsKey", "parse_value"); } virtual const std::string raw_name() const @@ -483,15 +483,15 @@ struct MetadataChoicesKeyWrapper : MetadataValueKey<std::shared_ptr<const Choices> > , bp::wrapper<MetadataValueKey<std::shared_ptr<const Choices> > > { - virtual const std::shared_ptr<const Choices> value() const + virtual const std::shared_ptr<const Choices> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = get_override("value")) + if (bp::override f = get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataChoicesKey", "value"); + throw PythonMethodNotImplemented("MetadataChoicesKey", "parse_value"); } virtual const std::string raw_name() const @@ -529,15 +529,15 @@ struct MetadataFSPathKeyWrapper : MetadataValueKey<FSPath> , bp::wrapper<MetadataValueKey<FSPath> > { - virtual const FSPath value() const + virtual const FSPath parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = get_override("value")) + if (bp::override f = get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataValueKey<FSPath> ", "value"); + throw PythonMethodNotImplemented("MetadataValueKey<FSPath> ", "parse_value"); } virtual const std::string raw_name() const @@ -576,15 +576,15 @@ struct MetadataCollectionKeyWrapper : MetadataCollectionKey<C_>, bp::wrapper<MetadataCollectionKey<C_> > { - virtual const std::shared_ptr<const C_> value() const + virtual const std::shared_ptr<const C_> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = this->get_override("value")) + if (bp::override f = this->get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataCollectionKey", "value"); + throw PythonMethodNotImplemented("MetadataCollectionKey", "parse_value"); } virtual const std::string raw_name() const @@ -630,15 +630,15 @@ struct MetadataSpecTreeKeyWrapper : MetadataSpecTreeKey<C_>, bp::wrapper<MetadataSpecTreeKey<C_> > { - virtual const std::shared_ptr<const C_> value() const + virtual const std::shared_ptr<const C_> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = this->get_override("value")) + if (bp::override f = this->get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataSpecTreeKey", "value"); + throw PythonMethodNotImplemented("MetadataSpecTreeKey", "parse_value"); } virtual const std::string raw_name() const @@ -684,15 +684,15 @@ struct MetadataSpecTreeKeyWrapper<FetchableURISpecTree> : MetadataSpecTreeKey<FetchableURISpecTree>, bp::wrapper<MetadataSpecTreeKey<FetchableURISpecTree> > { - virtual const std::shared_ptr<const FetchableURISpecTree> value() const + virtual const std::shared_ptr<const FetchableURISpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = this->get_override("value")) + if (bp::override f = this->get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataSpecTreeKey", "value"); + throw PythonMethodNotImplemented("MetadataSpecTreeKey", "parse_value"); } virtual const std::shared_ptr<const URILabel> initial_label() const @@ -749,15 +749,15 @@ struct MetadataSpecTreeKeyWrapper<DependencySpecTree> : MetadataSpecTreeKey<DependencySpecTree>, bp::wrapper<MetadataSpecTreeKey<DependencySpecTree> > { - virtual const std::shared_ptr<const DependencySpecTree> value() const + virtual const std::shared_ptr<const DependencySpecTree> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); - if (bp::override f = this->get_override("value")) + if (bp::override f = this->get_override("parse_value")) return f(); else - throw PythonMethodNotImplemented("MetadataSpecTreeKey", "value"); + throw PythonMethodNotImplemented("MetadataSpecTreeKey", "parse_value"); } virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const @@ -831,8 +831,8 @@ struct class_set_key : bp::implicitly_convertible<std::shared_ptr<MetadataCollectionKeyWrapper<C_> >, std::shared_ptr<MetadataKey> >(); - def("value", bp::pure_virtual(&MetadataCollectionKey<C_>::value), - ("value() -> " + set + "\n" + def("parse_value", bp::pure_virtual(&MetadataCollectionKey<C_>::parse_value), + ("parse_value() -> " + set + "\n" "Fetch our value.").c_str() ); } @@ -860,8 +860,8 @@ struct class_spec_tree_key : bp::implicitly_convertible<std::shared_ptr<MetadataSpecTreeKeyWrapper<C_> >, std::shared_ptr<MetadataKey> >(); - def("value", bp::pure_virtual(&MetadataSpecTreeKey<C_>::value), - ("value() -> " + spec_tree + "\n" + def("parse_value", bp::pure_virtual(&MetadataSpecTreeKey<C_>::parse_value), + ("parse_value() -> " + spec_tree + "\n" "Fetch our value").c_str() ); } @@ -891,8 +891,8 @@ struct class_spec_tree_key<FetchableURISpecTree> : bp::implicitly_convertible<std::shared_ptr<MetadataSpecTreeKeyWrapper<FetchableURISpecTree> >, std::shared_ptr<MetadataKey> >(); - def("value", bp::pure_virtual(&MetadataSpecTreeKey<FetchableURISpecTree>::value), - ("value() -> " + spec_tree + "\n" + def("parse_value", bp::pure_virtual(&MetadataSpecTreeKey<FetchableURISpecTree>::parse_value), + ("parse_value() -> " + spec_tree + "\n" "Fetch our value").c_str() ); @@ -928,8 +928,8 @@ struct class_spec_tree_key<DependencySpecTree> : bp::implicitly_convertible<std::shared_ptr<MetadataSpecTreeKeyWrapper<DependencySpecTree> >, std::shared_ptr<MetadataKey> >(); - def("value", bp::pure_virtual(&MetadataSpecTreeKey<DependencySpecTree>::value), - ("value() -> " + spec_tree + "\n" + def("parse_value", bp::pure_virtual(&MetadataSpecTreeKey<DependencySpecTree>::parse_value), + ("parse_value() -> " + spec_tree + "\n" "Fetch our value").c_str() ); @@ -1012,8 +1012,8 @@ void expose_metadata_key() "__init__()" ) ) - .def("value", bp::pure_virtual(&MetadataValueKey<std::shared_ptr<const PackageID> > ::value), - "value() -> PackageID\n" + .def("parse_value", bp::pure_virtual(&MetadataValueKey<std::shared_ptr<const PackageID> > ::parse_value), + "parse_value() -> PackageID\n" "Fetch our value." ) ; @@ -1036,8 +1036,8 @@ void expose_metadata_key() "__init__()" ) ) - .def("value", bp::pure_virtual(&MetadataValueKey<std::string> ::value), - "value() -> string\n" + .def("parse_value", bp::pure_virtual(&MetadataValueKey<std::string> ::parse_value), + "parse_value() -> string\n" "Fetch our value." ) ; @@ -1060,8 +1060,8 @@ void expose_metadata_key() "__init__()" ) ) - .def("value", bp::pure_virtual(&MetadataValueKey<SlotName> ::value), - "value() -> SlotName\n" + .def("parse_value", bp::pure_virtual(&MetadataValueKey<SlotName> ::parse_value), + "parse_value() -> SlotName\n" "Fetch our value." ) ; @@ -1112,8 +1112,8 @@ void expose_metadata_key() "__init__()" ) ) - .def("value", bp::pure_virtual(&MetadataTimeKey::value), - "value() -> int\n" + .def("parse_value", bp::pure_virtual(&MetadataTimeKey::parse_value), + "parse_value() -> int\n" "Fetch our value." ) ; @@ -1135,8 +1135,8 @@ void expose_metadata_key() "__init__()" ) ) - .def("value", bp::pure_virtual(&MetadataValueKey<FSPath> ::value), - "value() -> FSPath\n" + .def("parse_value", bp::pure_virtual(&MetadataValueKey<FSPath> ::parse_value), + "parse_value() -> FSPath\n" "Fetch our value." ) ; @@ -1158,8 +1158,8 @@ void expose_metadata_key() "__init__()" ) ) - .def("value", bp::pure_virtual(&MetadataValueKey<std::shared_ptr<const Contents> > ::value), - "value() -> Contents\n" + .def("parse_value", bp::pure_virtual(&MetadataValueKey<std::shared_ptr<const Contents> > ::parse_value), + "parse_value() -> Contents\n" "Fetch our value." ) @@ -1199,8 +1199,8 @@ void expose_metadata_key() "__init__()" ) ) - .def("value", bp::pure_virtual(&MetadataValueKey<std::shared_ptr<const Choices> > ::value), - "value() -> Choices\n" + .def("parse_value", bp::pure_virtual(&MetadataValueKey<std::shared_ptr<const Choices> > ::parse_value), + "parse_value() -> Choices\n" "Fetch our value." ) diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py index b428a3081..f5fbbb60a 100755 --- a/python/metadata_key_TEST.py +++ b/python/metadata_key_TEST.py @@ -71,7 +71,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataPackageIDKey.__init__(self) - def value(self): + def parse_value(self): e = NoConfigEnvironment(repo_path, "/var/empty") pid = iter(e.fetch_repository("testrepo").package_ids("foo/bar", [])).next() return pid @@ -92,7 +92,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataStringKey.__init__(self) - def value(self): + def parse_value(self): return "str" def raw_name(self): @@ -111,7 +111,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataTimeKey.__init__(self) - def value(self): + def parse_value(self): return 123 def raw_name(self): @@ -131,7 +131,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataContentsKey.__init__(self) - def value(self): + def parse_value(self): return Contents() def raw_name(self): @@ -150,7 +150,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataKeywordNameIterableKey.__init__(self) - def value(self): + def parse_value(self): return ["keyword"] def pretty_print_flat(self, f): @@ -173,7 +173,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataStringIterableKey.__init__(self) - def value(self): + def parse_value(self): return ["string"] def pretty_print_flat(self, f): @@ -195,7 +195,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataLicenseSpecTreeKey.__init__(self) - def value(self): + def parse_value(self): return AllDepSpec() def pretty_print(self, f): @@ -225,7 +225,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): MetadataProvideSpecTreeKey.__init__(self) self.e = NoConfigEnvironment(repo_path, "/var/empty") - def value(self): + def parse_value(self): return AllDepSpec() def pretty_print(self, f): @@ -253,7 +253,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): self.e = NoConfigEnvironment(repo_path, "/var/empty") MetadataDependencySpecTreeKey.__init__(self) - def value(self): + def parse_value(self): return AllDepSpec() def pretty_print(self, f): @@ -281,7 +281,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataPlainTextSpecTreeKey.__init__(self) - def value(self): + def parse_value(self): return AllDepSpec() def pretty_print(self, f): @@ -310,7 +310,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataFetchableURISpecTreeKey.__init__(self) - def value(self): + def parse_value(self): return AllDepSpec() def pretty_print(self, f): @@ -342,7 +342,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataSimpleURISpecTreeKey.__init__(self) - def value(self): + def parse_value(self): return AllDepSpec() def pretty_print(self, f): @@ -393,7 +393,7 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): def __init__(self): MetadataChoicesKey.__init__(self) - def value(self): + def parse_value(self): return Choices() def raw_name(self): diff --git a/python/package_id_TEST.py b/python/package_id_TEST.py index 4982b5ee3..d274c9e22 100755 --- a/python/package_id_TEST.py +++ b/python/package_id_TEST.py @@ -50,8 +50,8 @@ class TestCase_01_PackageID(unittest.TestCase): self.assertEquals(self.ipid.version, VersionSpec("1")) def test_04_slot(self): - self.assertEquals(str(self.ipid.slot_key().value()), "test_slot") - self.assertEquals(str(self.pid.slot_key().value()), "0") + self.assertEquals(str(self.ipid.slot_key().parse_value()), "test_slot") + self.assertEquals(str(self.pid.slot_key().parse_value()), "0") def test_05_repository(self): self.assertEquals(str(self.pid.repository_name), "testrepo") @@ -59,8 +59,8 @@ class TestCase_01_PackageID(unittest.TestCase): def test_07_canonical_form(self): # Load the metadata - self.pid.slot_key().value - self.ipid.slot_key().value + self.pid.slot_key().parse_value + self.ipid.slot_key().parse_value self.assertEquals(self.pid.canonical_form(PackageIDCanonicalForm.FULL), "foo/bar-1.0:0::testrepo") self.assertEquals(self.pid.canonical_form(PackageIDCanonicalForm.VERSION), "1.0") @@ -74,8 +74,8 @@ class TestCase_01_PackageID(unittest.TestCase): def test_08_str(self): # Load the metadata - self.pid.slot_key().value - self.ipid.slot_key().value + self.pid.slot_key().parse_value + self.ipid.slot_key().parse_value self.assertEquals(str(self.pid), "foo/bar-1.0:0::testrepo") self.assertEquals(str(self.ipid), "cat-one/pkg-one-1:test_slot::installed") @@ -108,7 +108,7 @@ class TestCase_01_PackageID(unittest.TestCase): def test_14_virtual_for_key(self): if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes": - self.assertEquals(self.vpid.virtual_for_key().value(), self.pid) + self.assertEquals(self.vpid.virtual_for_key().parse_value(), self.pid) self.assertEquals(self.pid.virtual_for_key(), None) self.assertEquals(self.ipid.virtual_for_key(), None) @@ -149,8 +149,8 @@ class TestCase_01_PackageID(unittest.TestCase): self.assertEquals(self.ipid.homepage_key(), None) def test_24_short_description_key(self): - self.assertEquals(self.pid.short_description_key().value(), "Test package") - self.assertEquals(self.ipid.short_description_key().value(), "a description") + self.assertEquals(self.pid.short_description_key().parse_value(), "Test package") + self.assertEquals(self.ipid.short_description_key().parse_value(), "a description") def test_25_long_description_key(self): self.assertEquals(self.pid.long_description_key(), None) @@ -166,14 +166,14 @@ class TestCase_01_PackageID(unittest.TestCase): def test_28_from_repositories_key(self): self.assertEquals(self.pid.from_repositories_key(), None) - self.assertEquals(iter(self.ipid.from_repositories_key().value()).next(), "origin_test") + self.assertEquals(iter(self.ipid.from_repositories_key().parse_value()).next(), "origin_test") def test_30_fs_location_key(self): self.assert_(isinstance(self.ipid.fs_location_key(), MetadataFSPathKey)) self.assert_(isinstance(self.ipid.fs_location_key(), MetadataFSPathKey)) def test_31_choices_key(self): - self.assert_(isinstance(self.pid.choices_key().value(), Choices)) + self.assert_(isinstance(self.pid.choices_key().parse_value(), Choices)) if __name__ == "__main__": diff --git a/python/repository_TEST.py b/python/repository_TEST.py index 7c9ebfc81..85d82b7e1 100755 --- a/python/repository_TEST.py +++ b/python/repository_TEST.py @@ -93,9 +93,9 @@ class TestCase_01_Repository(unittest.TestCase): def test_12_keys(self): self.assert_(repo.location_key()) - self.assertEquals(repo.location_key().value(), repo_path) + self.assertEquals(repo.location_key().parse_value(), repo_path) self.assert_(repo.find_metadata("format")) - self.assertEquals(repo.find_metadata("format").value(), "e") + self.assertEquals(repo.find_metadata("format").parse_value(), "e") self.assert_(not repo.find_metadata("asdf")) class TestCase_02_RepositoryInterfaces(unittest.TestCase): diff --git a/ruby/choice_TEST.rb b/ruby/choice_TEST.rb index 20f9ddfa0..0432b06cc 100644 --- a/ruby/choice_TEST.rb +++ b/ruby/choice_TEST.rb @@ -37,7 +37,7 @@ module Paludis end def choices - pid.choices_key.value + pid.choices_key.parse_value end def use_choice diff --git a/ruby/contents_TEST.rb b/ruby/contents_TEST.rb index d53b5f9fe..926f85d09 100644 --- a/ruby/contents_TEST.rb +++ b/ruby/contents_TEST.rb @@ -59,7 +59,7 @@ module Paludis def test_name ce = get_ce - assert_equal 'test', ce.location_key.value + assert_equal 'test', ce.location_key.parse_value end end @@ -93,7 +93,7 @@ module Paludis def test_name ce = get_ce - assert_equal 'test', ce.location_key.value + assert_equal 'test', ce.location_key.parse_value end end @@ -127,7 +127,7 @@ module Paludis def test_name ce = get_ce - assert_equal 'test', ce.location_key.value + assert_equal 'test', ce.location_key.parse_value end end @@ -170,12 +170,12 @@ module Paludis def test_name ce = get_ce - assert_equal 'test_name', ce.location_key.value + assert_equal 'test_name', ce.location_key.parse_value end def test_target ce = get_ce - assert_equal 'test_target', ce.target_key.value + assert_equal 'test_target', ce.target_key.parse_value end end class TestCase_Contents < Test::Unit::TestCase @@ -216,13 +216,13 @@ module Paludis c.add(cfe) assert_equal 1, c.entries.length - assert_equal cfe.location_key.value, c.entries.first.location_key.value + assert_equal cfe.location_key.parse_value, c.entries.first.location_key.parse_value c.add(cse) assert_equal 2, c.entries.length - assert_equal cfe.location_key.value, c.entries.first.location_key.value - assert_equal cse.location_key.value, c.entries.last.location_key.value + assert_equal cfe.location_key.parse_value, c.entries.first.location_key.parse_value + assert_equal cse.location_key.parse_value, c.entries.last.location_key.parse_value end end diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb index 21fc51956..d8c7f052e 100644 --- a/ruby/dep_spec_TEST.rb +++ b/ruby/dep_spec_TEST.rb @@ -262,7 +262,7 @@ module Paludis end def test_composites - spec = env[Selection::RequireExactlyOne.new(Generator::Package.new("foo/bar"))].last.build_dependencies_key.value + spec = env[Selection::RequireExactlyOne.new(Generator::Package.new("foo/bar"))].last.build_dependencies_key.parse_value assert_kind_of AllDepSpec, spec assert_equal 2, spec.to_a.length @@ -323,7 +323,7 @@ module Paludis end def test_uri_labels_dep_spec - specs = spec_key.value.to_a + specs = spec_key.parse_value.to_a assert_equal 6, specs.length specs.each do | spec | diff --git a/ruby/environment_TEST.rb b/ruby/environment_TEST.rb index fd348ecdc..d69dd8ec8 100644 --- a/ruby/environment_TEST.rb +++ b/ruby/environment_TEST.rb @@ -325,19 +325,19 @@ module Paludis assert_respond_to env, :format_key assert_not_nil env.format_key assert_kind_of MetadataStringKey, env.format_key - assert_equal 'paludis', env.format_key.value + assert_equal 'paludis', env.format_key.parse_value assert_respond_to ncenv, :format_key assert_not_nil ncenv.format_key assert_kind_of MetadataStringKey, ncenv.format_key - assert_equal 'no_config', ncenv.format_key.value + assert_equal 'no_config', ncenv.format_key.parse_value end def test_config_location_key assert_respond_to env, :config_location_key assert_not_nil env.config_location_key assert_kind_of MetadataFSPathKey, env.config_location_key - assert_equal Dir.getwd().to_s + "/environment_TEST_dir/home/.paludis", env.config_location_key.value + assert_equal Dir.getwd().to_s + "/environment_TEST_dir/home/.paludis", env.config_location_key.parse_value assert_respond_to ncenv, :config_location_key assert_nil ncenv.config_location_key diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc index 8c4b707b2..43bfb2032 100644 --- a/ruby/metadata_key.cc +++ b/ruby/metadata_key.cc @@ -259,7 +259,7 @@ namespace /* * call-seq: - * value -> PackageID + * parse_value -> PackageID * * Our Value. * */ @@ -270,7 +270,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - return package_id_to_value((std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const PackageID> > >(*self_ptr))->value()); + return package_id_to_value((std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const PackageID> > >(*self_ptr))->parse_value()); } catch (const std::exception & e) { @@ -280,7 +280,7 @@ namespace /* * call-seq: - * value -> String + * parse_value -> String * * Our Value. * */ @@ -291,7 +291,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - return rb_str_new2((std::static_pointer_cast<const MetadataValueKey<std::string> >(*self_ptr))->value().c_str()); + return rb_str_new2((std::static_pointer_cast<const MetadataValueKey<std::string> >(*self_ptr))->parse_value().c_str()); } catch (const std::exception & e) { @@ -301,7 +301,7 @@ namespace /* * call-seq: - * value -> String + * parse_value -> String * * Our Value. * */ @@ -312,7 +312,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - return rb_str_new2(stringify((std::static_pointer_cast<const MetadataValueKey<SlotName> >(*self_ptr))->value()).c_str()); + return rb_str_new2(stringify((std::static_pointer_cast<const MetadataValueKey<SlotName> >(*self_ptr))->parse_value()).c_str()); } catch (const std::exception & e) { @@ -322,7 +322,7 @@ namespace /* * call-seq: - * value -> Numeric + * parse_value -> Numeric * * Our Value. * */ @@ -333,7 +333,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - return LONG2NUM((std::static_pointer_cast<const MetadataValueKey<long> >(*self_ptr))->value()); + return LONG2NUM((std::static_pointer_cast<const MetadataValueKey<long> >(*self_ptr))->parse_value()); } catch (const std::exception & e) { @@ -343,7 +343,7 @@ namespace /* * call-seq: - * value -> String + * parse_value -> String * * Our Value. * */ @@ -354,7 +354,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - return rb_str_new2(stringify((std::static_pointer_cast<const MetadataValueKey<FSPath> >(*self_ptr))->value()).c_str()); + return rb_str_new2(stringify((std::static_pointer_cast<const MetadataValueKey<FSPath> >(*self_ptr))->parse_value()).c_str()); } catch (const std::exception & e) { @@ -364,7 +364,7 @@ namespace /* * call-seq: - * value -> Time + * parse_value -> Time * * Our Value. * */ @@ -375,7 +375,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - return rb_time_new((std::static_pointer_cast<const MetadataTimeKey>(*self_ptr))->value().seconds(), 0); + return rb_time_new((std::static_pointer_cast<const MetadataTimeKey>(*self_ptr))->parse_value().seconds(), 0); } catch (const std::exception & e) { @@ -385,7 +385,7 @@ namespace /* * call-seq: - * value -> Contents + * parse_value -> Contents * * Our Value. * */ @@ -396,8 +396,8 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - if (std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Contents> > >(*self_ptr)->value()) - return contents_to_value(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Contents> > >(*self_ptr)->value()); + if (std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Contents> > >(*self_ptr)->parse_value()) + return contents_to_value(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Contents> > >(*self_ptr)->parse_value()); return Qnil; } catch (const std::exception & e) @@ -408,7 +408,7 @@ namespace /* * call-seq: - * value -> Choices + * parse_value -> Choices * * Our Value. * */ @@ -419,7 +419,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - return choices_to_value(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Choices> > >(*self_ptr)->value()); + return choices_to_value(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Choices> > >(*self_ptr)->parse_value()); } catch (const std::exception & e) { @@ -429,7 +429,7 @@ namespace /* * call-seq: - * value -> Array + * parse_value -> Array * * Our Value. * */ @@ -443,7 +443,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - std::shared_ptr<const T_> c = std::static_pointer_cast<const MetadataCollectionKey<T_> >(*self_ptr)->value(); + std::shared_ptr<const T_> c = std::static_pointer_cast<const MetadataCollectionKey<T_> >(*self_ptr)->parse_value(); VALUE result (rb_ary_new()); for (typename T_::ConstIterator i(c->begin()), i_end(c->end()) ; i != i_end ; ++i) rb_ary_push(result, rb_str_new2(stringify(*i).c_str())); @@ -458,7 +458,7 @@ namespace /* * call-seq: - * value -> Hash + * parse_value -> Hash * * Our Value. * */ @@ -472,7 +472,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - std::shared_ptr<const T_> c = std::static_pointer_cast<const MetadataCollectionKey<T_> >(*self_ptr)->value(); + std::shared_ptr<const T_> c = std::static_pointer_cast<const MetadataCollectionKey<T_> >(*self_ptr)->parse_value(); VALUE result (rb_hash_new()); for (typename T_::ConstIterator i(c->begin()), i_end(c->end()) ; i != i_end ; ++i) rb_hash_aset(result, rb_str_new2(stringify(i->first).c_str()), rb_str_new2(stringify(i->second).c_str())); @@ -487,7 +487,7 @@ namespace /* * call-seq: - * value -> Array + * parse_value -> Array * * Our Value. * */ @@ -502,7 +502,7 @@ namespace std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); std::shared_ptr<const PackageIDSequence> c = std::static_pointer_cast<const MetadataCollectionKey<PackageIDSequence> >( - *self_ptr)->value(); + *self_ptr)->parse_value(); VALUE result (rb_ary_new()); for (PackageIDSequence::ConstIterator i(c->begin()), i_end(c->end()) ; i != i_end ; ++i) rb_ary_push(result, package_id_to_value(*i)); @@ -517,7 +517,7 @@ namespace /* * call-seq: - * value -> Array + * parse_value -> spec tree * * Our Value. * */ @@ -531,7 +531,7 @@ namespace { std::shared_ptr<const MetadataKey> * self_ptr; Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - std::shared_ptr<const T_> c = std::static_pointer_cast<const MetadataSpecTreeKey<T_> >(*self_ptr)->value(); + std::shared_ptr<const T_> c = std::static_pointer_cast<const MetadataSpecTreeKey<T_> >(*self_ptr)->parse_value(); return dep_tree_to_value<T_>(c); } catch (const std::exception & e) @@ -639,7 +639,7 @@ namespace /* * Document-class: Paludis::MetadataKey * - * Base metadata class, subclasses contain a "value" to return the contents of the key. + * Base metadata class, subclasses contain a "parse_value" to return the contents of the key. */ c_metadata_key = rb_define_class_under(paludis_module(), "MetadataKey", rb_cObject); rb_funcall(c_metadata_key, rb_intern("private_class_method"), 1, rb_str_new2("new")); @@ -653,7 +653,7 @@ namespace * Metadata class for a PackageId. */ c_metadata_package_id_key = rb_define_class_under(paludis_module(), "MetadataPackageIDKey", c_metadata_key); - rb_define_method(c_metadata_package_id_key, "value", RUBY_FUNC_CAST(&metadata_package_id_key_value), 0); + rb_define_method(c_metadata_package_id_key, "parse_value", RUBY_FUNC_CAST(&metadata_package_id_key_value), 0); /* * Document-class: Paludis::MetadataStringKey @@ -661,7 +661,7 @@ namespace * Metadata class for Strings. */ c_metadata_string_key = rb_define_class_under(paludis_module(), "MetadataStringKey", c_metadata_key); - rb_define_method(c_metadata_string_key, "value", RUBY_FUNC_CAST(&metadata_string_key_value), 0); + rb_define_method(c_metadata_string_key, "parse_value", RUBY_FUNC_CAST(&metadata_string_key_value), 0); /* * Document-class: Paludis::MetadataSlotNameKey @@ -669,7 +669,7 @@ namespace * Metadata class for SlotNames. */ c_metadata_slot_key = rb_define_class_under(paludis_module(), "MetadataSlotNameKey", c_metadata_key); - rb_define_method(c_metadata_slot_key, "value", RUBY_FUNC_CAST(&metadata_slot_key_value), 0); + rb_define_method(c_metadata_slot_key, "parse_value", RUBY_FUNC_CAST(&metadata_slot_key_value), 0); /* * Document-class: Paludis::MetadataSizeKey @@ -677,7 +677,7 @@ namespace * Metadata class for file sizes. */ c_metadata_size_key = rb_define_class_under(paludis_module(), "MetadataSizeKey", c_metadata_key); - rb_define_method(c_metadata_size_key, "value", RUBY_FUNC_CAST(&metadata_size_key_value), 0); + rb_define_method(c_metadata_size_key, "parse_value", RUBY_FUNC_CAST(&metadata_size_key_value), 0); /* * Document-class: Paludis::MetadataFSPathKey @@ -685,7 +685,7 @@ namespace * Metadata class for FSPath. */ c_metadata_fsentry_key = rb_define_class_under(paludis_module(), "MetadataFSPathKey", c_metadata_key); - rb_define_method(c_metadata_fsentry_key, "value", RUBY_FUNC_CAST(&metadata_fsentry_key_value), 0); + rb_define_method(c_metadata_fsentry_key, "parse_value", RUBY_FUNC_CAST(&metadata_fsentry_key_value), 0); /* * Document-class: Paludis::MetadataTimeKey @@ -693,7 +693,7 @@ namespace * Metadata class for Time. */ c_metadata_time_key = rb_define_class_under(paludis_module(), "MetadataTimeKey", c_metadata_key); - rb_define_method(c_metadata_time_key, "value", RUBY_FUNC_CAST(&metadata_time_key_value), 0); + rb_define_method(c_metadata_time_key, "parse_value", RUBY_FUNC_CAST(&metadata_time_key_value), 0); /* * Document-class: Paludis::MetadataContentsKey @@ -701,7 +701,7 @@ namespace * Metadata class for Contents. */ c_metadata_contents_key = rb_define_class_under(paludis_module(), "MetadataContentsKey", c_metadata_key); - rb_define_method(c_metadata_contents_key, "value", RUBY_FUNC_CAST(&metadata_contents_key_value), 0); + rb_define_method(c_metadata_contents_key, "parse_value", RUBY_FUNC_CAST(&metadata_contents_key_value), 0); /* * Document-class: Paludis::MetadataChoicesKey @@ -709,7 +709,7 @@ namespace * Metadata class for Contents. */ c_metadata_choices_key = rb_define_class_under(paludis_module(), "MetadataChoicesKey", c_metadata_key); - rb_define_method(c_metadata_choices_key, "value", RUBY_FUNC_CAST(&metadata_choices_key_value), 0); + rb_define_method(c_metadata_choices_key, "parse_value", RUBY_FUNC_CAST(&metadata_choices_key_value), 0); /* * Document-class: Paludis::MetadataKeywordNameSetKey @@ -717,7 +717,7 @@ namespace * Metadata class for keywords. */ c_metadata_keyword_name_set_key = rb_define_class_under(paludis_module(), "MetadataKeywordNameSetKey", c_metadata_key); - rb_define_method(c_metadata_keyword_name_set_key, "value", RUBY_FUNC_CAST((&SetValue<KeywordNameSet>::fetch)), 0); + rb_define_method(c_metadata_keyword_name_set_key, "parse_value", RUBY_FUNC_CAST((&SetValue<KeywordNameSet>::fetch)), 0); /* * Document-class: Paludis::MetadataPackageIDSequenceKey @@ -725,7 +725,7 @@ namespace * Metadata class for package IDs. */ c_metadata_package_id_sequence_key = rb_define_class_under(paludis_module(), "MetadataPackageIDSequenceKey", c_metadata_key); - rb_define_method(c_metadata_package_id_sequence_key, "value", RUBY_FUNC_CAST((&SetValue<PackageIDSequence>::fetch)), 0); + rb_define_method(c_metadata_package_id_sequence_key, "parse_value", RUBY_FUNC_CAST((&SetValue<PackageIDSequence>::fetch)), 0); /* * Document-class: Paludis::MetadataFSPathSequenceKey @@ -733,7 +733,7 @@ namespace * Metadata class for filesystem sequences. */ c_metadata_fsentry_sequence_key = rb_define_class_under(paludis_module(), "MetadataFSPathSequenceKey", c_metadata_key); - rb_define_method(c_metadata_fsentry_sequence_key, "value", RUBY_FUNC_CAST((&SetValue<FSPathSequence>::fetch)), 0); + rb_define_method(c_metadata_fsentry_sequence_key, "parse_value", RUBY_FUNC_CAST((&SetValue<FSPathSequence>::fetch)), 0); /* * Document-class: Paludis::MetadataStringSetKey @@ -741,7 +741,7 @@ namespace * Metadata class for String sets. */ c_metadata_string_set_key = rb_define_class_under(paludis_module(), "MetadataStringSetKey", c_metadata_key); - rb_define_method(c_metadata_string_set_key, "value", RUBY_FUNC_CAST((&SetValue<Set<std::string> >::fetch)), 0); + rb_define_method(c_metadata_string_set_key, "parse_value", RUBY_FUNC_CAST((&SetValue<Set<std::string> >::fetch)), 0); /* * Document-class: Paludis::MetadataStringStringMapKey @@ -749,7 +749,7 @@ namespace * Metadata class for String to String maps. */ c_metadata_string_string_map_key = rb_define_class_under(paludis_module(), "MetadataStringStringMapKey", c_metadata_key); - rb_define_method(c_metadata_string_string_map_key, "value", RUBY_FUNC_CAST((&MapValue<Map<std::string, std::string> >::fetch)), 0); + rb_define_method(c_metadata_string_string_map_key, "parse_value", RUBY_FUNC_CAST((&MapValue<Map<std::string, std::string> >::fetch)), 0); /* * Document-class: Paludis::MetadataStringSequenceKey @@ -757,7 +757,7 @@ namespace * Metadata class for String sequences. */ c_metadata_string_sequence_key = rb_define_class_under(paludis_module(), "MetadataStringSequenceKey", c_metadata_key); - rb_define_method(c_metadata_string_sequence_key, "value", RUBY_FUNC_CAST((&SetValue<Sequence<std::string> >::fetch)), 0); + rb_define_method(c_metadata_string_sequence_key, "parse_value", RUBY_FUNC_CAST((&SetValue<Sequence<std::string> >::fetch)), 0); /* * Document-class: Paludis::MetadataLicenseSpecTreeKey @@ -765,7 +765,7 @@ namespace * Metadata class for license specs. */ c_metadata_license_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataLicenseSpecTreeKey", c_metadata_key); - rb_define_method(c_metadata_license_spec_tree_key, "value", RUBY_FUNC_CAST((&SpecTreeValue<LicenseSpecTree>::fetch)), 0); + rb_define_method(c_metadata_license_spec_tree_key, "parse_value", RUBY_FUNC_CAST((&SpecTreeValue<LicenseSpecTree>::fetch)), 0); /* * Document-class: Paludis::MetadataProvideSpecTreeKey @@ -773,7 +773,7 @@ namespace * Metadata class for provide specs. */ c_metadata_provide_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataProvideSpecTreeKey", c_metadata_key); - rb_define_method(c_metadata_provide_spec_tree_key, "value", RUBY_FUNC_CAST((&SpecTreeValue<ProvideSpecTree>::fetch)), 0); + rb_define_method(c_metadata_provide_spec_tree_key, "parse_value", RUBY_FUNC_CAST((&SpecTreeValue<ProvideSpecTree>::fetch)), 0); /* * Document-class: Paludis::MetadataPlainTextSpecTreeKey @@ -781,7 +781,7 @@ namespace * Metadata class for restrict specs. */ c_metadata_plain_text_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataPlainTextSpecTreeKey", c_metadata_key); - rb_define_method(c_metadata_plain_text_spec_tree_key, "value", RUBY_FUNC_CAST((&SpecTreeValue<PlainTextSpecTree>::fetch)), 0); + rb_define_method(c_metadata_plain_text_spec_tree_key, "parse_value", RUBY_FUNC_CAST((&SpecTreeValue<PlainTextSpecTree>::fetch)), 0); /* * Document-class: Paludis::MetadataRequiredUseSpecTreeKey @@ -789,7 +789,7 @@ namespace * Metadata class for restrict specs. */ c_metadata_required_use_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataRequiredUseSpecTreeKey", c_metadata_key); - rb_define_method(c_metadata_required_use_spec_tree_key, "value", RUBY_FUNC_CAST((&SpecTreeValue<RequiredUseSpecTree>::fetch)), 0); + rb_define_method(c_metadata_required_use_spec_tree_key, "parse_value", RUBY_FUNC_CAST((&SpecTreeValue<RequiredUseSpecTree>::fetch)), 0); /* * Document-class: Paludis::MetadataDependencySpecTreeKey @@ -797,7 +797,7 @@ namespace * Metadata class for dependency specs. */ c_metadata_dependency_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataDependencySpecTreeKey", c_metadata_key); - rb_define_method(c_metadata_dependency_spec_tree_key, "value", RUBY_FUNC_CAST((&SpecTreeValue<DependencySpecTree>::fetch)), 0); + rb_define_method(c_metadata_dependency_spec_tree_key, "parse_value", RUBY_FUNC_CAST((&SpecTreeValue<DependencySpecTree>::fetch)), 0); rb_define_method(c_metadata_dependency_spec_tree_key, "initial_labels", RUBY_FUNC_CAST(&metadata_dependency_spec_tree_key_initial_labels), 0); /* @@ -806,7 +806,7 @@ namespace * Metadata class for fetchable uri specs. */ c_metadata_fetchable_uri_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataFetchableURISpecTreeKey", c_metadata_key); - rb_define_method(c_metadata_fetchable_uri_spec_tree_key, "value", RUBY_FUNC_CAST((&SpecTreeValue<FetchableURISpecTree>::fetch)), 0); + rb_define_method(c_metadata_fetchable_uri_spec_tree_key, "parse_value", RUBY_FUNC_CAST((&SpecTreeValue<FetchableURISpecTree>::fetch)), 0); rb_define_method(c_metadata_fetchable_uri_spec_tree_key, "initial_label", RUBY_FUNC_CAST(&metadata_fetchable_uri_spec_tree_key_initial_label), 0); /* @@ -815,7 +815,7 @@ namespace * Metadata class for simple uri specs. */ c_metadata_simple_uri_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataSimpleURISpecTreeKey", c_metadata_key); - rb_define_method(c_metadata_simple_uri_spec_tree_key, "value", RUBY_FUNC_CAST((&SpecTreeValue<SimpleURISpecTree>::fetch)), 0); + rb_define_method(c_metadata_simple_uri_spec_tree_key, "parse_value", RUBY_FUNC_CAST((&SpecTreeValue<SimpleURISpecTree>::fetch)), 0); /* * Document-class: Paludis::MetadataSectionKey diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb index e230843d9..94dd74d89 100644 --- a/ruby/package_id_TEST.rb +++ b/ruby/package_id_TEST.rb @@ -94,8 +94,8 @@ module Paludis end def test_value - assert_respond_to mk, :value - assert_kind_of String, mk.value + assert_respond_to mk, :parse_value + assert_kind_of String, mk.parse_value end end @@ -151,7 +151,7 @@ module Paludis end def test_subscript - assert_equal pid_testrepo["DESCRIPTION"].value, "Test package" + assert_equal pid_testrepo["DESCRIPTION"].parse_value, "Test package" assert_nil pid_testrepo["PRESCRIPTION"] end @@ -161,7 +161,7 @@ module Paludis "RESTRICT" => 1, "SRC_URI" => 1, "HOMEPAGE" => 1, "EBUILD" => 1, "PROPERTIES" => 1, "IUSE" => 1, "PALUDIS_CHOICES" => 1, "DEFINED_PHASES" => 1, "SLOT" => 1 } pid_testrepo.each_metadata do | key | - assert keys.has_key?(key.raw_name), "no key #{key.raw_name} -> #{key.value}" + assert keys.has_key?(key.raw_name), "no key #{key.raw_name} -> #{key.parse_value}" keys.delete key.raw_name end assert keys.empty?, "keys are #{keys.map { | k, v | k }.join ', '}" @@ -223,13 +223,13 @@ module Paludis end def test_slot - assert_kind_of String, pid_testrepo.slot_key.value - assert_equal '0', pid_testrepo.slot_key.value + assert_kind_of String, pid_testrepo.slot_key.parse_value + assert_equal '0', pid_testrepo.slot_key.parse_value end def test_short_description assert_kind_of MetadataStringKey, pid_testrepo.short_description_key - assert_equal 'Test package', pid_testrepo.short_description_key.value + assert_equal 'Test package', pid_testrepo.short_description_key.parse_value end def test_long_description @@ -247,23 +247,23 @@ module Paludis def test_keywords_key assert_kind_of MetadataKeywordNameSetKey, pid_testrepo.keywords_key - assert_kind_of Array, pid_testrepo.keywords_key.value - assert_equal ['~test'], pid_testrepo.keywords_key.value + assert_kind_of Array, pid_testrepo.keywords_key.parse_value + assert_equal ['~test'], pid_testrepo.keywords_key.parse_value end def test_build_dependencies_key assert_kind_of MetadataDependencySpecTreeKey, pid_testrepo.build_dependencies_key - assert_kind_of AllDepSpec, pid_testrepo.build_dependencies_key.value + assert_kind_of AllDepSpec, pid_testrepo.build_dependencies_key.parse_value end def test_homepage_key assert_kind_of MetadataSimpleURISpecTreeKey, pid_testrepo.homepage_key - assert_kind_of AllDepSpec, pid_testrepo.homepage_key.value + assert_kind_of AllDepSpec, pid_testrepo.homepage_key.parse_value end def test_fetches_key assert_kind_of MetadataFetchableURISpecTreeKey, pid_testrepo.fetches_key - assert_kind_of AllDepSpec, pid_testrepo.fetches_key.value + assert_kind_of AllDepSpec, pid_testrepo.fetches_key.parse_value assert_respond_to pid_testrepo.fetches_key, :initial_label assert_kind_of URILabel, pid_testrepo.fetches_key.initial_label assert_kind_of URIMirrorsThenListedLabel, pid_testrepo.fetches_key.initial_label @@ -290,13 +290,13 @@ module Paludis end def test_slot - assert_kind_of String, pid_installed.slot_key.value - assert_equal 'test_slot', pid_installed.slot_key.value + assert_kind_of String, pid_installed.slot_key.parse_value + assert_equal 'test_slot', pid_installed.slot_key.parse_value end def test_short_description assert_kind_of MetadataStringKey, pid_installed.short_description_key - assert_equal 'a description', pid_installed.short_description_key.value + assert_equal 'a description', pid_installed.short_description_key.parse_value end def test_long_description @@ -305,17 +305,17 @@ module Paludis def test_contents_key assert_kind_of MetadataContentsKey, pid_installed.contents_key - assert_kind_of Contents, pid_installed.contents_key.value + assert_kind_of Contents, pid_installed.contents_key.parse_value end def test_installed_time_key assert_kind_of MetadataTimeKey, pid_installed.installed_time_key - assert_kind_of Time, pid_installed.installed_time_key.value + assert_kind_of Time, pid_installed.installed_time_key.parse_value end def test_from_repositories_key assert_kind_of MetadataStringSetKey, pid_installed.from_repositories_key - assert_equal ['origin_test'], pid_installed.from_repositories_key.value + assert_equal ['origin_test'], pid_installed.from_repositories_key.parse_value end def test_keywords_key @@ -328,13 +328,13 @@ module Paludis def test_keywords_key assert_raise NameError do - pid_bad.keywords_key.value + pid_bad.keywords_key.parse_value end end def test_build_dependencies_key assert_raise NameError do - pid_bad.build_dependencies_key.value + pid_bad.build_dependencies_key.parse_value end end end diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb index 117f311f7..f11b1f1c7 100644 --- a/ruby/repository_TEST.rb +++ b/ruby/repository_TEST.rb @@ -195,7 +195,7 @@ module Paludis include RepositoryTestCase def contents - contents = installed_pid.contents_key.value + contents = installed_pid.contents_key.parse_value end def entries @@ -214,20 +214,20 @@ module Paludis def test_first_entry assert_kind_of ContentsEntry, entries[0] assert_kind_of ContentsDirEntry, entries[0] - assert_equal '/test', entries[0].location_key.value + assert_equal '/test', entries[0].location_key.parse_value end def test_second_entry assert_kind_of ContentsEntry, entries[1] assert_kind_of ContentsFileEntry, entries[1] - assert_equal '/test/test_file', entries[1].location_key.value + assert_equal '/test/test_file', entries[1].location_key.parse_value end def test_third_entry assert_kind_of ContentsEntry, entries[2] assert_kind_of ContentsSymEntry, entries[2] - assert_equal '/test/test_file', entries[2].target_key.value - assert_equal '/test/test_link', entries[2].location_key.value + assert_equal '/test/test_file', entries[2].target_key.parse_value + assert_equal '/test/test_link', entries[2].location_key.parse_value end end @@ -380,15 +380,15 @@ module Paludis def test_format_key assert_kind_of MetadataStringKey, repo.format_key - assert_equal 'e', repo.format_key.value + assert_equal 'e', repo.format_key.parse_value assert_kind_of MetadataStringKey, installed_repo.format_key - assert_equal 'vdb', installed_repo.format_key.value + assert_equal 'vdb', installed_repo.format_key.parse_value end def test_installed_root_key assert_nil repo.installed_root_key assert_kind_of MetadataFSPathKey, installed_repo.installed_root_key - assert_equal '/', installed_repo.installed_root_key.value + assert_equal '/', installed_repo.installed_root_key.parse_value end def test_each_metadata @@ -398,17 +398,17 @@ module Paludis def test_subscript assert_respond_to repo, :[] assert_kind_of MetadataStringKey, repo['format'] - assert_equal 'e', repo['format'].value + assert_equal 'e', repo['format'].parse_value assert_nil repo['monkey'] end def test_sync assert_kind_of MetadataStringStringMapKey, repo['sync'] - assert_kind_of Hash, repo['sync'].value - assert_equal 3, repo['sync'].value.size - assert_equal 'normalsync', repo['sync'].value[''] - assert_equal 'foosync', repo['sync'].value['foo'] - assert_equal 'barsync', repo['sync'].value['bar'] + assert_kind_of Hash, repo['sync'].parse_value + assert_equal 3, repo['sync'].parse_value.size + assert_equal 'normalsync', repo['sync'].parse_value[''] + assert_equal 'foosync', repo['sync'].parse_value['foo'] + assert_equal 'barsync', repo['sync'].parse_value['bar'] end end end diff --git a/src/clients/cave/cmd_contents.cc b/src/clients/cave/cmd_contents.cc index 60fe2f541..d726f3af8 100644 --- a/src/clients/cave/cmd_contents.cc +++ b/src/clients/cave/cmd_contents.cc @@ -82,24 +82,24 @@ namespace { std::string visit(const ContentsFileEntry & e) const { - return fuc(fs_file(), fv<'s'>(stringify(e.location_key()->value()))); + return fuc(fs_file(), fv<'s'>(stringify(e.location_key()->parse_value()))); } std::string visit(const ContentsDirEntry & e) const { - return fuc(fs_dir(), fv<'s'>(stringify(e.location_key()->value()))); + return fuc(fs_dir(), fv<'s'>(stringify(e.location_key()->parse_value()))); } std::string visit(const ContentsSymEntry & e) const { return fuc(fs_sym(), - fv<'s'>(stringify(e.location_key()->value())), - fv<'t'>(stringify(e.target_key()->value()))); + fv<'s'>(stringify(e.location_key()->parse_value())), + fv<'t'>(stringify(e.target_key()->parse_value()))); } std::string visit(const ContentsOtherEntry & e) const { - return fuc(fs_other(), fv<'s'>(stringify(e.location_key()->value()))); + return fuc(fs_other(), fv<'s'>(stringify(e.location_key()->parse_value()))); } }; @@ -128,22 +128,23 @@ ContentsCommand::run( throw args::DoHelp("contents takes exactly one parameter"); PackageDepSpec spec(parse_spec_with_nice_error(*cmdline.begin_parameters(), env.get(), - { }, filter::InstalledAtRoot(env->preferred_root_key()->value()))); + { }, filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))); std::shared_ptr<const PackageIDSequence> entries( (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) - | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + | filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); if (entries->empty()) - nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->preferred_root_key()->value())); + nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->preferred_root_key()->parse_value())); const std::shared_ptr<const PackageID> id(*entries->last()); if (! id->contents_key()) throw BadIDForCommand(spec, id, "does not support listing contents"); + auto contents(id->contents_key()->parse_value()); std::transform( - id->contents_key()->value()->begin(), - id->contents_key()->value()->end(), + contents->begin(), + contents->end(), std::ostream_iterator<std::string>(cout, "\n"), std::bind(stringify_contents_entry, std::placeholders::_1)); diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc index cf007d71e..b7d9bc20b 100755 --- a/src/clients/cave/cmd_display_resolution.cc +++ b/src/clients/cave/cmd_display_resolution.cc @@ -517,7 +517,7 @@ namespace const std::shared_ptr<const PackageID> & id, const bool is_new) { - if (id->short_description_key() && ! id->short_description_key()->value().empty()) + if (id->short_description_key() && ! id->short_description_key()->parse_value().empty()) { bool show(false); if (cmdline.display_options.a_show_descriptions.argument() == "none") @@ -532,7 +532,7 @@ namespace + cmdline.display_options.a_show_descriptions.long_name() + "'"); if (show) - cout << fuc(fs_description(), fv<'s'>(id->short_description_key()->value())); + cout << fuc(fs_description(), fv<'s'>(id->short_description_key()->parse_value())); } } @@ -552,11 +552,11 @@ namespace std::shared_ptr<const Choices> old_choices; if (old_id && old_id->choices_key()) - old_choices = old_id->choices_key()->value(); + old_choices = old_id->choices_key()->parse_value(); std::pair<std::string, bool> changed_s_prefix("", false), unchanged_s_prefix("", false); - for (Choices::ConstIterator k(id->choices_key()->value()->begin()), - k_end(id->choices_key()->value()->end()) ; + auto choices(id->choices_key()->parse_value()); + for (Choices::ConstIterator k(choices->begin()), k_end(choices->end()) ; k != k_end ; ++k) { if ((*k)->hidden()) @@ -884,27 +884,27 @@ namespace void visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) { - cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(*k.value()))); + cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(*k.parse_value()))); } void visit(const MetadataValueKey<std::string> & k) { - cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.value()))); + cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.parse_value()))); } void visit(const MetadataValueKey<SlotName> & k) { - cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.value()))); + cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.parse_value()))); } void visit(const MetadataValueKey<long> & k) { - cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.value()))); + cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.parse_value()))); } void visit(const MetadataValueKey<bool> & k) { - cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.value()))); + cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.parse_value()))); } void visit(const MetadataSectionKey & k) @@ -914,7 +914,7 @@ namespace void visit(const MetadataTimeKey & k) { - cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(pretty_print_time(k.value().seconds()))); + cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(pretty_print_time(k.parse_value().seconds()))); } void visit(const MetadataValueKey<std::shared_ptr<const Contents> > & k) @@ -924,7 +924,7 @@ namespace void visit(const MetadataValueKey<FSPath> & k) { - cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.value()))); + cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.parse_value()))); } void visit(const MetadataCollectionKey<Set<std::string> > & k) @@ -1250,16 +1250,13 @@ namespace cout << fuc(fs_change_not_best()); if ((! decision.destination()->replacing()->empty()) && - (*decision.destination()->replacing()->begin())->from_repositories_key() && - ! (*decision.destination()->replacing()->begin())->from_repositories_key()->value()->empty() && - (*decision.destination()->replacing()->begin())->from_repositories_key()->value()->end() == - (*decision.destination()->replacing()->begin())->from_repositories_key()->value()->find(stringify( - decision.origin_id()->repository_name()))) + (*decision.destination()->replacing()->begin())->from_repositories_key()) { - cout << fuc(fs_change_formerly_from(), fv<'r'>(join( - (*decision.destination()->replacing()->begin())->from_repositories_key()->value()->begin(), - (*decision.destination()->replacing()->begin())->from_repositories_key()->value()->end(), - ", ::"))); + auto from_repositories((*decision.destination()->replacing()->begin())->from_repositories_key()->parse_value()); + if (! from_repositories->empty() && from_repositories->end() == from_repositories->find(stringify(decision.origin_id()->repository_name()))) + { + cout << fuc(fs_change_formerly_from(), fv<'r'>(join(from_repositories->begin(), from_repositories->end(), ", ::"))); + } } cout << fuc(fs_change_version(), fv<'v'>(decision.origin_id()->canonical_form(idcf_version))); @@ -1457,11 +1454,11 @@ namespace { bool all_same(true); const std::shared_ptr<const ChoiceValue> first_choice_value( - (*v->second->begin())->choices_key()->value()->find_by_name_with_prefix(v->first)); + (*v->second->begin())->choices_key()->parse_value()->find_by_name_with_prefix(v->first)); std::string description(first_choice_value->description()); for (PackageIDSequence::ConstIterator w(next(v->second->begin())), w_end(v->second->end()) ; w != w_end ; ++w) - if ((*w)->choices_key()->value()->find_by_name_with_prefix(v->first)->description() != description) + if ((*w)->choices_key()->parse_value()->find_by_name_with_prefix(v->first)->description() != description) { all_same = false; break; @@ -1476,7 +1473,7 @@ namespace w != w_end ; ++w) { const std::shared_ptr<const ChoiceValue> value( - (*w)->choices_key()->value()->find_by_name_with_prefix(v->first)); + (*w)->choices_key()->parse_value()->find_by_name_with_prefix(v->first)); cout << fuc(fs_choice_to_explain_one(), fv<'s'>((*w)->canonical_form(idcf_no_version)), fv<'d'>(value->description())); } } diff --git a/src/clients/cave/cmd_fix_linkage.cc b/src/clients/cave/cmd_fix_linkage.cc index b95eb4384..01c030596 100644 --- a/src/clients/cave/cmd_fix_linkage.cc +++ b/src/clients/cave/cmd_fix_linkage.cc @@ -211,7 +211,7 @@ FixLinkageCommand::run( MutablePackageDepSpecData part_spec({ }); part_spec.require_package((*pkg_it)->name()); if ((*pkg_it)->slot_key()) - part_spec.require_exact_slot((*pkg_it)->slot_key()->value(), false); + part_spec.require_exact_slot((*pkg_it)->slot_key()->parse_value(), false); if (cmdline.a_exact.specified()) part_spec.require_version(vrc_and, vo_equal, (*pkg_it)->version()); diff --git a/src/clients/cave/cmd_generate_metadata.cc b/src/clients/cave/cmd_generate_metadata.cc index c38b657c8..0081032f9 100644 --- a/src/clients/cave/cmd_generate_metadata.cc +++ b/src/clients/cave/cmd_generate_metadata.cc @@ -99,7 +99,7 @@ namespace template <typename T_> void visit(const T_ & k) const { - auto PALUDIS_ATTRIBUTE((unused)) v(k.value()); + auto PALUDIS_ATTRIBUTE((unused)) v(k.parse_value()); } }; diff --git a/src/clients/cave/cmd_has_version.cc b/src/clients/cave/cmd_has_version.cc index 7d587868e..451cf325a 100644 --- a/src/clients/cave/cmd_has_version.cc +++ b/src/clients/cave/cmd_has_version.cc @@ -97,7 +97,7 @@ HasVersionCommand::run( auto s(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), { })); auto ids((*env)[selection::BestVersionOnly(generator::Matches(s, make_null_shared_ptr(), { }) | filter::InstalledAtRoot( - env->preferred_root_key()->value()))]); + env->preferred_root_key()->parse_value()))]); if (ids->empty()) return EXIT_FAILURE; diff --git a/src/clients/cave/cmd_import.cc b/src/clients/cave/cmd_import.cc index 04bb0b4ef..d7a59a638 100644 --- a/src/clients/cave/cmd_import.cc +++ b/src/clients/cave/cmd_import.cc @@ -226,7 +226,7 @@ ImportCommand::run( auto repo(env->fetch_repository((*i)->repository_name())); if (! repo->format_key()) continue; - if (repo->format_key()->value() != "installed_unpackaged") + if (repo->format_key()->parse_value() != "installed_unpackaged") continue; old_id = *i; break; @@ -237,7 +237,7 @@ ImportCommand::run( "no old ID available"); if (old_id->short_description_key()) - description = old_id->short_description_key()->value(); + description = old_id->short_description_key()->parse_value(); if (old_id->build_dependencies_key()) build_dependencies = old_id->build_dependencies_key()->pretty_print_value(UnformattedPrettyPrinter(), { }); if (old_id->run_dependencies_key()) diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc index d04006c58..7eb5fb291 100644 --- a/src/clients/cave/cmd_info.cc +++ b/src/clients/cave/cmd_info.cc @@ -117,23 +117,23 @@ namespace void visit(const ContentsFileEntry & e) { - s << fuc(fs_contents_file(), fv<'r'>(stringify(e.location_key()->value())), fv<'b'>(indent ? "true" : "")); + s << fuc(fs_contents_file(), fv<'r'>(stringify(e.location_key()->parse_value())), fv<'b'>(indent ? "true" : "")); } void visit(const ContentsDirEntry & e) { - s << fuc(fs_contents_dir(), fv<'r'>(stringify(e.location_key()->value())), fv<'b'>(indent ? "true" : "")); + s << fuc(fs_contents_dir(), fv<'r'>(stringify(e.location_key()->parse_value())), fv<'b'>(indent ? "true" : "")); } void visit(const ContentsSymEntry & e) { - s << fuc(fs_contents_sym(), fv<'r'>(stringify(e.location_key()->value())), fv<'b'>(indent ? "true" : ""), - fv<'v'>(e.target_key()->value())); + s << fuc(fs_contents_sym(), fv<'r'>(stringify(e.location_key()->parse_value())), fv<'b'>(indent ? "true" : ""), + fv<'v'>(e.target_key()->parse_value())); } void visit(const ContentsOtherEntry & e) { - s << fuc(fs_contents_other(), fv<'r'>(stringify(e.location_key()->value())), fv<'b'>(indent ? "true" : "")); + s << fuc(fs_contents_other(), fv<'r'>(stringify(e.location_key()->parse_value())), fv<'b'>(indent ? "true" : "")); } }; @@ -194,8 +194,8 @@ namespace void visit(const MetadataCollectionKey<FSPathSequence> & k) { - cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>( - join(k.value()->begin(), k.value()->end(), " "))); + auto v(k.parse_value()); + cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(join(v->begin(), v->end(), " "))); } void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) @@ -243,37 +243,37 @@ namespace void visit(const MetadataValueKey<std::string> & k) { ColourPrettyPrinter printer(env, make_null_shared_ptr(), indent); - cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.value()))); + cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.parse_value()))); } void visit(const MetadataValueKey<SlotName> & k) { ColourPrettyPrinter printer(env, make_null_shared_ptr(), indent); - cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.value()))); + cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.parse_value()))); } void visit(const MetadataValueKey<long> & k) { ColourPrettyPrinter printer(env, make_null_shared_ptr(), indent); - cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.value()))); + cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.parse_value()))); } void visit(const MetadataValueKey<bool> & k) { ColourPrettyPrinter printer(env, make_null_shared_ptr(), indent); - cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.value()))); + cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.parse_value()))); } void visit(const MetadataValueKey<FSPath> & k) { ColourPrettyPrinter printer(env, make_null_shared_ptr(), indent); - cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.value()))); + cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(k.parse_value()))); } void visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) { ColourPrettyPrinter printer(env, make_null_shared_ptr(), indent); - cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(*k.value()))); + cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(*k.parse_value()))); } void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) @@ -286,7 +286,7 @@ namespace void visit(const MetadataTimeKey & k) { - cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(pretty_print_time(k.value().seconds()))); + cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(pretty_print_time(k.parse_value().seconds()))); } }; @@ -376,12 +376,12 @@ namespace PackageDepSpec spec(parse_spec_with_nice_error(param, env.get(), { }, filter::All())); const std::shared_ptr<const PackageIDSequence> installed_ids((*env)[selection::AllVersionsSorted(generator::Matches( - spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); const std::shared_ptr<const PackageIDSequence> installable_ids((*env)[selection::BestVersionOnly(generator::Matches( spec, make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]); if (installed_ids->empty() && installable_ids->empty()) - nothing_matching_error(env.get(), param, filter::InstalledAtRoot(env->preferred_root_key()->value())); + nothing_matching_error(env.get(), param, filter::InstalledAtRoot(env->preferred_root_key()->parse_value())); for (PackageIDSequence::ConstIterator i(installed_ids->begin()), i_end(installed_ids->end()) ; i != i_end ; ++i) diff --git a/src/clients/cave/cmd_manage_search_index.cc b/src/clients/cave/cmd_manage_search_index.cc index 23e74051b..adb0d4e23 100644 --- a/src/clients/cave/cmd_manage_search_index.cc +++ b/src/clients/cave/cmd_manage_search_index.cc @@ -272,9 +272,9 @@ ManageSearchIndexCommand::run( std::string name(stringify((*i)->name())), short_desc, long_desc; if ((*i)->short_description_key()) - short_desc = (*i)->short_description_key()->value(); + short_desc = (*i)->short_description_key()->parse_value(); if ((*i)->long_description_key()) - long_desc = (*i)->long_description_key()->value(); + long_desc = (*i)->long_description_key()->parse_value(); bool is_visible(! (*i)->masked()); diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc index c6ad4952e..ce1ebc868 100644 --- a/src/clients/cave/cmd_match.cc +++ b/src/clients/cave/cmd_match.cc @@ -244,37 +244,38 @@ namespace void visit(const MetadataValueKey<std::string> & k) { - texts.push_back(stringify(k.value())); + texts.push_back(stringify(k.parse_value())); } void visit(const MetadataValueKey<FSPath> & k) { - texts.push_back(stringify(k.value())); + texts.push_back(stringify(k.parse_value())); } void visit(const MetadataValueKey<SlotName> & k) { - texts.push_back(stringify(k.value())); + texts.push_back(stringify(k.parse_value())); } void visit(const MetadataValueKey<long> & k) { - texts.push_back(stringify(k.value())); + texts.push_back(stringify(k.parse_value())); } void visit(const MetadataValueKey<bool> & k) { - texts.push_back(stringify(k.value())); + texts.push_back(stringify(k.parse_value())); } void visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) { - texts.push_back(stringify(*k.value())); + texts.push_back(stringify(*k.parse_value())); } void visit(const MetadataValueKey<std::shared_ptr<const Choices> > & k) { - for (Choices::ConstIterator c(k.value()->begin()), c_end(k.value()->end()) ; + auto choices(k.parse_value()); + for (Choices::ConstIterator c(choices->begin()), c_end(choices->end()) ; c != c_end ; ++c) for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ; i != i_end ; ++i) @@ -287,7 +288,7 @@ namespace void visit(const MetadataTimeKey & k) { - texts.push_back(stringify(k.value().seconds())); + texts.push_back(stringify(k.parse_value().seconds())); } void visit(const MetadataSectionKey & k) @@ -299,73 +300,79 @@ namespace void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k) { SpecTreeAsString m = { env, id, texts, match_options }; - k.value()->top()->accept(m); + k.parse_value()->top()->accept(m); } void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k) { SpecTreeAsString m = { env, id, texts, match_options }; - k.value()->top()->accept(m); + k.parse_value()->top()->accept(m); } void visit(const MetadataSpecTreeKey<DependencySpecTree> & k) { SpecTreeAsString m = { env, id, texts, match_options }; - k.value()->top()->accept(m); + k.parse_value()->top()->accept(m); } void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) { SpecTreeAsString m = { env, id, texts, match_options }; - k.value()->top()->accept(m); + k.parse_value()->top()->accept(m); } void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k) { SpecTreeAsString m = { env, id, texts, match_options }; - k.value()->top()->accept(m); + k.parse_value()->top()->accept(m); } void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k) { SpecTreeAsString m = { env, id, texts, match_options }; - k.value()->top()->accept(m); + k.parse_value()->top()->accept(m); } void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k) { SpecTreeAsString m = { env, id, texts, match_options }; - k.value()->top()->accept(m); + k.parse_value()->top()->accept(m); } void visit(const MetadataCollectionKey<Sequence<FSPath> > & k) { - std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), &stringify<FSPath>); + auto v(k.parse_value()); + std::transform(v->begin(), v->end(), std::back_inserter(texts), &stringify<FSPath>); } void visit(const MetadataCollectionKey<Sequence<std::string> > & k) { - std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), &stringify<std::string>); + auto v(k.parse_value()); + std::transform(v->begin(), v->end(), std::back_inserter(texts), &stringify<std::string>); } void visit(const MetadataCollectionKey<Set<std::string> > & k) { - std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), &stringify<std::string>); + auto v(k.parse_value()); + std::transform(v->begin(), v->end(), std::back_inserter(texts), &stringify<std::string>); } void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k) { - std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), stringify_string_pair); + auto v(k.parse_value()); + std::transform(v->begin(), v->end(), std::back_inserter(texts), stringify_string_pair); } void visit(const MetadataCollectionKey<Set<KeywordName> > & k) { - std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), &stringify<KeywordName>); + auto v(k.parse_value()); + std::transform(v->begin(), v->end(), std::back_inserter(texts), &stringify<KeywordName>); } void visit(const MetadataCollectionKey<Sequence<std::shared_ptr<const PackageID> > > & k) { - std::transform(indirect_iterator(k.value()->begin()), indirect_iterator(k.value()->end()), + auto v(k.parse_value()); + std::transform(indirect_iterator(v->begin()), indirect_iterator(v->end()), std::back_inserter(texts), &stringify<PackageID>); } @@ -420,9 +427,9 @@ MatchCommand::run_hosted( if (default_names_and_descriptions || match_options.a_description.specified()) { if (id->short_description_key()) - texts.push_back(stringify(id->short_description_key()->value())); + texts.push_back(stringify(id->short_description_key()->parse_value())); if (id->long_description_key()) - texts.push_back(stringify(id->long_description_key()->value())); + texts.push_back(stringify(id->long_description_key()->parse_value())); } for (args::StringSetArg::ConstIterator a(match_options.a_key.begin_args()), diff --git a/src/clients/cave/cmd_print_best_version.cc b/src/clients/cave/cmd_print_best_version.cc index 1ef5eb044..699c40627 100644 --- a/src/clients/cave/cmd_print_best_version.cc +++ b/src/clients/cave/cmd_print_best_version.cc @@ -109,7 +109,7 @@ PrintBestVersionCommand::run( auto s(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), { })); auto ids((*env)[selection::BestVersionOnly(generator::Matches(s, make_null_shared_ptr(), { }) | filter::InstalledAtRoot( - env->preferred_root_key()->value()))]); + env->preferred_root_key()->parse_value()))]); if (ids->empty()) return EXIT_FAILURE; diff --git a/src/clients/cave/cmd_print_dependent_ids.cc b/src/clients/cave/cmd_print_dependent_ids.cc index 7caae7afd..43131fcb7 100644 --- a/src/clients/cave/cmd_print_dependent_ids.cc +++ b/src/clients/cave/cmd_print_dependent_ids.cc @@ -99,7 +99,7 @@ namespace m->insert('c', stringify(i->name().category())); m->insert('p', stringify(i->name().package())); m->insert('v', stringify(i->version())); - m->insert('s', i->slot_key() ? stringify(i->slot_key()->value()) : ""); + m->insert('s', i->slot_key() ? stringify(i->slot_key()->parse_value()) : ""); m->insert(':', i->slot_key() ? ":" : ""); m->insert('r', stringify(i->repository_name())); m->insert('F', i->canonical_form(idcf_full)); @@ -128,7 +128,7 @@ PrintDependentIDsCommand::run( if (1 != std::distance(cmdline.begin_parameters(), cmdline.end_parameters())) throw args::DoHelp("print-dependent-ids requires exactly one parameter"); - auto installed_filter(filter::InstalledAtRoot(env->system_root_key()->value())); + auto installed_filter(filter::InstalledAtRoot(env->system_root_key()->parse_value())); auto spec(parse_spec_with_nice_error(*cmdline.begin_parameters(), env.get(), { }, installed_filter)); auto ids((*env)[selection::AllVersionsSorted( generator::Matches(spec, make_null_shared_ptr(), { }) | diff --git a/src/clients/cave/cmd_print_id_contents.cc b/src/clients/cave/cmd_print_id_contents.cc index 61e1b9195..1ce38dbe2 100644 --- a/src/clients/cave/cmd_print_id_contents.cc +++ b/src/clients/cave/cmd_print_id_contents.cc @@ -158,11 +158,11 @@ PrintIDContentsCommand::run( throw args::DoHelp("print-id-contents takes exactly one parameter"); PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), - { updso_allow_wildcards }, filter::InstalledAtRoot(env->preferred_root_key()->value()))); + { updso_allow_wildcards }, filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))); std::shared_ptr<const PackageIDSequence> entries( (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) | - filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); if (entries->empty()) throw NothingMatching(spec); @@ -177,7 +177,8 @@ PrintIDContentsCommand::run( if (! (*i)->contents_key()) throw BadIDForCommand(spec, (*i), "does not support listing contents"); - for (auto c((*i)->contents_key()->value()->begin()), c_end((*i)->contents_key()->value()->end()) ; + auto contents((*i)->contents_key()->parse_value()); + for (auto c(contents->begin()), c_end(contents->end()) ; c != c_end ; ++c) if (match_type(cmdline.a_type, *c)) cout << format_plain_contents_entry(*c, cmdline.a_format.argument()); diff --git a/src/clients/cave/cmd_print_ids.cc b/src/clients/cave/cmd_print_ids.cc index 3cfae9289..5be52940c 100644 --- a/src/clients/cave/cmd_print_ids.cc +++ b/src/clients/cave/cmd_print_ids.cc @@ -258,7 +258,7 @@ namespace m->insert('c', stringify(i->name().category())); m->insert('p', stringify(i->name().package())); m->insert('v', stringify(i->version())); - m->insert('s', i->slot_key() ? stringify(i->slot_key()->value()) : ""); + m->insert('s', i->slot_key() ? stringify(i->slot_key()->parse_value()) : ""); m->insert(':', i->slot_key() ? ":" : ""); m->insert('r', stringify(i->repository_name())); m->insert('F', i->canonical_form(idcf_full)); diff --git a/src/clients/cave/cmd_print_repositories.cc b/src/clients/cave/cmd_print_repositories.cc index 897cfdaf8..c5afef7b7 100644 --- a/src/clients/cave/cmd_print_repositories.cc +++ b/src/clients/cave/cmd_print_repositories.cc @@ -102,7 +102,7 @@ PrintRepositoriesCommand::run( if (r->format_key()) { if (cmdline.a_repository_format.end_args() == std::find(cmdline.a_repository_format.begin_args(), cmdline.a_repository_format.end_args(), - r->format_key()->value())) + r->format_key()->parse_value())) continue; repository_names.insert(r->name()); diff --git a/src/clients/cave/cmd_print_unused_distfiles.cc b/src/clients/cave/cmd_print_unused_distfiles.cc index a9a1e3ecc..02c1cab4f 100644 --- a/src/clients/cave/cmd_print_unused_distfiles.cc +++ b/src/clients/cave/cmd_print_unused_distfiles.cc @@ -158,7 +158,7 @@ PrintUnusedDistfilesCommand::run( std::set<std::string> used_distfiles; std::list<Selection> selections; - selections.push_back(selection::AllVersionsUnsorted(generator::All() | filter::InstalledAtRoot(env->preferred_root_key()->value()))); + selections.push_back(selection::AllVersionsUnsorted(generator::All() | filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))); for (auto c(cmdline.a_include.begin_args()), c_end(cmdline.a_include.end_args()) ; c != c_end ; ++c) @@ -179,7 +179,7 @@ PrintUnusedDistfilesCommand::run( if ((*iter)->fetches_key()) { DistfilesFilter filter(env.get(), *iter, used_distfiles); - (*iter)->fetches_key()->value()->top()->accept(filter); + (*iter)->fetches_key()->parse_value()->top()->accept(filter); } } } @@ -198,7 +198,7 @@ PrintUnusedDistfilesCommand::run( { auto path_key(visitor_cast<const MetadataValueKey<FSPath>>(**distdir_metadata)); if (path_key) - distdirs.insert(path_key->value().realpath()); + distdirs.insert(path_key->parse_value().realpath()); } } diff --git a/src/clients/cave/cmd_report.cc b/src/clients/cave/cmd_report.cc index fb34c37f2..1959a6d4c 100644 --- a/src/clients/cave/cmd_report.cc +++ b/src/clients/cave/cmd_report.cc @@ -101,7 +101,8 @@ namespace { if (id->from_repositories_key()) { - for (auto r(id->from_repositories_key()->value()->begin()), r_end(id->from_repositories_key()->value()->end()) ; + auto from_repositories(id->from_repositories_key()->parse_value()); + for (auto r(from_repositories->begin()), r_end(from_repositories->end()) ; r != r_end ; ++r) { auto ids((*env)[selection::BestVersionOnly(( @@ -170,7 +171,7 @@ ReportCommand::run( throw args::DoHelp("report takes no parameters"); auto ids((*env)[selection::AllVersionsSorted( - generator::All() | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + generator::All() | filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); auto insecurity(env->set(SetName("insecurity"))); @@ -195,8 +196,15 @@ ReportCommand::run( auto origin(find_origin_for(env, *i)); if (! origin) { - if ((*i)->behaviours_key() && - (*i)->behaviours_key()->value()->end() != (*i)->behaviours_key()->value()->find("transient")) + bool is_transient(false); + + if ((*i)->behaviours_key()) + { + auto behaviours((*i)->behaviours_key()->parse_value()); + is_transient = behaviours->end() != behaviours->find("transient"); + } + + if (is_transient) { /* that's ok */ } @@ -205,7 +213,10 @@ ReportCommand::run( need_heading(done_heading, *i); std::string repos; if ((*i)->from_repositories_key()) - repos = join((*i)->from_repositories_key()->value()->begin(), (*i)->from_repositories_key()->value()->end(), ", "); + { + auto from_repositories((*i)->from_repositories_key()->parse_value()); + repos = join(from_repositories->begin(), from_repositories->end(), ", "); + } cout << fuc(fs_package_no_origin(), fv<'s'>(repos)); } } @@ -226,9 +237,15 @@ ReportCommand::run( if (unused->end() != unused->find(*i)) { - if (((*i)->behaviours_key() && (*i)->behaviours_key()->value()->end() != - (*i)->behaviours_key()->value()->find("used")) || - (! (*i)->supports_action(SupportsActionTest<UninstallAction>()))) + bool is_used(false); + + if ((*i)->behaviours_key()) + { + auto behaviours((*i)->behaviours_key()->parse_value()); + is_used = behaviours->end() != behaviours->find("used"); + } + + if (is_used || (! (*i)->supports_action(SupportsActionTest<UninstallAction>()))) { /* ok, or weird */ } diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc index f3c070495..a5c9804f8 100644 --- a/src/clients/cave/cmd_show.cc +++ b/src/clients/cave/cmd_show.cc @@ -164,7 +164,7 @@ namespace std::string slot_as_string(const std::shared_ptr<const PackageID> & id) { if (id->slot_key()) - return stringify(id->slot_key()->value()); + return stringify(id->slot_key()->parse_value()); else return ""; } @@ -280,23 +280,23 @@ namespace void visit(const ContentsFileEntry & e) { - s << fuc(fs_contents_file(), fv<'r'>(stringify(e.location_key()->value())), fv<'b'>(indent ? "true" : "")); + s << fuc(fs_contents_file(), fv<'r'>(stringify(e.location_key()->parse_value())), fv<'b'>(indent ? "true" : "")); } void visit(const ContentsDirEntry & e) { - s << fuc(fs_contents_dir(), fv<'r'>(stringify(e.location_key()->value())), fv<'b'>(indent ? "true" : "")); + s << fuc(fs_contents_dir(), fv<'r'>(stringify(e.location_key()->parse_value())), fv<'b'>(indent ? "true" : "")); } void visit(const ContentsSymEntry & e) { - s << fuc(fs_contents_sym(), fv<'r'>(stringify(e.location_key()->value())), fv<'b'>(indent ? "true" : ""), - fv<'v'>(e.target_key()->value())); + s << fuc(fs_contents_sym(), fv<'r'>(stringify(e.location_key()->parse_value())), fv<'b'>(indent ? "true" : ""), + fv<'v'>(e.target_key()->parse_value())); } void visit(const ContentsOtherEntry & e) { - s << fuc(fs_contents_other(), fv<'r'>(stringify(e.location_key()->value())), fv<'b'>(indent ? "true" : "")); + s << fuc(fs_contents_other(), fv<'r'>(stringify(e.location_key()->parse_value())), fv<'b'>(indent ? "true" : "")); } }; @@ -333,7 +333,7 @@ namespace { std::shared_ptr<const ChoiceValue> maybe_old_value; if (maybe_old_id && maybe_old_id->choices_key()) - maybe_old_value = maybe_old_id->choices_key()->value()->find_by_name_with_prefix(value->name_with_prefix()); + maybe_old_value = maybe_old_id->choices_key()->parse_value()->find_by_name_with_prefix(value->name_with_prefix()); if (maybe_old_value) { @@ -507,10 +507,11 @@ namespace void visit(const MetadataCollectionKey<FSPathSequence> & k) { + auto v(k.parse_value()); out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(join(k.value()->begin(), k.value()->end(), ", ")), + fv<'v'>(join(v->begin(), v->end(), ", ")), fv<'i'>(std::string(indent, ' ')), fv<'b'>(important ? "true" : ""), fv<'p'>("") @@ -683,7 +684,7 @@ namespace out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(stringify(k.value())), + fv<'v'>(stringify(k.parse_value())), fv<'i'>(std::string(indent, ' ')), fv<'b'>(important ? "true" : ""), fv<'p'>("") @@ -695,7 +696,7 @@ namespace out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(stringify(k.value())), + fv<'v'>(stringify(k.parse_value())), fv<'i'>(std::string(indent, ' ')), fv<'b'>(important ? "true" : ""), fv<'p'>("") @@ -707,7 +708,7 @@ namespace out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(stringify(k.value())), + fv<'v'>(stringify(k.parse_value())), fv<'i'>(std::string(indent, ' ')), fv<'b'>(important ? "true" : ""), fv<'p'>("") @@ -719,7 +720,7 @@ namespace out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(stringify(k.value())), + fv<'v'>(stringify(k.parse_value())), fv<'i'>(std::string(indent, ' ')), fv<'b'>(important ? "true" : ""), fv<'p'>("") @@ -731,7 +732,7 @@ namespace out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(stringify(k.value())), + fv<'v'>(stringify(k.parse_value())), fv<'i'>(std::string(indent, ' ')), fv<'b'>(important ? "true" : ""), fv<'p'>("") @@ -743,7 +744,7 @@ namespace out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(stringify(*k.value())), + fv<'v'>(stringify(*k.parse_value())), fv<'i'>(std::string(indent, ' ')), fv<'b'>(important ? "true" : ""), fv<'p'>("") @@ -752,13 +753,13 @@ namespace void visit(const MetadataValueKey<std::shared_ptr<const Contents> > & k) { + auto v(k.parse_value()); if (cmdline.a_complex_keys.specified() || important) { if (cmdline.a_flat.specified()) { ContentsDisplayer d(0); - std::for_each(indirect_iterator(k.value()->begin()), - indirect_iterator(k.value()->end()), accept_visitor(d)); + std::for_each(indirect_iterator(v->begin()), indirect_iterator(v->end()), accept_visitor(d)); out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), @@ -771,8 +772,7 @@ namespace else { ContentsDisplayer d(indent); - std::for_each(indirect_iterator(k.value()->begin()), - indirect_iterator(k.value()->end()), accept_visitor(d)); + std::for_each(indirect_iterator(v->begin()), indirect_iterator(v->end()), accept_visitor(d)); out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), @@ -788,11 +788,12 @@ namespace void visit(const MetadataValueKey<std::shared_ptr<const Choices> > & k) { + auto choices(k.parse_value()); if (cmdline.a_flat.specified()) { std::stringstream s; bool empty_prefix(true); - for (Choices::ConstIterator c(k.value()->begin()), c_end(k.value()->end()) ; + for (Choices::ConstIterator c(choices->begin()), c_end(choices->end()) ; c != c_end ; ++c) { if (! cmdline.a_internal_keys.specified()) @@ -873,7 +874,7 @@ namespace fv<'p'>("") ); - for (Choices::ConstIterator c(k.value()->begin()), c_end(k.value()->end()) ; + for (Choices::ConstIterator c(choices->begin()), c_end(choices->end()) ; c != c_end ; ++c) { if (! cmdline.a_internal_keys.specified()) @@ -994,7 +995,7 @@ namespace out << fuc( (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(pretty_print_time(k.value().seconds())), + fv<'v'>(pretty_print_time(k.parse_value().seconds())), fv<'i'>(std::string(indent, ' ')), fv<'b'>(important ? "true" : ""), fv<'p'>("") diff --git a/src/clients/cave/cmd_sync.cc b/src/clients/cave/cmd_sync.cc index b287430f4..87330d721 100644 --- a/src/clients/cave/cmd_sync.cc +++ b/src/clients/cave/cmd_sync.cc @@ -140,10 +140,15 @@ namespace return ""; const std::shared_ptr<const Repository> r(env->fetch_repository(name)); - if (r->sync_host_key() && r->sync_host_key()->value()->end() != r->sync_host_key()->value()->find(cmdline.a_suffix.argument())) - return r->sync_host_key()->value()->find(cmdline.a_suffix.argument())->second; - else - return ""; + + if (r->sync_host_key()) + { + auto sync_host(r->sync_host_key()->parse_value()); + if (sync_host->end() != sync_host->find(cmdline.a_suffix.argument())) + return sync_host->find(cmdline.a_suffix.argument())->second; + } + + return ""; } virtual std::string unique_id() const diff --git a/src/clients/cave/cmd_uninstall.cc b/src/clients/cave/cmd_uninstall.cc index 6da009bcf..2b622a6f0 100644 --- a/src/clients/cave/cmd_uninstall.cc +++ b/src/clients/cave/cmd_uninstall.cc @@ -150,7 +150,7 @@ UninstallCommand::run( qpns_being_changed.insert((*i)->name()); std::string target("!" + stringify((*i)->name())); if ((*i)->slot_key()) - target.append(":" + stringify((*i)->slot_key()->value())); + target.append(":" + stringify((*i)->slot_key()->parse_value())); targets->push_back(std::make_pair(target, "")); } diff --git a/src/clients/cave/cmd_update_world.cc b/src/clients/cave/cmd_update_world.cc index e2ebd3e0b..afc5a26d9 100644 --- a/src/clients/cave/cmd_update_world.cc +++ b/src/clients/cave/cmd_update_world.cc @@ -137,7 +137,7 @@ UpdateWorldCommand::run( if (cmdline.a_if_nothing_left.specified()) { auto ids((*env)[selection::SomeArbitraryVersion(generator::Package(q) | - filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); if (ids->empty()) result = env->remove_from_world(q); } diff --git a/src/clients/cave/cmd_verify.cc b/src/clients/cave/cmd_verify.cc index 8dbe003bd..6590012c4 100644 --- a/src/clients/cave/cmd_verify.cc +++ b/src/clients/cave/cmd_verify.cc @@ -123,7 +123,7 @@ namespace if (e.end_metadata() != k) { const MetadataTimeKey * kk(visitor_cast<const MetadataTimeKey>(**k)); - if (kk && (kk->value().seconds() != f.mtim().seconds())) + if (kk && (kk->parse_value().seconds() != f.mtim().seconds())) { message(p, "Modification time changed"); return false; @@ -143,7 +143,7 @@ namespace { SafeIFStream s(f); MD5 md5(s); - if (kk->value() != md5.hexsum()) + if (kk->parse_value() != md5.hexsum()) { message(f, "Contents (md5) changed"); return false; @@ -156,7 +156,7 @@ namespace void visit(const ContentsFileEntry & e) { - FSPath f(e.location_key()->value()); + FSPath f(e.location_key()->parse_value()); FSStat f_stat(f); if (! f_stat.exists()) message(f, "Does not exist"); @@ -168,7 +168,7 @@ namespace void visit(const ContentsSymEntry & e) { - FSPath f(e.location_key()->value()); + FSPath f(e.location_key()->parse_value()); FSStat f_stat(f); if (! f_stat.exists()) message(f, "Does not exist"); @@ -180,7 +180,7 @@ namespace void visit(const ContentsDirEntry & e) { - FSPath f(e.location_key()->value()); + FSPath f(e.location_key()->parse_value()); FSStat f_stat(f); if (! f_stat.exists()) message(f, "Does not exist"); @@ -213,14 +213,14 @@ VerifyCommand::run( throw args::DoHelp("verify takes exactly one parameter"); PackageDepSpec spec(parse_spec_with_nice_error(*cmdline.begin_parameters(), env.get(), - { updso_allow_wildcards }, filter::InstalledAtRoot(env->preferred_root_key()->value()))); + { updso_allow_wildcards }, filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))); std::shared_ptr<const PackageIDSequence> entries( (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) | - filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); if (entries->empty()) - nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->preferred_root_key()->value())); + nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->preferred_root_key()->parse_value())); int exit_status(0); for (PackageIDSequence::ConstIterator i(entries->begin()), i_end(entries->end()) ; @@ -230,9 +230,8 @@ VerifyCommand::run( continue; Verifier v(*i); - std::for_each(indirect_iterator((*i)->contents_key()->value()->begin()), - indirect_iterator((*i)->contents_key()->value()->end()), - accept_visitor(v)); + auto contents((*i)->contents_key()->parse_value()); + std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(v)); exit_status |= v.exit_status; } diff --git a/src/clients/cave/executables_common.cc b/src/clients/cave/executables_common.cc index 123768003..962f1a485 100644 --- a/src/clients/cave/executables_common.cc +++ b/src/clients/cave/executables_common.cc @@ -81,17 +81,17 @@ namespace void visit(const ContentsFileEntry & e) { - if (is_executable_in_path(e.location_key()->value())) - _displayer(e.location_key()->value()); + if (is_executable_in_path(e.location_key()->parse_value())) + _displayer(e.location_key()->parse_value()); } void visit(const ContentsSymEntry & e) { - FSPath symlink(e.location_key()->value()); + FSPath symlink(e.location_key()->parse_value()); FSPath real_file(symlink.realpath_if_exists()); if (symlink != real_file && is_executable_in_path(symlink)) - _displayer(e.location_key()->value()); + _displayer(e.location_key()->parse_value()); } void visit(const ContentsDirEntry &) @@ -113,11 +113,11 @@ paludis::cave::executables_common( const bool best) { PackageDepSpec spec(parse_spec_with_nice_error(param, env.get(), { updso_allow_wildcards }, - filter::InstalledAtRoot(env->preferred_root_key()->value()))); + filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))); std::shared_ptr<const PackageIDSequence> entries( (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) | - filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); if (entries->empty()) throw NoSuchPackageError(param); @@ -135,7 +135,7 @@ paludis::cave::executables_common( { if ((*i)->contents_key()) { - std::shared_ptr<const Contents> contents((*i)->contents_key()->value()); + std::shared_ptr<const Contents> contents((*i)->contents_key()->parse_value()); std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(ed)); } } diff --git a/src/clients/cave/format_plain_contents_entry.cc b/src/clients/cave/format_plain_contents_entry.cc index 2b1efc719..eafa3778f 100644 --- a/src/clients/cave/format_plain_contents_entry.cc +++ b/src/clients/cave/format_plain_contents_entry.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2009, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -48,7 +48,7 @@ namespace void visit(const ContentsSymEntry & c) { - target = c.target_key()->value(); + target = c.target_key()->parse_value(); } void visit(const ContentsOtherEntry &) @@ -75,12 +75,12 @@ paludis::cave::format_plain_contents_entry( c->accept(v); std::shared_ptr<Map<char, std::string> > m(std::make_shared<Map<char, std::string>>()); - m->insert('n', stringify(c->location_key()->value())); - m->insert('d', stringify(c->location_key()->value().dirname())); - m->insert('b', stringify(c->location_key()->value().basename())); + m->insert('n', stringify(c->location_key()->parse_value())); + m->insert('d', stringify(c->location_key()->parse_value().dirname())); + m->insert('b', stringify(c->location_key()->parse_value().basename())); m->insert('t', v.target); m->insert('a', v.target.empty() ? "" : " -> "); - m->insert('i', std::string(number_of_parents(c->location_key()->value()), ' ')); + m->insert('i', std::string(number_of_parents(c->location_key()->parse_value()), ' ')); m->insert('/', v.slash); return format_string(f, m); diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc index 6845df5ca..fcdbd5abf 100644 --- a/src/clients/cave/format_plain_metadata_key.cc +++ b/src/clients/cave/format_plain_metadata_key.cc @@ -42,7 +42,7 @@ namespace void visit(const MetadataTimeKey & k) { - s << k.value().seconds(); + s << k.parse_value().seconds(); } void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) @@ -57,32 +57,32 @@ namespace void visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) { - s << *k.value(); + s << *k.parse_value(); } void visit(const MetadataValueKey<FSPath> & k) { - s << k.value(); + s << k.parse_value(); } void visit(const MetadataValueKey<bool> & k) { - s << (k.value() ? "true" : "false"); + s << (k.parse_value() ? "true" : "false"); } void visit(const MetadataValueKey<long> & k) { - s << k.value(); + s << k.parse_value(); } void visit(const MetadataValueKey<std::string> & k) { - s << k.value(); + s << k.parse_value(); } void visit(const MetadataValueKey<SlotName> & k) { - s << k.value(); + s << k.parse_value(); } void visit(const MetadataSpecTreeKey<DependencySpecTree> & k) diff --git a/src/clients/cave/owner_common.cc b/src/clients/cave/owner_common.cc index 183f26150..5b7a205d8 100644 --- a/src/clients/cave/owner_common.cc +++ b/src/clients/cave/owner_common.cc @@ -43,17 +43,17 @@ namespace { bool handle_full(const std::string & q, const std::shared_ptr<const ContentsEntry> & e) { - return q == stringify(e->location_key()->value()); + return q == stringify(e->location_key()->parse_value()); } bool handle_basename(const std::string & q, const std::shared_ptr<const ContentsEntry> & e) { - return q == e->location_key()->value().basename(); + return q == e->location_key()->parse_value().basename(); } bool handle_partial(const std::string & q, const std::shared_ptr<const ContentsEntry> & e) { - return std::string::npos != stringify(e->location_key()->value()).find(q); + return std::string::npos != stringify(e->location_key()->parse_value()).find(q); } } @@ -100,14 +100,14 @@ paludis::cave::owner_common( } std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsSorted(generator::All() | - filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); for (PackageIDSequence::ConstIterator p(ids->begin()), p_end(ids->end()); p != p_end; ++p) { if (! (*p)->contents_key()) continue; - std::shared_ptr<const Contents> contents((*p)->contents_key()->value()); + std::shared_ptr<const Contents> contents((*p)->contents_key()->parse_value()); if (contents->end() != std::find_if(contents->begin(), contents->end(), std::bind(handler, query, std::placeholders::_1))) { diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc index 1b06e5932..fde788486 100644 --- a/src/clients/cave/resolve_common.cc +++ b/src/clients/cave/resolve_common.cc @@ -185,7 +185,7 @@ namespace if (resolution_options.a_reinstall_dependents_of.specified()) { - auto installed_filter(filter::InstalledAtRoot(env->system_root_key()->value())); + auto installed_filter(filter::InstalledAtRoot(env->system_root_key()->parse_value())); auto installed_ids((*env)[selection::AllVersionsSorted( generator::All() | installed_filter)]); @@ -637,7 +637,7 @@ namespace { if (arg.argument() == "auto") { - if (env->preferred_root_key()->value() == FSPath("/")) + if (env->preferred_root_key()->parse_value() == FSPath("/")) return dt_install_to_slash; else return dt_install_to_chroot; diff --git a/src/clients/cave/select_format_for_spec.cc b/src/clients/cave/select_format_for_spec.cc index 5a59b6d73..7ce380a6c 100644 --- a/src/clients/cave/select_format_for_spec.cc +++ b/src/clients/cave/select_format_for_spec.cc @@ -41,7 +41,7 @@ paludis::cave::select_format_for_spec( const T_ & if_unavailable ) { - if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, from_id, { }) | filter::InstalledAtRoot(env->system_root_key()->value()))]->empty()) + if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, from_id, { }) | filter::InstalledAtRoot(env->system_root_key()->parse_value()))]->empty()) return if_installed; if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, from_id, { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty()) diff --git a/src/clients/cave/size_common.cc b/src/clients/cave/size_common.cc index c06927830..f5a7ddfba 100644 --- a/src/clients/cave/size_common.cc +++ b/src/clients/cave/size_common.cc @@ -70,7 +70,7 @@ namespace unsigned long visit(const ContentsFileEntry & e) const { - FSPath path(e.location_key()->value()); + FSPath path(e.location_key()->parse_value()); FSStat stat(path); if (stat.is_regular_file_or_symlink_to_regular_file()) @@ -95,7 +95,7 @@ paludis::cave::size_common( { PackageDepSpec spec(parse_spec_with_nice_error(q, env.get(), { }, filter::All())); std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) | - filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + filter::InstalledAtRoot(env->preferred_root_key()->parse_value()))]); if (entries->empty()) return EXIT_FAILURE; @@ -109,7 +109,8 @@ paludis::cave::size_common( throw BadIDForCommand(spec, (*i), "does not support listing contents"); unsigned long size(0); - for (auto c((*i)->contents_key()->value()->begin()), c_end((*i)->contents_key()->value()->end()) ; + auto contents((*i)->contents_key()->parse_value()); + for (auto c(contents->begin()), c_end(contents->end()) ; c != c_end ; ++c) size += (*c)->accept_returning<unsigned long>(GetSize()); diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc index aa26e60c0..67ab6ee85 100644 --- a/src/clients/instruo/instruo.cc +++ b/src/clients/instruo/instruo.cc @@ -64,112 +64,112 @@ namespace { void visit(const MetadataValueKey<std::string> & k) { - const std::string & PALUDIS_ATTRIBUTE((unused)) s(k.value()); + const std::string & PALUDIS_ATTRIBUTE((unused)) s(k.parse_value()); } void visit(const MetadataValueKey<SlotName> & k) { - const SlotName & PALUDIS_ATTRIBUTE((unused)) s(k.value()); + const SlotName & PALUDIS_ATTRIBUTE((unused)) s(k.parse_value()); } void visit(const MetadataValueKey<long> & k) { - long PALUDIS_ATTRIBUTE((unused)) t(k.value()); + long PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataValueKey<bool> & k) { - bool PALUDIS_ATTRIBUTE((unused)) t(k.value()); + bool PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) { - const std::shared_ptr<const PackageID> & PALUDIS_ATTRIBUTE((unused)) p(k.value()); + const std::shared_ptr<const PackageID> & PALUDIS_ATTRIBUTE((unused)) p(k.parse_value()); } void visit(const MetadataTimeKey & k) { - Timestamp PALUDIS_ATTRIBUTE((unused)) t(k.value()); + Timestamp PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataValueKey<std::shared_ptr<const Contents> > & k) { - const std::shared_ptr<const Contents> & PALUDIS_ATTRIBUTE((unused)) c(k.value()); + const std::shared_ptr<const Contents> & PALUDIS_ATTRIBUTE((unused)) c(k.parse_value()); } void visit(const MetadataValueKey<FSPath> & k) { - const FSPath & PALUDIS_ATTRIBUTE((unused)) c(k.value()); + const FSPath & PALUDIS_ATTRIBUTE((unused)) c(k.parse_value()); } void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k) { - const std::shared_ptr<const PlainTextSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); + const std::shared_ptr<const PlainTextSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k) { - const std::shared_ptr<const RequiredUseSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); + const std::shared_ptr<const RequiredUseSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k) { - const std::shared_ptr<const ProvideSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); + const std::shared_ptr<const ProvideSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k) { - const std::shared_ptr<const FetchableURISpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); + const std::shared_ptr<const FetchableURISpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k) { - const std::shared_ptr<const SimpleURISpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); + const std::shared_ptr<const SimpleURISpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) { - const std::shared_ptr<const LicenseSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); + const std::shared_ptr<const LicenseSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataSpecTreeKey<DependencySpecTree> & k) { - const std::shared_ptr<const DependencySpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); + const std::shared_ptr<const DependencySpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.parse_value()); } void visit(const MetadataCollectionKey<PackageIDSequence> & k) { - const std::shared_ptr<const PackageIDSequence> & PALUDIS_ATTRIBUTE((unused)) s(k.value()); + const std::shared_ptr<const PackageIDSequence> & PALUDIS_ATTRIBUTE((unused)) s(k.parse_value()); } void visit(const MetadataCollectionKey<Set<std::string> > & k) { - const std::shared_ptr<const Set<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value()); + const std::shared_ptr<const Set<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.parse_value()); } void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k) { - const std::shared_ptr<const Map<std::string, std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value()); + const std::shared_ptr<const Map<std::string, std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.parse_value()); } void visit(const MetadataCollectionKey<Sequence<std::string> > & k) { - const std::shared_ptr<const Sequence<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value()); + const std::shared_ptr<const Sequence<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.parse_value()); } void visit(const MetadataCollectionKey<FSPathSequence> & k) { - const std::shared_ptr<const FSPathSequence> & PALUDIS_ATTRIBUTE((unused)) s(k.value()); + const std::shared_ptr<const FSPathSequence> & PALUDIS_ATTRIBUTE((unused)) s(k.parse_value()); } void visit(const MetadataCollectionKey<KeywordNameSet> & k) { - const std::shared_ptr<const KeywordNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value()); + const std::shared_ptr<const KeywordNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.parse_value()); } void visit(const MetadataValueKey<std::shared_ptr<const Choices> > & k) { - const std::shared_ptr<const Choices> & PALUDIS_ATTRIBUTE((unused)) s(k.value()); + const std::shared_ptr<const Choices> & PALUDIS_ATTRIBUTE((unused)) s(k.parse_value()); } void visit(const MetadataSectionKey & k) @@ -220,7 +220,7 @@ namespace continue; } - if (visitor_cast<const MetadataValueKey<std::string> >(**eapi_i)->value() == "UNKNOWN") + if (visitor_cast<const MetadataValueKey<std::string> >(**eapi_i)->parse_value() == "UNKNOWN") { Lock lock(mutex); results.insert(std::make_pair(id, "EAPI is 'UNKNOWN'")); |