ERROR:
// Drop to a shell for debugging
if (pakfire_build_has_flag(build, PAKFIRE_BUILD_INTERACTIVE))
- pakfire_build_shell(build, NULL);
+ pakfire_build_shell(build, NULL, NULL);
return r;
}
return r;
}
-static int pakfire_build_init(struct pakfire_build* build, struct pakfire_package* package) {
+static int pakfire_build_init(struct pakfire_build* build,
+ struct pakfire_package* package, const char** packages) {
struct pakfire_transaction* transaction = NULL;
char* problems = NULL;
int r;
goto ERROR;
}
+ // Any custom packages
+ if (packages) {
+ for (const char** p = packages; *p; p++) {
+ r = pakfire_transaction_request(transaction,
+ PAKFIRE_JOB_INSTALL, *p, PAKFIRE_JOB_ESSENTIAL);
+ if (r < 0)
+ goto ERROR;
+ }
+ }
+
// Also update everything that has already been installed
r = pakfire_transaction_request(transaction, PAKFIRE_JOB_SYNC, NULL, 0);
if (r)
}
// Install everything we need and the source package, too
- r = pakfire_build_init(build, package);
+ r = pakfire_build_init(build, package, NULL);
if (r) {
ERROR(build->ctx, "Could not install the source package: %m\n");
goto ERROR;
goto ERROR;
// Install all packages
- r = pakfire_build_install(build, NULL);
+ r = pakfire_build_init(build, NULL, NULL);
if (r)
goto ERROR;
return r;
}
-int pakfire_build_install(struct pakfire_build* build, const char** packages) {
- struct pakfire_transaction* transaction = NULL;
- char* problems = NULL;
- int r;
-
- // Create a new transaction
- r = pakfire_transaction_create(&transaction, build->pakfire, 0);
- if (r)
- goto ERROR;
-
- // Install all packages
- for (const char** p = packages; *p; p++) {
- r = pakfire_transaction_request(transaction, PAKFIRE_JOB_INSTALL, *p, 0);
- if (r)
- goto ERROR;
- }
-
- // Solve the transaction
- r = pakfire_transaction_solve(transaction, 0, &problems);
- if (r) {
- ERROR(build->ctx, "Could not install packages:\n%s\n", problems);
- goto ERROR;
- }
-
- // Run the transaction
- r = pakfire_transaction_run(transaction);
- if (r)
- goto ERROR;
-
-ERROR:
- if (transaction)
- pakfire_transaction_unref(transaction);
- if (problems)
- free(problems);
-
- return r;
-}
-
/*
Drops the user into a shell
*/
-int pakfire_build_shell(struct pakfire_build* build, const char* argv[]) {
+int pakfire_build_shell(struct pakfire_build* build, const char* argv[], const char** packages) {
int r;
// Initialize the build environment
- r = pakfire_build_init(build, NULL);
+ r = pakfire_build_init(build, NULL, packages);
if (r)
return r;
int pakfire_build_set_ccache_path(struct pakfire_build* build, const char* path);
int pakfire_build_set_target(struct pakfire_build* build, const char* target);
-int pakfire_build_shell(struct pakfire_build* build, const char* argv[]);
+int pakfire_build_shell(struct pakfire_build* build, const char* argv[], const char** packages);
int pakfire_build_exec(struct pakfire_build* build, const char* path);
int pakfire_build_clean(struct pakfire* pakfire, int flags);
-int pakfire_build_install(struct pakfire_build* build, const char** packages);
-
#endif /* PAKFIRE_BUILD_H */