From 507c003a36584fae29cba00ca8e264488f39476e Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 12 Apr 2024 15:57:32 -0400 Subject: Save raw and rendered versions of the input configuration. --- src/deliverable.c | 2 ++ src/main.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'src') 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"); diff --git a/src/main.c b/src/main.c index 6608299..7c20ae7 100644 --- a/src/main.c +++ b/src/main.c @@ -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); -- cgit