From abe87056faa6ed02aff3bbf77c1fd78b713a0864 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 24 Jun 2024 11:23:26 -0400 Subject: Pass .ci_support/plat_arch_.yaml to conda-build (#8) * Pass .ci_support/plat_arch_.yaml to conda-build * Fixes a few outstanding leaks in delivery context * Move micromamba function out of stasis_indexer.c * Adjust code in the indexer to accommodate the move. The function now expects a MicromambaInfo structure as its first argument. * Add missing warning message * User is informed when pandoc is not available for HTML page generation * Initialize workdir_template string to zero * Add micromamba program to runtime PATH * Expose storage.tools_dir to template engine * Remove dead code * Fix wording in comment * Fix conda-forge builds * Pass their .ci_support configurations to conda-build in order to fully set up their build runtime environment * Add get_cpu_count() * Exposes STASIS_CPU_COUNT and CPU_COUNT to the runtime environment * Implements conda reactivation template string * {{ workaround.conda_reactivate }} * This is useful to call after installing any conda packages within a test.script * Fix conda runtime inside of test.script * This ensures conda and mamba are fully initialized. * Previous behavior only placed the commands on the PATH but didn't provide any shell macros (i.e. undefined behavior) * Document CPU_COUNT and workaround.conda_reactivate --- include/conda.h | 14 ++++++++++++++ include/core.h | 1 + include/utils.h | 6 ++++++ 3 files changed, 21 insertions(+) (limited to 'include') diff --git a/include/conda.h b/include/conda.h index 086a842..cea3f02 100644 --- a/include/conda.h +++ b/include/conda.h @@ -8,6 +8,20 @@ #define CONDA_INSTALL_PREFIX "conda" +struct MicromambaInfo { + char *micromamba_prefix; + char *conda_prefix; +}; + +/** + * Execute micromamba + * @param info MicromambaInfo data structure (must be populated before use) + * @param command printf-style formatter string + * @param ... variadic arguments + * @return exit code + */ +int micromamba(struct MicromambaInfo *info, char *command, ...); + /** * Execute Python * Python interpreter is determined by PATH diff --git a/include/core.h b/include/core.h index 1a7ddea..ac9ae2f 100644 --- a/include/core.h +++ b/include/core.h @@ -72,6 +72,7 @@ struct STASIS_GLOBAL { char *sysconfdir; //!< Path where STASIS reads its configuration files (mission directory, etc) struct { char *tox_posargs; + char *conda_reactivate; } workaround; struct Jfrog { char *jfrog_artifactory_base_url; diff --git a/include/utils.h b/include/utils.h index 2c80e77..eee2e30 100644 --- a/include/utils.h +++ b/include/utils.h @@ -351,4 +351,10 @@ int redact_sensitive(const char **to_redact, size_t to_redact_size, char *src, c */ struct StrList *listdir(const char *path); +/** + * Get CPU count + * @return CPU count on success, zero on error + */ +long get_cpu_count(); + #endif //STASIS_UTILS_H -- cgit