From a829d33be1863451de28918b9150f598727e7153 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 28 Apr 2023 14:18:04 +0000 Subject: [PATCH] build: Drop pakfire_build legacy function Since we need to extend the interface, it is becoming painful to keep the compat layer working for only one call. Signed-off-by: Michael Tremer --- src/_pakfire/pakfire.c | 19 +++++++++++++- src/libpakfire/build.c | 36 -------------------------- src/libpakfire/include/pakfire/build.h | 2 -- src/libpakfire/libpakfire.sym | 1 - 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/src/_pakfire/pakfire.c b/src/_pakfire/pakfire.c index 92cd5842f..b6dfa3a76 100644 --- a/src/_pakfire/pakfire.c +++ b/src/_pakfire/pakfire.c @@ -1220,6 +1220,7 @@ static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kw "disable_tests", NULL, }; + struct pakfire_build* build = NULL; const char* path = NULL; const char* target = NULL; const char* build_id = NULL; @@ -1252,8 +1253,24 @@ static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kw Py_BEGIN_ALLOW_THREADS + // Create a new build environment + r = pakfire_build_create(&build, self->pakfire, build_id, flags); + if (r) + goto ERROR; + + // Set target + if (target) { + r = pakfire_build_set_target(build, target); + if (r) + goto ERROR; + } + // Run build - r = pakfire_build(self->pakfire, path, target, build_id, flags); + r = pakfire_build_exec(build, path); + +ERROR: + if (build) + pakfire_build_unref(build); Py_END_ALLOW_THREADS diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index dfa50e7d9..22e76c6fc 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -2162,42 +2162,6 @@ ERROR: return r; } -/* - Compatibility function to keep the legacy API. -*/ -PAKFIRE_EXPORT int pakfire_build(struct pakfire* pakfire, const char* path, - const char* target, const char* id, int flags) { - struct pakfire_build* build = NULL; - int r; - - // Check if path is set - if (!path) { - errno = EINVAL; - return 1; - } - - // Create a new build environment - r = pakfire_build_create(&build, pakfire, id, flags); - if (r) - goto ERROR; - - // Set target - if (target) { - r = pakfire_build_set_target(build, target); - if (r) - goto ERROR; - } - - // Run build - r = pakfire_build_exec(build, path); - -ERROR: - if (build) - pakfire_build_unref(build); - - return r; -} - int pakfire_build_clean(struct pakfire* pakfire, int flags) { struct pakfire_repo* local = NULL; int r = 0; diff --git a/src/libpakfire/include/pakfire/build.h b/src/libpakfire/include/pakfire/build.h index cef7cfcdd..56749e78b 100644 --- a/src/libpakfire/include/pakfire/build.h +++ b/src/libpakfire/include/pakfire/build.h @@ -42,8 +42,6 @@ int pakfire_build_set_target(struct pakfire_build* build, const char* target); int pakfire_build_exec(struct pakfire_build* build, const char* path); -int pakfire_build(struct pakfire* pakfire, const char* path, const char* target, - const char* id, int flags); int pakfire_build_clean(struct pakfire* pakfire, int flags); int pakfire_shell(struct pakfire* pakfire, const char** packages, int flags); diff --git a/src/libpakfire/libpakfire.sym b/src/libpakfire/libpakfire.sym index 091c4ee1c..a68edebb3 100644 --- a/src/libpakfire/libpakfire.sym +++ b/src/libpakfire/libpakfire.sym @@ -64,7 +64,6 @@ global: pakfire_archive_verify; # build - pakfire_build; pakfire_build_create; pakfire_build_exec; pakfire_build_ref; -- 2.39.5