diff options
author | 2011-02-26 15:08:28 +0000 | |
---|---|---|
committer | 2011-02-26 15:08:28 +0000 | |
commit | 04f54edce9cefa3a71fc274376b6a64e6eafee1f (patch) | |
tree | fff642a88f3a346ebd058c44b008f718e0f91023 | |
parent | 2872d75638c53765e7a240a56fa12248c74cf5b8 (diff) | |
download | paludis-04f54edce9cefa3a71fc274376b6a64e6eafee1f.tar.gz paludis-04f54edce9cefa3a71fc274376b6a64e6eafee1f.tar.xz |
'Ebuild Location' is icky
Fixes: ticket:1121
-rw-r--r-- | paludis/repositories/e/eapi.cc | 2 | ||||
-rw-r--r-- | paludis/repositories/e/eapi.hh | 4 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/0.conf | 2 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/exheres-0.conf | 2 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/paludis-1.conf | 2 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild_id.cc | 54 |
6 files changed, 39 insertions, 27 deletions
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc index 1d0ab9cb5..8ff71376f 100644 --- a/paludis/repositories/e/eapi.cc +++ b/paludis/repositories/e/eapi.cc @@ -176,6 +176,8 @@ namespace n::eclass_must_not_set_variables() = check_get(k, "eclass_must_not_set_variables"), n::f_function_prefix() = check_get(k, "f_function_prefix"), n::fix_mtimes() = destringify_key<bool>(k, "fix_mtimes"), + n::fs_location_description() = check_get(k, "fs_location_description"), + n::fs_location_name() = check_get(k, "fs_location_name"), n::ignore_pivot_env_functions() = check_get(k, "ignore_pivot_env_functions"), n::ignore_pivot_env_variables() = check_get(k, "ignore_pivot_env_variables"), n::load_modules() = check_get(k, "load_modules"), diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh index f634edcce..29f35e5fd 100644 --- a/paludis/repositories/e/eapi.hh +++ b/paludis/repositories/e/eapi.hh @@ -123,6 +123,8 @@ namespace paludis typedef Name<struct name_fancy_test_flag> fancy_test_flag; typedef Name<struct name_fix_mtimes> fix_mtimes; typedef Name<struct name_flat_list_index> flat_list_index; + typedef Name<struct name_fs_location_description> fs_location_description; + typedef Name<struct name_fs_location_name> fs_location_name; typedef Name<struct name_general_description> general_description; typedef Name<struct name_general_lang> general_lang; typedef Name<struct name_general_note> general_note; @@ -405,6 +407,8 @@ namespace paludis NamedValue<n::eclass_must_not_set_variables, std::string> eclass_must_not_set_variables; NamedValue<n::f_function_prefix, std::string> f_function_prefix; NamedValue<n::fix_mtimes, bool> fix_mtimes; + NamedValue<n::fs_location_description, std::string> fs_location_description; + NamedValue<n::fs_location_name, std::string> fs_location_name; NamedValue<n::ignore_pivot_env_functions, std::string> ignore_pivot_env_functions; NamedValue<n::ignore_pivot_env_variables, std::string> ignore_pivot_env_variables; NamedValue<n::load_modules, std::string> load_modules; diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf index 578497696..844b0edd8 100644 --- a/paludis/repositories/e/eapis/0.conf +++ b/paludis/repositories/e/eapis/0.conf @@ -25,6 +25,8 @@ ignore_pivot_env_functions = ignore_pivot_env_variables = userpriv_cannot_use_root = false fix_mtimes = false +fs_location_name = EBUILD +fs_location_description = Ebuild Location has_optional_tests = true has_recommended_tests = false diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf index 1655cd7ad..3e6d3d2d3 100644 --- a/paludis/repositories/e/eapis/exheres-0.conf +++ b/paludis/repositories/e/eapis/exheres-0.conf @@ -33,6 +33,8 @@ userpriv_cannot_use_root = true has_optional_tests = false has_recommended_tests = true has_expensive_tests = true +fs_location_name = EXHERES +fs_location_description = Exheres Location vdb_from_env_variables = \ CATEGORY CHOST DEPENDENCIES SUMMARY EAPI \ diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf index ed3f17dca..6c7c73fd7 100644 --- a/paludis/repositories/e/eapis/paludis-1.conf +++ b/paludis/repositories/e/eapis/paludis-1.conf @@ -31,6 +31,8 @@ has_recommended_tests = true has_expensive_tests = false no_s_workdir_fallback = false fix_mtimes = false +fs_location_name = EBUILD +fs_location_description = Ebuild Location vdb_from_env_variables = \ CATEGORY CHOST COUNTER DEPEND DESCRIPTION EAPI FEATURES \ diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc index 22bcd7748..79e8a6de5 100644 --- a/paludis/repositories/e/ebuild_id.cc +++ b/paludis/repositories/e/ebuild_id.cc @@ -108,6 +108,21 @@ namespace post_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesPostLabelTag> >("PDEPEND")); } }; + + std::shared_ptr<LiteralMetadataValueKey<FSPath> > make_fs_location(const std::string & e, const FSPath & p) + { + auto eapi(EAPIData::get_instance()->eapi_from_string(e)); + if (eapi->supported()) + return std::make_shared<LiteralMetadataValueKey<FSPath> >( + eapi->supported()->ebuild_options()->fs_location_name(), + eapi->supported()->ebuild_options()->fs_location_description(), + mkt_internal, p); + else + return std::make_shared<LiteralMetadataValueKey<FSPath> >( + "FS_LOCATION", + "FS Location", + mkt_internal, p); + } } namespace paludis @@ -121,7 +136,6 @@ namespace paludis const VersionSpec version; const Environment * const environment; const RepositoryName repository_name; - const FSPath ebuild; mutable std::shared_ptr<const EAPI> eapi; const std::string guessed_eapi; const time_t master_mtime; @@ -129,8 +143,9 @@ namespace paludis mutable bool has_keys; mutable bool has_masks; + const std::shared_ptr<const LiteralMetadataValueKey<FSPath> > fs_location; + mutable std::shared_ptr<const MetadataValueKey<SlotName> > slot; - mutable std::shared_ptr<const LiteralMetadataValueKey<FSPath> > fs_location; mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > short_description; mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > long_description; mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > captured_stdout_key; @@ -177,12 +192,12 @@ namespace paludis version(v), environment(e), repository_name(r), - ebuild(f), guessed_eapi(g), master_mtime(t), eclass_mtimes(m), has_keys(false), - has_masks(false) + has_masks(false), + fs_location(make_fs_location(guessed_eapi, f)) { } }; @@ -225,16 +240,10 @@ EbuildID::need_keys_added() const _imp->has_keys = true; - // fs_location key could have been loaded by the ::fs_location_key() already. - if (! _imp->fs_location) - { - _imp->fs_location = std::make_shared<LiteralMetadataValueKey<FSPath> >("EBUILD", "Ebuild Location", - mkt_internal, _imp->ebuild); - add_metadata_key(_imp->fs_location); - } - Context context("When generating metadata for ID '" + canonical_form(idcf_full) + "':"); + add_metadata_key(_imp->fs_location); + auto repo(_imp->environment->package_database()->fetch_repository(repository_name())); auto e_repo(std::static_pointer_cast<const ERepository>(repo)); FSPath cache_file(e_repo->params().cache()); @@ -250,7 +259,7 @@ EbuildID::need_keys_added() const bool ok(false); if (e_repo->params().cache().basename() != "empty") { - EbuildFlatMetadataCache metadata_cache(_imp->environment, cache_file, _imp->ebuild, _imp->master_mtime, _imp->eclass_mtimes, false); + EbuildFlatMetadataCache metadata_cache(_imp->environment, cache_file, _imp->fs_location->value(), _imp->master_mtime, _imp->eclass_mtimes, false); if (metadata_cache.load(shared_from_this(), false)) ok = true; } @@ -258,7 +267,7 @@ EbuildID::need_keys_added() const if ((! ok) && e_repo->params().write_cache().basename() != "empty") { EbuildFlatMetadataCache write_metadata_cache(_imp->environment, - write_cache_file, _imp->ebuild, _imp->master_mtime, _imp->eclass_mtimes, true); + write_cache_file, _imp->fs_location->value(), _imp->master_mtime, _imp->eclass_mtimes, true); if (write_metadata_cache.load(shared_from_this(), false)) ok = true; else if (write_cache_file.stat().exists()) @@ -303,7 +312,7 @@ EbuildID::need_keys_added() const n::commands() = join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " "), n::distdir() = e_repo->params().distdir(), n::ebuild_dir() = e_repo->layout()->package_directory(name()), - n::ebuild_file() = _imp->ebuild, + n::ebuild_file() = _imp->fs_location->value(), n::eclassdirs() = e_repo->params().eclassdirs(), n::environment() = _imp->environment, n::exlibsdirs() = e_repo->layout()->exlibsdirs(name()), @@ -331,7 +340,7 @@ EbuildID::need_keys_added() const if (e_repo->params().write_cache().basename() != "empty" && _imp->eapi->supported()) { - EbuildFlatMetadataCache metadata_cache(_imp->environment, write_cache_file, _imp->ebuild, _imp->master_mtime, + EbuildFlatMetadataCache metadata_cache(_imp->environment, write_cache_file, _imp->fs_location->value(), _imp->master_mtime, _imp->eclass_mtimes, false); metadata_cache.save(shared_from_this()); } @@ -898,15 +907,6 @@ EbuildID::defined_phases_key() const const std::shared_ptr<const MetadataValueKey<FSPath> > EbuildID::fs_location_key() const { - Lock l(_imp->mutex); - - // Avoid loading whole metadata - if (! _imp->fs_location) - { - _imp->fs_location = std::make_shared<LiteralMetadataValueKey<FSPath> >("EBUILD", "Ebuild Location", mkt_internal, _imp->ebuild); - add_metadata_key(_imp->fs_location); - } - return _imp->fs_location; } @@ -1659,7 +1659,7 @@ EbuildID::purge_invalid_cache() const if (e_repo->params().write_cache().basename() != "empty") { EbuildFlatMetadataCache write_metadata_cache(_imp->environment, - write_cache_file, _imp->ebuild, _imp->master_mtime, _imp->eclass_mtimes, true); + write_cache_file, _imp->fs_location->value(), _imp->master_mtime, _imp->eclass_mtimes, true); if (! write_metadata_cache.load(shared_from_this(), true)) write_cache_file.unlink(); } @@ -1669,7 +1669,7 @@ EbuildID::purge_invalid_cache() const bool EbuildID::might_be_binary() const { - auto path(stringify(_imp->ebuild)); + auto path(stringify(_imp->fs_location->value())); auto dot_pos(path.rfind('.')); if (std::string::npos != dot_pos) |