]> git.ipfire.org Git - pakfire.git/commitdiff
cli: build: No longer use the build logger
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 5 Oct 2024 14:54:25 +0000 (14:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 5 Oct 2024 14:54:25 +0000 (14:54 +0000)
We have so many loggers and we need to remove a few...

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/cli/lib/build.c

index cb8d9c778301ebe4294cca485ec3434f933f9bbe..c5e070303ddf6fa0e7f4faabc9f1aa1b08799581 100644 (file)
@@ -104,20 +104,15 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int log_callback(struct pakfire_build* build, void* data,
-               int priority, int error, const char* file, int line, const char* function, const char* format, ...) {
+static void log_callback(void* data, int priority, const char* file, int line,
+               const char* function, const char* format, va_list args) {
        char* buffer = NULL;
-       va_list args;
        int r;
 
        // Format the message
-       va_start(args, format);
        r = vasprintf(&buffer, format, args);
-       va_end(args);
-
-       // Fail if we could not format the message
        if (r < 0)
-               return r;
+               return;
 
        switch (priority) {
                // Highlight any error messages
@@ -134,8 +129,6 @@ static int log_callback(struct pakfire_build* build, void* data,
        // Cleanup
        if (buffer)
                free(buffer);
-
-       return 0;
 }
 
 int cli_build(void* data, int argc, char* argv[]) {
@@ -155,6 +148,9 @@ int cli_build(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
+       // Replace the logger
+       pakfire_ctx_set_log_callback(cli_config->ctx, log_callback, NULL);
+
        // Setup pakfire
        r = cli_setup_pakfire(&pakfire, cli_config);
        if (r)
@@ -167,9 +163,6 @@ int cli_build(void* data, int argc, char* argv[]) {
                goto ERROR;
        }
 
-       // Set log callback
-       pakfire_build_set_log_callback(build, log_callback, NULL);
-
        // Set target
        if (config.target) {
                r = pakfire_build_set_target(build, config.target);