diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-12 15:57:32 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-12 15:57:32 -0400 |
commit | 507c003a36584fae29cba00ca8e264488f39476e (patch) | |
tree | d1062275360e96071ca3e8bf8b3d0be9df4a9a06 /src | |
parent | 4049e0de876611d1d94fbd0185a0ab9722cb8ce1 (diff) | |
download | stasis-507c003a36584fae29cba00ca8e264488f39476e.tar.gz |
Save raw and rendered versions of the input configuration.
Diffstat (limited to 'src')
-rw-r--r-- | src/deliverable.c | 2 | ||||
-rw-r--r-- | src/main.c | 27 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/deliverable.c b/src/deliverable.c index b7331e0..4c29fa4 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -228,6 +228,8 @@ void delivery_init_dirs_stage2(struct Delivery *ctx) { path_store(&ctx->storage.delivery_dir, PATH_MAX, ctx->storage.output_dir, "delivery"); path_store(&ctx->storage.results_dir, PATH_MAX, ctx->storage.output_dir, "results"); path_store(&ctx->storage.package_dir, PATH_MAX, ctx->storage.output_dir, "packages"); + path_store(&ctx->storage.cfgdump_dir, PATH_MAX, ctx->storage.output_dir, "config"); + path_store(&ctx->storage.conda_artifact_dir, PATH_MAX, ctx->storage.package_dir, "conda"); path_store(&ctx->storage.wheel_artifact_dir, PATH_MAX, ctx->storage.package_dir, "wheels"); path_store(&ctx->storage.docker_artifact_dir, PATH_MAX, ctx->storage.package_dir, "docker"); @@ -532,6 +532,33 @@ int main(int argc, char *argv[]) { conda_exec("list"); msg(OMC_MSG_L1, "Creating release\n"); + msg(OMC_MSG_L2, "Exporting delivery configuration\n"); + if (!pushd(ctx.storage.cfgdump_dir)) { + char filename[PATH_MAX] = {0}; + sprintf(filename, "%s.ini", ctx.info.release_name); + FILE *spec = fopen(filename, "w+"); + if (!spec) { + msg(OMC_MSG_ERROR | OMC_MSG_L2, "failed %s\n", filename); + exit(1); + } + ini_write(ctx._omc_ini_fp.delivery, &spec, INI_WRITE_RAW); + fclose(spec); + + memset(filename, 0, sizeof(filename)); + sprintf(filename, "%s-rendered.ini", ctx.info.release_name); + spec = fopen(filename, "w+"); + if (!spec) { + msg(OMC_MSG_ERROR | OMC_MSG_L2, "failed %s\n", filename); + exit(1); + } + ini_write(ctx._omc_ini_fp.delivery, &spec, INI_WRITE_PRESERVE); + fclose(spec); + popd(); + } else { + SYSERROR("Failed to enter directory: %s", ctx.storage.delivery_dir); + exit(1); + } + msg(OMC_MSG_L2, "Exporting %s\n", env_name_testing); if (conda_env_export(env_name_testing, ctx.storage.delivery_dir, env_name_testing)) { msg(OMC_MSG_ERROR | OMC_MSG_L2, "failed %s\n", env_name_testing); |