diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-02-29 17:47:52 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-02-29 18:07:46 +0100 |
commit | 7fb3ee34da91c7db0c6a98b35abd97b521581007 (patch) | |
tree | 7ea6ddc153b9bed93a32a937e387653887247b84 | |
parent | e8a9df96a084dc8c34d928a63e8fedbcb2eec9b6 (diff) | |
download | justbuild-7fb3ee34da91c7db0c6a98b35abd97b521581007.tar.gz |
archive_fetch_map: only have the actual archive content in the interface
... as this is the only part this map depends on, and not the
information on what to do with the archive, like style of unpacking,
etc. In this way, this map will also be reusable for fetching
foreign files.
-rw-r--r-- | src/other_tools/just_mr/fetch.cpp | 4 | ||||
-rw-r--r-- | src/other_tools/ops_maps/archive_fetch_map.cpp | 16 | ||||
-rw-r--r-- | src/other_tools/ops_maps/archive_fetch_map.hpp | 4 |
3 files changed, 11 insertions, 13 deletions
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp index 8779a7bd..74fc8fa8 100644 --- a/src/other_tools/just_mr/fetch.cpp +++ b/src/other_tools/just_mr/fetch.cpp @@ -132,7 +132,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, Logger::Log(LogLevel::Info, "Fetching to {}", fetch_dir->string()); // gather all repos to be fetched - std::vector<ArchiveRepoInfo> archives_to_fetch{}; + std::vector<ArchiveContent> archives_to_fetch{}; std::vector<GitTreeInfo> git_trees_to_fetch{}; archives_to_fetch.reserve( fetch_repos->to_include.size()); // pre-reserve a maximum size @@ -217,7 +217,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, if (not archive_repo_info->absent or common_args.fetch_absent) { archives_to_fetch.emplace_back( - std::move(*archive_repo_info)); + archive_repo_info->archive); } } break; case CheckoutType::GitTree: { diff --git a/src/other_tools/ops_maps/archive_fetch_map.cpp b/src/other_tools/ops_maps/archive_fetch_map.cpp index ab4ca7e8..1e89025d 100644 --- a/src/other_tools/ops_maps/archive_fetch_map.cpp +++ b/src/other_tools/ops_maps/archive_fetch_map.cpp @@ -82,19 +82,18 @@ auto CreateArchiveFetchMap( auto const& key) { // get corresponding distfile auto distfile = - (key.archive.distfile ? key.archive.distfile.value() - : std::filesystem::path(key.archive.fetch_url) - .filename() - .string()); + (key.distfile + ? key.distfile.value() + : std::filesystem::path(key.fetch_url).filename().string()); auto target_name = fetch_dir / distfile; // make sure content is in CAS content_cas_map->ConsumeAfterKeysReady( ts, - {key.archive}, + {key}, [target_name, local_api, remote_api, - content = key.archive.content, + content = key.content, setter, logger]([[maybe_unused]] auto const& values) { // content is in local CAS now @@ -111,8 +110,7 @@ auto CreateArchiveFetchMap( setter, logger); }, - [logger, content = key.archive.content](auto const& msg, - bool fatal) { + [logger, content = key.content](auto const& msg, bool fatal) { (*logger)( fmt::format("While ensuring content {} is in CAS:\n{}", content, @@ -120,5 +118,5 @@ auto CreateArchiveFetchMap( fatal); }); }; - return AsyncMapConsumer<ArchiveRepoInfo, bool>(fetch_archive, jobs); + return AsyncMapConsumer<ArchiveContent, bool>(fetch_archive, jobs); } diff --git a/src/other_tools/ops_maps/archive_fetch_map.hpp b/src/other_tools/ops_maps/archive_fetch_map.hpp index 89550996..9724a09b 100644 --- a/src/other_tools/ops_maps/archive_fetch_map.hpp +++ b/src/other_tools/ops_maps/archive_fetch_map.hpp @@ -23,7 +23,7 @@ #include "src/other_tools/ops_maps/content_cas_map.hpp" /// \brief Maps an archive content hash to a status flag. -using ArchiveFetchMap = AsyncMapConsumer<ArchiveRepoInfo, bool>; +using ArchiveFetchMap = AsyncMapConsumer<ArchiveContent, bool>; [[nodiscard]] auto CreateArchiveFetchMap( gsl::not_null<ContentCASMap*> const& content_cas_map, @@ -32,4 +32,4 @@ using ArchiveFetchMap = AsyncMapConsumer<ArchiveRepoInfo, bool>; std::optional<gsl::not_null<IExecutionApi*>> const& remote_api, std::size_t jobs) -> ArchiveFetchMap; -#endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_ARCHIVE_FETCH_MAP_HPP
\ No newline at end of file +#endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_ARCHIVE_FETCH_MAP_HPP |