From: Michael Tremer Date: Tue, 26 Sep 2023 17:59:06 +0000 (+0000) Subject: build: Check very early whether we can install the source package X-Git-Tag: 0.9.30~1630 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c4ac919659915f0e1d343bcb96b7209d76357bf;p=pakfire.git build: Check very early whether we can install the source package It might still fail, but at least we tried to solve this here before extracting the build environment and so on. Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index aeb7ede74..8c46e1714 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -2090,6 +2090,7 @@ PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* p struct pakfire_package* package = NULL; struct pakfire_parser* makefile = NULL; char* buildroot = NULL; + char* problems = NULL; char duration[TIME_STRING_MAX]; int r; @@ -2118,6 +2119,13 @@ PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* p goto ERROR; } + // Perform an install check to see whether we can build this at all + r = pakfire_package_installcheck(package, &problems, 0); + if (r) { + ERROR(build->pakfire, "Cannot build %s:\n%s\n", nevra, problems); + goto ERROR; + } + // Initialize the build environment r = pakfire_build_init(build); if (r) @@ -2183,6 +2191,8 @@ ERROR: pakfire_parser_unref(makefile); if (package) pakfire_package_unref(package); + if (problems) + free(problems); // Cleanup buildroot if (buildroot)