From: Michael Tremer Date: Sun, 29 Jun 2025 13:50:25 +0000 (+0000) Subject: packager: Directly pass the context X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=38c4eb3dcf14169d3b499cea76ad3b4425e4a096;p=pakfire.git packager: Directly pass the context Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/build.c b/src/pakfire/build.c index 4f026416..a4d134ab 100644 --- a/src/pakfire/build.c +++ b/src/pakfire/build.c @@ -1273,7 +1273,7 @@ static int pakfire_build_package(pakfire_build* build, pakfire_parser* makefile, goto ERROR; // Create a packager - r = pakfire_packager_create(&packager, build->root, pkg); + r = pakfire_packager_create(&packager, build->ctx, build->root, pkg); if (r) goto ERROR; diff --git a/src/pakfire/dist.c b/src/pakfire/dist.c index a523fa83..107036f8 100644 --- a/src/pakfire/dist.c +++ b/src/pakfire/dist.c @@ -473,7 +473,7 @@ int pakfire_dist(pakfire_ctx* ctx, pakfire_root* root, const char* path, pakfire goto ERROR; // Create a packager - r = pakfire_packager_create(&packager, root, pkg); + r = pakfire_packager_create(&packager, ctx, root, pkg); if (r) goto ERROR; diff --git a/src/pakfire/packager.c b/src/pakfire/packager.c index 54722089..dacc0ef8 100644 --- a/src/pakfire/packager.c +++ b/src/pakfire/packager.c @@ -92,7 +92,7 @@ static void pakfire_packager_free(pakfire_packager* packager) { } int pakfire_packager_create(pakfire_packager** packager, - pakfire_root* root, pakfire_package* pkg) { + pakfire_ctx* ctx, pakfire_root* root, pakfire_package* pkg) { pakfire_packager* p = NULL; char hostname[HOST_NAME_MAX]; int r = 1; @@ -109,7 +109,7 @@ int pakfire_packager_create(pakfire_packager** packager, p->nrefs = 1; // Store a reference to the context - p->ctx = pakfire_root_get_ctx(root); + p->ctx = pakfire_ctx_ref(ctx); // Store a reference to Pakfire p->root = pakfire_root_ref(root); diff --git a/src/pakfire/packager.h b/src/pakfire/packager.h index 4e33ca16..0b0b5a2b 100644 --- a/src/pakfire/packager.h +++ b/src/pakfire/packager.h @@ -21,6 +21,7 @@ #ifndef PAKFIRE_PACKAGER_H #define PAKFIRE_PACKAGER_H +#include #include #include #include @@ -32,7 +33,7 @@ typedef struct pakfire_packager pakfire_packager; int pakfire_packager_create(pakfire_packager** packager, - pakfire_root* root, pakfire_package* pkg); + pakfire_ctx* ctx, pakfire_root* root, pakfire_package* pkg); pakfire_packager* pakfire_packager_ref(pakfire_packager* packager); pakfire_packager* pakfire_packager_unref(pakfire_packager* packager); diff --git a/tests/libpakfire/packager.c b/tests/libpakfire/packager.c index 6172fea1..5ccadde4 100644 --- a/tests/libpakfire/packager.c +++ b/tests/libpakfire/packager.c @@ -40,7 +40,7 @@ static int test_create(const struct test* t) { "test", "1.0-1", "src")); // Create packager - ASSERT_SUCCESS(pakfire_packager_create(&packager, t->root, pkg)); + ASSERT_SUCCESS(pakfire_packager_create(&packager, t->ctx, t->root, pkg)); // Add a file to the package const char* path = TEST_SRC_PATH "data/beep-1.3-2.ip3.x86_64.pfm"; @@ -86,7 +86,7 @@ static int test_compare_metadata(const struct test* t) { pakfire_package_set_string(pkg1, PAKFIRE_PKG_DESCRIPTION, "DESCRIPTION"); // Create packager - ASSERT_SUCCESS(pakfire_packager_create(&packager, t->root, pkg1)); + ASSERT_SUCCESS(pakfire_packager_create(&packager, t->ctx, t->root, pkg1)); // Write archive FILE* f = test_mktemp(&path);