/*
Initializes the build environment
*/
-static int pakfire_build_setup_snapshot(struct pakfire_build* build) {
+static int pakfire_build_init(struct pakfire_build* build) {
int r;
// Don't do it again
return 0;
}
- // Nothing to do if we don't use the snapshot
- if (pakfire_build_has_flag(build, PAKFIRE_BUILD_DISABLE_SNAPSHOT))
- return 0;
+ const int use_snapshot = !pakfire_build_has_flag(build, PAKFIRE_BUILD_DISABLE_SNAPSHOT);
// Tells us whether we need to (re-)create the snapshot
int snapshot_needs_update = 0;
// Extract snapshot
- r = pakfire_snapshot_restore(build->pakfire);
- if (r)
- return r;
+ if (use_snapshot) {
+ r = pakfire_snapshot_restore(build->pakfire);
+ if (r)
+ return r;
+ }
// Install or update any build dependencies
r = pakfire_build_install_packages(build, &snapshot_needs_update);
return r;
// Update the snapshot if there were changes
- if (snapshot_needs_update) {
+ if (use_snapshot && snapshot_needs_update) {
// Store the snapshot
r = pakfire_snapshot_store(build->pakfire);
if (r)
INFO(build->pakfire, "Building %s...\n", nevra);
// Initialize the build environment
- r = pakfire_build_setup_snapshot(build);
+ r = pakfire_build_init(build);
if (r)
goto ERROR;
}
// Initialize the build environment
- r = pakfire_build_setup_snapshot(build);
+ r = pakfire_build_init(build);
if (r)
goto ERROR;