From: Michael Tremer Date: Tue, 31 Oct 2023 11:35:52 +0000 (+0000) Subject: buildservice: Send the host distribution info X-Git-Tag: 0.9.30~1373 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8b16b1ad340d7a026717095204d142cc667fc82;p=pakfire.git buildservice: Send the host distribution info Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/buildservice.c b/src/libpakfire/buildservice.c index 3043e0e51..66d9816af 100644 --- a/src/libpakfire/buildservice.c +++ b/src/libpakfire/buildservice.c @@ -990,6 +990,9 @@ PAKFIRE_EXPORT int pakfire_buildservice_submit_stats(struct pakfire_buildservice char* buffer = NULL; size_t length = 0; + // Fetch the distro + const struct pakfire_distro* distro = pakfire_ctx_get_distro(service->ctx); + // Fetch CPU info r = pakfire_cpuinfo(&cpuinfo); if (r) { @@ -1057,7 +1060,7 @@ PAKFIRE_EXPORT int pakfire_buildservice_submit_stats(struct pakfire_buildservice goto ERROR; // OS - r = pakfire_xfer_add_param(xfer, "os_name", "%s", "???"); + r = pakfire_xfer_add_param(xfer, "os_name", "%s", distro->pretty_name); if (r) goto ERROR; diff --git a/src/libpakfire/ctx.c b/src/libpakfire/ctx.c index 83ddb4093..aff3a02a3 100644 --- a/src/libpakfire/ctx.c +++ b/src/libpakfire/ctx.c @@ -28,6 +28,7 @@ #include #include #include +#include #include struct pakfire_ctx { @@ -40,6 +41,9 @@ struct pakfire_ctx { // Config struct pakfire_config* config; + // Distro + struct pakfire_distro distro; + // Logging struct pakfire_ctx_log { int level; @@ -181,6 +185,11 @@ PAKFIRE_EXPORT int pakfire_ctx_create(struct pakfire_ctx** ctx, const char* path if (r) goto ERROR; + // Load the distribution information + r = pakfire_distro(&c->distro, NULL); + if (r) + goto ERROR; + // Set the default confirm callback pakfire_ctx_set_confirm_callback(c, pakfire_ctx_default_confirm_callback, NULL); @@ -231,6 +240,12 @@ struct pakfire_config* pakfire_ctx_get_config(struct pakfire_ctx* ctx) { return pakfire_config_ref(ctx->config); } +// Distro + +const struct pakfire_distro* pakfire_ctx_get_distro(struct pakfire_ctx* ctx) { + return &ctx->distro; +} + // Logging PAKFIRE_EXPORT int pakfire_ctx_get_log_level(struct pakfire_ctx* ctx) { diff --git a/src/libpakfire/include/pakfire/ctx.h b/src/libpakfire/include/pakfire/ctx.h index 92a5acc87..b72c8cd62 100644 --- a/src/libpakfire/include/pakfire/ctx.h +++ b/src/libpakfire/include/pakfire/ctx.h @@ -81,6 +81,13 @@ void pakfire_ctx_set_pick_solution_callback(struct pakfire_ctx* ctx, #ifdef PAKFIRE_PRIVATE +#include + +// Distro +const struct pakfire_distro* pakfire_ctx_get_distro(struct pakfire_ctx* ctx); + +// Logging + void pakfire_ctx_log(struct pakfire_ctx* ctx, int level, const char* file, int line, const char* fn, const char* format, ...) __attribute__((format(printf, 6, 7)));