return r;
}
+static int pakfire_build_mkimage_install_deps(struct pakfire_build* build,
+ const char* type) {
+ struct pakfire_request* request = NULL;
+ struct pakfire_transaction* transaction = NULL;
+ char requires[NAME_MAX];
+ int r;
+
+ // Format requires
+ r = pakfire_string_format(requires, "mkimage(%s)", type);
+ if (r)
+ goto ERROR;
+
+ // Create a new request
+ r = pakfire_request_create(&request, build->pakfire, 0);
+ if (r) {
+ ERROR(build->pakfire, "Could not create request: %m\n");
+ goto ERROR;
+ }
+
+ // Add requires to the request
+ r = pakfire_request_add(request, PAKFIRE_REQ_INSTALL, requires,
+ PAKFIRE_REQUEST_ESSENTIAL);
+ if (r) {
+ ERROR(build->pakfire, "Could not add '%s' to the request: %m\n", requires);
+ goto ERROR;
+ }
+
+ // Solve the request
+ r = pakfire_request_solve(request, 0);
+ if (r) {
+ ERROR(build->pakfire, "Could not solve the request\n");
+ goto ERROR;
+ }
+
+ // Fetch the transaction
+ r = pakfire_request_get_transaction(request, &transaction);
+ if (r) {
+ ERROR(build->pakfire, "Could not fetch the transaction: %m\n");
+ goto ERROR;
+ }
+
+ // Run the transaction
+ r = pakfire_transaction_run(transaction, 0);
+ if (r)
+ goto ERROR;
+
+ERROR:
+ if (request)
+ pakfire_request_unref(request);
+ if (transaction)
+ pakfire_transaction_unref(transaction);
+
+ return r;
+}
+
static int pakfire_build_collect_packages(struct pakfire_build* build, const char* path) {
struct pakfire_request* request = NULL;
struct pakfire_transaction* transaction = NULL;
if (r)
goto ERROR;
+ // Install all dependencies
+ r = pakfire_build_mkimage_install_deps(build, type);
+ if (r)
+ goto ERROR;
+
const char* args[] = {
type,
pakfire_relpath(build->pakfire, path),