diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-06-04 13:34:58 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-06-04 13:34:58 -0400 |
| commit | 834b7dd88de570c991821bda3e0890de889773b1 (patch) | |
| tree | e94f185423ec6fc8716254527b528bf48b09e4e7 /src | |
| parent | 4a6b526a09af6d16ce6f0e5a8b6c64548fb7ea1b (diff) | |
| download | stasis-834b7dd88de570c991821bda3e0890de889773b1.tar.gz | |
delivery_conda_enable: always pin conda's version to the same version provided by the installer
* Some commands upgrade conda whether it is configured to allow the behavior or not
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/delivery/delivery_conda.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/delivery/delivery_conda.c b/src/lib/delivery/delivery_conda.c index e1a07f1..3938842 100644 --- a/src/lib/delivery/delivery_conda.c +++ b/src/lib/delivery/delivery_conda.c @@ -120,6 +120,30 @@ void delivery_conda_enable(struct Delivery *ctx, char *conda_install_dir) { exit(1); } + char pinned[PATH_MAX]; + snprintf(pinned, sizeof(pinned), "%s/conda-meta/pinned", conda_install_dir); + touch(pinned); + if (errno == ENOENT) { + errno = 0; + } + + char *conda_version = strdup(ctx->conda.installer_version); + if (conda_version) { + char *rev = strpbrk(conda_version, "-"); + if (rev) { + *rev = '\0'; + } + + FILE *pinned_fp = fopen(pinned, "w+"); + if (!pinned_fp) { + SYSERROR("unable to open conda-meta/pinned file for writing: %s", strerror(errno)); + exit(1); + } + fprintf(pinned_fp, "conda=%s\n", conda_version); + fclose(pinned_fp); + guard_free(conda_version); + } + if (conda_capable(&ctx->conda.capabilities)) { SYSERROR("Conda capability check failed"); exit(1); |
