]> git.ipfire.org Git - pakfire.git/commitdiff
build: Check very early whether we can install the source package
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 26 Sep 2023 17:59:06 +0000 (17:59 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 26 Sep 2023 17:59:06 +0000 (17:59 +0000)
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 <michael.tremer@ipfire.org>
src/libpakfire/build.c

index aeb7ede74b8fd341b2355bad34c65b686cd4391a..8c46e1714d44d8cd6d3eaafe7eab191c6806a073 100644 (file)
@@ -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)