diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-12 18:23:35 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-13 12:14:53 +0100 |
commit | 2bd069cdecb5371d906f8df9f5fb36f308d6296f (patch) | |
tree | 3db2cee634411639d520b2dee796b8a97b7342f6 /src/other_tools | |
parent | f487f592fdc85fbdb95856abb7f4281dd4353da9 (diff) | |
download | justbuild-2bd069cdecb5371d906f8df9f5fb36f308d6296f.tar.gz |
Move storage-aware tmpdir creation to config
... as the fs_utils have a lot more dependencies making them usable
in less places. Moreover, this function also serves to shape the
layout of the local build root and hence is more appropriately
placed in the config anyway.
Diffstat (limited to 'src/other_tools')
-rw-r--r-- | src/other_tools/just_mr/TARGETS | 2 | ||||
-rw-r--r-- | src/other_tools/just_mr/update.cpp | 4 | ||||
-rw-r--r-- | src/other_tools/ops_maps/TARGETS | 1 | ||||
-rw-r--r-- | src/other_tools/ops_maps/git_tree_fetch_map.cpp | 9 | ||||
-rw-r--r-- | src/other_tools/root_maps/TARGETS | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.cpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/content_git_map.cpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.cpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/foreign_file_git_map.cpp | 3 | ||||
-rw-r--r-- | src/other_tools/root_maps/fpath_git_map.cpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/tree_id_git_map.cpp | 3 |
11 files changed, 15 insertions, 17 deletions
diff --git a/src/other_tools/just_mr/TARGETS b/src/other_tools/just_mr/TARGETS index 5a8869c6..8471282b 100644 --- a/src/other_tools/just_mr/TARGETS +++ b/src/other_tools/just_mr/TARGETS @@ -131,7 +131,7 @@ , ["@", "json", "", "json"] , ["src/buildtool/logging", "logging"] , ["src/buildtool/multithreading", "task_system"] - , ["src/buildtool/storage", "fs_utils"] + , ["src/buildtool/storage", "config"] , ["src/other_tools/git_operations", "git_repo_remote"] , "exit_codes" , ["src/other_tools/just_mr/progress_reporting", "progress"] diff --git a/src/other_tools/just_mr/update.cpp b/src/other_tools/just_mr/update.cpp index a768e0e0..b4e2e455 100644 --- a/src/other_tools/just_mr/update.cpp +++ b/src/other_tools/just_mr/update.cpp @@ -21,7 +21,7 @@ #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/multithreading/task_system.hpp" -#include "src/buildtool/storage/fs_utils.hpp" +#include "src/buildtool/storage/config.hpp" #include "src/other_tools/git_operations/git_repo_remote.hpp" #include "src/other_tools/just_mr/exit_codes.hpp" #include "src/other_tools/just_mr/progress_reporting/progress.hpp" @@ -186,7 +186,7 @@ auto MultiRepoUpdate(std::shared_ptr<Configuration> const& config, } } // Create fake repo for the anonymous remotes - auto tmp_dir = StorageUtils::CreateTypedTmpDir("update"); + auto tmp_dir = StorageConfig::CreateTypedTmpDir("update"); if (not tmp_dir) { Logger::Log(LogLevel::Error, "Failed to create commit update tmp dir"); return kExitUpdateError; diff --git a/src/other_tools/ops_maps/TARGETS b/src/other_tools/ops_maps/TARGETS index 4a15849f..94894e60 100644 --- a/src/other_tools/ops_maps/TARGETS +++ b/src/other_tools/ops_maps/TARGETS @@ -124,7 +124,6 @@ , ["src/buildtool/multithreading", "task_system"] , ["src/buildtool/serve_api/remote", "serve_api"] , ["src/buildtool/storage", "config"] - , ["src/buildtool/storage", "fs_utils"] , ["src/buildtool/storage", "storage"] , ["src/buildtool/system", "system_command"] , ["src/other_tools/git_operations", "git_repo_remote"] diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.cpp b/src/other_tools/ops_maps/git_tree_fetch_map.cpp index 74214349..fecd2756 100644 --- a/src/other_tools/ops_maps/git_tree_fetch_map.cpp +++ b/src/other_tools/ops_maps/git_tree_fetch_map.cpp @@ -24,7 +24,6 @@ #include "src/buildtool/multithreading/task_system.hpp" #include "src/buildtool/serve_api/remote/serve_api.hpp" #include "src/buildtool/storage/config.hpp" -#include "src/buildtool/storage/fs_utils.hpp" #include "src/buildtool/storage/storage.hpp" #include "src/buildtool/system/system_command.hpp" #include "src/other_tools/git_operations/git_repo_remote.hpp" @@ -73,7 +72,7 @@ void MoveCASTreeToGit( GitTreeFetchMap::SetterPtr const& setter, GitTreeFetchMap::LoggerPtr const& logger) { // Move tree from CAS to local Git storage - auto tmp_dir = StorageUtils::CreateTypedTmpDir("fetch-remote-git-tree"); + auto tmp_dir = StorageConfig::CreateTypedTmpDir("fetch-remote-git-tree"); if (not tmp_dir) { (*logger)(fmt::format("Failed to create tmp directory for copying " "git-tree {} from remote CAS", @@ -259,7 +258,7 @@ auto CreateGitTreeFetchMap( return; } // create temporary location for command execution root - auto tmp_dir = StorageUtils::CreateTypedTmpDir("git-tree"); + auto tmp_dir = StorageConfig::CreateTypedTmpDir("git-tree"); if (not tmp_dir) { (*logger)( "Failed to create execution root tmp directory for " @@ -268,7 +267,7 @@ auto CreateGitTreeFetchMap( return; } // create temporary location for storing command result files - auto out_dir = StorageUtils::CreateTypedTmpDir("git-tree"); + auto out_dir = StorageConfig::CreateTypedTmpDir("git-tree"); if (not out_dir) { (*logger)( "Failed to create results tmp directory for tree id " @@ -397,7 +396,7 @@ auto CreateGitTreeFetchMap( } // define temp repo path auto tmp_dir = - StorageUtils::CreateTypedTmpDir("git-tree"); + StorageConfig::CreateTypedTmpDir("git-tree"); ; if (not tmp_dir) { (*logger)(fmt::format("Could not create unique " diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS index 42739b92..671a1d40 100644 --- a/src/other_tools/root_maps/TARGETS +++ b/src/other_tools/root_maps/TARGETS @@ -148,6 +148,7 @@ , ["src/buildtool/file_system", "file_root"] , ["src/buildtool/logging", "log_level"] , ["src/buildtool/serve_api/remote", "serve_api"] + , ["src/buildtool/storage", "config"] , ["src/buildtool/storage", "fs_utils"] , ["src/buildtool/storage", "storage"] , ["src/utils/cpp", "tmp_dir"] @@ -177,7 +178,6 @@ , ["src/buildtool/execution_api/git", "git"] , ["src/buildtool/file_system", "file_root"] , ["src/buildtool/storage", "config"] - , ["src/buildtool/storage", "fs_utils"] , ["src/buildtool/storage", "storage"] ] } diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index 8bd18cc9..f9da1300 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -727,7 +727,7 @@ void EnsureCommit( JustMRProgress::Instance().TaskTracker().Stop( repo_info.origin); // Move tree from local CAS to local Git storage - auto tmp_dir = StorageUtils::CreateTypedTmpDir( + auto tmp_dir = StorageConfig::CreateTypedTmpDir( "fetch-absent-root"); if (not tmp_dir) { (*logger)( diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp index 67e61606..3bbc21c5 100644 --- a/src/other_tools/root_maps/content_git_map.cpp +++ b/src/other_tools/root_maps/content_git_map.cpp @@ -359,7 +359,7 @@ void ExtractAndImportToGit( ContentGitMap::SetterPtr const& setter, ContentGitMap::LoggerPtr const& logger) { // extract archive - auto tmp_dir = StorageUtils::CreateTypedTmpDir(key.repo_type); + auto tmp_dir = StorageConfig::CreateTypedTmpDir(key.repo_type); if (not tmp_dir) { (*logger)(fmt::format("Failed to create tmp path for {} target {}", key.repo_type, diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index cc44c05c..e003e000 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -71,7 +71,7 @@ void ImportFromCASAndSetRoot( DistdirGitMap::SetterPtr const& setter, DistdirGitMap::LoggerPtr const& logger) { // create the links to CAS - auto tmp_dir = StorageUtils::CreateTypedTmpDir("distdir"); + auto tmp_dir = StorageConfig::CreateTypedTmpDir("distdir"); if (not tmp_dir) { (*logger)(fmt::format("Failed to create tmp path for " "distdir target {}", diff --git a/src/other_tools/root_maps/foreign_file_git_map.cpp b/src/other_tools/root_maps/foreign_file_git_map.cpp index c2d06786..5e08a18a 100644 --- a/src/other_tools/root_maps/foreign_file_git_map.cpp +++ b/src/other_tools/root_maps/foreign_file_git_map.cpp @@ -19,6 +19,7 @@ #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/serve_api/remote/serve_api.hpp" +#include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/fs_utils.hpp" #include "src/buildtool/storage/storage.hpp" #include "src/other_tools/root_maps/root_utils.hpp" @@ -55,7 +56,7 @@ void WithFetchedFile(ForeignFileInfo const& key, gsl::not_null<TaskSystem*> const& ts, ForeignFileGitMap::SetterPtr const& setter, ForeignFileGitMap::LoggerPtr const& logger) { - auto tmp_dir = StorageUtils::CreateTypedTmpDir("foreign-file"); + auto tmp_dir = StorageConfig::CreateTypedTmpDir("foreign-file"); auto const& cas = Storage::Instance().CAS(); auto digest = ArtifactDigest(key.archive.content, 0, key.executable); auto content_cas_path = cas.BlobPath(digest, key.executable); diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp index 9fb6858d..4c398612 100644 --- a/src/other_tools/root_maps/fpath_git_map.cpp +++ b/src/other_tools/root_maps/fpath_git_map.cpp @@ -346,7 +346,7 @@ auto CreateFilePathGitMap( /*fatal=*/false); } // it's not a git repo, so import it to git cache - auto tmp_dir = StorageUtils::CreateTypedTmpDir("file"); + auto tmp_dir = StorageConfig::CreateTypedTmpDir("file"); if (not tmp_dir) { (*logger)("Failed to create import-to-git tmp directory!", /*fatal=*/true); diff --git a/src/other_tools/root_maps/tree_id_git_map.cpp b/src/other_tools/root_maps/tree_id_git_map.cpp index e0456f12..9e8b1360 100644 --- a/src/other_tools/root_maps/tree_id_git_map.cpp +++ b/src/other_tools/root_maps/tree_id_git_map.cpp @@ -19,7 +19,6 @@ #include "src/buildtool/execution_api/git/git_api.hpp" #include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/storage/config.hpp" -#include "src/buildtool/storage/fs_utils.hpp" #include "src/buildtool/storage/storage.hpp" #include "src/other_tools/root_maps/root_utils.hpp" @@ -84,7 +83,7 @@ void MoveCASTreeToGitAndProcess( TreeIdGitMap::SetterPtr const& setter, TreeIdGitMap::LoggerPtr const& logger) { // Move tree from CAS to local Git storage - auto tmp_dir = StorageUtils::CreateTypedTmpDir("fetch-remote-git-tree"); + auto tmp_dir = StorageConfig::CreateTypedTmpDir("fetch-remote-git-tree"); if (not tmp_dir) { (*logger)(fmt::format("Failed to create tmp directory for copying " "git-tree {} from remote CAS", |