# Settings array.
self.settings = {
- "enable_ccache" : True,
+ "enable_ccache" : True,
+ "enable_snapshot" : True,
}
# Add settings from keyword arguments
"""
Sets up the environment by installing some basic packages
"""
+ enable_snapshot = self.builder.settings.get("enable_snapshot", True)
+
snapshot_path = self.pakfire.make_cache_path("snapshot.tar.zst")
# Restore the snapshot if available
- try:
- self.pakfire.restore_snapshot(snapshot_path)
+ if enable_snapshot:
+ try:
+ self.pakfire.restore_snapshot(snapshot_path)
- # Ignore if no snapshot was present
- except FileNotFoundError:
- pass
+ # Ignore if no snapshot was present
+ except FileNotFoundError:
+ pass
# Install any updates and essential packages
# If there have been updates, or on a fresh install, re-create the snapshot
if self._install(BUILD_PACKAGES):
- self.pakfire.create_snapshot(snapshot_path)
+ if enable_snapshot:
+ self.pakfire.create_snapshot(snapshot_path)
def _install(self, packages):
self.log.debug(_("Installing packages in build environment:"))
help=_("Run pakfire for the given architecture"))
parser.add_argument("--distro", nargs="?", default="ipfire3", # XXX for now
help=_("Choose the distribution configuration to use for build"))
+ parser.add_argument("--disable-snapshot", action="store_true",
+ help=_("Disable using snapshots"))
# build
build = subparsers.add_parser("build", help=_("Build one or more packages"))
# Find distro configuration file
conf = os.path.join(CONFIG_DISTRO_DIR, "%s.conf" % ns.distro)
- return builder.Builder(conf=conf, arch=ns.arch)
+ return builder.Builder(
+ conf=conf,
+ arch=ns.arch,
+ enable_snapshot=not ns.disable_snapshot
+ )
def handle_build(self, ns):
package, = ns.package