summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2019-12-02 13:37:03 +0000
committerDarius Makovsky <traveltissues@protonmail.com>2020-01-08 13:46:58 +0000
commit20db5433dc231c8894381154c975b205a52c2938 (patch)
treeb32b1b58d5406d9fd49ea30b320e9ef4f2757984
parent944149a363a178516fa4a2213535c97f63679fd2 (diff)
downloadbuildstream-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.py8
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(