#include <curl/curl.h>
#include <magic.h>
+// systemd
+#include <systemd/sd-event.h>
+
#include <pakfire/config.h>
#include <pakfire/ctx.h>
#include <pakfire/logging.h>
// Distro
struct pakfire_distro distro;
+ // Event Loop
+ sd_event* loop;
+
// Logging
struct pakfire_ctx_log {
int level;
}
static void pakfire_ctx_free(struct pakfire_ctx* ctx) {
+ // Release event loop
+ if (ctx->loop)
+ sd_event_unref(ctx->loop);
+
// Release cURL Share Handle
if (ctx->share)
curl_share_cleanup(ctx->share);
return ctx->pick_solution.callback(ctx, pakfire, ctx->pick_solution.data, transaction);
}
+// Event Loop
+
+int pakfire_ctx_loop(struct pakfire_ctx* ctx, sd_event** loop) {
+ int r;
+
+ // Initialize the loop whenever we need it
+ if (!ctx->loop) {
+ r = sd_event_new(&ctx->loop);
+ if (r < 0)
+ return r;
+ }
+
+ // Return the loop
+ *loop = sd_event_ref(ctx->loop);
+
+ return 0;
+}
+
// cURL
CURLSH* pakfire_ctx_curl_share(struct pakfire_ctx* ctx) {
int pakfire_ctx_pick_solution(struct pakfire_ctx* ctx, struct pakfire* pakfire,
struct pakfire_transaction* transaction);
+// Event Loop
+
+#include <systemd/sd-event.h>
+
+int pakfire_ctx_loop(struct pakfire_ctx* ctx, sd_event** loop);
+
// cURL
#include <curl/curl.h>