summaryrefslogtreecommitdiff
path: root/src/buildtool/storage/fs_utils.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-05-26 10:41:15 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-06-04 14:34:44 +0200
commit8d4f583d63c657397583f778096b8bcb6d96c12f (patch)
tree7bb05ba0b827974aae31226987f7565cfb380e60 /src/buildtool/storage/fs_utils.cpp
parent1258417cf03b3978005a637c3536873fef146c38 (diff)
downloadjustbuild-8d4f583d63c657397583f778096b8bcb6d96c12f.tar.gz
Add utility methods for caching valid trees
...through marker files kept in storage under generation regime. These can be used to allow valid source trees, i.e., those free of upwards symlinks, to be cached in a persistent manner over multiple builds.
Diffstat (limited to 'src/buildtool/storage/fs_utils.cpp')
-rw-r--r--src/buildtool/storage/fs_utils.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/buildtool/storage/fs_utils.cpp b/src/buildtool/storage/fs_utils.cpp
index 528dd8dd..861c8728 100644
--- a/src/buildtool/storage/fs_utils.cpp
+++ b/src/buildtool/storage/fs_utils.cpp
@@ -119,6 +119,14 @@ auto GetRehashIDFile(StorageConfig const& storage_config,
(from_git ? "from-git" : "from-cas") / hash;
}
+auto GetValidTreesMarkerFile(StorageConfig const& storage_config,
+ std::string const& tree_hash,
+ std::size_t generation) noexcept
+ -> std::filesystem::path {
+ return storage_config.GenerationCacheRoot(generation) /
+ "validated-git-trees" / tree_hash;
+}
+
auto WriteTreeIDFile(std::filesystem::path const& tree_id_file,
std::string const& tree_id) noexcept -> bool {
// needs to be done safely, so use the rename trick