#include <errno.h>
#include <getopt.h>
#include <stdlib.h>
+#include <sys/syslog.h>
#include "build.h"
+#include "color.h"
#include "command.h"
#include <pakfire/build.h>
return 0;
}
+static int log_callback(struct pakfire* pakfire, void* data,
+ int priority, const char* message, size_t length) {
+ switch (priority) {
+ case LOG_ERR:
+ fprintf(stderr, "%s%.*s%s", color_highlight(), (int)length, message, color_reset());
+ break;
+
+ default:
+ fprintf(stdout, "%.*s", (int)length, message);
+ break;
+ }
+
+ return 0;
+}
+
int cli_build(struct pakfire* pakfire, int argc, char* argv[]) {
struct pakfire_build* build = NULL;
struct config config = {
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);