diff options
author | Darius Makovsky <traveltissues@protonmail.com> | 2020-01-08 16:30:59 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-02-05 16:11:32 +0100 |
commit | 205786caf932f984f8194fb11193ca162b959783 (patch) | |
tree | dcee1476f618fd3b37dbf5503cbfb8ab5f4dda74 /src | |
parent | 6f857634ad6d2aec27e2ad66c647bf5692b847dc (diff) | |
download | buildstream-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.py | 10 |
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( |