void* result_data;
};
+static int pakfire_linter_default_result_callback(struct pakfire_ctx* ctx,
+ struct pakfire_archive* archive, struct pakfire_package* package,
+ int priority, const char* result, void* data) {
+ const char* nevra = pakfire_package_get_string(package, PAKFIRE_PKG_NEVRA);
+
+ switch (priority) {
+ case PAKFIRE_LINTER_INFO:
+ INFO(ctx, "%s: %s\n", nevra, result);
+ break;
+
+ case PAKFIRE_LINTER_WARNING:
+ INFO(ctx, "%s: %s\n", nevra, result);
+ break;
+
+ case PAKFIRE_LINTER_ERROR:
+ ERROR(ctx, "%s: %s\n", nevra, result);
+ break;
+
+ default:
+ return -ENOTSUP;
+ }
+
+ return 0;
+}
+
static void pakfire_linter_result_free(struct pakfire_linter_result* result) {
if (result->comment)
free(result->comment);
// Store the result
TAILQ_INSERT_TAIL(&linter->results, result, nodes);
- // Log the result
- DEBUG(linter->ctx, "%s: %s",
- pakfire_archive_get_path(linter->archive), result->comment);
-
// Call the callback
if (linter->result_callback) {
r = linter->result_callback(linter->ctx, linter->archive, linter->pkg,
// Initialize results
TAILQ_INIT(&l->results);
+ // Set the default callback
+ pakfire_linter_set_result_callback(l, pakfire_linter_default_result_callback, NULL);
+
// Store the archive
l->archive = pakfire_archive_ref(archive);