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) {
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;
#include <pakfire/config.h>
#include <pakfire/ctx.h>
#include <pakfire/logging.h>
+#include <pakfire/os.h>
#include <pakfire/private.h>
struct pakfire_ctx {
// Config
struct pakfire_config* config;
+ // Distro
+ struct pakfire_distro distro;
+
// Logging
struct pakfire_ctx_log {
int level;
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);
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) {
#ifdef PAKFIRE_PRIVATE
+#include <pakfire/os.h>
+
+// 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)));