/* vim: set sw=4 sts=4 et foldmethod=syntax : *//* * 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 * Public License version 2, as published by the Free Software Foundation. * * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA */#include<paludis/repositories/virtuals/virtuals_repository.hh>#include<paludis/environment.hh>#include<paludis/match_package.hh>#include<paludis/action.hh>#include<paludis/literal_metadata_key.hh>#include<paludis/selection.hh>#include<paludis/generator.hh>#include<paludis/filter.hh>#include<paludis/filtered_generator.hh>#include<paludis/hook.hh>#include<paludis/partially_made_package_dep_spec.hh>#include<paludis/util/log.hh>#include<paludis/util/operators.hh>#include<paludis/util/pimp-impl.hh>#include<paludis/util/map.hh>#include<paludis/util/set.hh>#include<paludis/util/sequence.hh>#include<paludis/util/mutex.hh>#include<paludis/util/hashes.hh>#include<paludis/util/make_named_values.hh>#include<paludis/util/wrapped_forward_iterator.hh>#include<paludis/util/wrapped_output_iterator.hh>#include<paludis/util/make_null_shared_ptr.hh>#include<functional>#include<unordered_map>#include<vector>#include<utility>#include<algorithm>usingnamespacepaludis;typedefstd::unordered_map<QualifiedPackageName,std::shared_ptr<PackageIDSequence>,Hash<QualifiedPackageName>>IDMap;namespacepaludis{template<>structImp<VirtualsRepository>{std::shared_ptr<constMetadataValueKey<std::string>>format_key;Imp():format_key(std::make_shared<LiteralMetadataValueKey<std::string>>("format","format",mkt_significant,"virtuals")){}};}VirtualsRepository::VirtualsRepository(constEnvironment*constenv):Repository(env,RepositoryName("virtuals"),make_named_values<RepositoryCapabilities>(n::destination_interface()=static_cast<RepositoryDestinationInterface*>(0),n::environment_variable_interface()=static_cast<RepositoryEnvironmentVariableInterface*>(0),n::manifest_interface()=static_cast<RepositoryManifestInterface*>(0))),_imp(){add_metadata_key(_imp->format_key);}VirtualsRepository::~VirtualsRepository(){}std::shared_ptr<constPackageIDSequence>VirtualsRepository::package_ids(constQualifiedPackageName&,constRepositoryContentMayExcludes&)const{returnstd::make_shared<PackageIDSequence>();}std::shared_ptr<constQualifiedPackageNameSet>VirtualsRepository::package_names(constCategoryNamePart&,constRepositoryContentMayExcludes&)const{returnstd::make_shared<QualifiedPackageNameSet>();}std::shared_ptr<constCategoryNamePartSet>VirtualsRepository::category_names(constRepositoryContentMayExcludes&)const{std::shared_ptr<CategoryNamePartSet>result(std::make_shared<CategoryNamePartSet>());returnresult;}boolVirtualsRepository::has_package_named(constQualifiedPackageName&,constRepositoryContentMayExcludes&)const{returnfalse;}boolVirtualsRepository::has_category_named(constCategoryNamePart&,constRepositoryContentMayExcludes&)const{returnfalse;}voidVirtualsRepository::invalidate(){}constboolVirtualsRepository::is_unimportant()const{returnfalse;}boolVirtualsRepository::some_ids_might_support_action(constSupportsActionTestBase&)const{returnfalse;}boolVirtualsRepository::some_ids_might_not_be_masked()const{returntrue;}std::shared_ptr<constCategoryNamePartSet>VirtualsRepository::unimportant_category_names(constRepositoryContentMayExcludes&)const{std::shared_ptr<CategoryNamePartSet>result(std::make_shared<CategoryNamePartSet>());returnresult;}conststd::shared_ptr<constMetadataValueKey<std::string>>VirtualsRepository::format_key()const{return_imp->format_key;}conststd::shared_ptr<constMetadataValueKey<FSPath>>VirtualsRepository::location_key()const{returnstd::shared_ptr<constMetadataValueKey<FSPath>>();}conststd::shared_ptr<constMetadataValueKey<FSPath>>VirtualsRepository::installed_root_key()const{returnstd::shared_ptr<constMetadataValueKey<FSPath>>();}voidVirtualsRepository::need_keys_added()const{}RepositoryNameVirtualsRepository::repository_factory_name(constEnvironment*const,conststd::function<std::string(conststd::string&)>&){returnRepositoryName("virtuals");}std::shared_ptr<Repository>VirtualsRepository::repository_factory_create(constEnvironment*constenv,conststd::function<std::string(conststd::string&)>&f){Log::get_instance()->message("virtuals.deprecated",ll_warning,lc_no_context)<<"Old-style virtuals no longer exist. You should remove "<<f("repo_file");returnstd::make_shared<VirtualsRepository>(env);}std::shared_ptr<constRepositoryNameSet>VirtualsRepository::repository_factory_dependencies(constEnvironment*const,conststd::function<std::string(conststd::string&)>&){returnstd::make_shared<RepositoryNameSet>();}voidVirtualsRepository::populate_sets()const{}HookResultVirtualsRepository::perform_hook(constHook&,conststd::shared_ptr<OutputManager>&){returnmake_named_values<HookResult>(n::max_exit_status()=0,n::output()="");}boolVirtualsRepository::sync(conststd::string&,conststd::string&,conststd::shared_ptr<OutputManager>&)const{returnfalse;}conststd::shared_ptr<constMetadataCollectionKey<Map<std::string,std::string>>>VirtualsRepository::sync_host_key()const{returnmake_null_shared_ptr();}conststd::shared_ptr<constSet<std::string>>VirtualsRepository::maybe_expand_licence_nonrecursively(conststd::string&)const{returnmake_null_shared_ptr();}