summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2020-01-08 16:30:59 +0000
committerJürg Billeter <j@bitron.ch>2020-02-05 16:11:32 +0100
commit205786caf932f984f8194fb11193ca162b959783 (patch)
treedcee1476f618fd3b37dbf5503cbfb8ab5f4dda74 /src
parent6f857634ad6d2aec27e2ad66c647bf5692b847dc (diff)
downloadbuildstream-205786caf932f984f8194fb11193ca162b959783.tar.gz
cascache.py: Parse timestamp and update mtimes in checkout
If checking out files from a CasBasedDirectory which holds node_properties in the index files are explicitly copied instead of being hardlinked and the mtime is updated to the stored value.
Diffstat (limited to 'src')
-rw-r--r--src/buildstream/_cas/cascache.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index 519de6e2e..bb2abc6c8 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -217,10 +217,18 @@ class CASCache:
for filenode in directory.files:
# regular file, create hardlink
fullpath = os.path.join(dest, filenode.name)
- if can_link:
+ # generally, if the node holds properties we will fallback
+ # to copying instead of hardlinking
+ if can_link and not filenode.node_properties:
utils.safe_link(self.objpath(filenode.digest), fullpath)
else:
utils.safe_copy(self.objpath(filenode.digest), fullpath)
+ if filenode.node_properties:
+ # see https://github.com/bazelbuild/remote-apis/blob/master/build/bazel/remote/execution/v2/nodeproperties.md
+ # for supported node property specifications
+ for prop in filenode.node_properties:
+ if prop.name == "MTime" and prop.value:
+ utils._set_file_mtime(fullpath, utils._parse_timestamp(prop.value))
if filenode.is_executable:
os.chmod(