return r;
}
+
+/*
+ * Convenience function to install a couple of packages. Simple.
+ */
+int pakfire_install(struct pakfire* self, const char** packages) {
+ struct pakfire_transaction* transaction = NULL;
+ char* problems = NULL;
+ int r;
+
+ // Create a new transaction
+ r = pakfire_transaction_create(&transaction, self, 0);
+ if (r < 0)
+ goto ERROR;
+
+ // Install all packages
+ for (const char** package = packages; *package; package++) {
+ r = pakfire_transaction_request(transaction, PAKFIRE_JOB_INSTALL, *package, 0);
+ if (r < 0)
+ goto ERROR;
+ }
+
+ // Solve the transaction
+ r = pakfire_transaction_solve(transaction, 0, &problems);
+ if (r) {
+ if (problems)
+ ERROR(self->ctx, "Could not install packages:\n%s\n", problems);
+
+ goto ERROR;
+ }
+
+ // Run the transaction
+ r = pakfire_transaction_run(transaction);
+ if (r < 0)
+ goto ERROR;
+
+ERROR:
+ if (transaction)
+ pakfire_transaction_unref(transaction);
+ if (problems)
+ free(problems);
+
+ return r;
+}
struct archive* pakfire_get_disk_reader(struct pakfire* pakfire);
struct archive* pakfire_get_disk_writer(struct pakfire* pakfire);
+int pakfire_install(struct pakfire* self, const char** packages);
+
#endif /* PAKFIRE_PAKFIRE_H */