diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/repo_map/repos_to_setup_map.cpp | 13 | ||||
-rw-r--r-- | src/other_tools/root_maps/TARGETS | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.cpp | 27 | ||||
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.hpp | 11 |
4 files changed, 41 insertions, 12 deletions
diff --git a/src/other_tools/repo_map/repos_to_setup_map.cpp b/src/other_tools/repo_map/repos_to_setup_map.cpp index d537f91b..cb5f9293 100644 --- a/src/other_tools/repo_map/repos_to_setup_map.cpp +++ b/src/other_tools/repo_map/repos_to_setup_map.cpp @@ -322,6 +322,12 @@ void DistdirCheckout(ExpressionPtr const& repo_desc, /*fatal=*/true); return; } + // get ignore-special entry + auto repo_desc_ignore_special = + repo_desc->Get("ignore_special", Expression::none_t{}); + bool ignore_special = repo_desc_ignore_special->IsBool() + ? repo_desc_ignore_special->Bool() + : false; // map of distfile to content auto distdir_content = std::make_shared<std::unordered_map<std::string, std::string>>(); @@ -458,7 +464,12 @@ void DistdirCheckout(ExpressionPtr const& repo_desc, .HexString(); // get the WS root as git tree DistdirInfo distdir_info = { - distdir_content_id, distdir_content, dist_repos_to_fetch, repo_name}; + distdir_content_id, /* content_id */ + distdir_content, /* content_list */ + dist_repos_to_fetch, /* repos_to_fetch */ + repo_name, /* origin */ + ignore_special /* ignore_special */ + }; distdir_git_map->ConsumeAfterKeysReady( ts, {std::move(distdir_info)}, diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS index 82884b34..9182f2ee 100644 --- a/src/other_tools/root_maps/TARGETS +++ b/src/other_tools/root_maps/TARGETS @@ -7,6 +7,7 @@ [ ["@", "json", "", "json"] , ["src/other_tools/ops_maps", "import_to_git_map"] , ["src/other_tools/ops_maps", "content_cas_map"] + , ["src/utils/cpp", "hash_combine"] ] , "stage": ["src", "other_tools", "root_maps"] , "private-deps": @@ -20,6 +21,7 @@ , ["src/buildtool/file_system", "file_storage"] , ["src/other_tools/just_mr/progress_reporting", "progress"] , ["src/other_tools/just_mr/progress_reporting", "statistics"] + , ["src/buildtool/file_system", "file_root"] ] } , "commit_git_map": diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index 952eeb75..db0e8ee9 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -17,6 +17,7 @@ #include <algorithm> #include "src/buildtool/execution_api/common/execution_common.hpp" +#include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/file_system/file_storage.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/storage.hpp" @@ -88,8 +89,10 @@ auto CreateDistdirGitMap( critical_git_op_map->ConsumeAfterKeysReady( ts, {std::move(op_key)}, - [distdir_tree_id = *distdir_tree_id, setter, logger]( - auto const& values) { + [distdir_tree_id = *distdir_tree_id, + ignore_special = key.ignore_special, + setter, + logger](auto const& values) { GitOpValue op_result = *values[0]; // check flag if (not op_result.result) { @@ -99,12 +102,14 @@ auto CreateDistdirGitMap( } // subdir is ".", so no need to deal with the Git cache // set the workspace root - (*setter)( - std::pair(nlohmann::json::array( - {"git tree", - distdir_tree_id, - StorageConfig::GitRoot().string()}), - true)); + (*setter)(std::pair( + nlohmann::json::array( + {ignore_special + ? FileRoot::kGitTreeIgnoreSpecialMarker + : FileRoot::kGitTreeMarker, + distdir_tree_id, + StorageConfig::GitRoot().string()}), + true)); }, [logger, target_path = StorageConfig::GitRoot()]( auto const& msg, bool fatal) { @@ -125,6 +130,7 @@ auto CreateDistdirGitMap( content_id = key.content_id, content_list = key.content_list, origin = key.origin, + ignore_special = key.ignore_special, import_to_git_map, ts, setter, @@ -156,6 +162,7 @@ auto CreateDistdirGitMap( [tmp_dir, // keep tmp_dir alive distdir_tree_id_file, origin, + ignore_special, setter, logger](auto const& values) { // check for errors @@ -179,7 +186,9 @@ auto CreateDistdirGitMap( // set the workspace root (*setter)(std::pair( nlohmann::json::array( - {"git tree", + {ignore_special + ? FileRoot::kGitTreeIgnoreSpecialMarker + : FileRoot::kGitTreeMarker, distdir_tree_id, StorageConfig::GitRoot().string()}), false)); diff --git a/src/other_tools/root_maps/distdir_git_map.hpp b/src/other_tools/root_maps/distdir_git_map.hpp index c440253b..7ede3b95 100644 --- a/src/other_tools/root_maps/distdir_git_map.hpp +++ b/src/other_tools/root_maps/distdir_git_map.hpp @@ -20,6 +20,7 @@ #include "nlohmann/json.hpp" #include "src/other_tools/ops_maps/content_cas_map.hpp" #include "src/other_tools/ops_maps/import_to_git_map.hpp" +#include "src/utils/cpp/hash_combine.hpp" struct DistdirInfo { std::string content_id; /* key */ @@ -27,10 +28,13 @@ struct DistdirInfo { std::shared_ptr<std::vector<ArchiveContent>> repos_to_fetch; // name of repository for which work is done; used in progress reporting std::string origin; + // create root that ignores symlinks + bool ignore_special; /* key */ [[nodiscard]] auto operator==(const DistdirInfo& other) const noexcept -> bool { - return content_id == other.content_id; + return content_id == other.content_id and + ignore_special == other.ignore_special; } }; @@ -51,7 +55,10 @@ template <> struct hash<DistdirInfo> { [[nodiscard]] auto operator()(const DistdirInfo& dd) const noexcept -> std::size_t { - return std::hash<std::string>{}(dd.content_id); + size_t seed{}; + hash_combine<std::string>(&seed, dd.content_id); + hash_combine<bool>(&seed, dd.ignore_special); + return seed; } }; } // namespace std |