return r;
}
+static int pakfire_build_install(struct pakfire_build* build, const char** packages) {
+ struct pakfire_transaction* transaction = NULL;
+ char* problems = NULL;
+ int r;
+
+ // Create a new transaction
+ r = pakfire_transaction_create(&transaction, build->pakfire, 0);
+ if (r)
+ goto ERROR;
+
+ // Install all packages
+ for (const char** p = packages; *p; p++) {
+ r = pakfire_transaction_request(transaction, PAKFIRE_JOB_INSTALL, *p, 0);
+ if (r)
+ goto ERROR;
+ }
+
+ // Solve the transaction
+ r = pakfire_transaction_solve(transaction, 0, &problems);
+ if (r) {
+ ERROR(build->pakfire, "Could not install packages:\n%s\n", problems);
+ goto ERROR;
+ }
+
+ // Run the transaction
+ r = pakfire_transaction_run(transaction);
+ if (r)
+ goto ERROR;
+
+ERROR:
+ if (transaction)
+ pakfire_transaction_unref(transaction);
+ if (problems)
+ free(problems);
+
+ return r;
+}
+
/*
This is a convenience function that sets up a build environment and
then drops the user into an interactive shell.
// Install any additional packages
if (packages) {
- r = pakfire_install(build->pakfire, 0, 0, packages, NULL, 0, NULL, NULL, NULL);
+ r = pakfire_build_install(build, packages);
if (r)
- return r;
+ goto ERROR;
}
// Run shell