]> git.ipfire.org Git - pakfire.git/commitdiff
build: Use pakfire_install to install build dependencies
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Jun 2021 16:51:47 +0000 (16:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Jun 2021 16:51:47 +0000 (16:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/build.c

index 464e8d4104117ab3fbc5d8c2fe9bfe9084fa545d..c19a4e8400130866b9b684657dbcdd1b3836caee 100644 (file)
 #include <pakfire/packager.h>
 #include <pakfire/parser.h>
 #include <pakfire/private.h>
-#include <pakfire/request.h>
 #include <pakfire/scriptlet.h>
 #include <pakfire/snapshot.h>
-#include <pakfire/transaction.h>
 #include <pakfire/types.h>
 #include <pakfire/util.h>
 
@@ -59,8 +57,6 @@ static const char* stages[] = {
        "exit 0\n"
 
 static int pakfire_build_install_packages(Pakfire pakfire, int* snapshot_needs_update) {
-       struct pakfire_request* request = NULL;
-       struct pakfire_transaction* transaction = NULL;
        char** packages = NULL;
        int r = 1;
 
@@ -78,49 +74,21 @@ static int pakfire_build_install_packages(Pakfire pakfire, int* snapshot_needs_u
        if (!packages)
                goto ERROR;
 
-       // Create a new request
-       r = pakfire_request_create(&request, pakfire, 0);
-       if (r)
+       // Install everything
+       r = pakfire_install(pakfire, (const char**)packages, 0);
+       if (r) {
+               ERROR(pakfire, "Could not install build dependencies\n");
                goto ERROR;
-
-       // Install all packages
-       for (char** package = packages; *package; package++) {
-               r = pakfire_request_install(request, *package, 0);
-               if (r) {
-                       ERROR(pakfire, "Cannot install '%s': %m\n", *package);
-                       goto ERROR;
-               }
        }
 
-       // XXX update everything
-
-       // Solve the request
-       r = pakfire_request_solve(request, 0);
-       if (r)
-               goto ERROR;
-
-       // Fetch the transaction
-       transaction = pakfire_request_get_transaction(request);
-       if (!transaction)
-               goto ERROR;
+       // XXX Update everything
 
-       // Mark the snapshot for update
-       if (pakfire_transaction_count(transaction))
-               *snapshot_needs_update = 1;
-
-       // Run the transaction
-       r = pakfire_transaction_run(transaction);
-       if (r)
-               goto ERROR;
+       // XXX How do we know that the snapshot needs to be updated?
 
        // Success
        r = 0;
 
 ERROR:
-       if (transaction)
-               pakfire_transaction_unref(transaction);
-       if (request)
-               pakfire_request_unref(request);
        if (packages) {
                for (char** package = packages; *package; package++)
                        free(*package);