]> git.ipfire.org Git - pakfire.git/commitdiff
builder: Catch error when no previous snapshot existed
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Mar 2021 16:42:32 +0000 (16:42 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Mar 2021 16:42:32 +0000 (16:42 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/builder.py

index 13803fd6b2afaa16a7d0a0897d70a15356341ae1..edb8a164d63839d0cc83e9c47610d00e6e76d052 100644 (file)
@@ -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