From d0bc9e242165111a3727669c72491890c6466e0d Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 15 Nov 2026 13:05:34 -0600 Subject: [PATCH 1/4] build(changelog): towncrier news fragments and a draft check Release notes went into CHANGELOG.md by hand, so any two pull requests that touch it conflict. The other stackhands repositories take one fragment per change in changelog.d/ and build the section at release with towncrier. towncrier.toml follows theirs, with this changelog's heading and section names. A workflow drafts the changelog on each pull request, with the version from Cargo.toml, and checks that a misnamed fragment fails. CONTRIBUTING asks for a fragment and puts towncrier build in the release steps. --- .github/workflows/changelog.yml | 46 +++++++++++++++++++++++++++++++++ CHANGELOG.md | 2 ++ CONTRIBUTING.md | 6 ++++- changelog.d/+towncrier.misc.md | 1 + changelog.d/.gitkeep | 0 towncrier.toml | 37 ++++++++++++++++++++++++++ 6 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/changelog.yml create mode 100644 changelog.d/+towncrier.misc.md create mode 100644 changelog.d/.gitkeep create mode 100644 towncrier.toml diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000..5423a7e4 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,46 @@ +name: changelog + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +concurrency: + group: changelog-${{ github.ref }} + cancel-in-progress: true + +jobs: + draft: + name: towncrier build --draft + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - uses: astral-sh/setup-uv@v7 + - name: Draft the changelog + run: | + set -euo pipefail + # The draft heading needs a version; Cargo.toml holds the one a release cuts. + version=$(sed -n '0,/^version = /s/^version = "\(.*\)"$/\1/p' Cargo.toml) + test -n "$version" + uvx towncrier@26.9.0 build --draft --version "$version" + - name: A malformed fragment fails the draft + run: | + set -euo pipefail + version=$(sed -n '0,/^version = /s/^version = "\(.*\)"$/\1/p' Cargo.toml) + name=not-a-fragment.md + printf '%s\n' 'This name has no fragment type.' > "changelog.d/$name" + set +e + out=$(uvx towncrier@26.9.0 build --draft --version "$version" 2>&1) + code=$? + set -e + printf '%s\n' "$out" + rm -f "changelog.d/$name" + test "$code" -ne 0 + printf '%s\n' "$out" | grep -F "Invalid news fragment name: $name" diff --git a/CHANGELOG.md b/CHANGELOG.md index 15cd09f7..c222740a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project are documented here. + + ## 0.7.4 - 2026-11-13 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e0c6ad6..0581ff95 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,6 +31,9 @@ Build heavy work on a remote builder when local compiles thrash the machine. either a unit test or an integration test under `tests/` - Known maintainer-bump regressions live in `tests/reproduce_real_prs.rs` and must stay green (library **and** CLI auto-bump) +- Every pull request adds a news fragment, `changelog.d/+..md` + with type `feature`, `bugfix`, `doc`, `removal` or `misc`; + `towncrier build --draft --version X.Y.Z` shows how it renders ## Documentation @@ -84,7 +87,8 @@ Keep these in lockstep on every release: 2. `pyproject.toml` `version` and `server.json` (both `version` fields) 3. `CITATION.cff` `version` 4. `docs/source/conf.py` `release` -5. `CHANGELOG.md`: move Unreleased notes into `## X.Y.Z - YYYY-MM-DD` +5. `CHANGELOG.md`: `towncrier build --version X.Y.Z` turns the fragments in + `changelog.d/` into `## X.Y.Z - YYYY-MM-DD` 6. `CITATION.cff`: add `date-released` when the version is published 7. The version a recorded command prints: `README.md`, this file, `docs/orgmode/index.org` (the install section), `docs/orgmode/install.org`, diff --git a/changelog.d/+towncrier.misc.md b/changelog.d/+towncrier.misc.md new file mode 100644 index 00000000..d7bb3773 --- /dev/null +++ b/changelog.d/+towncrier.misc.md @@ -0,0 +1 @@ +News fragments in `changelog.d/`, assembled into `CHANGELOG.md` by towncrier at release, as in the other stackhands repositories. diff --git a/changelog.d/.gitkeep b/changelog.d/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/towncrier.toml b/towncrier.toml new file mode 100644 index 00000000..bcdeceaf --- /dev/null +++ b/towncrier.toml @@ -0,0 +1,37 @@ +[tool.towncrier] +name = "eb-stack" +directory = "changelog.d" +filename = "CHANGELOG.md" +start_string = "\n" +title_format = "## {version} - {project_date}" +issue_format = "[#{issue}](https://github.com/stackhands/eb-stack/pull/{issue})" +underlines = ["", "", ""] +# Setting ignore, even to nothing, is what makes `towncrier build` fail a +# fragment whose name has no configured type. Unset, that file is skipped +# and the draft still passes. .gitkeep stays ignored either way. +ignore = [] + +[[tool.towncrier.type]] +directory = "feature" +name = "Added" +showcontent = true + +[[tool.towncrier.type]] +directory = "bugfix" +name = "Fixed" +showcontent = true + +[[tool.towncrier.type]] +directory = "doc" +name = "Documentation" +showcontent = true + +[[tool.towncrier.type]] +directory = "removal" +name = "Removed" +showcontent = true + +[[tool.towncrier.type]] +directory = "misc" +name = "Changed" +showcontent = true From a344c5451f023f08718ed8448b5658140b6dd7ab Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 15 Nov 2026 13:13:32 -0600 Subject: [PATCH 2/4] fix(eessi-extend): the current EESSI, the compat layer from EESSI_EPREFIX, and a named user prefix created eessi-extend-eb.sh defaulted to EESSI 2025.06 while the docs and the CLI default to 2026.06. It put the compatibility layer's ld on PATH only when EESSI_VERSION was set, so the default version ran without it. It created the user prefix only when no prefix was set, so a named EESSI_USER_INSTALL that did not exist yet made EESSI-extend refuse to load. The script now defaults to 2026.06, reads the repository from EESSI_CVMFS_REPO, and takes the compatibility layer from the EESSI_EPREFIX that the init sets, falling back to the path built from the version. It refuses two prefixes before creating anything and creates any user prefix, never a project or site one. The Cargo prelude takes the layer from EESSI_EPREFIX the same way, and the example target names 2026.06. tests/eessi_extend_eb_script.rs runs the script against a fake repository whose init defines module and whose eb prints its environment. --- changelog.d/+eessi-extend-eb.bugfix.md | 1 + examples/targets/eessi-extend.toml | 2 +- scripts/eessi-extend-eb.sh | 27 +++-- src/cargo.rs | 5 +- tests/eessi_extend_eb_script.rs | 145 +++++++++++++++++++++++++ tests/pypi_cran_extend.rs | 3 +- 6 files changed, 169 insertions(+), 14 deletions(-) create mode 100644 changelog.d/+eessi-extend-eb.bugfix.md create mode 100644 tests/eessi_extend_eb_script.rs diff --git a/changelog.d/+eessi-extend-eb.bugfix.md b/changelog.d/+eessi-extend-eb.bugfix.md new file mode 100644 index 00000000..840e6a17 --- /dev/null +++ b/changelog.d/+eessi-extend-eb.bugfix.md @@ -0,0 +1 @@ +`scripts/eessi-extend-eb.sh` defaults to EESSI 2026.06, takes the repository from `EESSI_CVMFS_REPO`, puts the compatibility layer's `ld` on `PATH` from `EESSI_EPREFIX` whether or not `EESSI_VERSION` was set, and creates a named `EESSI_USER_INSTALL` as well as the default one. The Cargo prelude takes the compatibility layer from `EESSI_EPREFIX` too. diff --git a/examples/targets/eessi-extend.toml b/examples/targets/eessi-extend.toml index aec20de0..6e2875b0 100644 --- a/examples/targets/eessi-extend.toml +++ b/examples/targets/eessi-extend.toml @@ -37,7 +37,7 @@ work_root = "/tmp/eb-stack-eessi/work" tmp_root = "/tmp/eb-stack-eessi/tmp" [targets.easybuild.environment] -EESSI_VERSION = "2025.06" +EESSI_VERSION = "2026.06" EESSI_USER_INSTALL = "/tmp/eb-stack-eessi/install" WORKING_DIR = "/tmp" EASYBUILD_SOURCEPATH = "/tmp/eb-stack-eessi/sources" diff --git a/scripts/eessi-extend-eb.sh b/scripts/eessi-extend-eb.sh index c1201a15..c655be8a 100755 --- a/scripts/eessi-extend-eb.sh +++ b/scripts/eessi-extend-eb.sh @@ -3,8 +3,10 @@ # EESSI init is not nounset-safe. set -eo pipefail -ver=${EESSI_VERSION:-2025.06} -init=/cvmfs/software.eessi.io/versions/${ver}/init/lmod/bash +# EESSI_CVMFS_REPO names a mirror or another EESSI repository. +repo=${EESSI_CVMFS_REPO:-/cvmfs/software.eessi.io} +ver=${EESSI_VERSION:-2026.06} +init=${repo}/versions/${ver}/init/lmod/bash if [[ ! -e $init ]]; then echo "eessi-extend-eb: missing ${init}" >&2 exit 2 @@ -18,13 +20,19 @@ n=0 [[ -n ${EESSI_PROJECT_INSTALL:-} ]] && n=$((n + 1)) [[ -n ${EESSI_SITE_INSTALL:-} ]] && n=$((n + 1)) [[ -n ${EESSI_CVMFS_INSTALL:-} ]] && n=$((n + 1)) -if [[ $n -eq 0 ]]; then - export EESSI_USER_INSTALL=${EESSI_USER_INSTALL:-$HOME/EESSI} - mkdir -p "$EESSI_USER_INSTALL" -elif [[ $n -gt 1 ]]; then +if [[ $n -gt 1 ]]; then echo "eessi-extend-eb: set exactly one of EESSI_USER_INSTALL, EESSI_PROJECT_INSTALL, EESSI_SITE_INSTALL, EESSI_CVMFS_INSTALL" >&2 exit 3 fi +# EESSI-extend refuses a user prefix that does not exist. Project and +# site prefixes need their group and modes set by an owner, so they are +# not created here. +if [[ $n -eq 0 ]]; then + export EESSI_USER_INSTALL=$HOME/EESSI +fi +if [[ -n ${EESSI_USER_INSTALL:-} ]]; then + mkdir -p "$EESSI_USER_INSTALL" +fi export WORKING_DIR=${WORKING_DIR:-/tmp} # Host Cargo/CMake wrappers are not in the EESSI module graph. Same @@ -39,10 +47,9 @@ _triple_env=$(printf %s "${_triple:-}" | tr '[:lower:]-' '[:upper:]_') if [[ -n ${_triple_env} ]]; then eval "export CARGO_TARGET_${_triple_env}_LINKER=\${CC:-gcc}" fi -# foss wrappers can drop the compat-layer ld that collect2 needs. +# foss wrappers can drop the compat-layer ld that collect2 needs. The +# init above sets EESSI_EPREFIX to the compat layer it loaded. _arch=$(uname -m) -if [[ -n ${EESSI_VERSION:-} ]]; then - export PATH="/cvmfs/software.eessi.io/versions/${EESSI_VERSION}/compat/linux/${_arch}/usr/bin:${PATH}" -fi +export PATH="${EESSI_EPREFIX:-${repo}/versions/${ver}/compat/linux/${_arch}}/usr/bin:${PATH}" module load EESSI-extend exec eb "$@" diff --git a/src/cargo.rs b/src/cargo.rs index c5d95356..0a83fc76 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -32,7 +32,7 @@ pub fn eessi_cargo_host_isolation() -> &'static str { r#"_triple_env=$(printf %s "$_triple" | tr "[:lower:]-" "[:upper:]_") && "#, r#"if [ -n "$_triple_env" ]; then eval export CARGO_TARGET_${_triple_env}_LINKER=${CC:-gcc}; fi && "#, r#"_arch=$(uname -m) && "#, - r#"_ebld=/cvmfs/software.eessi.io/versions/${EESSI_VERSION:-2025.06}/compat/linux/${_arch}/usr/bin && "#, + r#"_ebld=${EESSI_EPREFIX:-/cvmfs/software.eessi.io/versions/${EESSI_VERSION:-2026.06}/compat/linux/${_arch}}/usr/bin && "#, r#"export PATH="$_ebld:$PATH" && "#, r#"export RUSTFLAGS="-C link-arg=-B$_ebld $(printf -- '-L %s ' $(echo ${LIBRARY_PATH:-} | tr ':' ' '))" && "#, ) @@ -508,7 +508,8 @@ pyo3 = "0.22" let prelude = eessi_cargo_host_isolation(); assert!(prelude.contains("unset RUSTC_WRAPPER")); assert!(prelude.contains("uname -m")); - assert!(prelude.contains("compat/linux/${_arch}/usr/bin")); + assert!(prelude.contains("_ebld=${EESSI_EPREFIX:-")); + assert!(prelude.contains("compat/linux/${_arch}}/usr/bin")); assert!(prelude.contains("link-arg=-B")); assert!(prelude.contains("LINKER=${CC:-gcc}")); assert!( diff --git a/tests/eessi_extend_eb_script.rs b/tests/eessi_extend_eb_script.rs new file mode 100644 index 00000000..a45dcba7 --- /dev/null +++ b/tests/eessi_extend_eb_script.rs @@ -0,0 +1,145 @@ +//! scripts/eessi-extend-eb.sh against a fake EESSI repository: an init +//! that defines `module` and sets EESSI_EPREFIX, and an `eb` that prints +//! the environment it was given. + +use std::fs; +use std::os::unix::fs::PermissionsExt; +use std::path::{Path, PathBuf}; +use std::process::{Command, Output}; + +fn script() -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("scripts/eessi-extend-eb.sh") +} + +struct Fake { + dir: tempfile::TempDir, +} + +impl Fake { + fn new(version: &str, eprefix: Option<&str>) -> Self { + let dir = tempfile::tempdir().expect("tempdir"); + let init = dir + .path() + .join(format!("repo/versions/{version}/init/lmod")); + fs::create_dir_all(&init).expect("init dir"); + let mut text = String::from("module() { :; }\n"); + if let Some(e) = eprefix { + text.push_str(&format!("export EESSI_EPREFIX={e}\n")); + } + fs::write(init.join("bash"), text).expect("init"); + let bin = dir.path().join("bin"); + fs::create_dir_all(&bin).expect("bin"); + let eb = bin.join("eb"); + fs::write(&eb, "#!/bin/sh\nenv\n").expect("eb"); + fs::set_permissions(&eb, fs::Permissions::from_mode(0o755)).expect("chmod"); + fs::create_dir_all(dir.path().join("home")).expect("home"); + Self { dir } + } + + fn path(&self, rel: &str) -> PathBuf { + self.dir.path().join(rel) + } + + fn run(&self, env: &[(&str, &str)]) -> Output { + let mut cmd = Command::new("bash"); + cmd.arg(script()) + .env_clear() + .env( + "PATH", + format!("{}:/usr/bin:/bin", self.path("bin").display()), + ) + .env("HOME", self.path("home")) + .env("EESSI_CVMFS_REPO", self.path("repo")); + for (k, v) in env { + cmd.env(k, v); + } + cmd.output().expect("run script") + } +} + +fn var<'a>(out: &'a Output, name: &str) -> Option<&'a str> { + let text = std::str::from_utf8(&out.stdout).expect("utf8"); + let prefix = format!("{name}="); + text.lines().find_map(|l| l.strip_prefix(prefix.as_str())) +} + +fn ok(out: &Output) { + assert!( + out.status.success(), + "status {:?}\n{}", + out.status, + String::from_utf8_lossy(&out.stderr) + ); +} + +#[test] +fn without_a_version_it_loads_the_current_eessi() { + let fake = Fake::new("2026.06", None); + let out = fake.run(&[]); + ok(&out); + let arch = String::from_utf8(Command::new("uname").arg("-m").output().unwrap().stdout).unwrap(); + let compat = fake.path(&format!( + "repo/versions/2026.06/compat/linux/{}/usr/bin", + arch.trim() + )); + let path = var(&out, "PATH").expect("PATH"); + assert!( + path.starts_with(&format!("{}:", compat.display())), + "{path}" + ); +} + +#[test] +fn the_compat_layer_comes_from_the_init() { + let fake = Fake::new("2026.06", Some("/opt/eessi-compat")); + let out = fake.run(&[]); + ok(&out); + let path = var(&out, "PATH").expect("PATH"); + assert!(path.starts_with("/opt/eessi-compat/usr/bin:"), "{path}"); +} + +#[test] +fn a_named_user_prefix_is_created() { + let fake = Fake::new("2026.06", None); + let prefix = fake.path("home/eessi-mine"); + let out = fake.run(&[("EESSI_USER_INSTALL", prefix.to_str().unwrap())]); + ok(&out); + assert!(Path::new(&prefix).is_dir()); + assert_eq!(var(&out, "EESSI_USER_INSTALL"), prefix.to_str()); +} + +#[test] +fn the_default_user_prefix_is_home_eessi() { + let fake = Fake::new("2026.06", None); + let out = fake.run(&[]); + ok(&out); + assert!(fake.path("home/EESSI").is_dir()); +} + +#[test] +fn a_project_prefix_is_not_created() { + let fake = Fake::new("2026.06", None); + let project = fake.path("project"); + let out = fake.run(&[("EESSI_PROJECT_INSTALL", project.to_str().unwrap())]); + ok(&out); + assert!(!project.exists()); + assert_eq!(var(&out, "EESSI_USER_INSTALL"), None); +} + +#[test] +fn two_prefixes_are_refused() { + let fake = Fake::new("2026.06", None); + let out = fake.run(&[ + ("EESSI_USER_INSTALL", "/x"), + ("EESSI_PROJECT_INSTALL", "/y"), + ]); + assert_eq!(out.status.code(), Some(3)); +} + +#[test] +fn a_missing_version_is_reported() { + let fake = Fake::new("2026.06", None); + let out = fake.run(&[("EESSI_VERSION", "2025.06")]); + assert_eq!(out.status.code(), Some(2)); + assert!(String::from_utf8_lossy(&out.stderr).contains("versions/2025.06/init")); +} diff --git a/tests/pypi_cran_extend.rs b/tests/pypi_cran_extend.rs index 73f31d56..2c55eb54 100644 --- a/tests/pypi_cran_extend.rs +++ b/tests/pypi_cran_extend.rs @@ -236,7 +236,8 @@ fn assert_eessi_cargo_isolation(text: &str) { assert!( text.contains("unset RUSTC_WRAPPER") && text.contains("uname -m") - && text.contains("compat/linux/${_arch}/usr/bin") + && text.contains("${EESSI_EPREFIX:-") + && text.contains("compat/linux/${_arch}}/usr/bin") && text.contains("link-arg=-B") && text.contains("LINKER=${CC:-gcc}") && !text.contains("X86_64"), From cd3c25d938700ff14e3b25481b414334d122493e Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 15 Nov 2026 23:18:20 +0000 Subject: [PATCH 3/4] fix(eessi-extend): do not abort when rustc is absent A missing rustc failed the wrapper under pipefail before EasyBuild ran, and CI never executed the new script test. The Cargo prelude follows EESSI_CVMFS_REPO when EESSI_EPREFIX is unset. --- .github/workflows/ci_test.yml | 1 + changelog.d/+eessi-extend-rustc.bugfix.md | 1 + scripts/eessi-extend-eb.sh | 9 +++++++-- src/cargo.rs | 13 ++++++++++--- 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 changelog.d/+eessi-extend-rustc.bugfix.md diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 6d49a58d..f20eb30a 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -189,6 +189,7 @@ jobs: --test eb_robot_paths \ --test easyblock_layers \ --test easyblock_owed \ + --test eessi_extend_eb_script \ --test extension_provides \ --test family_site_layer \ --test fetch_prs_script \ diff --git a/changelog.d/+eessi-extend-rustc.bugfix.md b/changelog.d/+eessi-extend-rustc.bugfix.md new file mode 100644 index 00000000..89772237 --- /dev/null +++ b/changelog.d/+eessi-extend-rustc.bugfix.md @@ -0,0 +1 @@ +`scripts/eessi-extend-eb.sh` still reaches EasyBuild when `rustc` is not on `PATH`, and the Cargo prelude takes a mirror's compatibility layer from `EESSI_CVMFS_REPO` when `EESSI_EPREFIX` is unset. CI runs `tests/eessi_extend_eb_script.rs`. diff --git a/scripts/eessi-extend-eb.sh b/scripts/eessi-extend-eb.sh index c655be8a..c77b341b 100755 --- a/scripts/eessi-extend-eb.sh +++ b/scripts/eessi-extend-eb.sh @@ -42,8 +42,13 @@ unset RUSTC_WRAPPER CARGO_BUILD_RUSTC_WRAPPER RUSTC_WORKSPACE_WRAPPER RUSTFLAGS CMAKE_C_COMPILER_LAUNCHER CMAKE_CXX_COMPILER_LAUNCHER CMAKE_Fortran_COMPILER_LAUNCHER || true eval "$(env | awk -F= '/^CARGO_TARGET_[A-Z0-9_]*_(LINKER|RUSTFLAGS)=/{print "unset "$1}')" export LINKER=${CC:-gcc} -_triple=$(rustc -vV 2>/dev/null | awk '/^host:/{print $2}') -_triple_env=$(printf %s "${_triple:-}" | tr '[:lower:]-' '[:upper:]_') +# rustc is absent for an ordinary EasyBuild run. A failing command +# substitution under pipefail would exit before module load. +_triple="" +if _host=$(rustc -vV 2>/dev/null); then + _triple=$(printf '%s\n' "$_host" | awk '/^host:/{print $2}') +fi +_triple_env=$(printf %s "${_triple}" | tr '[:lower:]-' '[:upper:]_') if [[ -n ${_triple_env} ]]; then eval "export CARGO_TARGET_${_triple_env}_LINKER=\${CC:-gcc}" fi diff --git a/src/cargo.rs b/src/cargo.rs index 0a83fc76..d7179070 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -28,11 +28,14 @@ pub fn eessi_cargo_host_isolation() -> &'static str { r#"eval $(env | awk -F= '/^CARGO_TARGET_[A-Z0-9_]*_(LINKER|RUSTFLAGS)=/{print "unset "$1}') && "#, "export CARGO_HOME=%(builddir)s/.cargohome && ", "export LINKER=${CC:-gcc} && ", - r#"_triple=$(rustc -vV 2>/dev/null | awk "/^host:/{print \$2}") && "#, + // An ordinary recipe has no rustc. The host triple is best-effort, + // the same way scripts/eessi-extend-eb.sh discovers it, so a missing + // compiler does not drop the compat-layer linker from PATH. + r#"_triple=""; if _host=$(rustc -vV 2>/dev/null); then _triple=$(printf '%s\n' "$_host" | awk '/^host:/{print $2}'); fi && "#, r#"_triple_env=$(printf %s "$_triple" | tr "[:lower:]-" "[:upper:]_") && "#, r#"if [ -n "$_triple_env" ]; then eval export CARGO_TARGET_${_triple_env}_LINKER=${CC:-gcc}; fi && "#, r#"_arch=$(uname -m) && "#, - r#"_ebld=${EESSI_EPREFIX:-/cvmfs/software.eessi.io/versions/${EESSI_VERSION:-2026.06}/compat/linux/${_arch}}/usr/bin && "#, + r#"_ebld=${EESSI_EPREFIX:-${EESSI_CVMFS_REPO:-/cvmfs/software.eessi.io}/versions/${EESSI_VERSION:-2026.06}/compat/linux/${_arch}}/usr/bin && "#, r#"export PATH="$_ebld:$PATH" && "#, r#"export RUSTFLAGS="-C link-arg=-B$_ebld $(printf -- '-L %s ' $(echo ${LIBRARY_PATH:-} | tr ':' ' '))" && "#, ) @@ -508,8 +511,12 @@ pyo3 = "0.22" let prelude = eessi_cargo_host_isolation(); assert!(prelude.contains("unset RUSTC_WRAPPER")); assert!(prelude.contains("uname -m")); - assert!(prelude.contains("_ebld=${EESSI_EPREFIX:-")); + assert!(prelude.contains("_ebld=${EESSI_EPREFIX:-${EESSI_CVMFS_REPO:-")); assert!(prelude.contains("compat/linux/${_arch}}/usr/bin")); + assert!( + prelude.contains("if _host=$(rustc -vV 2>/dev/null); then"), + "a missing rustc must not abort the prelude" + ); assert!(prelude.contains("link-arg=-B")); assert!(prelude.contains("LINKER=${CC:-gcc}")); assert!( From 837e8cfb2833e0b6e9deb8e2f21e01083f3b30ba Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 15 Nov 2026 23:32:15 +0000 Subject: [PATCH 4/4] fix(eessi-extend): count a present prefix variable, even when it is empty EESSI-extend treats a prefix variable as set when it is present, including an empty value. The wrapper counted only non-empty values, so an empty EESSI_SITE_INSTALL also exported EESSI_USER_INSTALL and the module refused the combination. --- .../+eessi-extend-empty-prefix.bugfix.md | 1 + scripts/eessi-extend-eb.sh | 11 +++++--- tests/eessi_extend_eb_script.rs | 28 +++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 changelog.d/+eessi-extend-empty-prefix.bugfix.md diff --git a/changelog.d/+eessi-extend-empty-prefix.bugfix.md b/changelog.d/+eessi-extend-empty-prefix.bugfix.md new file mode 100644 index 00000000..54706458 --- /dev/null +++ b/changelog.d/+eessi-extend-empty-prefix.bugfix.md @@ -0,0 +1 @@ +`scripts/eessi-extend-eb.sh` counts a present `EESSI_*_INSTALL` variable as set when the value is empty, matching EESSI-extend. An empty `EESSI_SITE_INSTALL` or `EESSI_CVMFS_INSTALL` stays in that mode and no longer also creates a user prefix. diff --git a/scripts/eessi-extend-eb.sh b/scripts/eessi-extend-eb.sh index c77b341b..a8adf797 100755 --- a/scripts/eessi-extend-eb.sh +++ b/scripts/eessi-extend-eb.sh @@ -15,11 +15,14 @@ fi source "$init" # Exactly one prefix variable; the module reads them at load time. +# EESSI-extend uses os.getenv(name) ~= nil, so a present empty value is +# set. An empty EESSI_SITE_INSTALL is site mode. Counting only non-empty +# values also exported EESSI_USER_INSTALL, and the module refused both. n=0 -[[ -n ${EESSI_USER_INSTALL:-} ]] && n=$((n + 1)) -[[ -n ${EESSI_PROJECT_INSTALL:-} ]] && n=$((n + 1)) -[[ -n ${EESSI_SITE_INSTALL:-} ]] && n=$((n + 1)) -[[ -n ${EESSI_CVMFS_INSTALL:-} ]] && n=$((n + 1)) +[[ -v EESSI_USER_INSTALL ]] && n=$((n + 1)) +[[ -v EESSI_PROJECT_INSTALL ]] && n=$((n + 1)) +[[ -v EESSI_SITE_INSTALL ]] && n=$((n + 1)) +[[ -v EESSI_CVMFS_INSTALL ]] && n=$((n + 1)) if [[ $n -gt 1 ]]; then echo "eessi-extend-eb: set exactly one of EESSI_USER_INSTALL, EESSI_PROJECT_INSTALL, EESSI_SITE_INSTALL, EESSI_CVMFS_INSTALL" >&2 exit 3 diff --git a/tests/eessi_extend_eb_script.rs b/tests/eessi_extend_eb_script.rs index a45dcba7..df30d1d2 100644 --- a/tests/eessi_extend_eb_script.rs +++ b/tests/eessi_extend_eb_script.rs @@ -126,6 +126,34 @@ fn a_project_prefix_is_not_created() { assert_eq!(var(&out, "EESSI_USER_INSTALL"), None); } +#[test] +fn an_empty_site_install_is_not_a_user_prefix() { + let fake = Fake::new("2026.06", None); + let out = fake.run(&[("EESSI_SITE_INSTALL", "")]); + ok(&out); + assert!(!fake.path("home/EESSI").exists()); + assert_eq!(var(&out, "EESSI_USER_INSTALL"), None); + assert_eq!(var(&out, "EESSI_SITE_INSTALL"), Some("")); +} + +#[test] +fn an_empty_cvmfs_install_is_not_a_user_prefix() { + let fake = Fake::new("2026.06", None); + let out = fake.run(&[("EESSI_CVMFS_INSTALL", "")]); + ok(&out); + assert!(!fake.path("home/EESSI").exists()); + assert_eq!(var(&out, "EESSI_USER_INSTALL"), None); + assert_eq!(var(&out, "EESSI_CVMFS_INSTALL"), Some("")); +} + +#[test] +fn an_empty_site_install_with_a_user_prefix_is_refused() { + let fake = Fake::new("2026.06", None); + let out = fake.run(&[("EESSI_SITE_INSTALL", ""), ("EESSI_USER_INSTALL", "/x")]); + assert_eq!(out.status.code(), Some(3)); + assert!(!fake.path("home/EESSI").exists()); +} + #[test] fn two_prefixes_are_refused() { let fake = Fake::new("2026.06", None);