diff --git a/src/bsys.c b/src/bsys.c index 91444f72..ce9bd3a1 100644 --- a/src/bsys.c +++ b/src/bsys.c @@ -66,7 +66,7 @@ int bsys_dep_tree(bsys_t const* bsys, int argc, char* argv[]) { return 0; } -static int bsys_build_deps(bsys_t const* bsys) { +static int do_build_deps(bsys_t const* bsys) { if (bsys->dep_tree == NULL || bsys->build_deps == NULL) { return 0; } @@ -94,15 +94,13 @@ static int bsys_build_deps(bsys_t const* bsys) { return rv; } -int bsys_build(bsys_t const* bsys, char const* preinstall_prefix) { +int bsys_build(bsys_t const* bsys, char const* preinstall_prefix, bool build_deps) { if (bsys->build == NULL) { LOG_WARN("%s build system does not have a build step; nothing to build!", bsys->name); return 0; } - // Install dependencies. - - if (bsys_build_deps(bsys) < 0) { + if (build_deps && do_build_deps(bsys) < 0) { return -1; } @@ -187,7 +185,7 @@ static int install(bsys_t const* bsys, bool to_tmp_prefix) { // Run build step. - if (bsys_build(bsys, path) < 0) { + if (bsys_build(bsys, path, true) < 0) { return -1; } diff --git a/src/bsys.h b/src/bsys.h index 7b465ac1..d1121f72 100644 --- a/src/bsys.h +++ b/src/bsys.h @@ -45,7 +45,7 @@ static bsys_t const* const BSYS[] = { bsys_t const* bsys_identify(void); int bsys_dep_tree(bsys_t const* bsys, int argc, char* argv[]); -int bsys_build(bsys_t const* bsys, char const* preinstall_prefix); +int bsys_build(bsys_t const* bsys, char const* preinstall_prefix, bool build_deps); int bsys_run(bsys_t const* bsys, int argc, char* argv[]); int bsys_sh(bsys_t const* bsys, int argc, char* argv[]); int bsys_install(bsys_t const* bsys); diff --git a/src/deps.c b/src/deps.c index 2ae2fc7d..21f97092 100644 --- a/src/deps.c +++ b/src/deps.c @@ -28,7 +28,12 @@ static bool build_task(void* data) { // XXX If the dependency wants to use a different output path, we should probably add a function in the Bob build script to set the output path to something else instead of having an -o switch. cmd_t CMD_CLEANUP cmd = {0}; - cmd_create(&cmd, init_name, "-t", tmp_install_prefix, "-p", install_prefix, "-C", path, "build", NULL); + cmd_create(&cmd, init_name, "-p", install_prefix, "-C", path, NULL); + + cmd_add(&cmd, "-t"); + cmd_add(&cmd, tmp_install_prefix); + + cmd_add(&cmd, "build-no-deps"); int const rv = cmd_exec(&cmd); diff --git a/src/main.c b/src/main.c index e8dfdc81..5c56da21 100644 --- a/src/main.c +++ b/src/main.c @@ -273,12 +273,20 @@ int main(int argc, char* argv[]) { char const* const instr = *argv++; + // If we explicitly set a temporary installation prefix, we're probably intending to preinstall to that prefix, even when just building. + + char* const build_prefix = tmp_install_prefix_set ? tmp_install_prefix : NULL; + if (strcmp(instr, "build") == 0) { - // If we explicitly set a temporary installation prefix, we're probably intending to preinstall to that prefix, even when just building. + if (bsys_build(bsys, build_prefix, true) == 0) { + rv = EXIT_SUCCESS; + } + } - char* const prefix = tmp_install_prefix_set ? tmp_install_prefix : NULL; + // This is intentionally undocumented, as it's only used when the dependencies of this process are already being managed by another. - if (bsys_build(bsys, prefix) == 0) { + else if (strcmp(instr, "build-no-deps") == 0) { + if (bsys_build(bsys, build_prefix, false) == 0) { rv = EXIT_SUCCESS; } } @@ -301,7 +309,7 @@ int main(int argc, char* argv[]) { } } - // This is purposefully undocumented, as it's really only used for communication between Bob parent processes and their Bob children processes. + // This is intentionally undocumented, as it's really only used for communication between Bob parent processes and their Bob children processes. else if (strcmp(instr, "dep-tree") == 0) { LOG_WARN("This command is internal and isn't meant for direct use. A correct consumer of this command should be able to discard this message by reading the contents within the dependency tree tags.");