diff options
author | 2011-01-06 13:21:13 +0000 | |
---|---|---|
committer | 2011-01-07 11:32:56 +0000 | |
commit | 81ef7b0468950cade215c889d47143db21720695 (patch) | |
tree | 9fe89084961f1bbf5c35619f82d802e457443b8a | |
parent | 20cc98f89f0208619fa8845d784463f03a7c9234 (diff) | |
download | paludis-81ef7b0468950cade215c889d47143db21720695.tar.gz paludis-81ef7b0468950cade215c889d47143db21720695.tar.xz |
Pass ID to match_package
149 files changed, 955 insertions, 773 deletions
diff --git a/doc/api/cplusplus/examples/example_dep_spec.cc b/doc/api/cplusplus/examples/example_dep_spec.cc index 0607d66e4..2e9598507 100644 --- a/doc/api/cplusplus/examples/example_dep_spec.cc +++ b/doc/api/cplusplus/examples/example_dep_spec.cc @@ -141,7 +141,8 @@ int main(int argc, char * argv[]) /* And display packages matching that spec */ cout << " " << left << setw(24) << "Matches:" << " "; - std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsSorted(generator::Matches(spec, { }))]); + std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsSorted( + generator::Matches(spec, make_null_shared_ptr(), { }))]); bool need_indent(false); for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ; i != i_end ; ++i) diff --git a/doc/api/cplusplus/examples/example_match_package.cc b/doc/api/cplusplus/examples/example_match_package.cc index f689b33e7..c308f8dcd 100644 --- a/doc/api/cplusplus/examples/example_match_package.cc +++ b/doc/api/cplusplus/examples/example_match_package.cc @@ -55,7 +55,7 @@ int main(int argc, char * argv[]) { /* Is it paludis? */ if (match_package(*env, make_package_dep_spec({ }).package( - QualifiedPackageName("sys-apps/paludis")), *i, { })) + QualifiedPackageName("sys-apps/paludis")), *i, make_null_shared_ptr(), { })) cout << left << setw(50) << (stringify(**i) + ":") << " " << "paludis" << endl; /* No. Is it in system or world? */ diff --git a/doc/api/cplusplus/examples/example_selection.cc b/doc/api/cplusplus/examples/example_selection.cc index a1669af87..ad60e36b0 100644 --- a/doc/api/cplusplus/examples/example_selection.cc +++ b/doc/api/cplusplus/examples/example_selection.cc @@ -63,13 +63,13 @@ int main(int argc, char * argv[]) * simplest form, it takes a Generator as a parameter. */ show_selection(env, selection::AllVersionsSorted( generator::Matches(make_package_dep_spec({ }).package( - QualifiedPackageName("sys-apps/paludis")), { }))); + QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }))); /* Generators can be passed through a Filter. The Selection optimises * the code internally to avoid doing excess work. */ show_selection(env, selection::AllVersionsSorted( generator::Matches(make_package_dep_spec({ }).package( - QualifiedPackageName("sys-apps/paludis")), { }) | + QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) | filter::InstalledAtSlash())); /* Filters can be combined. Usually filter::NotMasked should be combined @@ -77,7 +77,7 @@ int main(int argc, char * argv[]) * aren't masked. */ show_selection(env, selection::AllVersionsSorted( generator::Matches(make_package_dep_spec({ }).package( - QualifiedPackageName("sys-apps/paludis")), { }) | + QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())); @@ -86,7 +86,7 @@ int main(int argc, char * argv[]) * you only need the best matching or some arbitrary matching ID. */ show_selection(env, selection::BestVersionOnly( generator::Matches(make_package_dep_spec({ }).package( - QualifiedPackageName("sys-apps/paludis")), { }) | + QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())); } diff --git a/doc/api/ruby/example_action.rb b/doc/api/ruby/example_action.rb index 60db632fc..3e14f37f2 100644 --- a/doc/api/ruby/example_action.rb +++ b/doc/api/ruby/example_action.rb @@ -18,7 +18,7 @@ env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment # Fetch package IDs for 'sys-apps/paludis' ids = env[Selection::AllVersionsSorted.new(Generator::Matches.new( - Paludis::parse_user_package_dep_spec("sys-apps/paludis", env, []), []))] + Paludis::parse_user_package_dep_spec("sys-apps/paludis", env, []), nil, []))] # For each ID: ids.each do | id | diff --git a/doc/api/ruby/example_contents.rb b/doc/api/ruby/example_contents.rb index 82c758d28..d653fe57a 100644 --- a/doc/api/ruby/example_contents.rb +++ b/doc/api/ruby/example_contents.rb @@ -18,7 +18,7 @@ env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment # Fetch package IDs for installed 'sys-apps/paludis' ids = env[Selection::AllVersionsSorted.new( - Generator::Matches.new(Paludis::parse_user_package_dep_spec("sys-apps/paludis", env, []), []) | + Generator::Matches.new(Paludis::parse_user_package_dep_spec("sys-apps/paludis", env, []), nil, []) | Filter::InstalledAtRoot.new("/"))] # For each ID: diff --git a/doc/api/ruby/example_mask.rb b/doc/api/ruby/example_mask.rb index 2bb306d2c..e63aa9207 100644 --- a/doc/api/ruby/example_mask.rb +++ b/doc/api/ruby/example_mask.rb @@ -18,7 +18,7 @@ env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment # Fetch package IDs for 'sys-apps/paludis' ids = env[Selection::AllVersionsSorted.new( - Generator::Matches.new(Paludis::parse_user_package_dep_spec("sys-apps/paludis", env, []), []))] + Generator::Matches.new(Paludis::parse_user_package_dep_spec("sys-apps/paludis", env, []), nil, []))] # For each ID: ids.each do | id | diff --git a/doc/api/ruby/example_match_package.rb b/doc/api/ruby/example_match_package.rb index 7a448be03..c38fc98a2 100644 --- a/doc/api/ruby/example_match_package.rb +++ b/doc/api/ruby/example_match_package.rb @@ -28,7 +28,7 @@ world = env.set('world') # For each ID: ids.each do | id | # Is it paludis? - if match_package(env, parse_user_package_dep_spec('sys-apps/paludis', env, []), id, []) + if match_package(env, parse_user_package_dep_spec('sys-apps/paludis', env, []), id, nil, []) puts id.to_s.ljust(49) + ': paludis' elsif match_package_in_set(env, system, id, []) puts id.to_s.ljust(49) + ': system' diff --git a/doc/api/ruby/example_package_id.rb b/doc/api/ruby/example_package_id.rb index 0d3b2f3a8..d4350272a 100644 --- a/doc/api/ruby/example_package_id.rb +++ b/doc/api/ruby/example_package_id.rb @@ -20,7 +20,7 @@ env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment # Fetch package IDs for installed 'sys-apps/paludis' ids = env[Selection::AllVersionsSorted.new( - Generator::Matches.new(Paludis::parse_user_package_dep_spec("sys-apps/paludis", env, []), []))] + Generator::Matches.new(Paludis::parse_user_package_dep_spec("sys-apps/paludis", env, []), nil, []))] # For each ID: ids.each do | id | diff --git a/doc/api/ruby/example_selection.rb b/doc/api/ruby/example_selection.rb index 7a61030bc..dea5b9fe6 100644 --- a/doc/api/ruby/example_selection.rb +++ b/doc/api/ruby/example_selection.rb @@ -34,19 +34,19 @@ env = EnvironmentFactory.instance.create(ExampleCommandLine.instance.environment # object used determines the number and ordering of results. In the # simplest form, it takes a Generator as a parameter. show_selection(env, Selection::AllVersionsSorted.new( - Generator::Matches.new(parse_user_package_dep_spec("sys-apps/paludis", env, []), []))) + Generator::Matches.new(parse_user_package_dep_spec("sys-apps/paludis", env, []), nil, []))) # Generators can be passed through a Filter. The Selection optimises # the code internally to avoid doing excess work. show_selection(env, Selection::AllVersionsSorted.new( - Generator::Matches.new(parse_user_package_dep_spec("sys-apps/paludis", env, []), []) | + Generator::Matches.new(parse_user_package_dep_spec("sys-apps/paludis", env, []), nil, []) | Filter::InstalledAtRoot.new("/"))) # Filters can be combined. Usually Filter::NotMasked should be combined # with Filter::SupportsAction.new(InstallAction), since installed packages # aren't masked. show_selection(env, Selection::AllVersionsSorted.new( - Generator::Matches.new(parse_user_package_dep_spec("sys-apps/paludis", env, []), []) | + Generator::Matches.new(parse_user_package_dep_spec("sys-apps/paludis", env, []), nil, []) | Filter::SupportsAction.new(InstallAction) | Filter::NotMasked.new)) @@ -54,7 +54,7 @@ show_selection(env, Selection::AllVersionsSorted.new( # is no metadata cache. Consider using other Selection objects if # you only need the best matching or some arbitrary matching ID. show_selection(env, Selection::BestVersionOnly.new( - Generator::Matches.new(parse_user_package_dep_spec("sys-apps/paludis", env, []), []) | + Generator::Matches.new(parse_user_package_dep_spec("sys-apps/paludis", env, []), nil, []) | Filter::SupportsAction.new(InstallAction) | Filter::NotMasked.new)) diff --git a/paludis/environments/paludis/keywords_conf.cc b/paludis/environments/paludis/keywords_conf.cc index ab8dc04de..3586b2126 100644 --- a/paludis/environments/paludis/keywords_conf.cc +++ b/paludis/environments/paludis/keywords_conf.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -149,7 +149,7 @@ KeywordsConf::query(const std::shared_ptr<const KeywordNameSet> & k, const std:: for (PDSToKeywordsList::const_iterator j(i->second.begin()), j_end(i->second.end()) ; j != j_end ; ++j) { - if (! match_package(*_imp->env, *j->first, e, { })) + if (! match_package(*_imp->env, *j->first, e, make_null_shared_ptr(), { })) continue; for (KeywordsList::const_iterator l(j->second.begin()), l_end(j->second.end()) ; @@ -215,7 +215,7 @@ KeywordsConf::query(const std::shared_ptr<const KeywordNameSet> & k, const std:: for (PDSToKeywordsList::const_iterator j(_imp->unqualified.begin()), j_end(_imp->unqualified.end()) ; j != j_end ; ++j) { - if (! match_package(*_imp->env, *j->first, e, { })) + if (! match_package(*_imp->env, *j->first, e, make_null_shared_ptr(), { })) continue; for (KeywordsList::const_iterator l(j->second.begin()), l_end(j->second.end()) ; diff --git a/paludis/environments/paludis/licenses_conf.cc b/paludis/environments/paludis/licenses_conf.cc index 52e2e8f68..8e6d925dc 100644 --- a/paludis/environments/paludis/licenses_conf.cc +++ b/paludis/environments/paludis/licenses_conf.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -143,7 +143,7 @@ LicensesConf::query(const std::string & t, const std::shared_ptr<const PackageID for (PDSToLicensesList::const_iterator j(i->second.begin()), j_end(i->second.end()) ; j != j_end ; ++j) { - if (! match_package(*_imp->env, *j->first, e, { })) + if (! match_package(*_imp->env, *j->first, e, make_null_shared_ptr(), { })) continue; for (LicensesList::const_iterator l(j->second.begin()), l_end(j->second.end()) ; @@ -208,7 +208,7 @@ LicensesConf::query(const std::string & t, const std::shared_ptr<const PackageID for (PDSToLicensesList::const_iterator j(_imp->unqualified.begin()), j_end(_imp->unqualified.end()) ; j != j_end ; ++j) { - if (! match_package(*_imp->env, *j->first, e, { })) + if (! match_package(*_imp->env, *j->first, e, make_null_shared_ptr(), { })) continue; for (LicensesList::const_iterator l(j->second.begin()), l_end(j->second.end()) ; diff --git a/paludis/environments/paludis/output_conf.cc b/paludis/environments/paludis/output_conf.cc index a97ec1801..1e760e173 100644 --- a/paludis/environments/paludis/output_conf.cc +++ b/paludis/environments/paludis/output_conf.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -196,7 +196,7 @@ namespace return false; if (rule.matches_requirement() && ! match_package(*env, *rule.matches_requirement(), - i.package_id(), { })) + i.package_id(), make_null_shared_ptr(), { })) return false; if (! rule.ignore_unfetched_requirement().is_indeterminate()) diff --git a/paludis/environments/paludis/package_mask_conf.cc b/paludis/environments/paludis/package_mask_conf.cc index 75ff80fc6..763801199 100644 --- a/paludis/environments/paludis/package_mask_conf.cc +++ b/paludis/environments/paludis/package_mask_conf.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -104,7 +104,7 @@ PackageMaskConf::query(const std::shared_ptr<const PackageID> & e) const if (indirect_iterator(_imp->masks.end()) != std::find_if( indirect_iterator(_imp->masks.begin()), indirect_iterator(_imp->masks.end()), - std::bind(&match_package, std::ref(*_imp->env), _1, std::cref(e), MatchPackageOptions()))) + std::bind(&match_package, std::ref(*_imp->env), _1, std::cref(e), make_null_shared_ptr(), MatchPackageOptions()))) return true; { diff --git a/paludis/environments/paludis/paludis_environment_TEST.cc b/paludis/environments/paludis/paludis_environment_TEST.cc index 787e471be..ee5d69d68 100644 --- a/paludis/environments/paludis/paludis_environment_TEST.cc +++ b/paludis/environments/paludis/paludis_environment_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2008, 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 @@ -23,6 +23,7 @@ #include <paludis/util/set.hh> #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/options.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/package_id.hh> #include <paludis/user_dep_spec.hh> #include <paludis/generator.hh> @@ -63,10 +64,10 @@ namespace test_cases std::shared_ptr<Environment> env(std::make_shared<PaludisEnvironment>("")); const std::shared_ptr<const PackageID> one(*(*env)[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - env.get(), { })), { }))]->begin()); + env.get(), { })), make_null_shared_ptr(), { }))]->begin()); const std::shared_ptr<const PackageID> three(*(*env)[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-two-3", - env.get(), { })), { }))]->begin()); + env.get(), { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(get_use("foo", one)); TEST_CHECK(! get_use("foofoo", one)); @@ -97,7 +98,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*(*env)[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - env.get(), { })), { }))]->begin()); + 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()) ; c != c_end ; ++c) @@ -123,10 +124,10 @@ namespace test_cases const std::shared_ptr<const PackageID> one(*(*env)[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - env.get(), { })), { }))]->begin()); + env.get(), { })), make_null_shared_ptr(), { }))]->begin()); const std::shared_ptr<const PackageID> three(*(*env)[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-two-3", - env.get(), { })), { }))]->begin()); + env.get(), { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(get_use("foo", one)); TEST_CHECK(! get_use("foofoo", one)); @@ -156,10 +157,10 @@ namespace test_cases const std::shared_ptr<const PackageID> one(*(*env)[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - env.get(), { })), { }))]->begin()); + env.get(), { })), make_null_shared_ptr(), { }))]->begin()); const std::shared_ptr<const PackageID> three(*(*env)[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-two-3", - env.get(), { })), { }))]->begin()); + env.get(), { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(get_use("foo", one)); TEST_CHECK(! get_use("foofoo", one)); diff --git a/paludis/environments/paludis/suggestions_conf.cc b/paludis/environments/paludis/suggestions_conf.cc index dbd5e5dce..226413d0c 100644 --- a/paludis/environments/paludis/suggestions_conf.cc +++ b/paludis/environments/paludis/suggestions_conf.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 @@ -194,7 +194,7 @@ SuggestionsConf::interest_in_suggestion( for (PDSToValuesList::const_iterator j(i->second.begin()), j_end(i->second.end()) ; j != j_end ; ++j) { - if (! match_package(*_imp->env, *j->first, from_id, { })) + if (! match_package(*_imp->env, *j->first, from_id, make_null_shared_ptr(), { })) continue; for (ValuesList::const_iterator l(j->second.begin()), l_end(j->second.end()) ; @@ -269,7 +269,7 @@ SuggestionsConf::interest_in_suggestion( for (PDSToValuesList::const_iterator j(_imp->unqualified.begin()), j_end(_imp->unqualified.end()) ; j != j_end ; ++j) { - if (! match_package(*_imp->env, *j->first, from_id, { })) + if (! match_package(*_imp->env, *j->first, from_id, make_null_shared_ptr(), { })) continue; for (ValuesList::const_iterator l(j->second.begin()), l_end(j->second.end()) ; diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc index 19b1f992d..f6b26c6cd 100644 --- a/paludis/environments/portage/portage_environment.cc +++ b/paludis/environments/portage/portage_environment.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -40,6 +40,7 @@ #include <paludis/util/fs_stat.hh> #include <paludis/util/fs_iterator.hh> #include <paludis/util/fs_error.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/hooker.hh> @@ -586,7 +587,7 @@ PortageEnvironment::want_choice_enabled( for (PackageUse::const_iterator i(_imp->package_use.begin()), i_end(_imp->package_use.end()) ; i != i_end ; ++i) { - if (! match_package(*this, *i->first, id, { })) + if (! match_package(*this, *i->first, id, make_null_shared_ptr(), { })) continue; if (i->second == stringify(f)) @@ -642,7 +643,7 @@ PortageEnvironment::accept_keywords(const std::shared_ptr <const KeywordNameSet> for (PackageKeywords::const_iterator it(_imp->package_keywords.begin()), it_end(_imp->package_keywords.end()); it_end != it; ++it) { - if (! match_package(*this, *it->first, d, { })) + if (! match_package(*this, *it->first, d, make_null_shared_ptr(), { })) continue; if ("-*" == it->second) @@ -677,7 +678,7 @@ PortageEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> & e) { for (PackageUnmask::const_iterator i(_imp->package_unmask.begin()), i_end(_imp->package_unmask.end()) ; i != i_end ; ++i) - if (match_package(*this, **i, e, { })) + if (match_package(*this, **i, e, make_null_shared_ptr(), { })) return true; return false; @@ -702,7 +703,7 @@ PortageEnvironment::known_choice_value_names(const std::shared_ptr<const Package for (PackageUse::const_iterator i(_imp->package_use.begin()), i_end(_imp->package_use.end()) ; i != i_end ; ++i) { - if (! match_package(*this, *i->first, id, { })) + if (! match_package(*this, *i->first, id, make_null_shared_ptr(), { })) continue; if (0 == i->second.compare(0, prefix_lower.length(), prefix_lower, 0, prefix_lower.length())) @@ -862,7 +863,7 @@ PortageEnvironment::mask_for_user(const std::shared_ptr<const PackageID> & d, co { for (PackageMask::const_iterator i(_imp->package_mask.begin()), i_end(_imp->package_mask.end()) ; i != i_end ; ++i) - if (match_package(*this, **i, d, { })) + if (match_package(*this, **i, d, make_null_shared_ptr(), { })) return std::make_shared<UserConfigMask>(o); return std::shared_ptr<const Mask>(); diff --git a/paludis/environments/portage/portage_environment_TEST.cc b/paludis/environments/portage/portage_environment_TEST.cc index c6fcbf56a..3e86d66de 100644 --- a/paludis/environments/portage/portage_environment_TEST.cc +++ b/paludis/environments/portage/portage_environment_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -24,6 +24,7 @@ #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/options.hh> #include <paludis/util/safe_ifstream.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/package_id.hh> #include <paludis/package_database.hh> #include <paludis/dep_spec.hh> @@ -85,11 +86,11 @@ namespace test_cases const std::shared_ptr<const PackageID> idx(*env[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-x-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(get_use("one", env, idx)); TEST_CHECK(get_use("two", env, idx)); @@ -120,7 +121,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - &env, { })), { }))]->begin()); + &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()) ; c != c_end ; ++c) @@ -143,7 +144,7 @@ namespace test_cases const std::shared_ptr<const PackageID> idx(*env[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-x-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(accept_keyword(env, KeywordName("arch"), idx)); TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), idx)); @@ -151,7 +152,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(accept_keyword(env, KeywordName("arch"), id1)); TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), id1)); @@ -159,7 +160,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-two-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), id2)); TEST_CHECK(accept_keyword(env, KeywordName("arch"), id2)); @@ -167,7 +168,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id3(*env[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-three-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(! accept_keyword(env, KeywordName("other_arch"), id3)); TEST_CHECK(! accept_keyword(env, KeywordName("arch"), id3)); @@ -175,14 +176,14 @@ namespace test_cases const std::shared_ptr<const PackageID> id4(*env[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-four-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(accept_keyword(env, KeywordName("fred"), id4)); std::shared_ptr<const KeywordNameSet> empty(std::make_shared<KeywordNameSet>()); TEST_CHECK(env.accept_keywords(empty, id4)); const std::shared_ptr<const PackageID> id5(*env[selection::RequireExactlyOne( generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-five-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(accept_keyword(env, KeywordName("~foo"), id5)); TEST_CHECK(! accept_keyword(env, KeywordName("foo"), id5)); } diff --git a/paludis/filter.cc b/paludis/filter.cc index ecf4b2385..ae413f11e 100644 --- a/paludis/filter.cc +++ b/paludis/filter.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 @@ -394,10 +394,12 @@ namespace AllFilterHandlerBase { const PackageDepSpec spec; + const std::shared_ptr<const PackageID> from_id; const MatchPackageOptions options; - MatchesHandler(const PackageDepSpec & s, const MatchPackageOptions & o) : + MatchesHandler(const PackageDepSpec & s, const std::shared_ptr<const PackageID> & f, const MatchPackageOptions & o) : spec(s), + from_id(f), options(o) { } @@ -411,7 +413,7 @@ namespace for (PackageIDSet::ConstIterator i(id->begin()), i_end(id->end()) ; i != i_end ; ++i) { - if (match_package(*env, spec, *i, options)) + if (match_package(*env, spec, *i, from_id, options)) result->insert(*i); } @@ -484,8 +486,8 @@ filter::NoSlot::NoSlot() : { } -filter::Matches::Matches(const PackageDepSpec & spec, const MatchPackageOptions & o) : - Filter(std::make_shared<MatchesHandler>(spec, o)) +filter::Matches::Matches(const PackageDepSpec & spec, const std::shared_ptr<const PackageID> & f, const MatchPackageOptions & o) : + Filter(std::make_shared<MatchesHandler>(spec, f, o)) { } diff --git a/paludis/filter.hh b/paludis/filter.hh index adfa0a72f..b2b7fe681 100644 --- a/paludis/filter.hh +++ b/paludis/filter.hh @@ -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 @@ -276,7 +276,16 @@ namespace paludis public Filter { public: - Matches(const PackageDepSpec &, const MatchPackageOptions &); + /** + * \param spec_id The PackageID the spec comes from. May be null. Used + * for [use=] style dependencies. + * + * \since 0.58 takes spec_id + */ + Matches( + const PackageDepSpec &, + const std::shared_ptr<const PackageID> & from_id, + const MatchPackageOptions &); }; } diff --git a/paludis/filter_TEST.cc b/paludis/filter_TEST.cc index 24a9d8acb..6069bc38b 100644 --- a/paludis/filter_TEST.cc +++ b/paludis/filter_TEST.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 @@ -31,6 +31,7 @@ #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/make_named_values.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <test/test_runner.hh> #include <test/test_framework.hh> #include <test/test_concepts.hh> @@ -96,7 +97,7 @@ namespace test_cases std::shared_ptr<const PackageIDSequence> got_none(env[selection::AllVersionsSorted( generator::Matches(parse_user_package_dep_spec("not/exist", &env, - { }), { }) | filter)]); + { }), make_null_shared_ptr(), { }) | filter)]); TEST_CHECK(bool(got_none)); TEST_CHECK_EQUAL(join(indirect_iterator(got_none->begin()), indirect_iterator(got_none->end()), ", "), ""); } @@ -222,7 +223,7 @@ namespace test_cases { MatchesFilterTestCase() : FilterTestCaseBase("matches", filter::Matches(parse_user_package_dep_spec("cat/a", - &env, { }), { })) + &env, { }), make_null_shared_ptr(), { })) { } @@ -240,7 +241,7 @@ namespace test_cases { MatchesCatWildcardFilterTestCase() : FilterTestCaseBase("matches cat wildcard", filter::Matches(parse_user_package_dep_spec("*/a", - &env, { updso_allow_wildcards }), { })) + &env, { updso_allow_wildcards }), make_null_shared_ptr(), { })) { } @@ -258,7 +259,7 @@ namespace test_cases { MatchesPkgWildcardFilterTestCase() : FilterTestCaseBase("matches pkg wildcard", filter::Matches(parse_user_package_dep_spec("cat/*", - &env, { updso_allow_wildcards }), { })) + &env, { updso_allow_wildcards }), make_null_shared_ptr(), { })) { } @@ -279,7 +280,7 @@ namespace test_cases MatchesAllWildcardFilterTestCase() : FilterTestCaseBase("matches all wildcard", filter::Matches( parse_user_package_dep_spec(">=*/*-2", - &env, { updso_allow_wildcards }), { })) + &env, { updso_allow_wildcards }), make_null_shared_ptr(), { })) { } diff --git a/paludis/formatted_pretty_printer.cc b/paludis/formatted_pretty_printer.cc index fbea1960a..acd35153d 100644 --- a/paludis/formatted_pretty_printer.cc +++ b/paludis/formatted_pretty_printer.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 @@ -61,13 +61,13 @@ FormattedPrettyPrinter::prettify(const PackageDepSpec & v) const if (_imp->env) { { - auto ids((*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(v, { }) | + auto ids((*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(v, _imp->package_id, { }) | filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]); if (! ids->empty()) return format_installed(stringify(v)); } { - auto ids((*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(v, { }) | + auto ids((*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(v, _imp->package_id, { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]); if (! ids->empty()) return format_installed(stringify(v)); @@ -85,7 +85,7 @@ FormattedPrettyPrinter::prettify(const BlockDepSpec & v) const if (_imp->env) { { - auto ids((*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(v.blocking(), { }) | + auto ids((*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(v.blocking(), _imp->package_id, { }) | filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]); if (! ids->empty()) return format_masked(stringify(v)); diff --git a/paludis/generator.cc b/paludis/generator.cc index a889b43d0..b9d0a6dc0 100644 --- a/paludis/generator.cc +++ b/paludis/generator.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 @@ -278,10 +278,12 @@ namespace AllGeneratorHandlerBase { const PackageDepSpec spec; + const std::shared_ptr<const PackageID> from_id; const MatchPackageOptions options; - MatchesGeneratorHandler(const PackageDepSpec & s, const MatchPackageOptions & o) : + MatchesGeneratorHandler(const PackageDepSpec & s, const std::shared_ptr<const PackageID> & i, const MatchPackageOptions & o) : spec(s), + from_id(i), options(o) { } @@ -446,7 +448,7 @@ namespace env->package_database()->fetch_repository(*r)->package_ids(*q)); for (PackageIDSequence::ConstIterator i(id->begin()), i_end(id->end()) ; i != i_end ; ++i) - if (match_package(*env, spec, *i, options)) + if (match_package(*env, spec, *i, from_id, options)) result->insert(*i); } } @@ -734,8 +736,8 @@ generator::Package::Package(const QualifiedPackageName & n) : { } -generator::Matches::Matches(const PackageDepSpec & spec, const MatchPackageOptions & o) : - Generator(std::make_shared<MatchesGeneratorHandler>(spec, o)) +generator::Matches::Matches(const PackageDepSpec & spec, const std::shared_ptr<const PackageID> & f, const MatchPackageOptions & o) : + Generator(std::make_shared<MatchesGeneratorHandler>(spec, f, o)) { } diff --git a/paludis/generator.hh b/paludis/generator.hh index 6b5162d5f..3fbdf4066 100644 --- a/paludis/generator.hh +++ b/paludis/generator.hh @@ -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 @@ -152,7 +152,13 @@ namespace paludis public Generator { public: - Matches(const PackageDepSpec &, const MatchPackageOptions &); + /** + * \param spec_id The PackageID the spec comes from. May be null. Used for + * [use=] style dependencies. + * + * \since 0.58 takes spec_id + */ + Matches(const PackageDepSpec &, const std::shared_ptr<const PackageID> & from_id, const MatchPackageOptions &); }; /** diff --git a/paludis/generator_TEST.cc b/paludis/generator_TEST.cc index e687c3082..deff8e84c 100644 --- a/paludis/generator_TEST.cc +++ b/paludis/generator_TEST.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 @@ -31,6 +31,7 @@ #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/make_named_values.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <test/test_runner.hh> #include <test/test_framework.hh> #include <test/test_concepts.hh> @@ -122,7 +123,7 @@ namespace test_cases { MatchesGeneratorTestCase() : GeneratorTestCaseBase("matches", generator::Matches(parse_user_package_dep_spec("cat/a", - &env, { }), { })) + &env, { }), make_null_shared_ptr(), { })) { } @@ -140,7 +141,7 @@ namespace test_cases { MatchesCatWildcardGeneratorTestCase() : GeneratorTestCaseBase("matches cat wildcard", generator::Matches(parse_user_package_dep_spec("*/a", - &env, { updso_allow_wildcards }), { })) + &env, { updso_allow_wildcards }), make_null_shared_ptr(), { })) { } @@ -158,7 +159,7 @@ namespace test_cases { MatchesPkgWildcardGeneratorTestCase() : GeneratorTestCaseBase("matches pkg wildcard", generator::Matches(parse_user_package_dep_spec("cat/*", - &env, { updso_allow_wildcards }), { })) + &env, { updso_allow_wildcards }), make_null_shared_ptr(), { })) { } @@ -179,7 +180,7 @@ namespace test_cases MatchesAllWildcardGeneratorTestCase() : GeneratorTestCaseBase("matches all wildcard", generator::Matches( parse_user_package_dep_spec(">=*/*-2", - &env, { updso_allow_wildcards }), { })) + &env, { updso_allow_wildcards }), make_null_shared_ptr(), { })) { } @@ -287,9 +288,9 @@ namespace test_cases IntersectionGeneratorTestCase() : GeneratorTestCaseBase("intersection", generator::Intersection( generator::Matches(parse_user_package_dep_spec("*/a", - &env, { updso_allow_wildcards }), { }), + &env, { updso_allow_wildcards }), make_null_shared_ptr(), { }), generator::Matches(parse_user_package_dep_spec("cat/*", - &env, { updso_allow_wildcards }), { }) + &env, { updso_allow_wildcards }), make_null_shared_ptr(), { }) )) { } diff --git a/paludis/legacy/dep_list.cc b/paludis/legacy/dep_list.cc index d7cc9f741..ebfc010d9 100644 --- a/paludis/legacy/dep_list.cc +++ b/paludis/legacy/dep_list.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 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 @@ -259,12 +259,14 @@ namespace { const Environment * const env; const PackageDepSpec & a; + const std::shared_ptr<const PackageID> from_id; const MatchPackageOptions & o; MatchDepListEntryAgainstPackageDepSpec(const Environment * const ee, - const PackageDepSpec & aa, const MatchPackageOptions & oo) : + const PackageDepSpec & aa, const std::shared_ptr<const PackageID> & f, const MatchPackageOptions & oo) : env(ee), a(aa), + from_id(f), o(oo) { } @@ -278,7 +280,7 @@ namespace case dlk_provided: case dlk_already_installed: case dlk_subpackage: - return match_package(*env, a, e.second->package_id(), o); + return match_package(*env, a, e.second->package_id(), from_id, o); case dlk_block: case dlk_masked: @@ -425,7 +427,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T /* find already installed things */ // TODO: check destinations std::shared_ptr<const PackageIDSequence> already_installed((*d->_imp->env)[selection::AllVersionsSorted( - generator::Matches(*node.spec(), d->_imp->opts->match_package_options()) | + generator::Matches(*node.spec(), d->_imp->current_package_id(), d->_imp->opts->match_package_options()) | filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()))]); /* are we already on the merge list? */ @@ -436,7 +438,8 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T q = std::make_pair(d->_imp->merge_list_index.begin(), d->_imp->merge_list_index.end()); MergeListIndex::iterator qq(std::find_if(q.first, q.second, - MatchDepListEntryAgainstPackageDepSpec(d->_imp->env, *node.spec(), d->_imp->opts->match_package_options()))); + MatchDepListEntryAgainstPackageDepSpec(d->_imp->env, *node.spec(), + d->_imp->current_package_id(), d->_imp->opts->match_package_options()))); MergeList::iterator existing_merge_list_entry(qq == q.second ? d->_imp->merge_list.end() : qq->second); if (existing_merge_list_entry != d->_imp->merge_list.end()) @@ -484,7 +487,8 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T /* find installable candidates, and find the best visible candidate */ std::shared_ptr<const PackageID> best_visible_candidate; std::shared_ptr<const PackageIDSequence> installable_candidates( - (*d->_imp->env)[selection::AllVersionsSorted(generator::Matches(*node.spec(), d->_imp->opts->match_package_options()) & + (*d->_imp->env)[selection::AllVersionsSorted(generator::Matches(*node.spec(), + d->_imp->current_package_id(), d->_imp->opts->match_package_options()) & generator::SomeIDsMightSupportAction<InstallAction>())]); for (PackageIDSequence::ReverseConstIterator p(installable_candidates->rbegin()), @@ -582,17 +586,18 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T if (already_installed->empty() || ! can_fall_back) { if (! node.spec()->additional_requirements_ptr()) - throw AllMaskedError(*node.spec()); + throw AllMaskedError(*node.spec(), d->_imp->current_package_id()); std::shared_ptr<const PackageIDSequence> match_except_reqs((*d->_imp->env)[selection::AllVersionsSorted( - generator::Matches(*node.spec(), d->_imp->opts->match_package_options() + mpo_ignore_additional_requirements))]); + generator::Matches(*node.spec(), d->_imp->current_package_id(), + d->_imp->opts->match_package_options() + mpo_ignore_additional_requirements))]); for (PackageIDSequence::ReverseConstIterator i(match_except_reqs->rbegin()), i_end(match_except_reqs->rend()) ; i != i_end ; ++i) if (! (*i)->masked()) throw AdditionalRequirementsNotMetError(*node.spec(), *i); - throw AllMaskedError(*node.spec()); + throw AllMaskedError(*node.spec(), d->_imp->current_package_id()); } else { @@ -868,10 +873,10 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ PackageDepSpec just_package(make_package_dep_spec({ }).package( *node.spec()->blocking().package_ptr())); already_installed = (*d->_imp->env)[selection::AllVersionsUnsorted( - generator::Matches(just_package, d->_imp->opts->match_package_options()) | + generator::Matches(just_package, make_null_shared_ptr(), d->_imp->opts->match_package_options()) | filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()))]; - MatchDepListEntryAgainstPackageDepSpec m(d->_imp->env, just_package, d->_imp->opts->match_package_options()); + MatchDepListEntryAgainstPackageDepSpec m(d->_imp->env, just_package, make_null_shared_ptr(), d->_imp->opts->match_package_options()); for (std::pair<MergeListIndex::const_iterator, MergeListIndex::const_iterator> p( d->_imp->merge_list_index.equal_range(*node.spec()->blocking().package_ptr())) ; p.first != p.second ; ++p.first) @@ -904,7 +909,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ for (PackageIDSequence::ConstIterator aa(already_installed->begin()), aa_end(already_installed->end()) ; aa != aa_end ; ++aa) { - if (! match_package(*d->_imp->env, node.spec()->blocking(), *aa, d->_imp->opts->match_package_options())) + if (! match_package(*d->_imp->env, node.spec()->blocking(), *aa, d->_imp->current_package_id(), d->_imp->opts->match_package_options())) continue; bool replaced(false); @@ -974,7 +979,8 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ for (std::list<MergeList::const_iterator>::const_iterator r(will_be_installed.begin()), r_end(will_be_installed.end()) ; r != r_end ; ++r) { - if (! match_package(*d->_imp->env, node.spec()->blocking(), (*r)->package_id(), d->_imp->opts->match_package_options())) + if (! match_package(*d->_imp->env, node.spec()->blocking(), (*r)->package_id(), + d->_imp->current_package_id(), d->_imp->opts->match_package_options())) continue; /* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking @@ -1011,7 +1017,8 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ for (MergeList::const_iterator r(d->_imp->merge_list.begin()), r_end(d->_imp->merge_list.end()) ; r != r_end ; ++r) { - if (! match_package(*d->_imp->env, node.spec()->blocking(), r->package_id(), d->_imp->opts->match_package_options())) + if (! match_package(*d->_imp->env, node.spec()->blocking(), r->package_id(), + d->_imp->current_package_id(), d->_imp->opts->match_package_options())) continue; /* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking @@ -1171,7 +1178,7 @@ DepList::add_package(const std::shared_ptr<const PackageID> & p, const std::shar /* add provides */ if (p->provide_key()) { - DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->env, _imp->current_package_id()); + DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->env, p); p->provide_key()->value()->top()->accept(f); if (f.begin() != f.end() && ! (*DistributionData::get_instance()->distribution_from_string( @@ -1195,7 +1202,7 @@ DepList::add_package(const std::shared_ptr<const PackageID> & p, const std::shar z = std::make_pair(_imp->merge_list_index.begin(), _imp->merge_list_index.end()); MergeListIndex::iterator zz(std::find_if(z.first, z.second, - MatchDepListEntryAgainstPackageDepSpec(_imp->env, *pp, _imp->opts->match_package_options()))); + MatchDepListEntryAgainstPackageDepSpec(_imp->env, *pp, p, _imp->opts->match_package_options()))); if (zz != z.second) continue; @@ -1708,7 +1715,7 @@ DepList::replaced(const PackageID & m) const PackageDepSpec spec(make_package_dep_spec({ }).package(m.name())); while (p.second != ((p.first = std::find_if(p.first, p.second, - MatchDepListEntryAgainstPackageDepSpec(_imp->env, spec, _imp->opts->match_package_options()))))) + MatchDepListEntryAgainstPackageDepSpec(_imp->env, spec, make_null_shared_ptr(), _imp->opts->match_package_options()))))) { if (! slot_is_same(*p.first->second->package_id(), m)) p.first = next(p.first); @@ -1720,7 +1727,7 @@ DepList::replaced(const PackageID & m) const } bool -DepList::match_on_list(const PackageDepSpec & a) const +DepList::match_on_list(const PackageDepSpec & a, const std::shared_ptr<const PackageID> & from_id) const { std::pair<MergeListIndex::const_iterator, MergeListIndex::const_iterator> p; if (a.package_ptr()) @@ -1729,7 +1736,7 @@ DepList::match_on_list(const PackageDepSpec & a) const p = std::make_pair(_imp->merge_list_index.begin(), _imp->merge_list_index.end()); return p.second != std::find_if(p.first, p.second, - MatchDepListEntryAgainstPackageDepSpec(_imp->env, a, _imp->opts->match_package_options())); + MatchDepListEntryAgainstPackageDepSpec(_imp->env, a, from_id, _imp->opts->match_package_options())); } DepList::Iterator diff --git a/paludis/legacy/dep_list.hh b/paludis/legacy/dep_list.hh index 036d977d2..ed3bed494 100644 --- a/paludis/legacy/dep_list.hh +++ b/paludis/legacy/dep_list.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 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 @@ -295,7 +295,7 @@ namespace paludis /** * Return whether a spec matches an item in the list. */ - bool match_on_list(const PackageDepSpec &) const; + bool match_on_list(const PackageDepSpec &, const std::shared_ptr<const PackageID> & from_id) const; /** * Whether we have any errors. diff --git a/paludis/legacy/dep_list_exceptions.cc b/paludis/legacy/dep_list_exceptions.cc index f2dd9bdc4..55af89d02 100644 --- a/paludis/legacy/dep_list_exceptions.cc +++ b/paludis/legacy/dep_list_exceptions.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 2008, 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 @@ -28,9 +28,10 @@ DepListError::DepListError(const std::string & m) throw () : { } -AllMaskedError::AllMaskedError(const PackageDepSpec & q) throw () : +AllMaskedError::AllMaskedError(const PackageDepSpec & q, const std::shared_ptr<const PackageID> & i) throw () : DepListError("Error searching for '" + stringify(q) + "': no available versions"), - _query(q) + _query(q), + _from_id(i) { } diff --git a/paludis/legacy/dep_list_exceptions.hh b/paludis/legacy/dep_list_exceptions.hh index e1e84054f..7552602e0 100644 --- a/paludis/legacy/dep_list_exceptions.hh +++ b/paludis/legacy/dep_list_exceptions.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 2008, 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 @@ -65,12 +65,13 @@ namespace paludis { private: const PackageDepSpec _query; + const std::shared_ptr<const PackageID> _from_id; public: ///\name Basic operations ///\{ - AllMaskedError(const PackageDepSpec & query) throw (); + AllMaskedError(const PackageDepSpec & query, const std::shared_ptr<const PackageID> & id) throw (); virtual ~AllMaskedError() throw () { @@ -85,6 +86,11 @@ namespace paludis { return _query; } + + const std::shared_ptr<const PackageID> from_id() const + { + return _from_id; + } }; /** diff --git a/paludis/legacy/install_task.cc b/paludis/legacy/install_task.cc index 9476bc366..3cd20133e 100644 --- a/paludis/legacy/install_task.cc +++ b/paludis/legacy/install_task.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -252,7 +252,7 @@ namespace return std::make_shared<DepListEntryHandledSkippedDependent>( *(*env)[selection::RequireExactlyOne(generator::Matches( parse_user_package_dep_spec(s.substr(1), env, - { }), { }))]->begin()); + { }), make_null_shared_ptr(), { }))]->begin()); case 'F': if (s.length() != 1) @@ -299,7 +299,7 @@ InstallTask::set_targets_from_serialisation(const std::string & format, throw InternalError(PALUDIS_HERE, "Serialised value '" + *s + "' too short: no package_id"); const std::shared_ptr<const PackageID> package_id(*(*_imp->env)[selection::RequireExactlyOne( generator::Matches(parse_user_package_dep_spec(*tokens.begin(), - _imp->env, { }), { }))]->begin()); + _imp->env, { }), make_null_shared_ptr(), { }))]->begin()); tokens.pop_front(); if (tokens.empty()) @@ -504,7 +504,7 @@ InstallTask::_add_target(const std::string & target) else { std::shared_ptr<const PackageIDSequence> names((*_imp->env)[selection::BestVersionOnly( - generator::Matches(*spec, { }) | filter::SupportsAction<InstallAction>())]); + generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>())]); if (names->empty()) { @@ -1538,7 +1538,7 @@ namespace void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node) { if (! failure) - if ((*env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) + if ((*env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), id, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]->empty()) failure = node.spec(); } @@ -1728,7 +1728,7 @@ namespace if (! d->handled()) continue; - if (! match_package(*env, *node.spec(), d->package_id(), { })) + if (! match_package(*env, *node.spec(), d->package_id(), id, { })) continue; CheckHandledVisitor v; @@ -1743,7 +1743,7 @@ namespace /* no match on the dep list, fall back to installed packages. if * there are no matches here it's not a problem because of or-deps. */ std::shared_ptr<const PackageIDSequence> installed((*env)[selection::AllVersionsUnsorted( - generator::Matches(*node.spec(), { }) | + generator::Matches(*node.spec(), id, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); for (PackageIDSequence::ConstIterator i(installed->begin()), i_end(installed->end()) ; diff --git a/paludis/legacy/query_visitor.cc b/paludis/legacy/query_visitor.cc index 0ddec62a6..b63c9d905 100644 --- a/paludis/legacy/query_visitor.cc +++ b/paludis/legacy/query_visitor.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 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 @@ -91,7 +91,7 @@ QueryVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & n // TODO: check destinations std::shared_ptr<const PackageIDSequence> matches((*_imp->environment)[selection::AllVersionsUnsorted( - generator::Matches(*node.spec(), _imp->dep_list->options()->match_package_options()) | + generator::Matches(*node.spec(), _imp->id, _imp->dep_list->options()->match_package_options()) | filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]); if (indirect_iterator(matches->end()) != std::find_if(indirect_iterator(matches->begin()), indirect_iterator(matches->end()), @@ -102,7 +102,7 @@ QueryVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & n } /* check the merge list for any new packages that match */ - if (_imp->dep_list->match_on_list(*node.spec())) + if (_imp->dep_list->match_on_list(*node.spec(), _imp->id)) { _imp->result = true; return; diff --git a/paludis/legacy/report_task.cc b/paludis/legacy/report_task.cc index 4924b5511..289348df2 100644 --- a/paludis/legacy/report_task.cc +++ b/paludis/legacy/report_task.cc @@ -36,6 +36,7 @@ #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/accept_visitor.hh> #include <paludis/util/sequence.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/package_database.hh> #include <paludis/version_requirements.hh> #include <paludis/partially_made_package_dep_spec.hh> @@ -104,7 +105,7 @@ namespace VulnerableChecker::visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node) { std::shared_ptr<const PackageIDSequence> insecure(_env[selection::AllVersionsSorted( - generator::Matches(*node.spec(), { }))]); + generator::Matches(*node.spec(), make_null_shared_ptr(), { }))]); for (PackageIDSequence::ConstIterator i(insecure->begin()), i_end(insecure->end()) ; i != i_end ; ++i) if (node.spec()->tag() && simple_visitor_cast<const GLSADepTag>(*node.spec()->tag())) @@ -217,7 +218,7 @@ ReportTask::execute() .version_requirement(make_named_values<VersionRequirement>( n::version_operator() = vo_equal, n::version_spec() = (*v)->version())), - { })) | + make_null_shared_ptr(), { })) | filter::SupportsAction<InstallAction>()))]); if (! installable->empty()) diff --git a/paludis/legacy/show_suggest_visitor.cc b/paludis/legacy/show_suggest_visitor.cc index fa53eccb1..88ee5eb78 100644 --- a/paludis/legacy/show_suggest_visitor.cc +++ b/paludis/legacy/show_suggest_visitor.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 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 @@ -191,7 +191,7 @@ ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Ty } std::shared_ptr<const PackageIDSequence> installed_matches((*_imp->environment)[selection::AllVersionsSorted( - generator::Matches(*node.spec(), _imp->dep_list->options()->match_package_options()) + generator::Matches(*node.spec(), _imp->id, _imp->dep_list->options()->match_package_options()) | filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]); if (! installed_matches->empty()) { @@ -203,7 +203,7 @@ ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Ty } std::shared_ptr<const PackageIDSequence> matches((*_imp->environment)[selection::AllVersionsSorted( - generator::Matches(*node.spec(), _imp->dep_list->options()->match_package_options()) + generator::Matches(*node.spec(), _imp->id, _imp->dep_list->options()->match_package_options()) | filter::SupportsAction<InstallAction>())]); if (matches->empty()) { diff --git a/paludis/legacy/uninstall_list.cc b/paludis/legacy/uninstall_list.cc index 4ec04cff9..305f16aec 100644 --- a/paludis/legacy/uninstall_list.cc +++ b/paludis/legacy/uninstall_list.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -183,7 +183,7 @@ UninstallList::add_errors_for_system() v != v_end && ! needed ; ++v) { const std::shared_ptr<const PackageIDSequence> virtuals((*_imp->env)[selection::AllVersionsUnsorted( - generator::Matches(**v, { }))]); + generator::Matches(**v, l->package_id(), { }))]); for (PackageIDSequence::ConstIterator i(virtuals->begin()), i_end(virtuals->end()) ; i != i_end && ! needed ; ++i) if (match_package_in_set(*_imp->env, *system, *i, { })) @@ -330,8 +330,8 @@ namespace std::shared_ptr<const PackageIDSequence> m( best_only ? - (*env)[selection::BestVersionOnly(generator::Matches(*node.spec(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))] : - (*env)[selection::AllVersionsSorted(generator::Matches(*node.spec(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + (*env)[selection::BestVersionOnly(generator::Matches(*node.spec(), pkg, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))] : + (*env)[selection::AllVersionsSorted(generator::Matches(*node.spec(), pkg, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); for (PackageIDSequence::ConstIterator it = m->begin(), it_end = m->end(); it_end != it; ++it) matches->insert(make_named_values<DepTagEntry>( diff --git a/paludis/legacy/uninstall_task.cc b/paludis/legacy/uninstall_task.cc index 98bf9efcf..45aa3d37e 100644 --- a/paludis/legacy/uninstall_task.cc +++ b/paludis/legacy/uninstall_task.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -179,7 +179,7 @@ UninstallTask::add_target(const std::string & target) { /* blech. wildcards. */ std::shared_ptr<const PackageIDSequence> names((*_imp->env)[selection::BestVersionOnly( - generator::Matches(*pds, { }) | filter::SupportsAction<UninstallAction>())]); + generator::Matches(*pds, make_null_shared_ptr(), { }) | filter::SupportsAction<UninstallAction>())]); if (names->empty()) { /* no match. we'll get an error from this later anyway. */ @@ -263,7 +263,7 @@ UninstallTask::execute() Context local_context("When looking for target '" + stringify(**t) + "':"); std::shared_ptr<const PackageIDSequence> r((*_imp->env)[selection::AllVersionsSorted( - generator::Matches(**t, { }) | + generator::Matches(**t, make_null_shared_ptr(), { }) | filter::SupportsAction<UninstallAction>())]); if (r->empty()) { @@ -331,7 +331,7 @@ UninstallTask::execute() { bool remove(true); std::shared_ptr<const PackageIDSequence> installed((*_imp->env)[selection::AllVersionsUnsorted( - generator::Matches(make_package_dep_spec({ }).package(i->first), { }) | + generator::Matches(make_package_dep_spec({ }).package(i->first), make_null_shared_ptr(), { }) | filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()) )]); for (PackageIDSequence::ConstIterator r(installed->begin()), r_end(installed->end()) ; diff --git a/paludis/match_package.cc b/paludis/match_package.cc index 0bc470bdf..ef0141346 100644 --- a/paludis/match_package.cc +++ b/paludis/match_package.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -35,6 +35,7 @@ #include <paludis/additional_package_dep_spec_requirement.hh> #include <paludis/util/indirect_iterator-impl.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <functional> #include <algorithm> @@ -81,6 +82,7 @@ paludis::match_package_with_maybe_changes( const PackageDepSpec & spec, const ChangedChoices * const maybe_changes_to_owner, const std::shared_ptr<const PackageID> & id, + const std::shared_ptr<const PackageID> &, const ChangedChoices * const maybe_changes_to_target, const MatchPackageOptions & options) { @@ -219,9 +221,10 @@ paludis::match_package( const Environment & env, const PackageDepSpec & spec, const std::shared_ptr<const PackageID> & id, + const std::shared_ptr<const PackageID> & from_id, const MatchPackageOptions & options) { - return match_package_with_maybe_changes(env, spec, 0, id, 0, options); + return match_package_with_maybe_changes(env, spec, 0, id, from_id, 0, options); } bool @@ -237,6 +240,6 @@ paludis::match_package_in_set( target.top()->accept(f); return indirect_iterator(f.end()) != std::find_if( indirect_iterator(f.begin()), indirect_iterator(f.end()), - std::bind(&match_package, std::cref(env), _1, std::cref(id), std::cref(options))); + std::bind(&match_package, std::cref(env), _1, std::cref(id), make_null_shared_ptr(), std::cref(options))); } diff --git a/paludis/match_package.hh b/paludis/match_package.hh index f1a67ed04..992ef1648 100644 --- a/paludis/match_package.hh +++ b/paludis/match_package.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2008, 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 @@ -44,12 +44,18 @@ namespace paludis * Return whether the specified PackageID matches the specified * PackageDepSpec. * + * \param spec_id The PackageID the spec comes from. May be null. Used for + * [use=] style dependencies. + * + * \since 0.58 takes spec_id + * * \ingroup g_query */ bool match_package( const Environment & env, const PackageDepSpec & spec, const std::shared_ptr<const PackageID> & id, + const std::shared_ptr<const PackageID> & spec_id, const MatchPackageOptions & options) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE; @@ -58,6 +64,11 @@ namespace paludis * PackageDepSpec, with the specified ChangedChoices applied to the target * and the ID from which the dep came. * + * \param spec_id The PackageID the spec comes from. May be null. Used for + * [use=] style dependencies. + * + * \since 0.58 takes spec_id + * * \ingroup g_query * \since 0.51 */ @@ -66,6 +77,7 @@ namespace paludis const PackageDepSpec & spec, const ChangedChoices * const maybe_changes_to_owner, const std::shared_ptr<const PackageID> & id, + const std::shared_ptr<const PackageID> & spec_id, const ChangedChoices * const maybe_changes_to_target, const MatchPackageOptions & options) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE; diff --git a/paludis/package_database.cc b/paludis/package_database.cc index 17e978b88..2a239dfb0 100644 --- a/paludis/package_database.cc +++ b/paludis/package_database.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 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 @@ -42,6 +42,7 @@ #include <paludis/util/sequence-impl.hh> #include <paludis/util/wrapped_forward_iterator-impl.hh> #include <paludis/util/member_iterator.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <functional> #include <algorithm> #include <list> @@ -279,7 +280,7 @@ PackageDatabase::fetch_unique_qualified_package_name(const PackageNamePart & p, std::set<std::pair<CategoryNamePart, RepositoryName>, CategoryRepositoryNamePairComparator> checked; std::shared_ptr<const PackageIDSequence> pkgs((*_imp->environment)[selection::AllVersionsUnsorted( - generator::Matches(make_package_dep_spec({ }).package_name_part(p), { }) | f)]); + generator::Matches(make_package_dep_spec({ }).package_name_part(p), make_null_shared_ptr(), { }) | f)]); for (IndirectIterator<PackageIDSequence::ConstIterator> it(pkgs->begin()), it_end(pkgs->end()); it_end != it; ++it) diff --git a/paludis/package_dep_spec_collection.cc b/paludis/package_dep_spec_collection.cc index b18247281..73e08876a 100644 --- a/paludis/package_dep_spec_collection.cc +++ b/paludis/package_dep_spec_collection.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,13 +32,19 @@ namespace paludis template <> struct Imp<PackageDepSpecCollection> { + const std::shared_ptr<const PackageID> from_id; std::multimap<QualifiedPackageName, PackageDepSpec> by_name; std::list<PackageDepSpec> unnamed; + + Imp(const std::shared_ptr<const PackageID> & i) : + from_id(i) + { + } }; } -PackageDepSpecCollection::PackageDepSpecCollection() : - Pimp<PackageDepSpecCollection>() +PackageDepSpecCollection::PackageDepSpecCollection(const std::shared_ptr<const PackageID> & i) : + Pimp<PackageDepSpecCollection>(i) { } @@ -61,12 +67,12 @@ PackageDepSpecCollection::match_any( { auto named(_imp->by_name.equal_range(id->name())); for ( ; named.first != named.second ; ++named.first) - if (match_package(*env, named.first->second, id, opts)) + if (match_package(*env, named.first->second, id, _imp->from_id, opts)) return true; for (auto u(_imp->unnamed.begin()), u_end(_imp->unnamed.end()) ; u != u_end ; ++u) - if (match_package(*env, *u, id, opts)) + if (match_package(*env, *u, id, _imp->from_id, opts)) return true; return false; diff --git a/paludis/package_dep_spec_collection.hh b/paludis/package_dep_spec_collection.hh index 7ce3beb2f..673bd334f 100644 --- a/paludis/package_dep_spec_collection.hh +++ b/paludis/package_dep_spec_collection.hh @@ -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 @@ -34,7 +34,7 @@ namespace paludis private Pimp<PackageDepSpecCollection> { public: - PackageDepSpecCollection(); + explicit PackageDepSpecCollection(const std::shared_ptr<const PackageID> & from_id); ~PackageDepSpecCollection(); void insert(const PackageDepSpec &); diff --git a/paludis/paludislike_options_conf.cc b/paludis/paludislike_options_conf.cc index f58b296f4..59fb38d16 100644 --- a/paludis/paludislike_options_conf.cc +++ b/paludis/paludislike_options_conf.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -32,6 +32,7 @@ #include <paludis/util/set.hh> #include <paludis/util/active_object_ptr.hh> #include <paludis/util/deferred_construction_ptr.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/choice.hh> #include <paludis/dep_spec.hh> #include <paludis/name.hh> @@ -426,7 +427,7 @@ namespace { if (maybe_id) { - if (! match_package(*env, i->spec(), maybe_id, { })) + if (! match_package(*env, i->spec(), maybe_id, make_null_shared_ptr(), { })) continue; } else @@ -453,7 +454,7 @@ namespace { if (maybe_id) { - if (! match_package(*env, i->spec(), maybe_id, { })) + if (! match_package(*env, i->spec(), maybe_id, make_null_shared_ptr(), { })) continue; } else diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc index d880933be..471d3acd4 100644 --- a/paludis/repositories/e/e_repository.cc +++ b/paludis/repositories/e/e_repository.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh * Copyright (c) 2006 Danny van Dyk * * This file is part of the Paludis package manager. Paludis is free software; @@ -670,7 +670,7 @@ ERepository::repository_masked(const std::shared_ptr<const PackageID> & id) cons else for (std::list<std::pair<std::shared_ptr<const PackageDepSpec>, std::shared_ptr<const RepositoryMaskInfo> > >::const_iterator k(r->second.begin()), k_end(r->second.end()) ; k != k_end ; ++k) - if (match_package(*_imp->params.environment(), *k->first, id, { })) + if (match_package(*_imp->params.environment(), *k->first, id, make_null_shared_ptr(), { })) return k->second; return std::shared_ptr<const RepositoryMaskInfo>(); diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc index 705970bd4..bdfe329e6 100644 --- a/paludis/repositories/e/e_repository_TEST.cc +++ b/paludis/repositories/e/e_repository_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -33,6 +33,7 @@ #include <paludis/util/set.hh> #include <paludis/util/return_literal_function.hh> #include <paludis/util/fs_stat.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_id.hh> @@ -497,7 +498,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(id1->end_metadata() != id1->find_metadata("EAPI")); TEST_CHECK(simple_visitor_cast<const MetadataValueKey<std::string> >(**id1->find_metadata("EAPI"))); @@ -516,7 +517,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-2", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(id2->end_metadata() != id2->find_metadata("EAPI")); TEST_CHECK(bool(id2->short_description_key())); @@ -532,7 +533,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id3(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-3", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(id3->end_metadata() != id3->find_metadata("EAPI")); TEST_CHECK(bool(id3->short_description_key())); @@ -578,7 +579,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-two-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(id1->end_metadata() != id1->find_metadata("EAPI")); TEST_CHECK_EQUAL(std::static_pointer_cast<const erepository::ERepositoryID>(id1)->eapi()->name(), "UNKNOWN"); @@ -622,13 +623,13 @@ namespace test_cases const std::shared_ptr<const PackageID> p1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); const std::shared_ptr<const PackageID> p2(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-two/pkg-two-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); const std::shared_ptr<const PackageID> p4(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-2", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); test_choice(p1, "flag1", true, true, false); test_choice(p1, "flag2", false, false, true); @@ -709,29 +710,29 @@ namespace test_cases TEST_CHECK((*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=category/package-1::test-repo-18", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); TEST_CHECK((*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=category/package-2::test-repo-18", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); TEST_CHECK(! (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=category/package-3::test-repo-18", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); TEST_CHECK(! (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=category/package-4::test-repo-18", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); TEST_CHECK((*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=category/package-1::test-repo-19", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); TEST_CHECK(! (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=category/package-2::test-repo-19", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); TEST_CHECK((*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=category/package-3::test-repo-19", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); TEST_CHECK(! (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=category/package-4::test-repo-19", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); } } test_e_repository_repository_masks; @@ -759,13 +760,13 @@ namespace test_cases TEST_CHECK((*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/masked-0", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); TEST_CHECK(! (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/was_masked-0", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); TEST_CHECK(! (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/not_masked-0", - &env, { })), { }))]->begin())->masked()); + &env, { })), make_null_shared_ptr(), { }))]->begin())->masked()); } } } test_e_repository_query_profile_masks; @@ -944,7 +945,7 @@ namespace test_cases TestMessageSuffix suffix("no files", true); const std::shared_ptr<const PackageID> no_files_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/no-files", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(no_files_id)); TEST_CHECK(bool(no_files_id->short_description_key())); TEST_CHECK_EQUAL(no_files_id->short_description_key()->value(), "The Short Description"); @@ -955,7 +956,7 @@ namespace test_cases TestMessageSuffix suffix("fetched files", true); const std::shared_ptr<const PackageID> fetched_files_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/fetched-files", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(fetched_files_id)); TEST_CHECK((FSPath("e_repository_TEST_dir") / "distdir" / "already-fetched.txt").stat().is_regular_file()); fetched_files_id->perform_action(action); @@ -967,7 +968,7 @@ namespace test_cases TEST_CHECK(! (FSPath("e_repository_TEST_dir") / "distdir" / "fetchable-1.txt").stat().is_regular_file()); const std::shared_ptr<const PackageID> fetchable_files_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/fetchable-files", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(fetchable_files_id)); fetchable_files_id->perform_action(action); TEST_CHECK((FSPath("e_repository_TEST_dir") / "distdir" / "fetchable-1.txt").stat().is_regular_file()); @@ -978,7 +979,7 @@ namespace test_cases TEST_CHECK(! (FSPath("e_repository_TEST_dir") / "distdir" / "arrowed.txt").stat().is_regular_file()); const std::shared_ptr<const PackageID> arrow_files_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/arrow-files", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(arrow_files_id)); arrow_files_id->perform_action(action); TEST_CHECK((FSPath("e_repository_TEST_dir") / "distdir" / "arrowed.txt").stat().is_regular_file()); @@ -988,7 +989,7 @@ namespace test_cases TestMessageSuffix suffix("unfetchable files", true); const std::shared_ptr<const PackageID> unfetchable_files_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/unfetchable-files", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(unfetchable_files_id)); TEST_CHECK_THROWS(unfetchable_files_id->perform_action(action), ActionFailedError); } @@ -996,7 +997,7 @@ namespace test_cases { const std::shared_ptr<const PackageID> no_files_restricted_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/no-files-restricted", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(no_files_restricted_id)); no_files_restricted_id->perform_action(action); } @@ -1004,7 +1005,7 @@ namespace test_cases { const std::shared_ptr<const PackageID> fetched_files_restricted_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/fetched-files-restricted", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(fetched_files_restricted_id)); fetched_files_restricted_id->perform_action(action); } @@ -1012,7 +1013,7 @@ namespace test_cases { const std::shared_ptr<const PackageID> fetchable_files_restricted_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/fetchable-files-restricted", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(fetchable_files_restricted_id)); TEST_CHECK_THROWS(fetchable_files_restricted_id->perform_action(action), ActionFailedError); } @@ -1050,7 +1051,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id(*env[selection::AllVersionsSorted(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("category/package", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); repo->make_manifest(id->name()); 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 bb18821aa..df8e925c2 100644 --- a/paludis/repositories/e/e_repository_TEST_0.cc +++ b/paludis/repositories/e/e_repository_TEST_0.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -30,6 +30,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_id.hh> @@ -159,7 +160,7 @@ namespace test_cases { const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=virtual/virtual-pretend-installed-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); } #endif @@ -168,7 +169,7 @@ namespace test_cases TestMessageSuffix suffix("in-ebuild die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/in-ebuild-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -177,7 +178,7 @@ namespace test_cases TestMessageSuffix suffix("in-subshell die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/in-subshell-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -186,7 +187,7 @@ namespace test_cases TestMessageSuffix suffix("success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -195,7 +196,7 @@ namespace test_cases TestMessageSuffix suffix("unpack die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/unpack-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -204,7 +205,7 @@ namespace test_cases TestMessageSuffix suffix("econf die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/econf-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -213,7 +214,7 @@ namespace test_cases TestMessageSuffix suffix("emake fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/emake-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -222,7 +223,7 @@ namespace test_cases TestMessageSuffix suffix("emake die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/emake-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -231,7 +232,7 @@ namespace test_cases TestMessageSuffix suffix("einstall die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/einstall-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -240,7 +241,7 @@ namespace test_cases TestMessageSuffix suffix("keepdir die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/keepdir-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -249,7 +250,7 @@ namespace test_cases TestMessageSuffix suffix("dobin fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/dobin-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -258,7 +259,7 @@ namespace test_cases TestMessageSuffix suffix("dobin die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/dobin-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -267,7 +268,7 @@ namespace test_cases TestMessageSuffix suffix("fperms fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/fperms-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -276,7 +277,7 @@ namespace test_cases TestMessageSuffix suffix("fperms die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/fperms-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -285,7 +286,7 @@ namespace test_cases TestMessageSuffix suffix("econf source 0", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0"); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); @@ -295,7 +296,7 @@ namespace test_cases TestMessageSuffix suffix("doman 0", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/doman-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0"); id->perform_action(action); @@ -305,7 +306,7 @@ namespace test_cases TestMessageSuffix suffix("no src_prepare 0", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0"); id->perform_action(action); @@ -315,7 +316,7 @@ namespace test_cases TestMessageSuffix suffix("no src_configure 0", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0"); id->perform_action(action); @@ -325,7 +326,7 @@ namespace test_cases TestMessageSuffix suffix("best version", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/best-version-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -334,7 +335,7 @@ namespace test_cases TestMessageSuffix suffix("has version", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/has-version-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -343,7 +344,7 @@ namespace test_cases TestMessageSuffix suffix("match", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/match-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -352,7 +353,7 @@ namespace test_cases TestMessageSuffix suffix("vars", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/vars-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -361,7 +362,7 @@ namespace test_cases TestMessageSuffix suffix("expand vars", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/expand-vars-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -370,7 +371,7 @@ namespace test_cases TestMessageSuffix suffix("econf disable dependency tracking", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0"); 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 c786c2024..45a7094b9 100644 --- a/paludis/repositories/e/e_repository_TEST_1.cc +++ b/paludis/repositories/e/e_repository_TEST_1.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -30,6 +30,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_id.hh> @@ -138,7 +139,7 @@ namespace test_cases TestMessageSuffix suffix("econf source 1", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-1", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1"); id->perform_action(action); @@ -148,7 +149,7 @@ namespace test_cases TestMessageSuffix suffix("dosym success 1", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/dosym-success-1", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1"); id->perform_action(action); @@ -158,7 +159,7 @@ namespace test_cases TestMessageSuffix suffix("doman 1", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/doman-1", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1"); id->perform_action(action); @@ -168,7 +169,7 @@ namespace test_cases TestMessageSuffix suffix("no src_prepare 1", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-1", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1"); id->perform_action(action); @@ -178,7 +179,7 @@ namespace test_cases TestMessageSuffix suffix("no src_configure 1", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-1", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1"); 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 768ff8072..c3484d74c 100644 --- a/paludis/repositories/e/e_repository_TEST_2.cc +++ b/paludis/repositories/e/e_repository_TEST_2.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -30,6 +30,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_id.hh> @@ -138,7 +139,7 @@ namespace test_cases TestMessageSuffix suffix("econf source 2", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-2", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2"); id->perform_action(action); @@ -148,7 +149,7 @@ namespace test_cases TestMessageSuffix suffix("doman 2", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/doman-2", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2"); id->perform_action(action); @@ -158,7 +159,7 @@ namespace test_cases TestMessageSuffix suffix("src_prepare 2", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-2", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2"); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); @@ -168,7 +169,7 @@ namespace test_cases TestMessageSuffix suffix("src_configure 2", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-2", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2"); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); @@ -178,7 +179,7 @@ namespace test_cases TestMessageSuffix suffix("default src_configure 2", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_configure-2", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2"); id->perform_action(action); @@ -188,7 +189,7 @@ namespace test_cases TestMessageSuffix suffix("default src_compile 2", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_compile-2", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2"); id->perform_action(action); @@ -198,7 +199,7 @@ namespace test_cases TestMessageSuffix suffix("default_src_compile 2", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_compile-2", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2"); id->perform_action(action); @@ -208,7 +209,7 @@ namespace test_cases TestMessageSuffix suffix("src_compile via default function 2", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/src_compile-via-default-func-2", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2"); 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 46942563e..aae03fe74 100644 --- a/paludis/repositories/e/e_repository_TEST_3.cc +++ b/paludis/repositories/e/e_repository_TEST_3.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -30,6 +30,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_id.hh> @@ -138,7 +139,7 @@ namespace test_cases TestMessageSuffix suffix("prefix", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/prefix-3", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3"); 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 b720681a3..4606a4379 100644 --- a/paludis/repositories/e/e_repository_TEST_4.cc +++ b/paludis/repositories/e/e_repository_TEST_4.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -31,6 +31,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_id.hh> @@ -145,7 +146,7 @@ namespace test_cases TestMessageSuffix suffix("pkg_pretend", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -156,7 +157,7 @@ namespace test_cases TestMessageSuffix suffix("pkg_pretend-failure", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-failure-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -167,7 +168,7 @@ namespace test_cases TestMessageSuffix suffix("default_src_install 4", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_install-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(action); @@ -177,7 +178,7 @@ namespace test_cases TestMessageSuffix suffix("docompress 4", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/docompress-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(action); @@ -187,7 +188,7 @@ namespace test_cases TestMessageSuffix suffix("dodoc -r", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/dodoc-r-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(action); @@ -197,7 +198,7 @@ namespace test_cases TestMessageSuffix suffix("doins symlink", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/doins-symlink-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(action); @@ -207,7 +208,7 @@ namespace test_cases TestMessageSuffix suffix("banned functions 4", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/banned-functions-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); @@ -217,7 +218,7 @@ namespace test_cases TestMessageSuffix suffix("econf disable dependency tracking", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(action); @@ -227,7 +228,7 @@ namespace test_cases TestMessageSuffix suffix("global scope use", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/global-scope-use-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(action); @@ -237,7 +238,7 @@ namespace test_cases TestMessageSuffix suffix("doman 4", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/doman-4", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(action); @@ -303,7 +304,7 @@ namespace test_cases TestMessageSuffix suffix("merge type source", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/merge-type-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(action); @@ -390,7 +391,7 @@ namespace test_cases TestMessageSuffix suffix("merge type buildonly", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/merge-type-bin-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(action); @@ -409,7 +410,7 @@ namespace test_cases TestMessageSuffix suffix("merge type binary", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/merge-type-bin-4::binrepo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "pbin-1+4"); id->perform_action(action); @@ -472,7 +473,7 @@ namespace test_cases TestMessageSuffix suffix("all good", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-all-good-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -489,7 +490,7 @@ namespace test_cases TestMessageSuffix suffix("all empty", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-all-empty-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -506,7 +507,7 @@ namespace test_cases TestMessageSuffix suffix("all one not good", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-all-one-not-good-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -523,7 +524,7 @@ namespace test_cases TestMessageSuffix suffix("any good", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-any-good-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -540,7 +541,7 @@ namespace test_cases TestMessageSuffix suffix("any empty", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-any-empty-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -557,7 +558,7 @@ namespace test_cases TestMessageSuffix suffix("any none", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-any-none-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -574,7 +575,7 @@ namespace test_cases TestMessageSuffix suffix("one none", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-one-none-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -591,7 +592,7 @@ namespace test_cases TestMessageSuffix suffix("one none", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-one-none-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); @@ -608,7 +609,7 @@ namespace test_cases TestMessageSuffix suffix("one good", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/required-use-one-good-4::test-repo", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4"); id->perform_action(pretend_action); diff --git a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc b/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc index b07f79ef9..5fd479cde 100644 --- a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc +++ b/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -31,6 +31,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_id.hh> @@ -106,7 +107,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("category/package", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); UnformattedPrettyPrinter ff; diff --git a/paludis/repositories/e/e_repository_TEST_ever.cc b/paludis/repositories/e/e_repository_TEST_ever.cc index 1d0f418ee..40711ced3 100644 --- a/paludis/repositories/e/e_repository_TEST_ever.cc +++ b/paludis/repositories/e/e_repository_TEST_ever.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 @@ -30,6 +30,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/output_manager.hh> #include <paludis/standard_output_manager.hh> #include <paludis/package_id.hh> @@ -158,7 +159,7 @@ namespace const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/" + test, - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } diff --git a/paludis/repositories/e/e_repository_TEST_exheres_0.cc b/paludis/repositories/e/e_repository_TEST_exheres_0.cc index 8025b46ed..0772d3b4d 100644 --- a/paludis/repositories/e/e_repository_TEST_exheres_0.cc +++ b/paludis/repositories/e/e_repository_TEST_exheres_0.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -30,6 +30,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_id.hh> @@ -157,7 +158,7 @@ namespace test_cases TestMessageSuffix suffix("in-ebuild die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/in-ebuild-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -166,7 +167,7 @@ namespace test_cases TestMessageSuffix suffix("in-subshell die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/in-subshell-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -175,7 +176,7 @@ namespace test_cases TestMessageSuffix suffix("success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -184,7 +185,7 @@ namespace test_cases TestMessageSuffix suffix("expatch success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/expatch-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -193,7 +194,7 @@ namespace test_cases TestMessageSuffix suffix("expatch success-dir", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/expatch-success-dir", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -202,7 +203,7 @@ namespace test_cases TestMessageSuffix suffix("expatch die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/expatch-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -211,7 +212,7 @@ namespace test_cases TestMessageSuffix suffix("expatch unrecognised", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/expatch-unrecognised", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -220,7 +221,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal expatch fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-expatch-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -229,7 +230,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal expatch die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-expatch-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -238,7 +239,7 @@ namespace test_cases TestMessageSuffix suffix("unpack die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/unpack-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -247,7 +248,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal unpack fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-unpack-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -256,7 +257,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal unpack die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-unpack-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -265,7 +266,7 @@ namespace test_cases TestMessageSuffix suffix("econf fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/econf-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -274,7 +275,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal econf", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-econf", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -283,7 +284,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal econf die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-econf-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -292,7 +293,7 @@ namespace test_cases TestMessageSuffix suffix("emake fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/emake-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -301,7 +302,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal emake", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-emake", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -310,7 +311,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal emake die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-emake-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -319,7 +320,7 @@ namespace test_cases TestMessageSuffix suffix("einstall fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/einstall-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -328,7 +329,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal einstall", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-einstall", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -337,7 +338,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal einstall die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-einstall-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -346,7 +347,7 @@ namespace test_cases TestMessageSuffix suffix("keepdir success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/keepdir-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -355,7 +356,7 @@ namespace test_cases TestMessageSuffix suffix("keepdir fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/keepdir-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -364,7 +365,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal keepdir", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-keepdir", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -373,7 +374,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal keepdir die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-keepdir-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -382,7 +383,7 @@ namespace test_cases TestMessageSuffix suffix("dobin success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/dobin-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -391,7 +392,7 @@ namespace test_cases TestMessageSuffix suffix("dobin fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/dobin-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -400,7 +401,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal dobin success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-dobin-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -409,7 +410,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal dobin fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-dobin-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -418,7 +419,7 @@ namespace test_cases TestMessageSuffix suffix("nonfatal dobin die", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/nonfatal-dobin-die", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -427,7 +428,7 @@ namespace test_cases TestMessageSuffix suffix("herebin success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/herebin-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -436,7 +437,7 @@ namespace test_cases TestMessageSuffix suffix("herebin fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/herebin-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -445,7 +446,7 @@ namespace test_cases TestMessageSuffix suffix("hereconfd success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/hereconfd-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -454,7 +455,7 @@ namespace test_cases TestMessageSuffix suffix("hereconfd fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/hereconfd-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -463,7 +464,7 @@ namespace test_cases TestMessageSuffix suffix("hereenvd success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/hereenvd-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -472,7 +473,7 @@ namespace test_cases TestMessageSuffix suffix("hereenvd fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/hereenvd-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -481,7 +482,7 @@ namespace test_cases TestMessageSuffix suffix("hereinitd success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/hereinitd-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -490,7 +491,7 @@ namespace test_cases TestMessageSuffix suffix("hereinitd fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/hereinitd-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -499,7 +500,7 @@ namespace test_cases TestMessageSuffix suffix("hereins success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/hereins-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -508,7 +509,7 @@ namespace test_cases TestMessageSuffix suffix("hereins fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/hereins-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -517,7 +518,7 @@ namespace test_cases TestMessageSuffix suffix("heresbin success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/heresbin-success", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -526,7 +527,7 @@ namespace test_cases TestMessageSuffix suffix("heresbin fail", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/heresbin-fail", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -535,7 +536,7 @@ namespace test_cases TestMessageSuffix suffix("best version", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/best-version-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -544,7 +545,7 @@ namespace test_cases TestMessageSuffix suffix("has version", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/has-version-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -553,7 +554,7 @@ namespace test_cases TestMessageSuffix suffix("match", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/match-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -562,7 +563,7 @@ namespace test_cases TestMessageSuffix suffix("econf phase", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/econf-phase-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -571,7 +572,7 @@ namespace test_cases TestMessageSuffix suffix("econf vars", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/econf-vars-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -580,7 +581,7 @@ namespace test_cases TestMessageSuffix suffix("expand vars", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/expand-vars-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -589,7 +590,7 @@ namespace test_cases TestMessageSuffix suffix("doman success", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/doman-success-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -598,7 +599,7 @@ namespace test_cases TestMessageSuffix suffix("doman nofatal", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/doman-nonfatal-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -607,7 +608,7 @@ namespace test_cases TestMessageSuffix suffix("doman failure", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/doman-failure-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -616,7 +617,7 @@ namespace test_cases TestMessageSuffix suffix("change globals", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/change-globals-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -625,7 +626,7 @@ namespace test_cases TestMessageSuffix suffix("install", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/install-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); } @@ -634,7 +635,7 @@ namespace test_cases TestMessageSuffix suffix("install s", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/install-s-0", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } @@ -643,7 +644,7 @@ namespace test_cases TestMessageSuffix suffix("global optionq", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/global-optionq-1", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError); } diff --git a/paludis/repositories/e/e_repository_TEST_exlibs.cc b/paludis/repositories/e/e_repository_TEST_exlibs.cc index 10ad171cf..1cc63723a 100644 --- a/paludis/repositories/e/e_repository_TEST_exlibs.cc +++ b/paludis/repositories/e/e_repository_TEST_exlibs.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 * Copyright (c) 2009 Bo Ørsted Andresen * * This file is part of the Paludis package manager. Paludis is free software; @@ -31,6 +31,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/package_id.hh> #include <paludis/metadata_key.hh> #include <paludis/action.hh> @@ -152,7 +153,7 @@ namespace const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/" + test, - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); switch (expected_result) { diff --git a/paludis/repositories/e/e_repository_TEST_pbin.cc b/paludis/repositories/e/e_repository_TEST_pbin.cc index a940010cf..acd4cf9dc 100644 --- a/paludis/repositories/e/e_repository_TEST_pbin.cc +++ b/paludis/repositories/e/e_repository_TEST_pbin.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -31,6 +31,7 @@ #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> #include <paludis/util/fs_stat.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_id.hh> @@ -169,7 +170,7 @@ namespace test_cases TestMessageSuffix suffix("prefix", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/simple-1", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), base_eapi); id->perform_action(bin_action); @@ -190,7 +191,7 @@ namespace test_cases TestMessageSuffix suffix("prefix", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/simple-1::binrepo" + base_eapi, - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "pbin-1+" + base_eapi); diff --git a/paludis/repositories/e/e_repository_TEST_phases.cc b/paludis/repositories/e/e_repository_TEST_phases.cc index ef73cbc0b..b8cb0a43f 100644 --- a/paludis/repositories/e/e_repository_TEST_phases.cc +++ b/paludis/repositories/e/e_repository_TEST_phases.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 @@ -30,6 +30,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/output_manager.hh> #include <paludis/standard_output_manager.hh> #include <paludis/package_id.hh> @@ -168,7 +169,7 @@ namespace const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/" + test, - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); TEST_CHECK_EQUAL(!! id->choices_key()->value()->find_by_name_with_prefix( ChoiceNameWithPrefix("build_options:expensive_tests")), expect_expensive_test); diff --git a/paludis/repositories/e/e_repository_TEST_replacing.cc b/paludis/repositories/e/e_repository_TEST_replacing.cc index e873be448..53b4b12ce 100644 --- a/paludis/repositories/e/e_repository_TEST_replacing.cc +++ b/paludis/repositories/e/e_repository_TEST_replacing.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -26,6 +26,7 @@ #include <paludis/util/make_named_values.hh> #include <paludis/util/set.hh> #include <paludis/util/map.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/package_id.hh> #include <paludis/metadata_key.hh> #include <paludis/action.hh> @@ -143,7 +144,7 @@ namespace const std::shared_ptr<const PackageIDSequence> rlist(env[selection::AllVersionsSorted(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(replacing, &env, { })), - { }) | + make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env.preferred_root_key()->value()))]); InstallAction action(make_named_values<InstallActionOptions>( @@ -156,7 +157,7 @@ namespace const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/" + test, - &env, { })), { }) | + &env, { })), make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>())]->last()); TEST_CHECK(bool(id)); id->perform_action(action); diff --git a/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc b/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc index afec5f7c6..e92c754c3 100644 --- a/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc +++ b/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -32,6 +32,7 @@ #include <paludis/util/set.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/package_id.hh> #include <paludis/metadata_key.hh> #include <paludis/action.hh> @@ -140,7 +141,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("cat/pkg", - &env, { })), { }))]->last()); + &env, { })), make_null_shared_ptr(), { }))]->last()); TEST_CHECK(bool(id)); id->perform_action(action); diff --git a/paludis/repositories/e/e_repository_news.cc b/paludis/repositories/e/e_repository_news.cc index da7df1e91..d37d1fca6 100644 --- a/paludis/repositories/e/e_repository_news.cc +++ b/paludis/repositories/e/e_repository_news.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -33,6 +33,7 @@ #include <paludis/util/fs_path.hh> #include <paludis/util/fs_stat.hh> #include <paludis/util/fs_iterator.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/environment.hh> #include <paludis/distribution.hh> @@ -177,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(), - std::shared_ptr<const PackageID>())), { }) | + std::shared_ptr<const PackageID>())), make_null_shared_ptr(), { }) | filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]->empty()) local_show = true; show &= local_show; diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc index 8dd8ab614..7005da784 100644 --- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc +++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh * Copyright (c) 2008 David Leverton * * This file is part of the Paludis package manager. Paludis is free software; @@ -34,6 +34,7 @@ #include <paludis/util/safe_ifstream.hh> #include <paludis/util/timestamp.hh> #include <paludis/util/fs_stat.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <test/test_framework.hh> #include <test/test_runner.hh> #include <iterator> @@ -77,7 +78,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_list"); @@ -105,7 +106,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-stale-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_list-stale"); @@ -134,7 +135,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-guessed-eapi-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_list-guessed-eapi"); @@ -162,7 +163,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-eclass-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_list-eclass"); @@ -193,7 +194,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-eclass-stale-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_list-eclass-stale"); @@ -221,7 +222,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-eclass-wrong-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_list-eclass-wrong"); @@ -249,7 +250,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-eclass-gone-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_list-eclass-gone"); @@ -277,7 +278,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-detection-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_list-detection"); @@ -305,7 +306,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash"); @@ -334,7 +335,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-guessed-eapi-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_hash-guessed-eapi"); @@ -362,7 +363,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-guessed-eapi-extension-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_hash-guessed-eapi-extension"); @@ -390,7 +391,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-no-guessed-eapi-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-no-guessed-eapi"); @@ -418,7 +419,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-empty-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), ""); @@ -447,7 +448,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-stale-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_hash-stale"); @@ -475,7 +476,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-no-mtime-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "the-description-flat_hash-no-mtime"); @@ -503,7 +504,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-no-mtime-stale-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_hash-no-mtime-stale"); @@ -531,7 +532,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-bad-mtime-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_hash-bad-mtime"); @@ -559,7 +560,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-no-eapi-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_hash-no-eapi"); @@ -587,7 +588,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-duplicate-key-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id1->short_description_key())); TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_hash-duplicate-key"); @@ -615,7 +616,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclass-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-eclass"); @@ -646,7 +647,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclass-stale-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-eclass-stale"); @@ -674,7 +675,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclass-wrong-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-eclass-wrong"); @@ -701,7 +702,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclass-gone-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-eclass-gone"); @@ -729,7 +730,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-full-eclass"); @@ -760,7 +761,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-nonstandard-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-full-eclass-nonstandard"); @@ -791,7 +792,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-stale-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-full-eclass-stale"); @@ -819,7 +820,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-wrong-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-full-eclass-wrong"); @@ -847,7 +848,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-full-eclass-gone-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-full-eclass-gone"); @@ -875,14 +876,14 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclasses-truncated-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-eclasses-truncated"); std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclasses-truncated-2", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id2->short_description_key())); TEST_CHECK_EQUAL(id2->short_description_key()->value(), "The Generated Description flat_hash-eclasses-truncated-2"); @@ -910,7 +911,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclasses-bad-mtime-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-eclasses-bad-mtime"); @@ -938,7 +939,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-eclasses-spaces-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-eclasses-spaces"); @@ -967,7 +968,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-exlib"); @@ -999,7 +1000,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-percat-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-exlib-percat"); @@ -1031,7 +1032,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-stale-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-exlib-stale"); @@ -1060,7 +1061,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-wrong-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-exlib-wrong"); @@ -1089,7 +1090,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlib-gone-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-exlib-gone"); @@ -1118,14 +1119,14 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlibs-truncated-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-exlibs-truncated"); std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlibs-truncated-2", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id2->short_description_key())); TEST_CHECK_EQUAL(id2->short_description_key()->value(), "The Generated Description flat_hash-exlibs-truncated-2"); @@ -1154,7 +1155,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlibs-bad-mtime-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-exlibs-bad-mtime"); @@ -1183,7 +1184,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-exlibs-spaces-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Generated Description flat_hash-exlibs-spaces"); @@ -1218,7 +1219,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/write-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(contents("ebuild_flat_metadata_cache_TEST_dir/cache/test-repo/cat/write-1"), contents("ebuild_flat_metadata_cache_TEST_dir/cache/expected/cat/write-1")); @@ -1254,7 +1255,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/write-eapi1-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(contents("ebuild_flat_metadata_cache_TEST_dir/cache/test-repo/cat/write-eapi1-1"), contents("ebuild_flat_metadata_cache_TEST_dir/cache/expected/cat/write-eapi1-1")); @@ -1292,7 +1293,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/write-eclasses-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(contents("ebuild_flat_metadata_cache_TEST_dir/cache/test-repo/cat/write-eclasses-1"), contents("ebuild_flat_metadata_cache_TEST_dir/cache/expected/cat/write-eclasses-1")); @@ -1329,7 +1330,7 @@ namespace test_cases std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/write-exlibs-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id->short_description_key())); TEST_CHECK_EQUAL(contents("ebuild_flat_metadata_cache_TEST_dir/cache/test-repo/cat/write-exlibs-1"), contents("ebuild_flat_metadata_cache_TEST_dir/cache/expected/cat/write-exlibs-1")); diff --git a/paludis/repositories/e/exheres_profile.cc b/paludis/repositories/e/exheres_profile.cc index 9020e62e5..beae1cc51 100644 --- a/paludis/repositories/e/exheres_profile.cc +++ b/paludis/repositories/e/exheres_profile.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 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 @@ -367,7 +367,7 @@ ExheresProfile::profile_masked(const std::shared_ptr<const PackageID> & id) cons { for (std::list<std::pair<std::shared_ptr<const PackageDepSpec>, std::shared_ptr<const RepositoryMaskInfo> > >::const_iterator k(rr->second.begin()), k_end(rr->second.end()) ; k != k_end ; ++k) - if (match_package(*_imp->env, *k->first, id, { })) + if (match_package(*_imp->env, *k->first, id, make_null_shared_ptr(), { })) return k->second; } diff --git a/paludis/repositories/e/exndbam_repository_TEST.cc b/paludis/repositories/e/exndbam_repository_TEST.cc index ed804688a..c48ff4d27 100644 --- a/paludis/repositories/e/exndbam_repository_TEST.cc +++ b/paludis/repositories/e/exndbam_repository_TEST.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 @@ -26,6 +26,7 @@ #include <paludis/util/make_named_values.hh> #include <paludis/util/sequence.hh> #include <paludis/util/fs_path.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/action.hh> #include <paludis/filtered_generator.hh> @@ -109,7 +110,7 @@ namespace test_cases if (! victim.empty()) replacing->push_back(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(victim, - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); InstallAction install_action(make_named_values<InstallActionOptions>( n::destination() = exndbam_repo, n::make_output_manager() = &make_standard_output_manager, @@ -119,7 +120,7 @@ namespace test_cases )); (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(chosen_one, - &env, { })), { }))]->begin())->perform_action(install_action); + &env, { })), make_null_shared_ptr(), { }))]->begin())->perform_action(install_action); } void run() diff --git a/paludis/repositories/e/fetch_visitor_TEST.cc b/paludis/repositories/e/fetch_visitor_TEST.cc index 4c9d523f7..cc3d7f33a 100644 --- a/paludis/repositories/e/fetch_visitor_TEST.cc +++ b/paludis/repositories/e/fetch_visitor_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -26,6 +26,7 @@ #include <paludis/util/sequence.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/fs_stat.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/package_database.hh> @@ -78,7 +79,7 @@ namespace test_cases const std::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string("exheres-0")); FetchVisitor v(&env, *env[selection::RequireExactlyOne( generator::Matches(parse_user_package_dep_spec("=cat/pkg-1", - &env, { }), { }))]->begin(), + &env, { }), make_null_shared_ptr(), { }))]->begin(), *eapi, FSPath("fetch_visitor_TEST_dir/out"), false, false, "test", std::make_shared<URIListedThenMirrorsLabel>("listed-then-mirrors"), false, std::make_shared<StandardOutputManager>(), get_mirrors_fn); diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc index e6dc55358..a17a5d51a 100644 --- a/paludis/repositories/e/fix_locked_dependencies.cc +++ b/paludis/repositories/e/fix_locked_dependencies.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 @@ -108,7 +108,7 @@ namespace break; std::shared_ptr<const PackageIDSequence> matches((*env)[selection::AllVersionsSorted( - generator::Matches(*node.spec(), { }) | filter::InstalledAtRoot(env->system_root_key()->value()))]); + generator::Matches(*node.spec(), id, { }) | filter::InstalledAtRoot(env->system_root_key()->value()))]); if (matches->empty()) break; diff --git a/paludis/repositories/e/info_metadata_key.cc b/paludis/repositories/e/info_metadata_key.cc index a14cfbd78..ec16cb699 100644 --- a/paludis/repositories/e/info_metadata_key.cc +++ b/paludis/repositories/e/info_metadata_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 @@ -32,6 +32,7 @@ #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/join.hh> #include <paludis/util/fs_stat.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/literal_metadata_key.hh> #include <paludis/selection.hh> @@ -189,7 +190,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(), - std::shared_ptr<const PackageID>()), { }) | + std::shared_ptr<const PackageID>()), make_null_shared_ptr(), { }) | filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]); if (q->empty()) diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc index 0e839ebec..46e9bc8a9 100644 --- a/paludis/repositories/e/pipe_command_handler.cc +++ b/paludis/repositories/e/pipe_command_handler.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh * Copyright (c) 2009 Ingmar Vanhassel * * This file is part of the Paludis package manager. Paludis is free software; @@ -277,7 +277,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment eapi->supported()->package_dep_spec_parse_options(), eapi->supported()->version_spec_options(), package_id)); std::shared_ptr<const PackageIDSequence> entries((*environment)[selection::AllVersionsSorted( - generator::Matches(spec, { }) | root)]); + generator::Matches(spec, package_id, { }) | root)]); if (eapi->supported()->pipe_commands()->rewrite_virtuals() && (! entries->empty()) && (*entries->last())->virtual_for_key()) { @@ -326,7 +326,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment eapi->supported()->package_dep_spec_parse_options(), eapi->supported()->version_spec_options(), package_id)); std::shared_ptr<const PackageIDSequence> entries((*environment)[selection::SomeArbitraryVersion( - generator::Matches(spec, { }) | root)]); + generator::Matches(spec, package_id, { }) | root)]); if (entries->empty()) return "O1;"; else @@ -350,7 +350,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment eapi->supported()->package_dep_spec_parse_options(), eapi->supported()->version_spec_options(), package_id)); std::shared_ptr<const PackageIDSequence> entries((*environment)[selection::AllVersionsSorted( - generator::Matches(spec, { }) | filter::InstalledAtRoot(environment->preferred_root_key()->value()))]); + generator::Matches(spec, package_id, { }) | filter::InstalledAtRoot(environment->preferred_root_key()->value()))]); if (eapi->supported()->pipe_commands()->rewrite_virtuals() && (! entries->empty())) { std::shared_ptr<PackageIDSequence> new_entries(std::make_shared<PackageIDSequence>()); diff --git a/paludis/repositories/e/traditional_profile.cc b/paludis/repositories/e/traditional_profile.cc index ce8cee8d9..94aecd78c 100644 --- a/paludis/repositories/e/traditional_profile.cc +++ b/paludis/repositories/e/traditional_profile.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 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 @@ -43,6 +43,7 @@ #include <paludis/util/map.hh> #include <paludis/util/fs_stat.hh> #include <paludis/util/fs_error.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/choice.hh> #include <paludis/dep_tag.hh> @@ -872,7 +873,7 @@ TraditionalProfile::use_masked( for (PackageFlagStatusMapList::const_iterator g(i->package_use_mask.begin()), g_end(i->package_use_mask.end()) ; g != g_end ; ++g) { - if (! match_package(*_imp->env, *g->first, id, { })) + if (! match_package(*_imp->env, *g->first, id, make_null_shared_ptr(), { })) continue; FlagStatusMap::const_iterator h(g->second.find(value_prefixed)); @@ -908,7 +909,7 @@ TraditionalProfile::use_forced( for (PackageFlagStatusMapList::const_iterator g(i->package_use_force.begin()), g_end(i->package_use_force.end()) ; g != g_end ; ++g) { - if (! match_package(*_imp->env, *g->first, id, { })) + if (! match_package(*_imp->env, *g->first, id, make_null_shared_ptr(), { })) continue; FlagStatusMap::const_iterator h(g->second.find(value_prefixed)); @@ -937,7 +938,7 @@ TraditionalProfile::use_state_ignoring_masks( for (PackageFlagStatusMapList::const_iterator g(i->package_use.begin()), g_end(i->package_use.end()) ; g != g_end ; ++g) { - if (! match_package(*_imp->env, *g->first, id, { })) + if (! match_package(*_imp->env, *g->first, id, make_null_shared_ptr(), { })) continue; FlagStatusMap::const_iterator h(g->second.find(value_prefixed)); @@ -1046,7 +1047,7 @@ TraditionalProfile::profile_masked(const std::shared_ptr<const PackageID> & id) { for (std::list<std::pair<std::shared_ptr<const PackageDepSpec>, std::shared_ptr<const RepositoryMaskInfo> > >::const_iterator k(rr->second.begin()), k_end(rr->second.end()) ; k != k_end ; ++k) - if (match_package(*_imp->env, *k->first, id, { })) + if (match_package(*_imp->env, *k->first, id, make_null_shared_ptr(), { })) return k->second; } diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc index f4901e86a..3318279ef 100644 --- a/paludis/repositories/e/vdb_repository.cc +++ b/paludis/repositories/e/vdb_repository.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -1443,7 +1443,7 @@ VDBRepository::perform_updates() SlotName old_slot(tokens.at(2)), new_slot(tokens.at(3)); const std::shared_ptr<const PackageIDSequence> ids((*_imp->params.environment())[selection::AllVersionsSorted( - (generator::Matches(old_spec, { }) & generator::InRepository(name())) | + (generator::Matches(old_spec, make_null_shared_ptr(), { }) & generator::InRepository(name())) | filter::Slot(old_slot) )]); if (! ids->empty()) diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc index a0205b5ec..e28ba6f31 100644 --- a/paludis/repositories/e/vdb_repository_TEST.cc +++ b/paludis/repositories/e/vdb_repository_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -153,7 +153,7 @@ namespace test_cases std::shared_ptr<const PackageID> e1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(e1->choices_key())); TEST_CHECK(bool(e1->choices_key()->value())); @@ -224,7 +224,7 @@ namespace test_cases std::shared_ptr<const PackageID> e1(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1", - &env, { })), { }))]->begin()); + &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()), @@ -278,7 +278,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("category/package", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); UnformattedPrettyPrinter ff; @@ -381,7 +381,7 @@ namespace test_cases TestMessageSuffix suffix("install", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::srcrepo", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(install_action); } @@ -392,7 +392,7 @@ namespace test_cases TestMessageSuffix suffix("reinstall", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::srcrepo", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(install_action); } @@ -403,7 +403,7 @@ namespace test_cases TestMessageSuffix suffix("info", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(info_action); } @@ -412,7 +412,7 @@ namespace test_cases TestMessageSuffix suffix("config", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(config_action); } @@ -421,7 +421,7 @@ namespace test_cases TestMessageSuffix suffix("uninstall", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(uninstall_action); } @@ -511,7 +511,7 @@ namespace test_cases TestMessageSuffix suffix("vars", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::srcrepo", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(install_action); } @@ -522,7 +522,7 @@ namespace test_cases TestMessageSuffix suffix("reinstall", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::srcrepo", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(install_action); } @@ -533,7 +533,7 @@ namespace test_cases TestMessageSuffix suffix("info", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(info_action); } @@ -542,7 +542,7 @@ namespace test_cases TestMessageSuffix suffix("config", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(config_action); } @@ -551,7 +551,7 @@ namespace test_cases TestMessageSuffix suffix("uninstall", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/target-" + eapi + "::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(bool(id)); id->perform_action(uninstall_action); } @@ -588,7 +588,7 @@ namespace test_cases if (! victim.empty()) replacing->push_back(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(victim, - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); InstallAction install_action(make_named_values<InstallActionOptions>( n::destination() = vdb_repo, n::make_output_manager() = &make_standard_output_manager, @@ -598,7 +598,7 @@ namespace test_cases )); (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(chosen_one, - &env, { })), { }))]->begin())->perform_action(install_action); + &env, { })), make_null_shared_ptr(), { }))]->begin())->perform_action(install_action); } void run() @@ -710,7 +710,7 @@ namespace test_cases TestMessageSuffix suffix("remove other slot", true); const std::shared_ptr<const PackageID> inst_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat1/pkg1-2::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); inst_id->perform_action(uninstall_action); vdb_repo->invalidate(); @@ -739,7 +739,7 @@ namespace test_cases TestMessageSuffix suffix("remove other package", true); const std::shared_ptr<const PackageID> inst_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat1/pkg2-1::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); inst_id->perform_action(uninstall_action); vdb_repo->invalidate(); @@ -766,7 +766,7 @@ namespace test_cases TestMessageSuffix suffix("remove other category", true); const std::shared_ptr<const PackageID> inst_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat2/pkg1-1::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); inst_id->perform_action(uninstall_action); vdb_repo->invalidate(); @@ -781,7 +781,7 @@ namespace test_cases TestMessageSuffix suffix("uninstall", true); const std::shared_ptr<const PackageID> inst_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat1/pkg1-1::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); inst_id->perform_action(uninstall_action); vdb_repo->invalidate(); @@ -955,7 +955,7 @@ namespace test_cases if (! victim.empty()) replacing->push_back(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(victim, - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); InstallAction install_action(make_named_values<InstallActionOptions>( n::destination() = vdb_repo, n::make_output_manager() = &make_standard_output_manager, @@ -965,7 +965,7 @@ namespace test_cases )); (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(chosen_one, - &env, { })), { }))]->begin())->perform_action(install_action); + &env, { })), make_null_shared_ptr(), { }))]->begin())->perform_action(install_action); } void run() @@ -1085,7 +1085,7 @@ namespace test_cases TestMessageSuffix suffix("remove other slot", true); const std::shared_ptr<const PackageID> inst_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat1/pkg1-2::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); inst_id->perform_action(uninstall_action); vdb_repo->invalidate(); @@ -1104,7 +1104,7 @@ namespace test_cases TestMessageSuffix suffix("remove other package", true); const std::shared_ptr<const PackageID> inst_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat1/pkg2-1::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); inst_id->perform_action(uninstall_action); vdb_repo->invalidate(); @@ -1115,7 +1115,7 @@ namespace test_cases TestMessageSuffix suffix("uninstall", true); const std::shared_ptr<const PackageID> inst_id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat1/pkg1-1::installed", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); inst_id->perform_action(uninstall_action); vdb_repo->invalidate(); @@ -1224,7 +1224,7 @@ namespace test_cases TestMessageSuffix suffix("install", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/pkg-1::reinstalltest_src1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); id->perform_action(install_action); vdb_repo->invalidate(); @@ -1236,7 +1236,7 @@ namespace test_cases TestMessageSuffix suffix("reinstall", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/pkg-1::reinstalltest_src1", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); id->perform_action(install_action); vdb_repo->invalidate(); @@ -1248,7 +1248,7 @@ namespace test_cases TestMessageSuffix suffix("reinstall equivalent", true); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec("=cat/pkg-1::reinstalltest_src2", - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); id->perform_action(install_action); vdb_repo->invalidate(); @@ -1281,7 +1281,7 @@ namespace test_cases if (! victim.empty()) replacing->push_back(*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(victim, - &env, { })), { }))]->begin()); + &env, { })), make_null_shared_ptr(), { }))]->begin()); InstallAction install_action(make_named_values<InstallActionOptions>( n::destination() = vdb_repo, n::make_output_manager() = &make_standard_output_manager, @@ -1291,7 +1291,7 @@ namespace test_cases )); (*env[selection::RequireExactlyOne(generator::Matches( PackageDepSpec(parse_user_package_dep_spec(chosen_one, - &env, { })), { }))]->begin())->perform_action(install_action); + &env, { })), make_null_shared_ptr(), { }))]->begin())->perform_action(install_action); } void run() diff --git a/paludis/repositories/e/vdb_unmerger_TEST.cc b/paludis/repositories/e/vdb_unmerger_TEST.cc index 5610f3dbb..c7e96c543 100644 --- a/paludis/repositories/e/vdb_unmerger_TEST.cc +++ b/paludis/repositories/e/vdb_unmerger_TEST.cc @@ -26,6 +26,7 @@ #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/sequence.hh> #include <paludis/util/fs_stat.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/standard_output_manager.hh> #include <paludis/user_dep_spec.hh> #include <paludis/package_database.hh> @@ -129,8 +130,7 @@ namespace n::ignore() = &ignore_nothing, n::output_manager() = std::make_shared<StandardOutputManager>(), n::package_id() = *env[selection::RequireExactlyOne(generator::Matches( - parse_user_package_dep_spec("cat/" + fix(what), &env, { }), - { }))]->begin(), + parse_user_package_dep_spec("cat/" + fix(what), &env, { }), make_null_shared_ptr(), { }))]->begin(), n::root() = root_dir )); diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc index cd83a654b..ff554986f 100644 --- a/paludis/repositories/unpackaged/installed_repository_TEST.cc +++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -138,7 +138,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne( generator::Matches(parse_user_package_dep_spec("cat-one/foo:0", - &env, { }), { }))]->begin()); + &env, { }), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK_EQUAL(id1->version(), VersionSpec("1", { })); TEST_CHECK_EQUAL(id1->slot_key()->value(), SlotName("0")); @@ -156,7 +156,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne( generator::Matches(parse_user_package_dep_spec("cat-one/foo:1", - &env, { }), { }))]->begin()); + &env, { }), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK_EQUAL(id2->version(), VersionSpec("2", { })); TEST_CHECK_EQUAL(id2->slot_key()->value(), SlotName("1")); @@ -192,13 +192,13 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne( generator::Matches(parse_user_package_dep_spec("cat-one/foo:0", - &env, { }), { }))]->begin()); + &env, { }), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(! id1->masked()); const std::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne( generator::Matches(parse_user_package_dep_spec("cat-one/foo:1", - &env, { }), { }))]->begin()); + &env, { }), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(! id2->masked()); } @@ -228,7 +228,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne( generator::Matches(parse_user_package_dep_spec("cat-one/foo:1", - &env, { }), { }))]->begin()); + &env, { }), make_null_shared_ptr(), { }))]->begin()); TEST_CHECK(! id1->supports_action(SupportsActionTest<InstallAction>())); TEST_CHECK(! id1->supports_action(SupportsActionTest<ConfigAction>())); @@ -320,7 +320,7 @@ namespace test_cases const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne( generator::Matches(parse_user_package_dep_spec("cat-one/foo:fred", - &env, { }), { }))]->begin()); + &env, { }), make_null_shared_ptr(), { }))]->begin()); UninstallAction action(make_named_values<UninstallActionOptions>( n::config_protect() = "", @@ -585,7 +585,7 @@ namespace test_cases )); (*env[selection::RequireExactlyOne(generator::Matches( parse_user_package_dep_spec("cat/pkg4a", - &env, { }), { }))]->begin())->perform_action(action); + &env, { }), make_null_shared_ptr(), { }))]->begin())->perform_action(action); TEST_CHECK(FSPath("installed_repository_TEST_dir/root4/dir").stat().is_directory()); TEST_CHECK(! FSPath("installed_repository_TEST_dir/root4/dir/4a").stat().is_regular_file()); @@ -631,7 +631,7 @@ namespace test_cases )); (*env[selection::RequireExactlyOne(generator::Matches( parse_user_package_dep_spec("cat/pkg4b", - &env, { }), { }))]->begin())->perform_action(action); + &env, { }), make_null_shared_ptr(), { }))]->begin())->perform_action(action); TEST_CHECK(! FSPath("installed_repository_TEST_dir/root4/dir").stat().is_directory()); diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc index a17dce361..c1af193d1 100644 --- a/paludis/repositories/virtuals/virtuals_repository.cc +++ b/paludis/repositories/virtuals/virtuals_repository.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -223,7 +223,7 @@ VirtualsRepository::need_ids() const v(_imp->names.begin()), v_end(_imp->names.end()) ; v != v_end ; ++v) { std::shared_ptr<const PackageIDSequence> matches((*_imp->env)[selection::AllVersionsSorted( - generator::Matches(*v->second, { }) | + generator::Matches(*v->second, make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>())]); if (matches->empty()) diff --git a/paludis/resolver/allowed_to_remove_helper.cc b/paludis/resolver/allowed_to_remove_helper.cc index 9272e749d..69c16383d 100644 --- a/paludis/resolver/allowed_to_remove_helper.cc +++ b/paludis/resolver/allowed_to_remove_helper.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 @@ -23,6 +23,7 @@ #include <paludis/resolver/resolvent.hh> #include <paludis/resolver/resolution.hh> #include <paludis/util/pimp-impl.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/dep_spec.hh> #include <paludis/package_dep_spec_collection.hh> @@ -38,7 +39,8 @@ namespace paludis PackageDepSpecCollection allowed_to_remove_specs; Imp(const Environment * const e) : - env(e) + env(e), + allowed_to_remove_specs(make_null_shared_ptr()) { } }; diff --git a/paludis/resolver/always_via_binary_helper.cc b/paludis/resolver/always_via_binary_helper.cc index 147b58c93..abe64db6f 100644 --- a/paludis/resolver/always_via_binary_helper.cc +++ b/paludis/resolver/always_via_binary_helper.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 @@ -26,6 +26,7 @@ #include <paludis/resolver/destination_utils.hh> #include <paludis/util/pimp-impl.hh> #include <paludis/util/simple_visitor_cast.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/dep_spec.hh> #include <paludis/package_id.hh> #include <paludis/metadata_key.hh> @@ -43,7 +44,8 @@ namespace paludis PackageDepSpecCollection always_via_binary_specs; Imp(const Environment * const e) : - env(e) + env(e), + always_via_binary_specs(make_null_shared_ptr()) { } }; diff --git a/paludis/resolver/can_use_helper.cc b/paludis/resolver/can_use_helper.cc index af5e1b046..0e4613090 100644 --- a/paludis/resolver/can_use_helper.cc +++ b/paludis/resolver/can_use_helper.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 @@ -20,6 +20,7 @@ #include <paludis/resolver/can_use_helper.hh> #include <paludis/util/pimp-impl.hh> #include <paludis/util/options.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/dep_spec.hh> #include <paludis/package_id.hh> #include <paludis/package_dep_spec_collection.hh> @@ -36,7 +37,8 @@ namespace paludis PackageDepSpecCollection cannot_use_specs; Imp(const Environment * const e) : - env(e) + env(e), + cannot_use_specs(make_null_shared_ptr()) { } }; diff --git a/paludis/resolver/collect_depped_upon.cc b/paludis/resolver/collect_depped_upon.cc index 67e1cf517..fdfd572c7 100644 --- a/paludis/resolver/collect_depped_upon.cc +++ b/paludis/resolver/collect_depped_upon.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 @@ -53,6 +53,7 @@ namespace const std::shared_ptr<const PackageID> best_eventual( const Environment * const env, const PackageDepSpec & spec, + const std::shared_ptr<const PackageID> & from_id, const S_ & seq) { std::shared_ptr<const PackageID> result; @@ -61,7 +62,7 @@ namespace i != i_end ; ++i) { if ((! result) || dependent_checker_id(*i)->version() >= result->version()) - if (match_package(*env, spec, dependent_checker_id(*i), { })) + if (match_package(*env, spec, dependent_checker_id(*i), from_id, { })) result = dependent_checker_id(*i); } @@ -108,9 +109,9 @@ namespace if (s.spec()->slot_requirement_ptr() && simple_visitor_cast<const SlotAnyUnlockedRequirement>( *s.spec()->slot_requirement_ptr())) { - auto best_eventual_id(best_eventual(env, *s.spec(), newly_available)); + auto best_eventual_id(best_eventual(env, *s.spec(), id, newly_available)); if (! best_eventual_id) - best_eventual_id = best_eventual(env, *s.spec(), not_changing_slots); + best_eventual_id = best_eventual(env, *s.spec(), id, not_changing_slots); if (best_eventual_id && best_eventual_id->slot_key()) { PartiallyMadePackageDepSpec part_spec(*s.spec()); @@ -119,14 +120,14 @@ namespace } } - if (! match_package(*env, *spec, dependent_checker_id(*g), { })) + if (! match_package(*env, *spec, dependent_checker_id(*g), id, { })) continue; bool any(false); for (typename C_::ConstIterator n(newly_available->begin()), n_end(newly_available->end()) ; n != n_end ; ++n) { - if (match_package(*env, *spec, dependent_checker_id(*n), { })) + if (match_package(*env, *spec, dependent_checker_id(*n), id, { })) { any = true; break; diff --git a/paludis/resolver/collect_provided.cc b/paludis/resolver/collect_provided.cc index 4fe17d535..a0d0235f8 100644 --- a/paludis/resolver/collect_provided.cc +++ b/paludis/resolver/collect_provided.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 @@ -50,7 +50,7 @@ paludis::resolver::collect_provided( v != v_end ; ++v) { const std::shared_ptr<const PackageIDSequence> virtuals((*env)[selection::AllVersionsUnsorted( - generator::Matches(**v, { }))]); + generator::Matches(**v, id, { }))]); std::copy(virtuals->begin(), virtuals->end(), result->inserter()); } } diff --git a/paludis/resolver/confirm_helper.cc b/paludis/resolver/confirm_helper.cc index 3a531b58d..f9d646504 100644 --- a/paludis/resolver/confirm_helper.cc +++ b/paludis/resolver/confirm_helper.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 @@ -47,6 +47,9 @@ namespace paludis Imp(const Environment * const e) : env(e), + permit_downgrade_specs(make_null_shared_ptr()), + permit_old_version_specs(make_null_shared_ptr()), + allowed_to_break_specs(make_null_shared_ptr()), allowed_to_break_system(false) { } diff --git a/paludis/resolver/constraint.cc b/paludis/resolver/constraint.cc index f23e187e8..7d147c870 100644 --- a/paludis/resolver/constraint.cc +++ b/paludis/resolver/constraint.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -147,6 +147,7 @@ Constraint::serialise(Serialiser & s) const s.object("Constraint") .member(SerialiserFlags<>(), "destination_type", stringify(destination_type())) .member(SerialiserFlags<>(), "force_unable", stringify(force_unable())) + .member(SerialiserFlags<serialise::might_be_null>(), "from_id", from_id()) .member(SerialiserFlags<>(), "nothing_is_fine_too", nothing_is_fine_too()) .member(SerialiserFlags<serialise::might_be_null>(), "reason", reason()) .member(SerialiserFlags<>(), "spec", spec()) @@ -155,52 +156,6 @@ Constraint::serialise(Serialiser & s) const ; } -namespace -{ - struct IDFinder - { - const std::shared_ptr<const PackageID> visit(const DependencyReason & r) const - { - return r.from_id(); - } - - const std::shared_ptr<const PackageID> visit(const SetReason &) const - { - return make_null_shared_ptr(); - } - - const std::shared_ptr<const PackageID> visit(const LikeOtherDestinationTypeReason &) const - { - return make_null_shared_ptr(); - } - - const std::shared_ptr<const PackageID> visit(const PresetReason &) const - { - return make_null_shared_ptr(); - } - - const std::shared_ptr<const PackageID> visit(const TargetReason &) const - { - return make_null_shared_ptr(); - } - - const std::shared_ptr<const PackageID> visit(const DependentReason &) const - { - return make_null_shared_ptr(); - } - - const std::shared_ptr<const PackageID> visit(const ViaBinaryReason &) const - { - return make_null_shared_ptr(); - } - - const std::shared_ptr<const PackageID> visit(const WasUsedByReason &) const - { - return make_null_shared_ptr(); - } - }; -} - const std::shared_ptr<Constraint> Constraint::deserialise(Deserialisation & d) { @@ -209,15 +164,15 @@ Constraint::deserialise(Deserialisation & d) Deserialisator v(d, "Constraint"); const std::shared_ptr<Reason> reason(v.member<std::shared_ptr<Reason> >("reason")); - IDFinder id_finder; + const std::shared_ptr<const PackageID> from_id(v.member<std::shared_ptr<const PackageID> >("from_id")); return std::make_shared<Constraint>(make_named_values<Constraint>( n::destination_type() = destringify<DestinationType>(v.member<std::string>("destination_type")), n::force_unable() = v.member<bool>("force_unable"), + n::from_id() = from_id, n::nothing_is_fine_too() = v.member<bool>("nothing_is_fine_too"), n::reason() = reason, - n::spec() = PackageOrBlockDepSpec::deserialise(*v.find_remove_member("spec"), - reason->accept_returning<std::shared_ptr<const PackageID> >(id_finder)), + n::spec() = PackageOrBlockDepSpec::deserialise(*v.find_remove_member("spec"), from_id), n::untaken() = v.member<bool>("untaken"), n::use_existing() = destringify<UseExisting>(v.member<std::string>("use_existing")) )); diff --git a/paludis/resolver/constraint.hh b/paludis/resolver/constraint.hh index 0e1aed443..7d27c7cc2 100644 --- a/paludis/resolver/constraint.hh +++ b/paludis/resolver/constraint.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -37,6 +37,7 @@ namespace paludis { typedef Name<struct name_destination_type> destination_type; typedef Name<struct name_force_unable> force_unable; + typedef Name<struct name_from_id> from_id; typedef Name<struct name_nothing_is_fine_too> nothing_is_fine_too; typedef Name<struct name_reason> reason; typedef Name<struct name_spec> spec; @@ -50,6 +51,7 @@ namespace paludis { NamedValue<n::destination_type, DestinationType> destination_type; NamedValue<n::force_unable, bool> force_unable; + NamedValue<n::from_id, std::shared_ptr<const PackageID> > from_id; NamedValue<n::nothing_is_fine_too, bool> nothing_is_fine_too; NamedValue<n::reason, std::shared_ptr<const Reason> > reason; NamedValue<n::spec, PackageOrBlockDepSpec> spec; diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc index 57a6b4b2b..c31d6671e 100644 --- a/paludis/resolver/decider.cc +++ b/paludis/resolver/decider.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -38,6 +38,7 @@ #include <paludis/resolver/accumulate_deps_and_provides.hh> #include <paludis/resolver/why_changed_choices.hh> #include <paludis/resolver/same_slot.hh> +#include <paludis/resolver/reason_utils.hh> #include <paludis/util/exception.hh> #include <paludis/util/stringify.hh> #include <paludis/util/make_named_values.hh> @@ -577,6 +578,7 @@ Decider::_make_constraints_from_target( result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>( n::destination_type() = resolution->resolvent().destination_type(), n::force_unable() = false, + n::from_id() = make_null_shared_ptr(), n::nothing_is_fine_too() = existing.second, n::reason() = reason, n::spec() = spec, @@ -606,6 +608,7 @@ Decider::_make_constraints_from_dependency( result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>( n::destination_type() = resolution->resolvent().destination_type(), n::force_unable() = false, + n::from_id() = dep.from_id(), n::nothing_is_fine_too() = existing.second, n::reason() = reason, n::spec() = *dep.spec().if_package(), @@ -638,11 +641,11 @@ Decider::_make_constraints_from_blocker( break; case bk_manual: - force_unable = ! _already_met(spec); + force_unable = ! _already_met(spec, maybe_from_package_id_from_reason(reason)); break; case bk_upgrade_blocked_before: - nothing_is_fine_too = ! _already_met(spec); + nothing_is_fine_too = ! _already_met(spec, maybe_from_package_id_from_reason(reason)); break; case last_bk: @@ -655,6 +658,7 @@ Decider::_make_constraints_from_blocker( result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>( n::destination_type() = *t, n::force_unable() = force_unable, + n::from_id() = maybe_from_package_id_from_reason(reason), n::nothing_is_fine_too() = nothing_is_fine_too, n::reason() = reason, n::spec() = spec, @@ -703,13 +707,13 @@ namespace if (constraint.spec().if_package()) { if (! match_package_with_maybe_changes(*env, *constraint.spec().if_package(), - changed_choices_for_constraint.get(), chosen_id, changed_choices.get(), { })) + changed_choices_for_constraint.get(), chosen_id, constraint.from_id(), changed_choices.get(), { })) return false; } else { if (match_package_with_maybe_changes(*env, constraint.spec().if_block()->blocking(), - changed_choices_for_constraint.get(), chosen_id, changed_choices.get(), { })) + changed_choices_for_constraint.get(), chosen_id, constraint.from_id(), changed_choices.get(), { })) return false; } @@ -1177,7 +1181,7 @@ Decider::_add_dependencies_if_necessary( } const std::shared_ptr<DependencyReason> reason(std::make_shared<DependencyReason>( - package_id, changed_choices, our_resolution->resolvent(), *s, _already_met(s->spec()))); + package_id, changed_choices, our_resolution->resolvent(), *s, _already_met(s->spec(), package_id))); /* empty resolvents is always ok for blockers, since blocking on things * that don't exist is fine */ @@ -1310,7 +1314,7 @@ Decider::find_any_score( if (is_block) { const std::shared_ptr<const PackageIDSequence> ids((*_imp->env)[selection::BestVersionOnly( - generator::Matches(spec, { mpo_ignore_additional_requirements }) + generator::Matches(spec, our_id, { mpo_ignore_additional_requirements }) | filter::SupportsAction<InstallAction>() | filter::NotMasked() )]); if (ids->empty()) @@ -1320,7 +1324,7 @@ Decider::find_any_score( /* next: already installed */ { const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly( - generator::Matches(spec, { }) | + generator::Matches(spec, our_id, { }) | filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (! installed_ids->empty() ^ is_block) return std::make_pair(acs_already_installed, operator_bias); @@ -1330,14 +1334,14 @@ Decider::find_any_score( if (! is_block && spec.additional_requirements_ptr()) { const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly( - generator::Matches(spec, { mpo_ignore_additional_requirements }) | + generator::Matches(spec, our_id, { mpo_ignore_additional_requirements }) | filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (! installed_ids->empty()) return std::make_pair(acs_wrong_options_installed, operator_bias); } const std::shared_ptr<DependencyReason> reason(std::make_shared<DependencyReason>( - our_id, make_null_shared_ptr(), our_resolution->resolvent(), dep, _already_met(dep.spec()))); + our_id, make_null_shared_ptr(), our_resolution->resolvent(), dep, _already_met(dep.spec(), our_id))); const std::shared_ptr<const Resolvents> resolvents(_get_resolvents_for(spec, reason).first); /* next: will already be installing */ @@ -1374,7 +1378,7 @@ Decider::find_any_score( if (is_block) { const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly( - generator::Matches(spec, { }) | + generator::Matches(spec, our_id, { }) | filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (! installed_ids->empty()) return std::make_pair(acs_blocks_installed, operator_bias); @@ -1384,7 +1388,7 @@ Decider::find_any_score( if (! is_block) { const std::shared_ptr<const PackageIDSequence> ids((*_imp->env)[selection::BestVersionOnly( - generator::Matches(spec, { mpo_ignore_additional_requirements }) + generator::Matches(spec, our_id, { mpo_ignore_additional_requirements }) )]); if (! ids->empty()) return std::make_pair(acs_exists, operator_bias); @@ -1473,7 +1477,7 @@ Decider::_get_resolvents_for( exact_slot = spec.slot_requirement_ptr()->accept_returning<std::shared_ptr<SlotName> >(f); } - return _imp->fns.get_resolvents_for_fn()(spec, exact_slot, reason); + return _imp->fns.get_resolvents_for_fn()(spec, maybe_from_package_id_from_reason(reason), exact_slot, reason); } const DestinationTypes @@ -1847,9 +1851,9 @@ Decider::_find_id_for_from( c != c_end ; ++c) { if ((*c)->spec().if_package()) - ok = ok && match_package(*_imp->env, *(*c)->spec().if_package(), *i, opts); + ok = ok && match_package(*_imp->env, *(*c)->spec().if_package(), *i, (*c)->from_id(), opts); else - ok = ok && ! match_package(*_imp->env, (*c)->spec().if_block()->blocking(), *i, opts); + ok = ok && ! match_package(*_imp->env, (*c)->spec().if_block()->blocking(), *i, (*c)->from_id(), opts); if (! ok) break; @@ -1915,10 +1919,10 @@ Decider::_find_id_for_from( if ((*c)->spec().if_package()) ok = ok && match_package_with_maybe_changes(*_imp->env, *(*c)->spec().if_package(), - get_changed_choices_for(*c).get(), *i, why_changed_choices->changed_choices().get(), { }); + get_changed_choices_for(*c).get(), *i, (*c)->from_id(), why_changed_choices->changed_choices().get(), { }); else ok = ok && ! match_package_with_maybe_changes(*_imp->env, (*c)->spec().if_block()->blocking(), - get_changed_choices_for(*c).get(), *i, why_changed_choices->changed_choices().get(), { }); + get_changed_choices_for(*c).get(), *i, (*c)->from_id(), why_changed_choices->changed_choices().get(), { }); } if (ok) @@ -2113,10 +2117,10 @@ Decider::resolve() } bool -Decider::_already_met(const PackageOrBlockDepSpec & spec) const +Decider::_already_met(const PackageOrBlockDepSpec & spec, const std::shared_ptr<const PackageID> & from_id) const { const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::AllVersionsUnsorted( - generator::Matches(spec.if_package() ? *spec.if_package() : spec.if_block()->blocking(), { }) | + generator::Matches(spec.if_package() ? *spec.if_package() : spec.if_block()->blocking(), from_id, { }) | filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (installed_ids->empty()) return bool(spec.if_block()); @@ -2386,6 +2390,7 @@ namespace result->push_back(make_shared_copy(make_named_values<Constraint>( n::destination_type() = destination_type, n::force_unable() = false, + n::from_id() = from_constraint->from_id(), n::nothing_is_fine_too() = true, n::reason() = std::make_shared<LikeOtherDestinationTypeReason>( resolvent, diff --git a/paludis/resolver/decider.hh b/paludis/resolver/decider.hh index c3f1d9ce4..c040588e6 100644 --- a/paludis/resolver/decider.hh +++ b/paludis/resolver/decider.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -240,7 +240,9 @@ namespace paludis const std::shared_ptr<const PackageID> &, const bool existing) const; - bool _already_met(const PackageOrBlockDepSpec &) const PALUDIS_ATTRIBUTE((warn_unused_result)); + bool _already_met( + const PackageOrBlockDepSpec &, + const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result)); bool _installed_but_allowed_to_remove( const std::shared_ptr<const Resolution> &) const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/resolver/get_constraints_for_dependent_helper.cc b/paludis/resolver/get_constraints_for_dependent_helper.cc index d27f9a64e..1a5cfc351 100644 --- a/paludis/resolver/get_constraints_for_dependent_helper.cc +++ b/paludis/resolver/get_constraints_for_dependent_helper.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 @@ -27,6 +27,7 @@ #include <paludis/util/simple_visitor_cast.hh> #include <paludis/util/make_shared_copy.hh> #include <paludis/util/make_named_values.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/util/stringify.hh> #include <paludis/dep_spec.hh> #include <paludis/package_id.hh> @@ -47,7 +48,8 @@ namespace paludis PackageDepSpecCollection less_restrictive_remove_blockers_specs; Imp(const Environment * const e) : - env(e) + env(e), + less_restrictive_remove_blockers_specs(make_null_shared_ptr()) { } }; @@ -94,6 +96,7 @@ GetConstraintsForDependentHelper::operator() ( result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>( n::destination_type() = dt_install_to_slash, n::force_unable() = false, + n::from_id() = id, n::nothing_is_fine_too() = true, n::reason() = reason, n::spec() = BlockDepSpec("!" + stringify(*spec), *spec, bk_weak), diff --git a/paludis/resolver/get_constraints_for_purge_helper.cc b/paludis/resolver/get_constraints_for_purge_helper.cc index 631a1e423..7c51fdedc 100644 --- a/paludis/resolver/get_constraints_for_purge_helper.cc +++ b/paludis/resolver/get_constraints_for_purge_helper.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 @@ -27,6 +27,7 @@ #include <paludis/util/simple_visitor_cast.hh> #include <paludis/util/make_shared_copy.hh> #include <paludis/util/make_named_values.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/util/stringify.hh> #include <paludis/dep_spec.hh> #include <paludis/package_id.hh> @@ -47,7 +48,8 @@ namespace paludis PackageDepSpecCollection purge_specs; Imp(const Environment * const e) : - env(e) + env(e), + purge_specs(make_null_shared_ptr()) { } }; @@ -85,6 +87,7 @@ GetConstraintsForPurgeHelper::operator() ( result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>( n::destination_type() = dt_install_to_slash, n::force_unable() = false, + n::from_id() = id, n::nothing_is_fine_too() = true, n::reason() = reason, n::spec() = BlockDepSpec("!" + stringify(spec), spec, bk_weak), diff --git a/paludis/resolver/get_constraints_for_via_binary_helper.cc b/paludis/resolver/get_constraints_for_via_binary_helper.cc index ee7ea91ff..c8b6f74b6 100644 --- a/paludis/resolver/get_constraints_for_via_binary_helper.cc +++ b/paludis/resolver/get_constraints_for_via_binary_helper.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 @@ -28,6 +28,7 @@ #include <paludis/util/make_shared_copy.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/stringify.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/dep_spec.hh> #include <paludis/partially_made_package_dep_spec.hh> @@ -71,6 +72,7 @@ GetConstraintsForViaBinaryHelper::operator() ( result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>( n::destination_type() = resolution->resolvent().destination_type(), n::force_unable() = false, + n::from_id() = make_null_shared_ptr(), n::nothing_is_fine_too() = false, n::reason() = reason, n::spec() = spec, diff --git a/paludis/resolver/get_initial_constraints_for_helper.cc b/paludis/resolver/get_initial_constraints_for_helper.cc index 85b154072..a26fd1c7b 100644 --- a/paludis/resolver/get_initial_constraints_for_helper.cc +++ b/paludis/resolver/get_initial_constraints_for_helper.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 @@ -87,11 +87,11 @@ GetInitialConstraintsForHelper::add_without_spec(const PackageDepSpec & spec) } void -GetInitialConstraintsForHelper::add_preset_spec(const PackageDepSpec & spec) +GetInitialConstraintsForHelper::add_preset_spec(const PackageDepSpec & spec, const std::shared_ptr<const PackageID> & from_id) { auto reason(std::make_shared<PresetReason>("preset", make_null_shared_ptr())); - auto ids((*_imp->env)[selection::BestVersionInEachSlot(generator::Matches(spec, { }))]); + auto ids((*_imp->env)[selection::BestVersionInEachSlot(generator::Matches(spec, from_id, { }))]); for (auto i(ids->begin()), i_end(ids->end()) ; i != i_end ; ++i) for (EnumIterator<DestinationType> t, t_end(last_dt) ; t != t_end ; ++t) @@ -101,6 +101,7 @@ GetInitialConstraintsForHelper::add_preset_spec(const PackageDepSpec & spec) const std::shared_ptr<Constraint> constraint(std::make_shared<Constraint>(make_named_values<Constraint>( n::destination_type() = r.destination_type(), n::force_unable() = false, + n::from_id() = from_id, n::nothing_is_fine_too() = true, n::reason() = reason, n::spec() = spec, @@ -234,6 +235,7 @@ GetInitialConstraintsForHelper::_make_initial_constraints_for( result->add(std::make_shared<Constraint>(make_named_values<Constraint>( n::destination_type() = resolvent.destination_type(), n::force_unable() = false, + n::from_id() = make_null_shared_ptr(), n::nothing_is_fine_too() = true, n::reason() = std::make_shared<PresetReason>("is scm", make_null_shared_ptr()), n::spec() = make_package_dep_spec({ }).package(resolvent.package()), diff --git a/paludis/resolver/get_initial_constraints_for_helper.hh b/paludis/resolver/get_initial_constraints_for_helper.hh index cdc3b3cce..c42f01f15 100644 --- a/paludis/resolver/get_initial_constraints_for_helper.hh +++ b/paludis/resolver/get_initial_constraints_for_helper.hh @@ -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 @@ -47,7 +47,7 @@ namespace paludis void add_without_spec(const PackageDepSpec &); - void add_preset_spec(const PackageDepSpec &); + void add_preset_spec(const PackageDepSpec &, const std::shared_ptr<const PackageID> & from_id); void add_suggested_restart(const SuggestRestart &); diff --git a/paludis/resolver/get_resolvents_for_helper.cc b/paludis/resolver/get_resolvents_for_helper.cc index 24a6f36c5..02f658deb 100644 --- a/paludis/resolver/get_resolvents_for_helper.cc +++ b/paludis/resolver/get_resolvents_for_helper.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 @@ -264,6 +264,7 @@ namespace std::pair<std::shared_ptr<Resolvents>, bool> GetResolventsForHelper::operator() ( const PackageDepSpec & spec, + const std::shared_ptr<const PackageID> & from_id, const std::shared_ptr<const SlotName> & maybe_slot, const std::shared_ptr<const Reason> & reason) const { @@ -271,7 +272,7 @@ GetResolventsForHelper::operator() ( std::shared_ptr<const PackageID> best; auto ids((*_imp->env)[selection::BestVersionOnly( - generator::Matches(spec, { mpo_ignore_additional_requirements }) | + generator::Matches(spec, from_id, { mpo_ignore_additional_requirements }) | filter::SupportsAction<InstallAction>() | filter::NotMasked() | (maybe_slot ? Filter(filter::Slot(*maybe_slot)) : Filter(filter::All())))]); @@ -280,7 +281,7 @@ GetResolventsForHelper::operator() ( best = *ids->begin(); auto installed_ids((*_imp->env)[selection::BestVersionInEachSlot( - generator::Matches(spec, { }) | + 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()))))]); diff --git a/paludis/resolver/get_resolvents_for_helper.hh b/paludis/resolver/get_resolvents_for_helper.hh index 03ebdef11..c310815bf 100644 --- a/paludis/resolver/get_resolvents_for_helper.hh +++ b/paludis/resolver/get_resolvents_for_helper.hh @@ -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 @@ -57,6 +57,7 @@ namespace paludis std::pair<std::shared_ptr<Resolvents>, bool> operator() ( const PackageDepSpec &, + const std::shared_ptr<const PackageID> & from_id, const std::shared_ptr<const SlotName> &, const std::shared_ptr<const Reason> &) const; }; diff --git a/paludis/resolver/interest_in_spec_helper.cc b/paludis/resolver/interest_in_spec_helper.cc index 35f5fc9d1..2427cbe4a 100644 --- a/paludis/resolver/interest_in_spec_helper.cc +++ b/paludis/resolver/interest_in_spec_helper.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 @@ -28,6 +28,7 @@ #include <paludis/util/pimp-impl.hh> #include <paludis/util/stringify.hh> #include <paludis/util/tribool.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/dep_spec.hh> #include <paludis/selection.hh> #include <paludis/generator.hh> @@ -65,6 +66,8 @@ namespace paludis Imp(const Environment * const e) : env(e), + no_blockers_from_specs(make_null_shared_ptr()), + no_dependencies_from_specs(make_null_shared_ptr()), follow_installed_build_dependencies(false), follow_installed_dependencies(true), take_suggestions(indeterminate), @@ -201,7 +204,7 @@ namespace const std::shared_ptr<const PackageIDSequence> installed_ids( (*env)[selection::SomeArbitraryVersion( - generator::Matches(*dep.spec().if_package(), { }) | + generator::Matches(*dep.spec().if_package(), dep.from_id(), { }) | filter::InstalledAtRoot(env->system_root_key()->value()))]); if (installed_ids->empty()) return false; @@ -271,7 +274,7 @@ InterestInSpecHelper::operator() ( for (auto l(_imp->take_from_specs.begin()), l_end(_imp->take_from_specs.end()) ; l != l_end ; ++l) { - if (match_package(*_imp->env, *l, id, { })) + if (match_package(*_imp->env, *l, id, make_null_shared_ptr(), { })) return si_take; } @@ -300,7 +303,7 @@ InterestInSpecHelper::operator() ( for (auto l(_imp->ignore_from_specs.begin()), l_end(_imp->ignore_from_specs.end()) ; l != l_end ; ++l) { - if (match_package(*_imp->env, *l, id, { })) + if (match_package(*_imp->env, *l, id, make_null_shared_ptr(), { })) return si_ignore; } @@ -328,7 +331,7 @@ InterestInSpecHelper::operator() ( { const std::shared_ptr<const PackageIDSequence> installed_ids( (*_imp->env)[selection::SomeArbitraryVersion( - generator::Matches(*dep.spec().if_package(), { }) | + generator::Matches(*dep.spec().if_package(), dep.from_id(), { }) | filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (! installed_ids->empty()) return si_take; diff --git a/paludis/resolver/order_early_helper.cc b/paludis/resolver/order_early_helper.cc index 2ea967ef0..11af1a767 100644 --- a/paludis/resolver/order_early_helper.cc +++ b/paludis/resolver/order_early_helper.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 @@ -24,6 +24,7 @@ #include <paludis/resolver/decision_utils.hh> #include <paludis/util/pimp-impl.hh> #include <paludis/util/tribool.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/dep_spec.hh> #include <paludis/package_dep_spec_collection.hh> @@ -40,7 +41,9 @@ namespace paludis PackageDepSpecCollection late_specs; Imp(const Environment * const e) : - env(e) + env(e), + early_specs(make_null_shared_ptr()), + late_specs(make_null_shared_ptr()) { } }; diff --git a/paludis/resolver/reason_utils-fwd.hh b/paludis/resolver/reason_utils-fwd.hh index 23cf6e593..b616b1e53 100644 --- a/paludis/resolver/reason_utils-fwd.hh +++ b/paludis/resolver/reason_utils-fwd.hh @@ -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 @@ -22,6 +22,7 @@ #include <paludis/util/attributes.hh> #include <paludis/resolver/reason-fwd.hh> +#include <paludis/package_id-fwd.hh> #include <memory> namespace paludis @@ -29,6 +30,9 @@ namespace paludis namespace resolver { bool is_target(const std::shared_ptr<const Reason> &) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result)); + + const std::shared_ptr<const PackageID> maybe_from_package_id_from_reason( + const std::shared_ptr<const Reason> &) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result)); } } diff --git a/paludis/resolver/reason_utils.cc b/paludis/resolver/reason_utils.cc index 063bd7703..724b23c77 100644 --- a/paludis/resolver/reason_utils.cc +++ b/paludis/resolver/reason_utils.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 @@ -19,6 +19,7 @@ #include <paludis/resolver/reason_utils.hh> #include <paludis/resolver/reason.hh> +#include <paludis/util/make_null_shared_ptr.hh> using namespace paludis; using namespace paludis::resolver; @@ -67,6 +68,49 @@ namespace return r.reason_for_set()->accept_returning<bool>(*this); } }; + + struct FromIDVisitor + { + std::shared_ptr<const PackageID> visit(const DependencyReason & r) const + { + return r.from_id(); + } + + std::shared_ptr<const PackageID> visit(const DependentReason &) const + { + return make_null_shared_ptr(); + } + + std::shared_ptr<const PackageID> visit(const WasUsedByReason &) const + { + return make_null_shared_ptr(); + } + + std::shared_ptr<const PackageID> visit(const PresetReason &) const + { + return make_null_shared_ptr(); + } + + std::shared_ptr<const PackageID> visit(const ViaBinaryReason &) const + { + return make_null_shared_ptr(); + } + + std::shared_ptr<const PackageID> visit(const TargetReason &) const + { + return make_null_shared_ptr(); + } + + std::shared_ptr<const PackageID> visit(const LikeOtherDestinationTypeReason & r) const + { + return r.reason_for_other()->accept_returning<std::shared_ptr<const PackageID> >(*this); + } + + std::shared_ptr<const PackageID> visit(const SetReason & r) const + { + return r.reason_for_set()->accept_returning<std::shared_ptr<const PackageID> >(*this); + } + }; } bool @@ -76,3 +120,10 @@ paludis::resolver::is_target(const std::shared_ptr<const Reason> & reason) return reason->accept_returning<bool>(v); } +const std::shared_ptr<const PackageID> +paludis::resolver::maybe_from_package_id_from_reason(const std::shared_ptr<const Reason> & reason) +{ + FromIDVisitor v; + return reason->accept_returning<std::shared_ptr<const PackageID> >(v); +} + diff --git a/paludis/resolver/remove_if_dependent_helper.cc b/paludis/resolver/remove_if_dependent_helper.cc index 7a8baa0f9..4e6116d31 100644 --- a/paludis/resolver/remove_if_dependent_helper.cc +++ b/paludis/resolver/remove_if_dependent_helper.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 @@ -23,6 +23,7 @@ #include <paludis/resolver/resolvent.hh> #include <paludis/resolver/resolution.hh> #include <paludis/util/pimp-impl.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/dep_spec.hh> #include <paludis/package_dep_spec_collection.hh> @@ -38,7 +39,8 @@ namespace paludis PackageDepSpecCollection remove_if_dependent_specs; Imp(const Environment * const e) : - env(e) + env(e), + remove_if_dependent_specs(make_null_shared_ptr()) { } }; diff --git a/paludis/resolver/resolver_functions.hh b/paludis/resolver/resolver_functions.hh index 4074599e1..4a286e0ed 100644 --- a/paludis/resolver/resolver_functions.hh +++ b/paludis/resolver/resolver_functions.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -137,6 +137,7 @@ namespace paludis typedef std::function<std::pair<std::shared_ptr<Resolvents>, bool> ( const PackageDepSpec &, + const std::shared_ptr<const PackageID> &, const std::shared_ptr<const SlotName> &, const std::shared_ptr<const Reason> & )> GetResolventsForFunction; diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc index 02a8b6f2c..87419b2c4 100644 --- a/paludis/resolver/sanitised_dependencies.cc +++ b/paludis/resolver/sanitised_dependencies.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -378,6 +378,7 @@ namespace n::active_dependency_labels() = *labels_stack.begin(), n::active_dependency_labels_as_string() = adl.str(), n::active_dependency_labels_classifier() = classifier, + n::from_id() = our_id, n::metadata_key_human_name() = human_name, n::metadata_key_raw_name() = raw_name, n::original_specs_as_string() = original_specs_as_string, @@ -542,6 +543,7 @@ SanitisedDependency::serialise(Serialiser & s) const .member(SerialiserFlags<>(), "active_conditions_as_string", active_conditions_as_string()) .member(SerialiserFlags<>(), "active_dependency_labels_as_string", active_dependency_labels_as_string()) .member(SerialiserFlags<serialise::might_be_null>(), "active_dependency_labels_classifier", active_dependency_labels_classifier()) + .member(SerialiserFlags<serialise::might_be_null>(), "from_id", from_id()) .member(SerialiserFlags<>(), "metadata_key_human_name", metadata_key_human_name()) .member(SerialiserFlags<>(), "metadata_key_raw_name", metadata_key_raw_name()) .member(SerialiserFlags<>(), "original_specs_as_string", original_specs_as_string()) @@ -561,6 +563,7 @@ SanitisedDependency::deserialise(Deserialisation & d, const std::shared_ptr<cons n::active_dependency_labels() = make_null_shared_ptr(), n::active_dependency_labels_as_string() = v.member<std::string>("active_dependency_labels_as_string"), n::active_dependency_labels_classifier() = v.member<std::shared_ptr<LabelsClassifier> >("active_dependency_labels_classifier"), + n::from_id() = v.member<std::shared_ptr<const PackageID> >("from_id"), n::metadata_key_human_name() = v.member<std::string>("metadata_key_human_name"), n::metadata_key_raw_name() = v.member<std::string>("metadata_key_raw_name"), n::original_specs_as_string() = v.member<std::string>("original_specs_as_string"), diff --git a/paludis/resolver/sanitised_dependencies.hh b/paludis/resolver/sanitised_dependencies.hh index cbfa4e0a9..dd270391b 100644 --- a/paludis/resolver/sanitised_dependencies.hh +++ b/paludis/resolver/sanitised_dependencies.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -40,6 +40,7 @@ namespace paludis typedef Name<struct name_active_dependency_labels> active_dependency_labels; typedef Name<struct name_active_dependency_labels_as_string> active_dependency_labels_as_string; typedef Name<struct name_active_dependency_labels_classifier> active_dependency_labels_classifier; + typedef Name<struct name_from_id> from_id; typedef Name<struct name_metadata_key_human_name> metadata_key_human_name; typedef Name<struct name_metadata_key_raw_name> metadata_key_raw_name; typedef Name<struct name_original_specs_as_string> original_specs_as_string; @@ -54,6 +55,7 @@ namespace paludis NamedValue<n::active_dependency_labels, std::shared_ptr<const DependenciesLabelSequence> > active_dependency_labels; NamedValue<n::active_dependency_labels_as_string, std::string> active_dependency_labels_as_string; NamedValue<n::active_dependency_labels_classifier, std::shared_ptr<const LabelsClassifier> > active_dependency_labels_classifier; + NamedValue<n::from_id, std::shared_ptr<const PackageID> > from_id; NamedValue<n::metadata_key_human_name, std::string> metadata_key_human_name; NamedValue<n::metadata_key_raw_name, std::string> metadata_key_raw_name; NamedValue<n::original_specs_as_string, std::string> original_specs_as_string; diff --git a/paludis/selection_TEST.cc b/paludis/selection_TEST.cc index 928d2d4da..4d5c82049 100644 --- a/paludis/selection_TEST.cc +++ b/paludis/selection_TEST.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 @@ -30,6 +30,7 @@ #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/make_named_values.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <test/test_runner.hh> #include <test/test_framework.hh> #include <test/test_concepts.hh> @@ -69,41 +70,41 @@ namespace test_cases TEST_CHECK(true); PackageDepSpec d1(parse_user_package_dep_spec("r1c1/r1c1p1", &env, { })); - const std::shared_ptr<const PackageIDSequence> q1(env[selection::AllVersionsSorted(generator::Matches(d1, { }))]); + const std::shared_ptr<const PackageIDSequence> q1(env[selection::AllVersionsSorted(generator::Matches(d1, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(std::distance(q1->begin(), q1->end()), 1); PackageDepSpec d2(parse_user_package_dep_spec("r1c1/r1c1p2", &env, { })); - const std::shared_ptr<const PackageIDSequence> q2(env[selection::AllVersionsSorted(generator::Matches(d2, { }))]); + const std::shared_ptr<const PackageIDSequence> q2(env[selection::AllVersionsSorted(generator::Matches(d2, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(std::distance(q2->begin(), q2->end()), 2); PackageDepSpec d3(parse_user_package_dep_spec(">=r1c1/r1c1p2-1", &env, { })); - const std::shared_ptr<const PackageIDSequence> q3(env[selection::AllVersionsSorted(generator::Matches(d3, { }))]); + const std::shared_ptr<const PackageIDSequence> q3(env[selection::AllVersionsSorted(generator::Matches(d3, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(std::distance(q3->begin(), q3->end()), 2); PackageDepSpec d4(parse_user_package_dep_spec(">=r1c1/r1c1p2-2", &env, { })); - const std::shared_ptr<const PackageIDSequence> q4(env[selection::AllVersionsSorted(generator::Matches(d4, { }))]); + const std::shared_ptr<const PackageIDSequence> q4(env[selection::AllVersionsSorted(generator::Matches(d4, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q4->begin()), indirect_iterator(q4->end()), " "), "r1c1/r1c1p2-2:0::repo1"); TEST_CHECK_EQUAL(std::distance(q4->begin(), q4->end()), 1); PackageDepSpec d5(parse_user_package_dep_spec(">=r1c1/r1c1p2-3", &env, { })); - const std::shared_ptr<const PackageIDSequence> q5(env[selection::AllVersionsSorted(generator::Matches(d5, { }))]); + const std::shared_ptr<const PackageIDSequence> q5(env[selection::AllVersionsSorted(generator::Matches(d5, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(std::distance(q5->begin(), q5->end()), 0); PackageDepSpec d6(parse_user_package_dep_spec("<r1c1/r1c1p2-3", &env, { })); - const std::shared_ptr<const PackageIDSequence> q6(env[selection::AllVersionsSorted(generator::Matches(d6, { }))]); + const std::shared_ptr<const PackageIDSequence> q6(env[selection::AllVersionsSorted(generator::Matches(d6, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(std::distance(q6->begin(), q6->end()), 2); PackageDepSpec d7(parse_user_package_dep_spec("rac1/rac1pa", &env, { })); - const std::shared_ptr<const PackageIDSequence> q7(env[selection::AllVersionsSorted(generator::Matches(d7, { }))]); + const std::shared_ptr<const PackageIDSequence> q7(env[selection::AllVersionsSorted(generator::Matches(d7, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(std::distance(q7->begin(), q7->end()), 4); PackageDepSpec d8(parse_user_package_dep_spec("foo/bar", &env, { })); - const std::shared_ptr<const PackageIDSequence> q8(env[selection::AllVersionsSorted(generator::Matches(d8, { }))]); + const std::shared_ptr<const PackageIDSequence> q8(env[selection::AllVersionsSorted(generator::Matches(d8, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(std::distance(q8->begin(), q8->end()), 0); PackageDepSpec d9(parse_user_package_dep_spec("r1c1/r1c1p1", &env, { })); - const std::shared_ptr<const PackageIDSequence> q9(env[selection::AllVersionsSorted(generator::Matches(d9, { }) + const std::shared_ptr<const PackageIDSequence> q9(env[selection::AllVersionsSorted(generator::Matches(d9, make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>())]); TEST_CHECK_EQUAL(std::distance(q9->begin(), q9->end()), 1); } @@ -137,19 +138,19 @@ namespace test_cases PackageDepSpec d(parse_user_package_dep_spec("cat/pkg", &env, { })); - const std::shared_ptr<const PackageIDSequence> q1(env[selection::AllVersionsSorted(generator::Matches(d, { }))]); + const std::shared_ptr<const PackageIDSequence> q1(env[selection::AllVersionsSorted(generator::Matches(d, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q1->begin()), indirect_iterator(q1->end()), " "), "cat/pkg-1:a::repo2 cat/pkg-1:a::repo1 cat/pkg-2:c::repo1 cat/pkg-3:b::repo2 cat/pkg-3:c::repo1 cat/pkg-4:a::repo1"); - const std::shared_ptr<const PackageIDSequence> q2(env[selection::AllVersionsGroupedBySlot(generator::Matches(d, { }))]); + const std::shared_ptr<const PackageIDSequence> q2(env[selection::AllVersionsGroupedBySlot(generator::Matches(d, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q2->begin()), indirect_iterator(q2->end()), " "), "cat/pkg-3:b::repo2 cat/pkg-2:c::repo1 cat/pkg-3:c::repo1 cat/pkg-1:a::repo2 cat/pkg-1:a::repo1 cat/pkg-4:a::repo1"); - const std::shared_ptr<const PackageIDSequence> q3(env[selection::BestVersionOnly(generator::Matches(d, { }))]); + const std::shared_ptr<const PackageIDSequence> q3(env[selection::BestVersionOnly(generator::Matches(d, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q3->begin()), indirect_iterator(q3->end()), " "), "cat/pkg-4:a::repo1"); - const std::shared_ptr<const PackageIDSequence> q4(env[selection::BestVersionInEachSlot(generator::Matches(d, { }))]); + const std::shared_ptr<const PackageIDSequence> q4(env[selection::BestVersionInEachSlot(generator::Matches(d, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q4->begin()), indirect_iterator(q4->end()), " "), "cat/pkg-3:b::repo2 cat/pkg-3:c::repo1 cat/pkg-4:a::repo1"); @@ -162,31 +163,31 @@ namespace test_cases PackageDepSpec c(parse_user_package_dep_spec("cat/*", &env, { updso_allow_wildcards })); - const std::shared_ptr<const PackageIDSequence> q5(env[selection::AllVersionsSorted(generator::Matches(c, { }))]); + const std::shared_ptr<const PackageIDSequence> q5(env[selection::AllVersionsSorted(generator::Matches(c, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q5->begin()), indirect_iterator(q5->end()), " "), "cat/other-1:a::repo3 cat/pkg-1:a::repo2 cat/pkg-1:a::repo1 cat/pkg-2:c::repo1 " "cat/pkg-3:b::repo2 cat/pkg-3:c::repo1 cat/pkg-4:a::repo1"); - const std::shared_ptr<const PackageIDSequence> q6(env[selection::AllVersionsGroupedBySlot(generator::Matches(c, { }))]); + const std::shared_ptr<const PackageIDSequence> q6(env[selection::AllVersionsGroupedBySlot(generator::Matches(c, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q6->begin()), indirect_iterator(q6->end()), " "), "cat/other-1:a::repo3 cat/pkg-3:b::repo2 cat/pkg-2:c::repo1 cat/pkg-3:c::repo1 " "cat/pkg-1:a::repo2 cat/pkg-1:a::repo1 cat/pkg-4:a::repo1"); - const std::shared_ptr<const PackageIDSequence> q7(env[selection::BestVersionOnly(generator::Matches(c, { }))]); + const std::shared_ptr<const PackageIDSequence> q7(env[selection::BestVersionOnly(generator::Matches(c, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q7->begin()), indirect_iterator(q7->end()), " "), "cat/other-1:a::repo3 cat/pkg-4:a::repo1"); - const std::shared_ptr<const PackageIDSequence> q8(env[selection::BestVersionInEachSlot(generator::Matches(c, { }))]); + const std::shared_ptr<const PackageIDSequence> q8(env[selection::BestVersionInEachSlot(generator::Matches(c, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q8->begin()), indirect_iterator(q8->end()), " "), "cat/other-1:a::repo3 cat/pkg-3:b::repo2 cat/pkg-3:c::repo1 cat/pkg-4:a::repo1"); PackageDepSpec b(parse_user_package_dep_spec("cat/pkg:a", &env, { })); - const std::shared_ptr<const PackageIDSequence> q9(env[selection::AllVersionsGroupedBySlot(generator::Matches(b, { }))]); + const std::shared_ptr<const PackageIDSequence> q9(env[selection::AllVersionsGroupedBySlot(generator::Matches(b, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q9->begin()), indirect_iterator(q9->end()), " "), "cat/pkg-1:a::repo2 cat/pkg-1:a::repo1 cat/pkg-4:a::repo1"); PackageDepSpec a(parse_user_package_dep_spec("cat/pkg[=1|=3]", &env, { })); - const std::shared_ptr<const PackageIDSequence> q10(env[selection::AllVersionsGroupedBySlot(generator::Matches(a, { }))]); + const std::shared_ptr<const PackageIDSequence> q10(env[selection::AllVersionsGroupedBySlot(generator::Matches(a, make_null_shared_ptr(), { }))]); TEST_CHECK_EQUAL(join(indirect_iterator(q10->begin()), indirect_iterator(q10->end()), " "), "cat/pkg-1:a::repo2 cat/pkg-1:a::repo1 cat/pkg-3:b::repo2 cat/pkg-3:c::repo1"); } diff --git a/paludis/serialise.cc b/paludis/serialise.cc index bb8c249b0..43f256700 100644 --- a/paludis/serialise.cc +++ b/paludis/serialise.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -378,7 +378,7 @@ DeserialisatorHandler<std::shared_ptr<const PackageID> >::handle(Deserialisation epdso_allow_use_dep_question_defaults }, { vso_flexible_dashes, vso_flexible_dots, vso_ignore_case, vso_letters_anywhere, vso_dotted_suffixes }, - make_null_shared_ptr()), { }))]->begin(); + make_null_shared_ptr()), make_null_shared_ptr(), { }))]->begin(); } template class Pimp<Deserialiser>; diff --git a/paludis/set_file.cc b/paludis/set_file.cc index f6a36bca4..aef0dfe2d 100644 --- a/paludis/set_file.cc +++ b/paludis/set_file.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -28,6 +28,7 @@ #include <paludis/util/system.hh> #include <paludis/util/safe_ofstream.hh> #include <paludis/util/process.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/environment.hh> #include <paludis/package_database.hh> #include <paludis/selection.hh> @@ -275,7 +276,7 @@ namespace make_package_dep_spec({ }) .package(*spec->package_ptr()) .slot_requirement(spec->slot_requirement_ptr()), - { }) | + make_null_shared_ptr(), { }) | filter::InstalledAtRoot(params.environment()->preferred_root_key()->value()))]->empty()) result->top()->append(spec); } diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc index c07b5f88d..2ecdd3cef 100644 --- a/paludis/user_dep_spec.cc +++ b/paludis/user_dep_spec.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2005, 2006, 2007, 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 @@ -41,6 +41,7 @@ #include <paludis/util/destringify.hh> #include <paludis/util/accept_visitor.hh> #include <paludis/util/tribool.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <algorithm> using namespace paludis; @@ -77,7 +78,7 @@ namespace if (options[updso_no_disambiguation]) throw PackageDepSpecError("Need an explicit category specified"); result.package(env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(s), - filter::And(filter, filter::Matches(result, { })))); + filter::And(filter, filter::Matches(result, make_null_shared_ptr(), { })))); } } diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc index 79522355c..8a2d21d23 100644 --- a/paludis/user_dep_spec_TEST.cc +++ b/paludis/user_dep_spec_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -28,6 +28,7 @@ #include <paludis/util/options.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/make_named_values.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/version_requirements.hh> #include <paludis/environments/test/test_environment.hh> #include <paludis/repositories/fake/fake_repository.hh> @@ -430,75 +431,75 @@ namespace test_cases pkg3->keywords_key()->set_from_string("~d"); PackageDepSpec a(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS<~a]", &env, { })); - TEST_CHECK(match_package(env, a, pkg1, { })); - TEST_CHECK(match_package(env, a, pkg2, { })); - TEST_CHECK(! match_package(env, a, pkg3, { })); + TEST_CHECK(match_package(env, a, pkg1, make_null_shared_ptr(), { })); + TEST_CHECK(match_package(env, a, pkg2, make_null_shared_ptr(), { })); + TEST_CHECK(! match_package(env, a, pkg3, make_null_shared_ptr(), { })); PackageDepSpec b(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS<~b]", &env, { })); - TEST_CHECK(match_package(env, b, pkg1, { })); - TEST_CHECK(! match_package(env, b, pkg2, { })); - TEST_CHECK(! match_package(env, b, pkg3, { })); + TEST_CHECK(match_package(env, b, pkg1, make_null_shared_ptr(), { })); + TEST_CHECK(! match_package(env, b, pkg2, make_null_shared_ptr(), { })); + TEST_CHECK(! match_package(env, b, pkg3, make_null_shared_ptr(), { })); PackageDepSpec c(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS<~c]", &env, { })); - TEST_CHECK(! match_package(env, c, pkg1, { })); - TEST_CHECK(match_package(env, c, pkg2, { })); - TEST_CHECK(! match_package(env, c, pkg3, { })); + TEST_CHECK(! match_package(env, c, pkg1, make_null_shared_ptr(), { })); + TEST_CHECK(match_package(env, c, pkg2, make_null_shared_ptr(), { })); + TEST_CHECK(! match_package(env, c, pkg3, make_null_shared_ptr(), { })); PackageDepSpec d(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS>~a]", &env, { })); - TEST_CHECK(! match_package(env, d, pkg1, { })); - TEST_CHECK(! match_package(env, d, pkg2, { })); - TEST_CHECK(! match_package(env, d, pkg3, { })); + TEST_CHECK(! match_package(env, d, pkg1, make_null_shared_ptr(), { })); + TEST_CHECK(! match_package(env, d, pkg2, make_null_shared_ptr(), { })); + TEST_CHECK(! match_package(env, d, pkg3, make_null_shared_ptr(), { })); PackageDepSpec e(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS=~d]", &env, { })); - TEST_CHECK(! match_package(env, e, pkg1, { })); - TEST_CHECK(! match_package(env, e, pkg2, { })); - TEST_CHECK(match_package(env, e, pkg3, { })); + TEST_CHECK(! match_package(env, e, pkg1, make_null_shared_ptr(), { })); + TEST_CHECK(! match_package(env, e, pkg2, make_null_shared_ptr(), { })); + TEST_CHECK(match_package(env, e, pkg3, make_null_shared_ptr(), { })); PackageDepSpec f(parse_user_package_dep_spec("cat/pkg1[.KEYWORDS=~a ~c]", &env, { })); - TEST_CHECK(! match_package(env, f, pkg1, { })); - TEST_CHECK(match_package(env, f, pkg2, { })); - TEST_CHECK(! match_package(env, f, pkg3, { })); + TEST_CHECK(! match_package(env, f, pkg1, make_null_shared_ptr(), { })); + TEST_CHECK(match_package(env, f, pkg2, make_null_shared_ptr(), { })); + TEST_CHECK(! match_package(env, f, pkg3, make_null_shared_ptr(), { })); PackageDepSpec g(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER=42]", &env, { })); - TEST_CHECK(match_package(env, g, pkg1, { })); + TEST_CHECK(match_package(env, g, pkg1, make_null_shared_ptr(), { })); PackageDepSpec h(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER<41]", &env, { })); - TEST_CHECK(! match_package(env, h, pkg1, { })); + TEST_CHECK(! match_package(env, h, pkg1, make_null_shared_ptr(), { })); PackageDepSpec i(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER<42]", &env, { })); - TEST_CHECK(! match_package(env, i, pkg1, { })); + TEST_CHECK(! match_package(env, i, pkg1, make_null_shared_ptr(), { })); PackageDepSpec j(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER<43]", &env, { })); - TEST_CHECK(match_package(env, j, pkg1, { })); + TEST_CHECK(match_package(env, j, pkg1, make_null_shared_ptr(), { })); PackageDepSpec k(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER>42]", &env, { })); - TEST_CHECK(! match_package(env, k, pkg1, { })); + TEST_CHECK(! match_package(env, k, pkg1, make_null_shared_ptr(), { })); PackageDepSpec l(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER>41]", &env, { })); - TEST_CHECK(match_package(env, l, pkg1, { })); + TEST_CHECK(match_package(env, l, pkg1, make_null_shared_ptr(), { })); PackageDepSpec m(parse_user_package_dep_spec("cat/pkg1[.HITCHHIKER?]", &env, { })); - TEST_CHECK(match_package(env, m, pkg1, { })); + TEST_CHECK(match_package(env, m, pkg1, make_null_shared_ptr(), { })); PackageDepSpec n(parse_user_package_dep_spec("cat/pkg1[.SPOON?]", &env, { })); - TEST_CHECK(! match_package(env, n, pkg1, { })); + TEST_CHECK(! match_package(env, n, pkg1, make_null_shared_ptr(), { })); PackageDepSpec o(parse_user_package_dep_spec("cat/pkg1[.$keywords<~a]", &env, { })); - TEST_CHECK(match_package(env, o, pkg1, { })); - TEST_CHECK(match_package(env, o, pkg2, { })); - TEST_CHECK(! match_package(env, o, pkg3, { })); + TEST_CHECK(match_package(env, o, pkg1, make_null_shared_ptr(), { })); + TEST_CHECK(match_package(env, o, pkg2, make_null_shared_ptr(), { })); + TEST_CHECK(! match_package(env, o, pkg3, make_null_shared_ptr(), { })); PackageDepSpec p(parse_user_package_dep_spec("cat/pkg1[.::$format=fake]", &env, { })); - TEST_CHECK(match_package(env, p, pkg1, { })); + TEST_CHECK(match_package(env, p, pkg1, make_null_shared_ptr(), { })); PackageDepSpec q(parse_user_package_dep_spec("cat/pkg1[.::$format=e]", &env, { })); - TEST_CHECK(! match_package(env, q, pkg1, { })); + TEST_CHECK(! match_package(env, q, pkg1, make_null_shared_ptr(), { })); PackageDepSpec r(parse_user_package_dep_spec("cat/pkg1[.::format=fake]", &env, { })); - TEST_CHECK(match_package(env, r, pkg1, { })); + TEST_CHECK(match_package(env, r, pkg1, make_null_shared_ptr(), { })); PackageDepSpec s(parse_user_package_dep_spec("cat/pkg1[.::format=e]", &env, { })); - TEST_CHECK(! match_package(env, s, pkg1, { })); + TEST_CHECK(! match_package(env, s, pkg1, make_null_shared_ptr(), { })); } } test_user_package_dep_spec_user_key_req; } diff --git a/python/dep_list.cc b/python/dep_list.cc index 3a83dd46f..74703e0d8 100644 --- a/python/dep_list.cc +++ b/python/dep_list.cc @@ -299,11 +299,6 @@ void expose_dep_list() "Return whether a spec structure is already installed." ) - .def("match_on_list", &DepList::match_on_list, - "match_on_list(PackageDepSpec) -> bool\n" - "Return whether a spec matches an item in the list." - ) - .def("__iter__", bp::range<bp::return_internal_reference<> >(dl_begin_ptr, dl_end_ptr)) ; } diff --git a/python/dep_list_TEST.py b/python/dep_list_TEST.py index 129ea1e78..616bd364f 100755 --- a/python/dep_list_TEST.py +++ b/python/dep_list_TEST.py @@ -131,25 +131,14 @@ class TestCase_02_DepList(unittest.TestCase): def test_02_options(self): self.assert_(isinstance(dl.options, DepListOptions)) - def test_03_match_on_list(self): - self.assert_(not dl.match_on_list(pds)) - def test_04_clear(self): dl.add(pds, dd) - self.assert_(dl.match_on_list(pds)) dl.clear() - self.assert_(not dl.match_on_list(pds)) def test_05_add(self): - self.assert_(not dl.match_on_list(pds)) dl.add(pds, dd) - self.assert_(dl.match_on_list(pds)) - dl.clear() - - self.assert_(not dl.match_on_list(pds)) dl.add(cds, dd) - self.assert_(dl.match_on_list(pds)) def test_06_already_installed(self): self.assert_(not dl.already_installed(pds, dd)) diff --git a/python/generator.cc b/python/generator.cc index 80d771d00..4281fdb2a 100644 --- a/python/generator.cc +++ b/python/generator.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008 Ciaran McCreesh + * Copyright (c) 2008, 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 @@ -24,11 +24,20 @@ #include <paludis/filtered_generator.hh> #include <paludis/filter.hh> #include <paludis/dep_spec.hh> +#include <paludis/util/make_null_shared_ptr.hh> using namespace paludis; using namespace paludis::python; namespace bp = boost::python; +namespace +{ + generator::Matches * make_generator_matches(const PackageDepSpec & spec, const MatchPackageOptions & o) + { + return new generator::Matches(spec, make_null_shared_ptr(), o); + } +} + void expose_generator() { bp::class_<Generator> generator( @@ -62,7 +71,12 @@ void expose_generator() bp::class_<generator::Matches, bp::bases<Generator> > generator_matches( "Matches", "Generate matching packages.", - bp::init<const PackageDepSpec &, const MatchPackageOptions &>("__init__(spec, MatchPackageOptions)") + bp::no_init + ); + + generator_matches.def("__init__", + bp::make_constructor(&make_generator_matches), + "__init__(spec, MatchPackageOptions)" ); bp::class_<generator::Intersection, bp::bases<Generator> > generator_intersection( diff --git a/ruby/dep_list_TEST.rb b/ruby/dep_list_TEST.rb index cf8457996..056ba64f6 100644 --- a/ruby/dep_list_TEST.rb +++ b/ruby/dep_list_TEST.rb @@ -206,7 +206,7 @@ module Paludis def test_add_bad_tree assert_raise TypeError do dl.add(env[Selection::BestVersionOnly.new(Generator::Matches.new( - pda, []))].last.build_dependencies_key.value, dd) + pda, nil, []))].last.build_dependencies_key.value, dd) end end diff --git a/ruby/environment_TEST.rb b/ruby/environment_TEST.rb index 22ac5c4c1..dd76c4d5c 100644 --- a/ruby/environment_TEST.rb +++ b/ruby/environment_TEST.rb @@ -2,7 +2,7 @@ # vim: set sw=4 sts=4 et tw=80 : # -# Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh +# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh # Copyright (c) 2007, 2008 Richard Brown # # This file is part of the Paludis package manager. Paludis is free software; @@ -80,7 +80,7 @@ module Paludis def pid env[Selection::RequireExactlyOne.new(Generator::Matches.new( - Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), []))].first + Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), nil, []))].first end def test_accept_license @@ -88,7 +88,7 @@ module Paludis assert !env.accept_license('Failure', pid) pid2 = env[Selection::RequireExactlyOne.new(Generator::Matches.new( - Paludis::parse_user_package_dep_spec('=foo/baz-1.0::testrepo', env, []), []))].first + Paludis::parse_user_package_dep_spec('=foo/baz-1.0::testrepo', env, []), nil, []))].first assert env.accept_license('GPL-2', pid2) assert env.accept_license('Failure', pid2) end @@ -107,7 +107,7 @@ module Paludis def pid env[Selection::RequireExactlyOne.new(Generator::Matches.new( - Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), []))].first + Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), nil, []))].first end def test_accept_keywords @@ -311,7 +311,7 @@ module Paludis end def test_package_database_query - a = env[Selection::AllVersionsSorted.new(Generator::Matches.new(pda, []))] + a = env[Selection::AllVersionsSorted.new(Generator::Matches.new(pda, nil, []))] assert_kind_of Array, a assert_equal 1, a.length pid = a.first @@ -320,7 +320,7 @@ module Paludis assert_equal '1.0', pid.version.to_s assert_equal 'testrepo', pid.repository_name - a = env[Selection::AllVersionsSorted.new(Generator::Matches.new(pda, []) | Filter::SupportsAction.new(InstallAction))] + a = env[Selection::AllVersionsSorted.new(Generator::Matches.new(pda, nil, []) | Filter::SupportsAction.new(InstallAction))] assert_kind_of Array, a assert_equal 1, a.length pid = a.first @@ -329,7 +329,7 @@ module Paludis assert_equal '1.0', pid.version.to_s assert_equal 'testrepo', pid.repository_name - a = env[Selection::AllVersionsSorted.new(Generator::Matches.new(pda, []))] + a = env[Selection::AllVersionsSorted.new(Generator::Matches.new(pda, nil, []))] assert_kind_of Array, a assert_equal 1, a.length pid = a.first @@ -338,7 +338,7 @@ module Paludis assert_equal '1.0', pid.version.to_s assert_equal 'testrepo', pid.repository_name - a = env[Selection::AllVersionsSorted.new(Generator::Matches.new(pda2, []) | Filter::SupportsAction.new(InstallAction))] + a = env[Selection::AllVersionsSorted.new(Generator::Matches.new(pda2, nil, []) | Filter::SupportsAction.new(InstallAction))] assert_kind_of Array, a assert_equal 2, a.length pid = a.shift @@ -368,10 +368,10 @@ module Paludis a = env[Selection::AllVersionsUnsorted.new(Generator::Matches.new(Paludis::parse_user_package_dep_spec( - '>=foo/bar-27', env, []), []))] + '>=foo/bar-27', env, []), nil, []))] assert a.empty? - a = env[Selection::AllVersionsUnsorted.new(Generator::Matches.new(pda2, []) | Filter::SupportsAction.new(ConfigAction))] + a = env[Selection::AllVersionsUnsorted.new(Generator::Matches.new(pda2, nil, []) | Filter::SupportsAction.new(ConfigAction))] assert a.empty? end end diff --git a/ruby/generator.cc b/ruby/generator.cc index 16631b992..5d6f753eb 100644 --- a/ruby/generator.cc +++ b/ruby/generator.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2009 Ciaran McCreesh + * Copyright (c) 2008, 2009, 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 @@ -110,14 +110,15 @@ namespace } VALUE - generator_matches_new(VALUE self, VALUE spec_v, VALUE options_v) + generator_matches_new(VALUE self, VALUE spec_v, VALUE id_v, VALUE options_v) { Generator * ptr(0); try { std::shared_ptr<const PackageDepSpec> spec(value_to_package_dep_spec(spec_v)); + std::shared_ptr<const PackageID> id(value_to_package_id(id_v, true)); MatchPackageOptions options(value_to_match_package_options(options_v)); - ptr = new generator::Matches(*spec, options); + ptr = new generator::Matches(*spec, id, options); VALUE data(Data_Wrap_Struct(self, 0, &Common<Generator>::free, ptr)); rb_obj_call_init(data, 2, &spec_v); return data; @@ -300,7 +301,7 @@ namespace * Generate matching packages. */ c_generator_matches = rb_define_class_under(c_generator_module, "Matches", c_generator); - rb_define_singleton_method(c_generator_matches, "new", RUBY_FUNC_CAST(&generator_matches_new), 2); + rb_define_singleton_method(c_generator_matches, "new", RUBY_FUNC_CAST(&generator_matches_new), 3); /* * Document-class: Paludis::Generator::Intersection diff --git a/ruby/generator_TEST.rb b/ruby/generator_TEST.rb index e4dd336a5..7b91c0820 100644 --- a/ruby/generator_TEST.rb +++ b/ruby/generator_TEST.rb @@ -2,7 +2,7 @@ # vim: set sw=4 sts=4 et tw=80 : # -# Copyright (c) 2008 Ciaran McCreesh +# Copyright (c) 2008, 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 @@ -51,15 +51,15 @@ module Paludis def test_create assert_nothing_raised do - Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", env, []), []) + Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", env, []), nil, []) end end def test_to_s - assert_equal Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", env, []), []).to_s, + assert_equal Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", env, []), nil, []).to_s, "packages matching a/b" assert_equal Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", env, []), - [:ignore_additional_requirements]).to_s, + nil, [:ignore_additional_requirements]).to_s, "packages matching a/b (ignoring additional requirements)" end end diff --git a/ruby/package_id.cc b/ruby/package_id.cc index 71dab061f..e7ba44b8e 100644 --- a/ruby/package_id.cc +++ b/ruby/package_id.cc @@ -576,8 +576,11 @@ paludis::ruby::package_id_to_value(std::shared_ptr<const PackageID> m) } std::shared_ptr<const PackageID> -paludis::ruby::value_to_package_id(VALUE v) +paludis::ruby::value_to_package_id(VALUE v, bool nil_ok) { + if (nil_ok && rb_obj_is_kind_of(v, rb_cNilClass)) + return std::shared_ptr<const PackageID>(); + if (rb_obj_is_kind_of(v, c_package_id)) { std::shared_ptr<const PackageID> * v_ptr; diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc index 95d68140b..661c62d60 100644 --- a/ruby/paludis_ruby.cc +++ b/ruby/paludis_ruby.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh * Copyright (c) 2006, 2007, 2008 Richard Brown * * This file is part of the Paludis package manager. Paludis is free software; @@ -79,20 +79,21 @@ namespace * Document-method: match_package * * call-seq: - * match_package(environment, package_dep_spec, package_id, options) -> true or false + * match_package(environment, package_dep_spec, package_id, from_package_id, options) -> true or false * * Return whether the specified PackageID matches the specified PackageDepSpec. * */ - VALUE paludis_match_package(VALUE, VALUE en, VALUE a, VALUE t, VALUE o) + VALUE paludis_match_package(VALUE, VALUE en, VALUE a, VALUE t, VALUE f, VALUE o) { try { std::shared_ptr<Environment> env = value_to_environment(en); std::shared_ptr<const PackageDepSpec> spec = value_to_package_dep_spec(a); std::shared_ptr<const PackageID> target = value_to_package_id(t); + std::shared_ptr<const PackageID> from_package_id = value_to_package_id(f, true); MatchPackageOptions options(value_to_match_package_options(o)); - return match_package(*env, *spec, target, options) ? Qtrue : Qfalse; + return match_package(*env, *spec, target, from_package_id, options) ? Qtrue : Qfalse; } catch (const std::exception & e) { @@ -427,7 +428,7 @@ void PALUDIS_VISIBLE paludis::ruby::init() */ c_bad_version_operator_error = rb_define_class_under(c_paludis_module, "BadVersionOperatorError", rb_eRuntimeError); - rb_define_module_function(c_paludis_module, "match_package", RUBY_FUNC_CAST(&paludis_match_package), 4); + rb_define_module_function(c_paludis_module, "match_package", RUBY_FUNC_CAST(&paludis_match_package), 5); rb_define_module_function(c_paludis_module, "match_package_in_set", RUBY_FUNC_CAST(&paludis_match_package_in_set), 4); rb_define_module_function(c_paludis_module, "version_spec_comparator", RUBY_FUNC_CAST(&paludis_version_spec_comparator), 3); diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh index 8ac703083..bb86a76c9 100644 --- a/ruby/paludis_ruby.hh +++ b/ruby/paludis_ruby.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh * Copyright (c) 2006, 2007, 2008 Richard Brown * * This file is part of the Paludis package manager. Paludis is free software; @@ -110,7 +110,7 @@ namespace paludis VALUE bool_to_value(bool b); VersionSpec value_to_version_spec(VALUE v); - std::shared_ptr<const PackageID> value_to_package_id(VALUE); + std::shared_ptr<const PackageID> value_to_package_id(VALUE, bool nil_ok = false); std::shared_ptr<const PackageDepSpec> value_to_package_dep_spec(VALUE v); std::shared_ptr<const DependenciesLabelsDepSpec> value_to_dependencies_labels_dep_spec(VALUE v); std::shared_ptr<const DepSpec> value_to_dep_spec(VALUE v); diff --git a/ruby/paludis_ruby_TEST.rb b/ruby/paludis_ruby_TEST.rb index 8a830fc3e..2bd9d6dd1 100644 --- a/ruby/paludis_ruby_TEST.rb +++ b/ruby/paludis_ruby_TEST.rb @@ -2,7 +2,7 @@ # vim: set sw=4 sts=4 et tw=80 : # -# Copyright (c) 2006, 2007, 2008 Ciaran McCreesh +# Copyright (c) 2006, 2007, 2008, 2011 Ciaran McCreesh # Copyright (c) 2008 Richard Brown # # This file is part of the Paludis package manager. Paludis is free software; @@ -42,10 +42,10 @@ module Paludis spec_good = Paludis::parse_user_package_dep_spec('>=foo/bar-1', env, []) spec_bad = Paludis::parse_user_package_dep_spec('>=foo/bar-2', env, []) pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new( - Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), []))].first + Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), nil, []))].first - assert Paludis::match_package(env, spec_good, pid, []) - assert !Paludis::match_package(env, spec_bad, pid, []) + assert Paludis::match_package(env, spec_good, pid, nil, []) + assert !Paludis::match_package(env, spec_bad, pid, nil, []) end @@ -53,7 +53,7 @@ module Paludis env = EnvironmentFactory.instance.create("") world = env.set('world') pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new( - Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), []))].first + Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), nil, []))].first assert Paludis::match_package_in_set(env, world, pid, []) end @@ -62,14 +62,14 @@ module Paludis env = EnvironmentFactory.instance.create("") spec = Paludis::parse_user_package_dep_spec('>=foo/bar-1', env, []) pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new( - Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), []))].first + Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, []), nil, []))].first assert_raise TypeError do - Paludis::match_package(spec,spec,pid, []) + Paludis::match_package(spec,spec,pid, nil, []) end assert_raise TypeError do - Paludis::match_package(env,spec,spec, []) + Paludis::match_package(env,spec,spec, nil, []) end end diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb index 3e0260817..82aae2678 100644 --- a/ruby/repository_TEST.rb +++ b/ruby/repository_TEST.rb @@ -2,7 +2,7 @@ # vim: set sw=4 sts=4 et tw=80 : # -# Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh +# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh # Copyright (c) 2006, 2007, 2008 Richard Brown # # This file is part of the Paludis package manager. Paludis is free software; @@ -55,7 +55,7 @@ module Paludis def p env[Selection::RequireExactlyOne.new(Generator::Matches.new( - Paludis::parse_user_package_dep_spec('=foo/bar-2.0::testrepo', env, []), []))].first + Paludis::parse_user_package_dep_spec('=foo/bar-2.0::testrepo', env, []), nil, []))].first end def installed_pid @@ -185,7 +185,7 @@ module Paludis def test_get_environment_variable pid = env[Selection::BestVersionOnly.new(Generator::Matches.new(Paludis::parse_user_package_dep_spec( - '=foo/bar-1.0', env, []), []))].first; + '=foo/bar-1.0', env, []), nil, []))].first; assert_equal "hello", repo.get_environment_variable(pid, "TEST_ENV_VAR") assert_equal "", repo.get_environment_variable(pid, "TEST_UNSET_ENV_VAR") end diff --git a/src/clients/adjutrix/downgrade_check.cc b/src/clients/adjutrix/downgrade_check.cc index aeb7dbdae..676fac7cc 100644 --- a/src/clients/adjutrix/downgrade_check.cc +++ b/src/clients/adjutrix/downgrade_check.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -29,6 +29,7 @@ #include <paludis/util/safe_ofstream.hh> #include <paludis/util/safe_ifstream.hh> #include <paludis/util/fs_stat.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/package_id.hh> #include <paludis/user_dep_spec.hh> #include <paludis/generator.hh> @@ -119,7 +120,7 @@ namespace part_spec.package(b->first.first); if ("(none)" != b->first.second) part_spec.slot_requirement(std::make_shared<UserSlotExactRequirement>(SlotName(b->first.second))); - if (! env[selection::SomeArbitraryVersion(generator::Matches(part_spec, { }))]->empty()) + if (! env[selection::SomeArbitraryVersion(generator::Matches(part_spec, make_null_shared_ptr(), { }))]->empty()) { results.insert(std::make_pair(b->first, stringify(b->second) + " -> nothing on " + desc)); exit_status |= 2; diff --git a/src/clients/adjutrix/find_insecure_packages.cc b/src/clients/adjutrix/find_insecure_packages.cc index 377e2318e..44da9ba56 100644 --- a/src/clients/adjutrix/find_insecure_packages.cc +++ b/src/clients/adjutrix/find_insecure_packages.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -33,6 +33,7 @@ #include <paludis/selection.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/accept_visitor.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <set> #include <map> @@ -86,7 +87,7 @@ namespace void visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node) { std::shared_ptr<const PackageIDSequence> insecure(_env[selection::AllVersionsSorted( - generator::Matches(*node.spec(), { }))]); + generator::Matches(*node.spec(), make_null_shared_ptr(), { }))]); for (PackageIDSequence::ConstIterator i(insecure->begin()), i_end(insecure->end()) ; i != i_end ; ++i) if (node.spec()->tag()) diff --git a/src/clients/adjutrix/find_reverse_deps.cc b/src/clients/adjutrix/find_reverse_deps.cc index 66c45d1ef..2189a7645 100644 --- a/src/clients/adjutrix/find_reverse_deps.cc +++ b/src/clients/adjutrix/find_reverse_deps.cc @@ -28,6 +28,7 @@ #include <paludis/util/options.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/accept_visitor.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/dep_spec.hh> #include <paludis/user_dep_spec.hh> #include <paludis/package_id.hh> @@ -56,6 +57,7 @@ namespace { private: const Environment * const _env; + const std::shared_ptr<const PackageID> _from_id; const PackageIDSequence & _entries; std::string _depname; std::string _p; @@ -69,10 +71,11 @@ namespace std::set<SetName> _recursing_sets; public: - ReverseDepChecker(const Environment * const e, + ReverseDepChecker(const Environment * const e, const std::shared_ptr<const PackageID> & f, const PackageIDSequence & entries, const std::string & p) : _env(e), + _from_id(f), _entries(entries), _depname(""), _p(p), @@ -159,10 +162,10 @@ namespace } void - ReverseDepChecker::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node) + ReverseDepChecker::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node) { std::shared_ptr<const PackageIDSequence> dep_entries((*_env)[selection::AllVersionsSorted( - generator::Matches(*node.spec(), { mpo_ignore_additional_requirements }))]); + generator::Matches(*node.spec(), _from_id, { mpo_ignore_additional_requirements }))]); std::shared_ptr<PackageIDSequence> matches(std::make_shared<PackageIDSequence>()); bool header_written = false; @@ -216,24 +219,24 @@ namespace bool found_matches(false); - for (IndirectIterator<PackageIDSequence::ConstIterator> e(p_entries->begin()), e_end(p_entries->end()) ; + for (auto e(p_entries->begin()), e_end(p_entries->end()) ; e != e_end ; ++e) { try { - ReverseDepChecker checker(&env, entries, stringify(p) + "-" + stringify(e->canonical_form(idcf_version))); + ReverseDepChecker checker(&env, *e, entries, stringify(p) + "-" + stringify((*e)->canonical_form(idcf_version))); - if (e->build_dependencies_key()) - checker.check(e->build_dependencies_key()->value(), e->build_dependencies_key()->raw_name()); + if ((*e)->build_dependencies_key()) + checker.check((*e)->build_dependencies_key()->value(), (*e)->build_dependencies_key()->raw_name()); - if (e->run_dependencies_key()) - checker.check(e->run_dependencies_key()->value(), e->run_dependencies_key()->raw_name()); + if ((*e)->run_dependencies_key()) + checker.check((*e)->run_dependencies_key()->value(), (*e)->run_dependencies_key()->raw_name()); - if (e->post_dependencies_key()) - checker.check(e->post_dependencies_key()->value(), e->post_dependencies_key()->raw_name()); + if ((*e)->post_dependencies_key()) + checker.check((*e)->post_dependencies_key()->value(), (*e)->post_dependencies_key()->raw_name()); - if (e->suggested_dependencies_key()) - checker.check(e->suggested_dependencies_key()->value(), e->suggested_dependencies_key()->raw_name()); + if ((*e)->suggested_dependencies_key()) + checker.check((*e)->suggested_dependencies_key()->value(), (*e)->suggested_dependencies_key()->raw_name()); found_matches |= checker.found_matches(); } @@ -304,7 +307,7 @@ int do_find_reverse_deps(NoConfigEnvironment & env) } std::shared_ptr<const PackageIDSequence> entries(env[selection::AllVersionsSorted(generator::Matches( - *spec, { }))]); + *spec, make_null_shared_ptr(), { }))]); int ret(0); if (entries->empty()) diff --git a/src/clients/adjutrix/keywords_graph.cc b/src/clients/adjutrix/keywords_graph.cc index 581b12787..2d0679f72 100644 --- a/src/clients/adjutrix/keywords_graph.cc +++ b/src/clients/adjutrix/keywords_graph.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -27,6 +27,7 @@ #include <paludis/util/set.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/log.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/repository.hh> #include <paludis/package_database.hh> #include <paludis/metadata_key.hh> @@ -86,7 +87,7 @@ namespace FindUnusedPackagesTask task(&e, &repo); std::shared_ptr<const PackageIDSequence> packages(e[selection::AllVersionsGroupedBySlot( generator::InRepository(repo.name()) & - generator::Matches(make_package_dep_spec({ }).package(package), { }))]); + generator::Matches(make_package_dep_spec({ }).package(package), make_null_shared_ptr(), { }))]); std::shared_ptr<const PackageIDSequence> unused(task.execute(package)); if (packages->empty()) diff --git a/src/clients/cave/cmd_config.cc b/src/clients/cave/cmd_config.cc index 6ee0d2f0b..7f19c590a 100644 --- a/src/clients/cave/cmd_config.cc +++ b/src/clients/cave/cmd_config.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 @@ -23,6 +23,7 @@ #include <paludis/args/do_help.hh> #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/make_named_values.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/environment.hh> #include <paludis/package_database.hh> #include <paludis/repository.hh> @@ -95,7 +96,7 @@ ConfigCommand::run( PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), { })); const std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsUnsorted( - generator::Matches(spec, { }) | filter::SupportsAction<ConfigAction>())]); + generator::Matches(spec, make_null_shared_ptr(), { }) | filter::SupportsAction<ConfigAction>())]); if (ids->empty()) nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::SupportsAction<ConfigAction>()); else if (1 != std::distance(ids->begin(), ids->end())) diff --git a/src/clients/cave/cmd_contents.cc b/src/clients/cave/cmd_contents.cc index 3758143d7..7eb9ec89d 100644 --- a/src/clients/cave/cmd_contents.cc +++ b/src/clients/cave/cmd_contents.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 @@ -31,6 +31,7 @@ #include <paludis/util/options.hh> #include <paludis/util/sequence.hh> #include <paludis/util/stringify.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/filter.hh> #include <paludis/generator.hh> #include <paludis/filtered_generator.hh> @@ -129,7 +130,8 @@ ContentsCommand::run( { }, filter::InstalledAtRoot(env->preferred_root_key()->value()))); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) + | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->preferred_root_key()->value())); diff --git a/src/clients/cave/cmd_digest.cc b/src/clients/cave/cmd_digest.cc index beb26c1b3..c47a153b4 100644 --- a/src/clients/cave/cmd_digest.cc +++ b/src/clients/cave/cmd_digest.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 @@ -31,6 +31,7 @@ #include <paludis/util/map.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/return_literal_function.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/name.hh> #include <paludis/environment.hh> @@ -111,7 +112,7 @@ DigestCommand::run( throw args::DoHelp("digest takes exactly two parameters"); RepositoryName repo(*next(cmdline.begin_parameters())); - Filter repo_filter(filter::Matches(make_package_dep_spec({ }).in_repository(repo), { })); + Filter repo_filter(filter::Matches(make_package_dep_spec({ }).in_repository(repo), make_null_shared_ptr(), { })); QualifiedPackageName pkg(std::string::npos == cmdline.begin_parameters()->find('/') ? env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(*cmdline.begin_parameters()), repo_filter) : QualifiedPackageName(*cmdline.begin_parameters())); diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc index 6273c3596..b5aebc52b 100755 --- a/src/clients/cave/cmd_display_resolution.cc +++ b/src/clients/cave/cmd_display_resolution.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -317,7 +317,7 @@ namespace { const std::shared_ptr<const PackageID> maybe_id(id_for_decision_or_null(decision)); if (maybe_id) - return match_package(*env, spec, maybe_id, { }); + return match_package(*env, spec, maybe_id, make_null_shared_ptr(), { }); else { /* could also match slot here too */ @@ -1417,8 +1417,8 @@ namespace cout << fuc(fs_unable_unsuitable_did_not_meet(), fv<'s'>(s)); if ((*c)->spec().if_package() && (*c)->spec().if_package()->additional_requirements_ptr() && - (! match_package(*env, *(*c)->spec().if_package(), u->package_id(), { })) && - match_package(*env, *(*c)->spec().if_package(), u->package_id(), { mpo_ignore_additional_requirements })) + (! match_package(*env, *(*c)->spec().if_package(), u->package_id(), (*c)->from_id(), { })) && + match_package(*env, *(*c)->spec().if_package(), u->package_id(), (*c)->from_id(), { mpo_ignore_additional_requirements })) { for (AdditionalPackageDepSpecRequirements::ConstIterator a((*c)->spec().if_package()->additional_requirements_ptr()->begin()), a_end((*c)->spec().if_package()->additional_requirements_ptr()->end()) ; diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc index 3f3b682c6..d5d499686 100644 --- a/src/clients/cave/cmd_execute_resolution.cc +++ b/src/clients/cave/cmd_execute_resolution.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -148,7 +148,7 @@ namespace const PackageDepSpec & spec) { const std::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly( - generator::Matches(spec, { }))]); + generator::Matches(spec, make_null_shared_ptr(), { }))]); if (ids->empty()) return stringify(spec); else @@ -307,7 +307,7 @@ namespace else r.append(", "); - const auto replacing_ids((*env)[selection::BestVersionOnly(generator::Matches(*i, { }))]); + const auto replacing_ids((*env)[selection::BestVersionOnly(generator::Matches(*i, make_null_shared_ptr(), { }))]); if (replacing_ids->empty()) r.append(stringify(*i)); else if (id_specs->empty() || *id_specs->begin()->package_ptr() != (*replacing_ids->begin())->name()) @@ -332,7 +332,7 @@ namespace if (! r.empty()) r.append(", "); - const auto ids((*env)[selection::BestVersionOnly(generator::Matches(*i, { }))]); + const auto ids((*env)[selection::BestVersionOnly(generator::Matches(*i, make_null_shared_ptr(), { }))]); if (ids->empty()) r.append(stringify(*i)); else @@ -1591,7 +1591,7 @@ namespace std::string r; if (! j.replacing_specs()->empty()) { - const auto origin_ids((*env)[selection::BestVersionOnly(generator::Matches(j.origin_id_spec(), { }))]); + const auto origin_ids((*env)[selection::BestVersionOnly(generator::Matches(j.origin_id_spec(), make_null_shared_ptr(), { }))]); for (auto i(j.replacing_specs()->begin()), i_end(j.replacing_specs()->end()) ; i != i_end ; ++i) @@ -1601,7 +1601,7 @@ namespace else r.append(", "); - const auto ids((*env)[selection::BestVersionOnly(generator::Matches(*i, { }))]); + const auto ids((*env)[selection::BestVersionOnly(generator::Matches(*i, make_null_shared_ptr(), { }))]); if (ids->empty()) r.append(stringify(*i)); else if (origin_ids->empty() || (*origin_ids->begin())->name() != (*ids->begin())->name()) diff --git a/src/clients/cave/cmd_find_candidates.cc b/src/clients/cave/cmd_find_candidates.cc index 215b40aa8..e0346a110 100644 --- a/src/clients/cave/cmd_find_candidates.cc +++ b/src/clients/cave/cmd_find_candidates.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 @@ -43,6 +43,7 @@ #include <paludis/util/make_shared_copy.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/simple_visitor_cast.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <cstdlib> #include <iostream> @@ -193,7 +194,7 @@ FindCandidatesCommand::run_hosted( for (auto m(matches.begin()), m_end(matches.end()) ; m != m_end ; ++m) if (match_package(*env, *m, *(*env)[selection::RequireExactlyOne(generator::Matches( - parse_user_package_dep_spec(*s, env.get(), { }), { }))]->begin(), { })) + parse_user_package_dep_spec(*s, env.get(), { }), make_null_shared_ptr(), { }))]->begin(), make_null_shared_ptr(), { })) { ok = true; break; @@ -298,7 +299,7 @@ FindCandidatesCommand::run_hosted( k_end(search_options.a_matching.end_args()) ; k != k_end ; ++k) { - generator::Matches m(parse_user_package_dep_spec(*k, env.get(), { updso_allow_wildcards }), { }); + generator::Matches m(parse_user_package_dep_spec(*k, env.get(), { updso_allow_wildcards }), make_null_shared_ptr(), { }); if (match_generator) match_generator = std::make_shared<generator::Union>(*match_generator, m); diff --git a/src/clients/cave/cmd_has_version.cc b/src/clients/cave/cmd_has_version.cc index 3015fcbaa..b96bed002 100644 --- a/src/clients/cave/cmd_has_version.cc +++ b/src/clients/cave/cmd_has_version.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 @@ -29,6 +29,7 @@ #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/simple_visitor_cast.hh> #include <paludis/util/map.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/generator.hh> #include <paludis/filtered_generator.hh> #include <paludis/filter.hh> @@ -96,7 +97,7 @@ HasVersionCommand::run( throw args::DoHelp("has-version takes exactly one parameter"); auto s(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), { })); - auto ids((*env)[selection::BestVersionOnly(generator::Matches(s, { }) | filter::InstalledAtRoot( + auto ids((*env)[selection::BestVersionOnly(generator::Matches(s, make_null_shared_ptr(), { }) | filter::InstalledAtRoot( env->preferred_root_key()->value()))]); if (ids->empty()) diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc index 3f621dc1f..24056a1d2 100644 --- a/src/clients/cave/cmd_info.cc +++ b/src/clients/cave/cmd_info.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 @@ -376,9 +376,9 @@ namespace PackageDepSpec spec(parse_user_package_dep_spec(param, env.get(), { })); const std::shared_ptr<const PackageIDSequence> installed_ids((*env)[selection::AllVersionsSorted(generator::Matches( - spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); const std::shared_ptr<const PackageIDSequence> installable_ids((*env)[selection::BestVersionOnly(generator::Matches( - spec, { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]); + 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())); diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc index 058c25150..dfe5b01d7 100644 --- a/src/clients/cave/cmd_match.cc +++ b/src/clients/cave/cmd_match.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,6 +32,7 @@ #include <paludis/util/iterator_funcs.hh> #include <paludis/util/singleton-impl.hh> #include <paludis/util/accept_visitor.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/generator.hh> #include <paludis/filtered_generator.hh> #include <paludis/filter.hh> @@ -409,7 +410,7 @@ MatchCommand::run_hosted( const PackageDepSpec & spec) { const std::shared_ptr<const PackageID> id(*((*env)[selection::RequireExactlyOne( - generator::Matches(spec, { }))])->begin()); + generator::Matches(spec, make_null_shared_ptr(), { }))])->begin()); std::list<std::string> texts; diff --git a/src/clients/cave/cmd_perform.cc b/src/clients/cave/cmd_perform.cc index f8228d93d..2dcdf172c 100644 --- a/src/clients/cave/cmd_perform.cc +++ b/src/clients/cave/cmd_perform.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -409,7 +409,7 @@ PerformCommand::run( const auto spec_str(*next(cmdline.begin_parameters())); const auto spec(parse_user_package_dep_spec(spec_str, env.get(), { })); - const auto ids((*env)[selection::AllVersionsUnsorted(generator::Matches(spec, { }))]); + const auto ids((*env)[selection::AllVersionsUnsorted(generator::Matches(spec, make_null_shared_ptr(), { }))]); if (ids->empty()) nothing_matching_error(env.get(), spec_str, filter::All()); else if (1 != std::distance(ids->begin(), ids->end())) @@ -429,7 +429,7 @@ PerformCommand::run( p != p_end ; ++p) { PackageDepSpec rspec(parse_user_package_dep_spec(*p, env.get(), { })); - const std::shared_ptr<const PackageIDSequence> rids((*env)[selection::AllVersionsUnsorted(generator::Matches(rspec, { }))]); + const std::shared_ptr<const PackageIDSequence> rids((*env)[selection::AllVersionsUnsorted(generator::Matches(rspec, make_null_shared_ptr(), { }))]); if (rids->empty()) nothing_matching_error(env.get(), *p, filter::All()); else if (1 != std::distance(rids->begin(), rids->end())) diff --git a/src/clients/cave/cmd_print_best_version.cc b/src/clients/cave/cmd_print_best_version.cc index 5059ebf19..e39489c30 100644 --- a/src/clients/cave/cmd_print_best_version.cc +++ b/src/clients/cave/cmd_print_best_version.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 @@ -29,6 +29,7 @@ #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/simple_visitor_cast.hh> #include <paludis/util/map.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/generator.hh> #include <paludis/filtered_generator.hh> #include <paludis/filter.hh> @@ -108,7 +109,7 @@ PrintBestVersionCommand::run( throw args::DoHelp("print-best-version takes exactly one parameter"); auto s(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), { })); - auto ids((*env)[selection::BestVersionOnly(generator::Matches(s, { }) | filter::InstalledAtRoot( + auto ids((*env)[selection::BestVersionOnly(generator::Matches(s, make_null_shared_ptr(), { }) | filter::InstalledAtRoot( env->preferred_root_key()->value()))]); if (ids->empty()) diff --git a/src/clients/cave/cmd_print_id_actions.cc b/src/clients/cave/cmd_print_id_actions.cc index 8e696e771..473dfee13 100644 --- a/src/clients/cave/cmd_print_id_actions.cc +++ b/src/clients/cave/cmd_print_id_actions.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 @@ -24,6 +24,7 @@ #include <paludis/util/set.hh> #include <paludis/util/iterator_funcs.hh> #include <paludis/util/stringify.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/environment.hh> #include <paludis/user_dep_spec.hh> #include <paludis/filtered_generator.hh> @@ -107,7 +108,7 @@ PrintIDActionsCommand::run( PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), { updso_allow_wildcards })); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }))]); + (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }))]); if (entries->empty()) throw NothingMatching(spec); diff --git a/src/clients/cave/cmd_print_id_contents.cc b/src/clients/cave/cmd_print_id_contents.cc index 416179245..f60db7c4f 100644 --- a/src/clients/cave/cmd_print_id_contents.cc +++ b/src/clients/cave/cmd_print_id_contents.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 @@ -29,6 +29,7 @@ #include <paludis/util/iterator_funcs.hh> #include <paludis/util/options.hh> #include <paludis/util/sequence.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/filter.hh> #include <paludis/generator.hh> #include <paludis/filtered_generator.hh> @@ -160,7 +161,8 @@ PrintIDContentsCommand::run( { updso_allow_wildcards }, filter::InstalledAtRoot(env->preferred_root_key()->value()))); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) | + filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) throw NothingMatching(spec); diff --git a/src/clients/cave/cmd_print_id_environment_variable.cc b/src/clients/cave/cmd_print_id_environment_variable.cc index b7c96e94a..9e7b372f6 100644 --- a/src/clients/cave/cmd_print_id_environment_variable.cc +++ b/src/clients/cave/cmd_print_id_environment_variable.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 * Copyright (c) 2010 David Leverton * * This file is part of the Paludis package manager. Paludis is free software; @@ -24,6 +24,7 @@ #include <paludis/args/args.hh> #include <paludis/args/do_help.hh> #include <paludis/util/map.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/environment.hh> #include <paludis/user_dep_spec.hh> #include <paludis/filtered_generator.hh> @@ -134,7 +135,7 @@ PrintIDEnvironmentVariableCommand::run( PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), { updso_allow_wildcards })); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }))]); + (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }))]); if (entries->empty()) throw NothingMatching(spec); diff --git a/src/clients/cave/cmd_print_id_masks.cc b/src/clients/cave/cmd_print_id_masks.cc index 3f509417d..1937eb6aa 100644 --- a/src/clients/cave/cmd_print_id_masks.cc +++ b/src/clients/cave/cmd_print_id_masks.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 @@ -186,7 +186,7 @@ PrintIDMasksCommand::run( PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), { updso_allow_wildcards })); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }))]); + (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }))]); if (entries->empty()) throw NothingMatching(spec); diff --git a/src/clients/cave/cmd_print_id_metadata.cc b/src/clients/cave/cmd_print_id_metadata.cc index 2ce293dc0..960742561 100644 --- a/src/clients/cave/cmd_print_id_metadata.cc +++ b/src/clients/cave/cmd_print_id_metadata.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 @@ -26,6 +26,7 @@ #include <paludis/util/set.hh> #include <paludis/util/iterator_funcs.hh> #include <paludis/util/options.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/environment.hh> #include <paludis/metadata_key.hh> #include <paludis/user_dep_spec.hh> @@ -151,7 +152,7 @@ PrintIDMetadataCommand::run( PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(), { updso_allow_wildcards })); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }))]); + (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }))]); if (entries->empty()) throw NothingMatching(spec); diff --git a/src/clients/cave/cmd_print_ids.cc b/src/clients/cave/cmd_print_ids.cc index aa1427ba9..daa5d08ee 100644 --- a/src/clients/cave/cmd_print_ids.cc +++ b/src/clients/cave/cmd_print_ids.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 @@ -30,6 +30,7 @@ #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/simple_visitor_cast.hh> #include <paludis/util/map.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/generator.hh> #include <paludis/filtered_generator.hh> #include <paludis/filter.hh> @@ -289,7 +290,7 @@ PrintIDsCommand::run( m != m_end ; ++m) { PackageDepSpec s(parse_user_package_dep_spec(*m, env.get(), { updso_allow_wildcards })); - g = g & generator::Matches(s, { }); + g = g & generator::Matches(s, make_null_shared_ptr(), { }); } } diff --git a/src/clients/cave/cmd_report.cc b/src/clients/cave/cmd_report.cc index db8b224c0..8bbc34881 100644 --- a/src/clients/cave/cmd_report.cc +++ b/src/clients/cave/cmd_report.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 @@ -110,7 +110,7 @@ namespace .version_requirement(make_named_values<VersionRequirement>( n::version_operator() = vo_equal, n::version_spec() = id->version())), - { })) | + make_null_shared_ptr(), { })) | filter::SupportsAction<InstallAction>())]); if (! ids->empty()) diff --git a/src/clients/cave/cmd_search.cc b/src/clients/cave/cmd_search.cc index 8c5d1b16d..de06f763e 100644 --- a/src/clients/cave/cmd_search.cc +++ b/src/clients/cave/cmd_search.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 @@ -48,6 +48,7 @@ #include <paludis/util/wrapped_output_iterator.hh> #include <paludis/util/mutex.hh> #include <paludis/util/iterator_funcs.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <cstdlib> #include <iostream> @@ -113,7 +114,7 @@ namespace const PackageDepSpec & spec) { const std::shared_ptr<const PackageID> id(*((*env)[selection::RequireExactlyOne( - generator::Matches(spec, { }))])->begin()); + generator::Matches(spec, make_null_shared_ptr(), { }))])->begin()); result->insert(id->name()); } diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc index 7f776c7e9..fe838e91b 100644 --- a/src/clients/cave/cmd_show.cc +++ b/src/clients/cave/cmd_show.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 @@ -176,7 +176,7 @@ namespace void visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node) { - out << fuc(select_format_for_spec(env, *node.spec(), + out << fuc(select_format_for_spec(env, *node.spec(), make_null_shared_ptr(), fs_set_spec_installed(), fs_set_spec_installable(), fs_set_spec_unavailable()), @@ -226,7 +226,7 @@ namespace { cout << fuc(fs_wildcard_heading(), fv<'s'>(stringify(s))); - const std::shared_ptr<const PackageIDSequence> names((*env)[selection::BestVersionOnly(generator::Matches(s, { }))]); + const std::shared_ptr<const PackageIDSequence> names((*env)[selection::BestVersionOnly(generator::Matches(s, make_null_shared_ptr(), { }))]); if (names->empty()) throw NothingMatching(s); @@ -234,7 +234,7 @@ namespace i != i_end ; ++i) { PackageDepSpec name_spec(make_package_dep_spec({ }).package((*i)->name())); - cout << fuc(select_format_for_spec(env, name_spec, + cout << fuc(select_format_for_spec(env, name_spec, make_null_shared_ptr(), fs_wildcard_spec_installed(), fs_wildcard_spec_installable(), fs_wildcard_spec_unavailable() @@ -1259,7 +1259,7 @@ namespace { cout << fuc(fs_package_heading(), fv<'s'>(stringify(s))); - auto ids((*env)[selection::AllVersionsGroupedBySlot(generator::Matches(s, { }))]); + auto ids((*env)[selection::AllVersionsGroupedBySlot(generator::Matches(s, make_null_shared_ptr(), { }))]); if (ids->empty()) throw NothingMatching(s); @@ -1274,7 +1274,7 @@ namespace for (auto r(repos.begin()), r_end(repos.end()) ; r != r_end ; ++r) { auto r_ids((*env)[selection::AllVersionsGroupedBySlot(generator::Matches( - PartiallyMadePackageDepSpec(s).in_repository(*r), { }))]); + PartiallyMadePackageDepSpec(s).in_repository(*r), make_null_shared_ptr(), { }))]); if (! r_ids->empty()) do_one_package_with_ids(cmdline, env, s, r_ids, cout, rest_out); } @@ -1294,7 +1294,7 @@ namespace const PackageDepSpec & s) { const std::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly(generator::Matches(s, - { }))]); + make_null_shared_ptr(), { }))]); if (ids->empty()) throw NothingMatching(s); diff --git a/src/clients/cave/cmd_uninstall.cc b/src/clients/cave/cmd_uninstall.cc index d7829fc93..5f5798e7e 100644 --- a/src/clients/cave/cmd_uninstall.cc +++ b/src/clients/cave/cmd_uninstall.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 @@ -142,7 +142,7 @@ UninstallCommand::run( { PackageDepSpec spec(parse_user_package_dep_spec(*p, env.get(), { updso_allow_wildcards })); const std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsSorted( - generator::Matches(spec, { }) | filter::SupportsAction<UninstallAction>())]); + generator::Matches(spec, make_null_shared_ptr(), { }) | filter::SupportsAction<UninstallAction>())]); if (ids->empty()) nothing_matching_error(env.get(), *p, filter::SupportsAction<UninstallAction>()); else if ((! cmdline.a_all_versions.specified()) && has_multiple_versions(ids)) diff --git a/src/clients/cave/cmd_verify.cc b/src/clients/cave/cmd_verify.cc index 8139be2c8..624ee8ef1 100644 --- a/src/clients/cave/cmd_verify.cc +++ b/src/clients/cave/cmd_verify.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,6 +32,7 @@ #include <paludis/util/simple_visitor_cast.hh> #include <paludis/util/md5.hh> #include <paludis/util/fs_stat.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <paludis/environment.hh> #include <paludis/package_database.hh> #include <paludis/repository.hh> @@ -213,7 +214,8 @@ VerifyCommand::run( { updso_allow_wildcards }, filter::InstalledAtRoot(env->preferred_root_key()->value()))); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) | + filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->preferred_root_key()->value())); diff --git a/src/clients/cave/executables_common.cc b/src/clients/cave/executables_common.cc index a255a29ea..73dd0418a 100644 --- a/src/clients/cave/executables_common.cc +++ b/src/clients/cave/executables_common.cc @@ -2,7 +2,7 @@ /* * Copyright (c) 2009 Alexander Færøy - * 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 @@ -37,6 +37,7 @@ #include <paludis/util/system.hh> #include <paludis/util/tokeniser.hh> #include <paludis/util/accept_visitor.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <algorithm> #include <set> @@ -115,7 +116,7 @@ paludis::cave::executables_common( filter::InstalledAtRoot(env->preferred_root_key()->value()))); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | + (*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc index e554495be..210ab4382 100644 --- a/src/clients/cave/resolve_common.cc +++ b/src/clients/cave/resolve_common.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -791,7 +791,7 @@ paludis::cave::resolve_common( for (args::StringSetArg::ConstIterator i(resolution_options.a_preset.begin_args()), i_end(resolution_options.a_preset.end_args()) ; i != i_end ; ++i) - get_initial_constraints_for_helper.add_preset_spec(parse_user_package_dep_spec(*i, env.get(), { updso_allow_wildcards })); + get_initial_constraints_for_helper.add_preset_spec(parse_user_package_dep_spec(*i, env.get(), { updso_allow_wildcards }), make_null_shared_ptr()); get_initial_constraints_for_helper.set_reinstall_scm_days(reinstall_scm_days(resolution_options)); diff --git a/src/clients/cave/select_format_for_spec.cc b/src/clients/cave/select_format_for_spec.cc index 94be4a937..5a59b6d73 100644 --- a/src/clients/cave/select_format_for_spec.cc +++ b/src/clients/cave/select_format_for_spec.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2010 Ciaran McCreesh + * Copyright (c) 2008, 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 @@ -35,14 +35,15 @@ T_ paludis::cave::select_format_for_spec( const std::shared_ptr<const Environment> & env, const PackageDepSpec & spec, + const std::shared_ptr<const PackageID> & from_id, const T_ & if_installed, const T_ & if_installable, const T_ & if_unavailable ) { - if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->system_root_key()->value()))]->empty()) + if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, from_id, { }) | filter::InstalledAtRoot(env->system_root_key()->value()))]->empty()) return if_installed; - if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, { }) | filter::SupportsAction<InstallAction>() + if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, from_id, { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty()) return if_installable; return if_unavailable; @@ -51,6 +52,7 @@ paludis::cave::select_format_for_spec( template std::string paludis::cave::select_format_for_spec( const std::shared_ptr<const Environment> & env, const PackageDepSpec & spec, + const std::shared_ptr<const PackageID> & from_id, const std::string & if_installed, const std::string & if_installable, const std::string & if_unavailable @@ -59,6 +61,7 @@ template std::string paludis::cave::select_format_for_spec( template FormatString<'i', 's'> paludis::cave::select_format_for_spec( const std::shared_ptr<const Environment> & env, const PackageDepSpec & spec, + const std::shared_ptr<const PackageID> & from_id, const FormatString<'i', 's'> & if_installed, const FormatString<'i', 's'> & if_installable, const FormatString<'i', 's'> & if_unavailable @@ -67,6 +70,7 @@ template FormatString<'i', 's'> paludis::cave::select_format_for_spec( template FormatString<'s'> paludis::cave::select_format_for_spec( const std::shared_ptr<const Environment> & env, const PackageDepSpec & spec, + const std::shared_ptr<const PackageID> & from_id, const FormatString<'s'> & if_installed, const FormatString<'s'> & if_installable, const FormatString<'s'> & if_unavailable diff --git a/src/clients/cave/select_format_for_spec.hh b/src/clients/cave/select_format_for_spec.hh index a946e772d..a967607d5 100644 --- a/src/clients/cave/select_format_for_spec.hh +++ b/src/clients/cave/select_format_for_spec.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2010 Ciaran McCreesh + * Copyright (c) 2008, 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 @@ -23,7 +23,9 @@ #include <paludis/util/attributes.hh> #include <paludis/environment-fwd.hh> #include <paludis/dep_spec-fwd.hh> +#include <paludis/package_id-fwd.hh> #include <string> +#include <memory> namespace paludis { @@ -33,6 +35,7 @@ namespace paludis T_ select_format_for_spec( const std::shared_ptr<const Environment> &, const PackageDepSpec &, + const std::shared_ptr<const PackageID> & from_id, const T_ & if_installed, const T_ & if_installable, const T_ & if_unavailable diff --git a/src/clients/cave/size_common.cc b/src/clients/cave/size_common.cc index 9559e01d8..8bcace5b8 100644 --- a/src/clients/cave/size_common.cc +++ b/src/clients/cave/size_common.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 @@ -39,6 +39,7 @@ #include <paludis/util/fs_path.hh> #include <paludis/util/fs_stat.hh> #include <paludis/util/iterator_funcs.hh> +#include <paludis/util/make_null_shared_ptr.hh> #include <algorithm> #include <functional> #include <iostream> @@ -93,7 +94,7 @@ paludis::cave::size_common( const bool best) { PackageDepSpec spec(parse_user_package_dep_spec(q, env.get(), { })); - std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | + std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted(generator::Matches(spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc index 04982ab42..92a191278 100644 --- a/src/clients/paludis/applets.cc +++ b/src/clients/paludis/applets.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -187,7 +187,7 @@ int do_has_version(const std::shared_ptr<Environment> & env) std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( parse_user_package_dep_spec(query, env.get(), { }))); std::shared_ptr<const PackageIDSequence> entries((*env)[selection::SomeArbitraryVersion( - generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) return_code = 1; @@ -205,7 +205,7 @@ int do_best_version(const std::shared_ptr<Environment> & env) std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( parse_user_package_dep_spec(query, env.get(), { }))); std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); /* make built_with_use work for virtuals... icky... */ while (! entries->empty()) @@ -246,7 +246,7 @@ int do_match(const std::shared_ptr<Environment> & env) std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( parse_user_package_dep_spec(query, env.get(), { }))); std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); while (! entries->empty()) { @@ -291,10 +291,10 @@ int do_environment_variable(const std::shared_ptr<Environment> & env) parse_user_package_dep_spec(spec_str, env.get(), { }))); std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) - entries = (*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }))]; + entries = (*env)[selection::AllVersionsSorted(generator::Matches(*spec, make_null_shared_ptr(), { }))]; if (entries->empty()) throw NoSuchPackageError(spec_str); diff --git a/src/clients/paludis/do_config.cc b/src/clients/paludis/do_config.cc index c1d14ee90..d78a31c66 100644 --- a/src/clients/paludis/do_config.cc +++ b/src/clients/paludis/do_config.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -81,7 +81,8 @@ namespace filter::InstalledAtRoot(env->preferred_root_key()->value())))); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsUnsorted(generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + (*env)[selection::AllVersionsUnsorted(generator::Matches(*spec, make_null_shared_ptr(), { }) + | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) throw NoSuchPackageError(target); diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc index e15189e08..3e7c726f2 100644 --- a/src/clients/paludis/do_contents.cc +++ b/src/clients/paludis/do_contents.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -87,7 +87,8 @@ do_one_contents( filter::InstalledAtRoot(env->preferred_root_key()->value())))); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + (*env)[selection::AllVersionsSorted(generator::Matches(*spec, make_null_shared_ptr(), { }) + | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) throw NoSuchPackageError(q); diff --git a/src/clients/paludis/do_executables.cc b/src/clients/paludis/do_executables.cc index 2b94dd8a9..143f1d481 100644 --- a/src/clients/paludis/do_executables.cc +++ b/src/clients/paludis/do_executables.cc @@ -139,7 +139,8 @@ do_one_executables( filter::InstalledAtRoot(env->preferred_root_key()->value())))); std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); + (*env)[selection::AllVersionsSorted(generator::Matches(*spec, make_null_shared_ptr(), { }) + | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); if (entries->empty()) throw NoSuchPackageError(q); diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc index 94d37b98a..fd8e02566 100644 --- a/src/clients/paludis/info.cc +++ b/src/clients/paludis/info.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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 @@ -239,11 +239,11 @@ int do_one_info( std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(q, env.get(), { }))); std::shared_ptr<const PackageIDSequence> - entries((*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }))]), + entries((*env)[selection::AllVersionsSorted(generator::Matches(*spec, make_null_shared_ptr(), { }))]), installed_entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]), + generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]), installable_entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]); + generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]); std::shared_ptr<PackageIDSequence> to_show_entries(std::make_shared<PackageIDSequence>()); diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc index fdcbea2bf..f6d922aa8 100644 --- a/src/output/console_install_task.cc +++ b/src/output/console_install_task.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 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 @@ -512,16 +512,16 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d) std::shared_ptr<const PackageIDSequence> existing_repo((*environment())[selection::AllVersionsSorted(repo ? generator::Matches(make_package_dep_spec({ }) - .package(d.package_id()->name()).in_repository(*repo), { }) : + .package(d.package_id()->name()).in_repository(*repo), d.package_id(), { }) : generator::Matches(make_package_dep_spec({ }) - .package(d.package_id()->name()), { }) | filter::InstalledAtRoot(environment()->preferred_root_key()->value()) + .package(d.package_id()->name()), d.package_id(), { }) | filter::InstalledAtRoot(environment()->preferred_root_key()->value()) )]);; std::shared_ptr<const PackageIDSequence> existing_slot_repo((*environment())[selection::AllVersionsSorted((repo ? generator::Matches(make_package_dep_spec({ }) - .package(d.package_id()->name()).in_repository(*repo), { }) : + .package(d.package_id()->name()).in_repository(*repo), d.package_id(), { }) : generator::Matches(make_package_dep_spec({ }) - .package(d.package_id()->name()), { }) | filter::InstalledAtRoot(environment()->preferred_root_key()->value())) + .package(d.package_id()->name()), d.package_id(), { }) | filter::InstalledAtRoot(environment()->preferred_root_key()->value())) | filter::SameSlot(d.package_id()))]); display_merge_list_entry_start(d, m); @@ -1430,8 +1430,10 @@ ConsoleInstallTask::display_merge_list_entry_package_tags(const DepListEntry & d std::shared_ptr<const PackageDepSpec> spec( std::static_pointer_cast<const DependencyDepTag>(tag->tag())->dependency()); + std::shared_ptr<const PackageID> id( + std::static_pointer_cast<const DependencyDepTag>(tag->tag())->package_id()); if (d.kind() != dlk_masked && d.kind() != dlk_block && (*environment())[selection::SomeArbitraryVersion( - generator::Matches(*spec, { }) | + generator::Matches(*spec, id, { }) | filter::InstalledAtRoot(environment()->preferred_root_key()->value()))]->empty()) unsatisfied_dependents.insert(tag->tag()->short_text()); else @@ -1670,7 +1672,7 @@ ConsoleInstallTask::on_all_masked_error(const AllMaskedError & e) { std::shared_ptr<const PackageIDSequence> p( (*environment())[selection::AllVersionsSorted( - generator::Matches(e.query(), { }) + generator::Matches(e.query(), e.from_id(), { }) | filter::SupportsAction<InstallAction>())]); if (p->empty()) { diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc index cbd7628f7..efd5b35f7 100644 --- a/src/output/console_query_task.cc +++ b/src/output/console_query_task.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 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,7 +94,7 @@ ConsoleQueryTask::show(const PackageDepSpec & a, const std::shared_ptr<const Pac if (! a.package_ptr()) { std::shared_ptr<const PackageIDSequence> entries( - (*_imp->env)[selection::BestVersionOnly(generator::Matches(a, { }))]); + (*_imp->env)[selection::BestVersionOnly(generator::Matches(a, display_entry, { }))]); if (entries->empty()) throw NoSuchPackageError(stringify(a)); @@ -117,9 +117,9 @@ ConsoleQueryTask::show_one(const PackageDepSpec & a, const std::shared_ptr<const /* prefer the best installed version, then the best visible version, then * the best version */ std::shared_ptr<const PackageIDSequence> - entries((*_imp->env)[selection::AllVersionsSorted(generator::Matches(a, { }))]), + entries((*_imp->env)[selection::AllVersionsSorted(generator::Matches(a, display_entry, { }))]), preferred_entries((*_imp->env)[selection::AllVersionsSorted( - generator::Matches(a, { }) | filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]); + generator::Matches(a, display_entry, { }) | filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]); if (entries->empty()) throw NoSuchPackageError(stringify(a)); if (preferred_entries->empty()) |