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);
}
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
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);
}
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
// 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;
}
}
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;
// 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))
}
// 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;
}
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;
// 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);