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.
This commit is contained in:
Christian Kellner 2022-12-14 16:49:41 +01:00 committed by Tom Gundersen
parent 76197c70c4
commit 15dc8b7a00

View file

@ -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):