diff options
author | Alberto Sartori <alberto.sartori@huawei.com> | 2023-07-21 11:26:52 +0200 |
---|---|---|
committer | Alberto Sartori <alberto.sartori@huawei.com> | 2023-07-21 14:08:29 +0200 |
commit | 629dc072c7c81693e55cafaa90e63ff1128b0efe (patch) | |
tree | 54960c37839b1ef388d50444414795d78298a6c2 /src/buildtool/execution_api | |
parent | 5548997571612cb8a78dfa9ac50ed690a28341ca (diff) | |
download | justbuild-629dc072c7c81693e55cafaa90e63ff1128b0efe.tar.gz |
bugfix: stage symlinks as symlinks when creating an action directory
Before this patch, when creating an action directory, symlinks were
staged as regular files.
Diffstat (limited to 'src/buildtool/execution_api')
-rw-r--r-- | src/buildtool/execution_api/local/local_action.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp index d42dcdd6..d3ad7fd9 100644 --- a/src/buildtool/execution_api/local/local_action.cpp +++ b/src/buildtool/execution_api/local/local_action.cpp @@ -185,6 +185,18 @@ auto LocalAction::StageFile(std::filesystem::path const& target_path, return false; } + if (info.type == ObjectType::Symlink) { + auto to = + FileSystemManager::ReadContentAtPath(*blob_path, ObjectType::File); + if (not to) { + logger_.Emit(LogLevel::Error, + "could not read content of symlink {}", + (*blob_path).string()); + return false; + } + return FileSystemManager::CreateSymlink(*to, target_path); + } + return FileSystemManager::CreateDirectory(target_path.parent_path()) and FileSystemManager::CreateFileHardlink(*blob_path, target_path); } |