diff options
-rw-r--r-- | include/deliverable.h | 6 | ||||
-rw-r--r-- | src/deliverable.c | 16 | ||||
-rw-r--r-- | src/main.c | 2 |
3 files changed, 21 insertions, 3 deletions
diff --git a/include/deliverable.h b/include/deliverable.h index 76d7eb4..b528c46 100644 --- a/include/deliverable.h +++ b/include/deliverable.h @@ -87,6 +87,8 @@ struct Delivery { */ struct Info { char *release_name; ///< The fully combined release string + char *build_name; + char *build_number; struct tm *time_info; ///< Delivery time structure time_t time_now; ///< Time stamp for when OMC execution started char *time_str_epoch; ///< String representation of Unix epoch @@ -141,7 +143,9 @@ struct Delivery { struct Rule { struct INIFILE *_handle; bool enable_final; ///< true=allow rc value replacement, false=keep rc value even if final release - char *release_fmt; ///< Release generator format string + char *release_fmt; ///< Release format string + char *build_name_fmt; ///< Build name format string + char *build_number_fmt; ///< Build number format string struct Content content[1000]; } rules; }; diff --git a/src/deliverable.c b/src/deliverable.c index e2bbffb..c5b9150 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -429,10 +429,22 @@ int delivery_init(struct Delivery *ctx, struct INIFILE *ini, struct INIFILE *cfg getter_required(ctx->rules._handle, "meta", "release_fmt", INIVAL_TYPE_STR) conv_str(ctx, rules.release_fmt) + // TODO move this somewhere else? + // Used for setting artifactory build info + getter_required(ctx->rules._handle, "meta", "build_name_fmt", INIVAL_TYPE_STR) + conv_str(ctx, rules.build_name_fmt) + + // TODO move this somewhere else? + // Used for setting artifactory build info + getter_required(ctx->rules._handle, "meta", "build_number_fmt", INIVAL_TYPE_STR) + conv_str(ctx, rules.build_number_fmt) + if (delivery_format_str(ctx, &ctx->info.release_name, ctx->rules.release_fmt)) { fprintf(stderr, "Failed to generate release name. Format used: %s\n", ctx->rules.release_fmt); return -1; } + delivery_format_str(ctx, &ctx->info.build_name, ctx->rules.build_name_fmt); + delivery_format_str(ctx, &ctx->info.build_number, ctx->rules.build_number_fmt); ctx->conda.conda_packages_defer = strlist_init(); ctx->conda.pip_packages_defer = strlist_init(); @@ -1458,8 +1470,8 @@ int delivery_artifact_upload(struct Delivery *ctx) { } ctx->deploy[i].upload_ctx.workaround_parent_only = true; - ctx->deploy[i].upload_ctx.build_name = strdup(ctx->info.release_name); - ctx->deploy[i].upload_ctx.build_number = ctx->info.time_now; + ctx->deploy[i].upload_ctx.build_name = ctx->info.build_name; + ctx->deploy[i].upload_ctx.build_number = ctx->info.build_number; char files[PATH_MAX]; @@ -201,6 +201,8 @@ int main(int argc, char *argv[], char *arge[]) { tpl_register("meta.python_compact", &ctx.meta.python_compact); tpl_register("info.time_str_epoch", &ctx.info.time_str_epoch); tpl_register("info.release_name", &ctx.info.release_name); + tpl_register("info.build_name", &ctx.info.build_name); + tpl_register("info.build_number", &ctx.info.build_number); tpl_register("storage.tmpdir", &ctx.storage.tmpdir); tpl_register("storage.delivery_dir", &ctx.storage.delivery_dir); tpl_register("storage.conda_artifact_dir", &ctx.storage.conda_artifact_dir); |