diff options
author | 2011-03-18 20:49:27 +0000 | |
---|---|---|
committer | 2011-03-18 20:54:51 +0000 | |
commit | 17bd7034975c35359e40af59a24b290b0599fcd1 (patch) | |
tree | edbe3fab41a19edbfdeb8d4df64ad1c40b88a2c7 | |
parent | 56c42c4f9f3f558649b2b5ebb3f490736435998e (diff) | |
download | paludis-17bd7034975c35359e40af59a24b290b0599fcd1.tar.gz paludis-17bd7034975c35359e40af59a24b290b0599fcd1.tar.xz |
Clean up a bit
-rw-r--r-- | paludis/repositories/e/traditional_profile.cc | 213 |
1 files changed, 83 insertions, 130 deletions
diff --git a/paludis/repositories/e/traditional_profile.cc b/paludis/repositories/e/traditional_profile.cc index 51d5ca051..0a5e6e6da 100644 --- a/paludis/repositories/e/traditional_profile.cc +++ b/paludis/repositories/e/traditional_profile.cc @@ -98,146 +98,99 @@ namespace namespace paludis { - /** - * Imp for TraditionalProfile. - * - * \ingroup grperepository - * \see TraditionalProfile - */ template<> - class Imp<TraditionalProfile> + struct Imp<TraditionalProfile> { - private: - void load_environment(); - void load_profile_directory_recursively(const FSPath & dir); - void load_profile_parent(const FSPath & dir); - void load_profile_make_defaults(const FSPath & dir); - - void load_basic_use_file(const FSPath & file, FlagStatusMap & m); - void load_spec_use_file(const EAPI &, const FSPath & file, PackageFlagStatusMapList & m); - - void add_use_expand_to_use(); - void fish_out_use_expand_names(); - void make_vars_from_file_vars(); - void handle_profile_arch_var(const std::string &); - void load_special_make_defaults_vars(const FSPath &); - - ProfileFile<LineConfigFile> packages_file; - ProfileFile<LineConfigFile> virtuals_file; - ProfileFile<MaskFile> package_mask_file; - - bool is_incremental(const EAPI &, const std::string & s) const; - - public: - ///\name General variables - ///\{ - - const Environment * const env; - const ERepository * const repository; - - std::shared_ptr<FSPathSequence> profiles_with_parents; - - ///\} - - ///\name Environment variables - ///\{ - - EnvironmentVariablesMap environment_variables; - - ///\} - - ///\name System package set - ///\{ - - std::shared_ptr<SetSpecTree> system_packages; - - ///\} - - ///\name Virtuals - ///\{ - - std::shared_ptr<Map<QualifiedPackageName, PackageDepSpec> > virtuals; - - ///\} - - ///\name USE related values - ///\{ - - std::set<std::pair<ChoicePrefixName, UnprefixedChoiceName> > use; - std::shared_ptr<Set<std::string> > use_expand; - std::shared_ptr<Set<std::string> > use_expand_hidden; - std::shared_ptr<Set<std::string> > use_expand_unprefixed; - std::shared_ptr<Set<std::string> > use_expand_implicit; - std::shared_ptr<Set<std::string> > iuse_implicit; - std::unordered_map<std::string, std::shared_ptr<Set<std::string> > > use_expand_values; - KnownMap known_choice_value_names; - mutable Mutex known_choice_value_names_for_separator_mutex; - mutable std::unordered_map<char, KnownMap> known_choice_value_names_for_separator; - StackedValuesList stacked_values_list; - - ///\} - - ///\name Masks - ///\{ - - PackageMaskMap package_mask; + void load_environment(); + void load_profile_directory_recursively(const FSPath & dir); + void load_profile_parent(const FSPath & dir); + void load_profile_make_defaults(const FSPath & dir); + + void load_basic_use_file(const FSPath & file, FlagStatusMap & m); + void load_spec_use_file(const EAPI &, const FSPath & file, PackageFlagStatusMapList & m); + + void add_use_expand_to_use(); + void fish_out_use_expand_names(); + void make_vars_from_file_vars(); + void handle_profile_arch_var(const std::string &); + void load_special_make_defaults_vars(const FSPath &); + + ProfileFile<LineConfigFile> packages_file; + ProfileFile<LineConfigFile> virtuals_file; + ProfileFile<MaskFile> package_mask_file; + + bool is_incremental(const EAPI &, const std::string & s) const; + + const Environment * const env; + const ERepository * const repository; + + std::shared_ptr<FSPathSequence> profiles_with_parents; + + EnvironmentVariablesMap environment_variables; + + std::shared_ptr<SetSpecTree> system_packages; + + std::shared_ptr<Map<QualifiedPackageName, PackageDepSpec> > virtuals; + + std::set<std::pair<ChoicePrefixName, UnprefixedChoiceName> > use; + std::shared_ptr<Set<std::string> > use_expand; + std::shared_ptr<Set<std::string> > use_expand_hidden; + std::shared_ptr<Set<std::string> > use_expand_unprefixed; + std::shared_ptr<Set<std::string> > use_expand_implicit; + std::shared_ptr<Set<std::string> > iuse_implicit; + std::unordered_map<std::string, std::shared_ptr<Set<std::string> > > use_expand_values; + KnownMap known_choice_value_names; + mutable Mutex known_choice_value_names_for_separator_mutex; + mutable std::unordered_map<char, KnownMap> known_choice_value_names_for_separator; + StackedValuesList stacked_values_list; + + PackageMaskMap package_mask; + + Imp(const Environment * const e, const ERepository * const p, + const RepositoryName & name, const FSPathSequence & dirs, + const std::string & arch_var_if_special, const bool profiles_explicitly_set) : + packages_file(std::bind(&ERepository::eapi_for_file, p, std::placeholders::_1)), + virtuals_file(std::bind(&ERepository::eapi_for_file, p, std::placeholders::_1)), + package_mask_file(std::bind(&ERepository::eapi_for_file, p, std::placeholders::_1)), + env(e), + repository(p), + profiles_with_parents(std::make_shared<FSPathSequence>()), + system_packages(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>())), + virtuals(std::make_shared<Map<QualifiedPackageName, PackageDepSpec>>()), + use_expand(std::make_shared<Set<std::string>>()), + use_expand_hidden(std::make_shared<Set<std::string>>()), + use_expand_unprefixed(std::make_shared<Set<std::string>>()), + use_expand_implicit(std::make_shared<Set<std::string>>()), + iuse_implicit(std::make_shared<Set<std::string>>()) + { + Context context("When loading profiles '" + join(dirs.begin(), dirs.end(), "' '") + "' for repository '" + stringify(name) + "':"); - ///\} + if (dirs.empty()) + throw ERepositoryConfigurationError("No profiles directories specified"); - ///\name Basic operations - ///\{ + load_environment(); - Imp(const Environment * const e, const ERepository * const p, - const RepositoryName & name, const FSPathSequence & dirs, - const std::string & arch_var_if_special, const bool profiles_explicitly_set) : - packages_file(std::bind(&ERepository::eapi_for_file, p, std::placeholders::_1)), - virtuals_file(std::bind(&ERepository::eapi_for_file, p, std::placeholders::_1)), - package_mask_file(std::bind(&ERepository::eapi_for_file, p, std::placeholders::_1)), - env(e), - repository(p), - profiles_with_parents(std::make_shared<FSPathSequence>()), - system_packages(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>())), - virtuals(std::make_shared<Map<QualifiedPackageName, PackageDepSpec>>()), - use_expand(std::make_shared<Set<std::string>>()), - use_expand_hidden(std::make_shared<Set<std::string>>()), - use_expand_unprefixed(std::make_shared<Set<std::string>>()), - use_expand_implicit(std::make_shared<Set<std::string>>()), - iuse_implicit(std::make_shared<Set<std::string>>()) + for (FSPathSequence::ConstIterator d(dirs.begin()), d_end(dirs.end()) ; + d != d_end ; ++d) { - Context context("When loading profiles '" + join(dirs.begin(), dirs.end(), "' '") + "' for repository '" + stringify(name) + "':"); - - if (dirs.empty()) - throw ERepositoryConfigurationError("No profiles directories specified"); - - load_environment(); + Context subcontext("When using directory '" + stringify(*d) + "':"); - for (FSPathSequence::ConstIterator d(dirs.begin()), d_end(dirs.end()) ; - d != d_end ; ++d) - { - Context subcontext("When using directory '" + stringify(*d) + "':"); - - if (profiles_explicitly_set) - if (! p->params().ignore_deprecated_profiles()) - if ((*d / "deprecated").stat().is_regular_file_or_symlink_to_regular_file()) - Log::get_instance()->message("e.profile.deprecated", ll_warning, lc_context) << "Profile directory '" << *d - << "' is deprecated. See the file '" << (*d / "deprecated") << "' for details"; - - load_profile_directory_recursively(*d); - } + if (profiles_explicitly_set) + if (! p->params().ignore_deprecated_profiles()) + if ((*d / "deprecated").stat().is_regular_file_or_symlink_to_regular_file()) + Log::get_instance()->message("e.profile.deprecated", ll_warning, lc_context) << "Profile directory '" << *d + << "' is deprecated. See the file '" << (*d / "deprecated") << "' for details"; - make_vars_from_file_vars(); - load_special_make_defaults_vars(*dirs.begin()); - add_use_expand_to_use(); - fish_out_use_expand_names(); - if (! arch_var_if_special.empty()) - handle_profile_arch_var(arch_var_if_special); + load_profile_directory_recursively(*d); } - ~Imp() - { - } - - ///\} + make_vars_from_file_vars(); + load_special_make_defaults_vars(*dirs.begin()); + add_use_expand_to_use(); + fish_out_use_expand_names(); + if (! arch_var_if_special.empty()) + handle_profile_arch_var(arch_var_if_special); + } }; } |