]> git.ipfire.org Git - pakfire.git/commitdiff
build: Drop separate logging callback
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 2 Aug 2022 18:26:51 +0000 (18:26 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 2 Aug 2022 18:26:51 +0000 (18:26 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/libpakfire/build.c
src/libpakfire/include/pakfire/build.h

index 134a06e2d70cf9bfa85eedb6a42485d1e9e396b3..4ed49ffe247f658b76b362c898c75a0553aee066 100644 (file)
@@ -1082,30 +1082,17 @@ static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kw
        char* kwlist[] = {
                "path",
                "build_id",
-               "logging_callback",
                NULL,
        };
 
        const char* path = NULL;
        const char* build_id = NULL;
-       PyObject* logging_callback = NULL;
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zO", kwlist, &path,
-                       &build_id, &logging_callback))
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|z", kwlist, &path, &build_id))
                return NULL;
 
-       // Check if logging_callback is
-       if (logging_callback && !PyCallable_Check(logging_callback)) {
-               PyErr_SetString(PyExc_TypeError, "logging_callback must be callable\n");
-               return NULL;
-       }
-
-       // Set logging callback
-       Pakfire_execute_logging_callback = logging_callback;
-
        // Run build
-       int r = pakfire_build(self->pakfire, path, NULL, build_id, 0,
-               (logging_callback) ? __Pakfire_execute_logging_callback : NULL, NULL);
+       int r = pakfire_build(self->pakfire, path, NULL, build_id, 0);
 
        return execute_return_value(r);
 }
index 480a7faa600b94aa7936aade0c4dc54db3ec2941..6762f8d937efc3b85b24e38bc4cb6c24cc05f3e9 100644 (file)
@@ -581,8 +581,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_build_stage(struct pakfire* pakfire, struct pakfire_parser* makefile, const char* stage,
-               pakfire_execute_logging_callback logging_callback, void* data) {
+static int pakfire_build_stage(struct pakfire* pakfire, struct pakfire_parser* makefile, const char* stage) {
        char template[1024];
 
        // Prepare template for this stage
@@ -602,8 +601,7 @@ static int pakfire_build_stage(struct pakfire* pakfire, struct pakfire_parser* m
 
        INFO(pakfire, "Running build stage '%s'\n", stage);
 
-       r = pakfire_execute_script(pakfire, script, strlen(script), NULL, envp, 0,
-               logging_callback, data);
+       r = pakfire_execute_script(pakfire, script, strlen(script), NULL, envp, 0, NULL, NULL);
        if (r) {
                ERROR(pakfire, "Build stage '%s' failed with status %d\n", stage, r);
        }
@@ -636,8 +634,7 @@ static const char* post_build_scripts[] = {
        NULL,
 };
 
-static int pakfire_build_run_post_build_scripts(struct pakfire* pakfire, const char* buildroot,
-               pakfire_execute_logging_callback logging_callback, void* data) {
+static int pakfire_build_run_post_build_scripts(struct pakfire* pakfire, const char* buildroot) {
        // Set default arguments for build scripts
        const char* args[] = {
                buildroot, NULL
@@ -645,7 +642,7 @@ static int pakfire_build_run_post_build_scripts(struct pakfire* pakfire, const c
 
        // Run them one by one
        for (const char** script = post_build_scripts; *script; script++) {
-               int r = pakfire_build_run_script(pakfire, *script, args, logging_callback, data);
+               int r = pakfire_build_run_script(pakfire, *script, args, NULL, NULL);
                if (r)
                        return r;
        }
@@ -654,8 +651,7 @@ static int pakfire_build_run_post_build_scripts(struct pakfire* pakfire, const c
 }
 
 static int pakfire_build_makefile(struct pakfire* pakfire, const char* path, const char* target,
-               uuid_t* build_id, int flags,
-               pakfire_execute_logging_callback logging_callback, void* data) {
+               uuid_t* build_id, int flags) {
        struct pakfire_parser* makefile = NULL;
        char buildroot[PATH_MAX];
        struct pakfire_parser_error* error = NULL;
@@ -692,7 +688,7 @@ static int pakfire_build_makefile(struct pakfire* pakfire, const char* path, con
 
        // Run through all build stages
        for (const char** stage = stages; *stage; stage++) {
-               r = pakfire_build_stage(pakfire, makefile, *stage, logging_callback, data);
+               r = pakfire_build_stage(pakfire, makefile, *stage);
                if (r) {
                        // Drop to a shell for debugging
                        if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_INTERACTIVE))
@@ -703,7 +699,7 @@ static int pakfire_build_makefile(struct pakfire* pakfire, const char* path, con
        }
 
        // Run post build scripts
-       r = pakfire_build_run_post_build_scripts(pakfire, buildroot_rel, logging_callback, data);
+       r = pakfire_build_run_post_build_scripts(pakfire, buildroot_rel);
        if (r)
                goto ERROR;
 
@@ -725,8 +721,7 @@ ERROR:
 }
 
 PAKFIRE_EXPORT int pakfire_build(struct pakfire* pakfire, const char* path,
-               const char* target, const char* id, int flags,
-               pakfire_execute_logging_callback logging_callback, void* data) {
+               const char* target, const char* id, int flags) {
        char makefiles[PATH_MAX];
        char cwd[PATH_MAX];
        uuid_t build_id;
@@ -799,8 +794,7 @@ PAKFIRE_EXPORT int pakfire_build(struct pakfire* pakfire, const char* path,
 
        // Iterate over all makefiles
        for (unsigned int i = 0; i < buffer.gl_pathc; i++) {
-               r = pakfire_build_makefile(pakfire, buffer.gl_pathv[i], target, &build_id, flags,
-                       logging_callback, data);
+               r = pakfire_build_makefile(pakfire, buffer.gl_pathv[i], target, &build_id, flags);
                if (r) {
                        ERROR(pakfire, "Could not build %s: %m\n", buffer.gl_pathv[i]);
                        globfree(&buffer);
index 63018d5d14c38620eedaf0bb2407ce0df29e576e..1cfc425c1b4eb90b491473bfe74a08351dc6cb3b 100644 (file)
@@ -25,7 +25,7 @@
 #include <pakfire/pakfire.h>
 
 int pakfire_build(struct pakfire* pakfire, const char* path, const char* target,
-       const char* id, int flags, pakfire_execute_logging_callback logging_callback, void* data);
+       const char* id, int flags);
 int pakfire_shell(struct pakfire* pakfire, const char** packages);
 int pakfire_build_clean(struct pakfire* pakfire, int flags);