From: Michael Tremer Date: Thu, 25 Mar 2021 16:42:32 +0000 (+0000) Subject: builder: Catch error when no previous snapshot existed X-Git-Tag: 0.9.28~1285^2~463 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77866fed96f5b24d43d8582b72d37915be9950cc;p=pakfire.git builder: Catch error when no previous snapshot existed Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/builder.py b/src/pakfire/builder.py index 13803fd6b..edb8a164d 100644 --- a/src/pakfire/builder.py +++ b/src/pakfire/builder.py @@ -19,6 +19,7 @@ # # ############################################################################### +import errno import os import uuid @@ -185,13 +186,18 @@ class BuilderContext(object): Sets up the environment by installing some basic packages """ # XXX this needs to be unique for each distribution - snapshot_path = "/tmp/pakfire-snapshot.tar" + snapshot_path = "/var/cache/pakfire/snapshot-XXX.tar.zst" # Restore the snapshot if available try: self.pakfire.restore_snapshot(snapshot_path) - except FileNotFoundError: - pass + + # Ignore if no snapshot was present + except IOError as e: + if e.code == errno.ENOENT: + pass + else: + raise # Install any updates and essential packages # If there have been updates, or on a fresh install, re-create the snapshot