int init:1;
};
-static const char* stages[] = {
- "prepare",
- "build",
- "test",
- "install",
- NULL,
-};
-
#define TEMPLATE \
"#!/bin/bash --login\n" \
"\n" \
struct pakfire_parser* makefile) {
int r;
- // Run through all build stages
- for (const char** stage = stages; *stage; stage++) {
- r = pakfire_build_stage(build, makefile, *stage);
- if (r) {
- // Drop to a shell for debugging
- if (pakfire_has_flag(build->pakfire, PAKFIRE_BUILD_INTERACTIVE))
- pakfire_build_shell(build);
+ // Prepare the build
+ r = pakfire_build_stage(build, makefile, "prepare");
+ if (r)
+ goto ERROR;
- return r;
- }
- }
+ // Perform the build
+ r = pakfire_build_stage(build, makefile, "build");
+ if (r)
+ goto ERROR;
+
+ // Test the build
+ r = pakfire_build_stage(build, makefile, "test");
+ if (r)
+ goto ERROR;
+
+ // Install everything
+ r = pakfire_build_stage(build, makefile, "install");
+ if (r)
+ goto ERROR;
// Run post build scripts
- return pakfire_build_run_post_build_scripts(build);
+ r = pakfire_build_run_post_build_scripts(build);
+ if (r)
+ goto ERROR;
+
+ // Done!
+ return 0;
+
+ERROR:
+ // Drop to a shell for debugging
+ if (pakfire_has_flag(build->pakfire, PAKFIRE_BUILD_INTERACTIVE))
+ pakfire_build_shell(build);
+
+ return r;
}
PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* path) {