aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-04-12 09:07:10 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-04-12 09:07:10 -0400
commita8d6e37a874c7a40429d0aec247658ae1edca6ed (patch)
treec9c958c0c416ecea8eec0042a88a4b2a036c1274 /src
parent6a66d6848a834eddae8225fd723a2a05e98b3c4d (diff)
downloadstasis-a8d6e37a874c7a40429d0aec247658ae1edca6ed.tar.gz
Bootstrap delivery context
* Gives access to build information before directory creation * Better control over where data ends up * Decreases complexity related to uploading artifacts from a delivery tree
Diffstat (limited to 'src')
-rw-r--r--src/deliverable.c21
-rw-r--r--src/main.c7
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;
}
diff --git a/src/main.c b/src/main.c
index f91b3f7..0ead157 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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)) {