From 15dc8b7a001ca1369b35eabfaab403bd54150eda Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Wed, 14 Dec 2022 16:49:41 +0100 Subject: [PATCH] objectstore: clamp mtime on commit When we commit objects to the store and there is a `source_epoch` set on the `Object`, clamp the mtime. This is needed because it is possible that the object corresponds to the last stage of a pipeline[1] and it could later directly be exported without going through `finalize` again. Also we are doing in on object itself and not the cloned path so that resuming and checkpointing will behave identical. [1] not even necessarily the pipeline we are currently building. --- osbuild/objectstore.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osbuild/objectstore.py b/osbuild/objectstore.py index 579589bc..9f1dcef4 100644 --- a/osbuild/objectstore.py +++ b/osbuild/objectstore.py @@ -423,6 +423,10 @@ class ObjectStore(contextlib.AbstractContextManager): with self.cache.store(object_id) as name: path = os.path.join(self.cache, name) + # we clamp the mtime of `obj` itself so that it + # resuming a snapshop and building with a snapshot + # goes through the same code path + obj.clamp_mtime() obj.clone(path) def cleanup(self):