// Local build repo
struct pakfire_repo* repo;
+
+ // States
+ int init:1;
};
static const char* stages[] = {
return r;
}
-static int pakfire_build_extract_snapshot(struct pakfire_build* build) {
+/*
+ Initializes the build environment
+*/
+static int pakfire_build_init(struct pakfire_build* build) {
char path[PATH_MAX];
int r;
+ // Don't do it again
+ if (build->init) {
+ DEBUG(build->pakfire, "Build environment has already been initialized\n");
+ return 0;
+ }
+
// Refresh the local repository
if (build->repo) {
r = pakfire_repo_refresh(build->repo, 0);
return r;
}
+ // Mark as initialized
+ build->init = 1;
+
return 0;
}
INFO(build->pakfire, "Building %s...\n", nevra);
- // Extract the snapshot
- r = pakfire_build_extract_snapshot(build);
- if (r) {
- ERROR(build->pakfire, "Could not extract snapshot: %m\n");
+ // Initialize the build environment
+ r = pakfire_build_init(build);
+ if (r)
goto ERROR;
- }
const char* packages[] = {
path, NULL
goto ERROR;
}
- // Extract the snapshot
- r = pakfire_build_extract_snapshot(build);
- if (r) {
- ERROR(build->pakfire, "Could not extract snapshot: %m\n");
- return r;
- }
+ // Initialize the build environment
+ r = pakfire_build_init(build);
+ if (r)
+ goto ERROR;
// Install any additional packages
if (packages) {