From e9155ff25255bfd6ff8aab3c829799f6028670e6 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 31 Jan 2025 14:40:18 +0000 Subject: [PATCH] snapshot: Clone pakfire with custom flags Signed-off-by: Michael Tremer --- src/pakfire/snapshot.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pakfire/snapshot.c b/src/pakfire/snapshot.c index 162defbe..981e151e 100644 --- a/src/pakfire/snapshot.c +++ b/src/pakfire/snapshot.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -507,11 +508,14 @@ ERROR: Creates a new snapshot */ int pakfire_snapshot_make(struct pakfire_snapshot** snapshot, struct pakfire* pakfire) { + struct pakfire_config* config = NULL; struct pakfire* p = NULL; char snapshot_path[PATH_MAX]; char tmp[PATH_MAX]; + const char* arch = NULL; const char* path = NULL; char time[1024]; + int flags = PAKFIRE_FLAGS_BUILD|PAKFIRE_FLAGS_BUILD_LOCAL; int r; const char* packages[] = { @@ -521,6 +525,12 @@ int pakfire_snapshot_make(struct pakfire_snapshot** snapshot, struct pakfire* pa struct pakfire_ctx* ctx = pakfire_ctx(pakfire); + // Fetch the configuration + config = pakfire_get_config(pakfire); + + // Fetch the architecture + arch = pakfire_get_arch(pakfire); + // Store the current time r = pakfire_strftime_now(time, PAKFIRE_SNAPSHOT_TIMESTAMP_FORMAT); if (r < 0) @@ -543,8 +553,8 @@ int pakfire_snapshot_make(struct pakfire_snapshot** snapshot, struct pakfire* pa goto ERROR; } - // Clone the Pakfire instance - r = pakfire_clone(&p, pakfire, tmp); + // Create a new pakfire instance + r = pakfire_create(&p, ctx, config, tmp, arch, flags); if (r < 0) { ERROR(ctx, "Could not clone pakfire: %s\n", strerror(-r)); goto ERROR; @@ -578,6 +588,8 @@ int pakfire_snapshot_make(struct pakfire_snapshot** snapshot, struct pakfire* pa ERROR: if (p) pakfire_unref(p); + if (config) + pakfire_config_unref(config); if (ctx) pakfire_ctx_unref(ctx); -- 2.39.5