diff options
-rw-r--r-- | src/deliverable.c | 21 | ||||
-rw-r--r-- | src/main.c | 7 |
2 files changed, 24 insertions, 4 deletions
diff --git a/src/deliverable.c b/src/deliverable.c index b71b178..6c88e66 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -239,10 +239,10 @@ void delivery_init_dirs_stage1(struct Delivery *ctx) { fprintf(stderr, "OMC_ROOT is set, but empty. Please assign a file system path to this environment variable.\n"); exit(1); } - path_store(&ctx->storage.root, PATH_MAX, rootdir, ""); + path_store(&ctx->storage.root, PATH_MAX, rootdir, ctx->info.build_name); } else { // use "omc" in current working directory - path_store(&ctx->storage.root, PATH_MAX, "omc", ""); + path_store(&ctx->storage.root, PATH_MAX, "omc", ctx->info.build_name); } path_store(&ctx->storage.tools_dir, PATH_MAX, ctx->storage.root, "tools"); path_store(&ctx->storage.tmpdir, PATH_MAX, ctx->storage.root, "tmp"); @@ -673,6 +673,23 @@ static int populate_info(struct Delivery *ctx) { } return 0; } + +int *bootstrap_build_info(struct Delivery *ctx) { + struct Delivery local; + memset(&local, 0, sizeof(local)); + local._omc_ini_fp.cfg = ini_open(ctx->_omc_ini_fp.cfg_path); + local._omc_ini_fp.delivery = ini_open(ctx->_omc_ini_fp.delivery_path); + delivery_init_platform(&local); + populate_delivery_cfg(&local); + populate_delivery_ini(&local); + populate_info(&local); + ctx->info.build_name = strdup(local.info.build_name); + ctx->info.build_number = strdup(local.info.build_number); + ctx->info.release_name = strdup(local.info.release_name); + memcpy(&ctx->info.time_info, &local.info.time_info, sizeof(ctx->info.time_info)); + ctx->info.time_now = local.info.time_now; + ctx->info.time_str_epoch = strdup(local.info.time_str_epoch); + delivery_free(&local); return 0; } @@ -343,8 +343,11 @@ int main(int argc, char *argv[]) { ctx._omc_ini_fp.delivery_path = strdup(delivery_input); - extern char *bootstrap_build_name(struct Delivery *ctx); - bootstrap_build_name(&ctx); + msg(OMC_MSG_L2, "Bootstrapping delivery context\n"); + if (bootstrap_build_info(&ctx)) { + msg(OMC_MSG_ERROR | OMC_MSG_L2, "Failed to bootstrap delivery context\n"); + exit(1); + } msg(OMC_MSG_L2, "Initializing delivery context\n"); if (delivery_init(&ctx)) { |