diff options
author | Darius Makovsky <traveltissues@protonmail.com> | 2019-12-02 13:37:03 +0000 |
---|---|---|
committer | Darius Makovsky <traveltissues@protonmail.com> | 2020-01-08 13:46:58 +0000 |
commit | 20db5433dc231c8894381154c975b205a52c2938 (patch) | |
tree | b32b1b58d5406d9fd49ea30b320e9ef4f2757984 | |
parent | 944149a363a178516fa4a2213535c97f63679fd2 (diff) | |
download | buildstream-20db5433dc231c8894381154c975b205a52c2938.tar.gz |
cascache: 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.
-rw-r--r-- | src/buildstream/_cas/cascache.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index 519de6e2e..0049ba78f 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -217,10 +217,16 @@ 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: + for prop in filenode.node_properties: + if prop.name == "MTime" and prop.value: + utils._set_file_mtime(fullpath, prop.value) if filenode.is_executable: os.chmod( |