Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/+attempt-modulepath.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A verification command runs with the module tree of the attempt's install path, `<installpath>/modules/all` by default, first on `MODULEPATH` and on `EESSI_EXTRA_MODULEPATH`, so `module load {module}` finds the module the attempt built, also after the EESSI init replaces `MODULEPATH`.
1 change: 1 addition & 0 deletions changelog.d/+attempt-prefix.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The target reference and the eOn on EESSI how-to say that each campaign attempt installs into `<work_root>/install-attempts/<package>-<version>/attempt-<N>`, which takes precedence over the prefix EESSI-extend derives from `EESSI_USER_INSTALL`.
11 changes: 7 additions & 4 deletions docs/orgmode/howto/eon-eessi-extend.org
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ Read the campaign while it runs, from another shell:
eb-stack campaign status --state /tmp/eb-stack/bundles/eon-tutorial.campaign.json
#+end_src

The modules land under
~$EESSI_USER_INSTALL/versions/2026.06/software/linux/$EESSI_SOFTWARE_SUBDIR/modules/all~,
so a second CPU target gets its own tree, and each host loads the build for
its own architecture.
The campaign installs each attempt into its own prefix,
~<work_root>/install-attempts/eOn-2.17.10/attempt-<N>~, and passes it to ~eb~
as ~--installpath~, which takes precedence over the path ~EESSI-extend~
derives from ~$EESSI_USER_INSTALL~. The modules land under ~modules/all~ in
that prefix, and the verification commands find them there. Unlike the
~$EESSI_USER_INSTALL~ tree, which has one directory per
~$EESSI_SOFTWARE_SUBDIR~, that path does not name the CPU target.

* Develop eOn from a working tree

Expand Down
5 changes: 4 additions & 1 deletion docs/orgmode/reference/cli.org
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,10 @@ eb-stack campaign finding resolve \

~campaign run~ resumes state with matching package identity, increments the
attempt, stages the bundle, runs every emitted recipe, and executes each
profile's verification commands. Transport, executor, runtime, interrupted,
profile's verification commands. Each attempt installs into its own prefix
under ~<work_root>/install-attempts/~, and its verification commands find
that prefix's modules first, as [[file:targets.org][the target reference]]
describes. Transport, executor, runtime, interrupted,
checksum, patch, dependency, configure, compile, link, test, install, sanity,
resource, timeout, and unknown failures are persisted as typed findings.

Expand Down
17 changes: 17 additions & 0 deletions docs/orgmode/reference/targets.org
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,23 @@ The routed build command adds ~--robot=<colon-separated paths>~ and
~--buildpath=<work_root>/build~. Later robot roots override earlier recipes
with the same EasyBuild identity.

A campaign gives each attempt its own prefix. It sets ~EASYBUILD_INSTALLPATH~
to ~<work_root>/install-attempts/<package>-<version>/attempt-<N>~, and the
build command passes that as ~--installpath~. The flag takes precedence over
an install path from the environment, such as the one ~EESSI-extend~ derives
from ~EESSI_USER_INSTALL~, so a campaign does not install into that prefix.

A verification command runs with the module tree of ~EASYBUILD_INSTALLPATH~
first on ~MODULEPATH~ and on ~EESSI_EXTRA_MODULEPATH~. The tree is
~<installpath>/modules/all~ unless the environment sets
~EASYBUILD_INSTALLPATH_MODULES~, ~EASYBUILD_SUBDIR_MODULES~, or
~EASYBUILD_SUFFIX_MODULES_PATH~. So ~module load {module}~ finds the attempt's
module, also after the EESSI init, which replaces ~MODULEPATH~ and keeps
~EESSI_EXTRA_MODULEPATH~. That init puts its own trees first, so a module
EESSI also provides loads from EESSI. To load the attempt's build instead,
run ~module use $EASYBUILD_INSTALLPATH/modules/all~ after the init and before
~module load EESSI-extend~, which sets ~EASYBUILD_INSTALLPATH~ again.

Treat ~EASYBUILD_PARALLEL~ and the executor allocation as one resource
contract. Parallel C++ compiler processes can each consume more than a
gigabyte, so CPU count alone is not a safe job count. The runnable local target
Expand Down
33 changes: 28 additions & 5 deletions llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1597,10 +1597,13 @@ Read the campaign while it runs, from another shell:
eb-stack campaign status --state /tmp/eb-stack/bundles/eon-tutorial.campaign.json
```

The modules land under
`$EESSI_USER_INSTALL/versions/2026.06/software/linux/$EESSI_SOFTWARE_SUBDIR/modules/all`,
so a second CPU target gets its own tree, and each host loads the build for
its own architecture.
The campaign installs each attempt into its own prefix,
`<work_root>/install-attempts/eOn-2.17.10/attempt-<N>`, and passes it to `eb`
as `--installpath`, which takes precedence over the path `EESSI-extend`
derives from `$EESSI_USER_INSTALL`. The modules land under `modules/all` in
that prefix, and the verification commands find them there. Unlike the
`$EESSI_USER_INSTALL` tree, which has one directory per
`$EESSI_SOFTWARE_SUBDIR`, that path does not name the CPU target.

# Develop eOn from a working tree

Expand Down Expand Up @@ -8603,7 +8606,10 @@ eb-stack campaign finding resolve \

`campaign run` resumes state with matching package identity, increments the
attempt, stages the bundle, runs every emitted recipe, and executes each
profile's verification commands. Transport, executor, runtime, interrupted,
profile's verification commands. Each attempt installs into its own prefix
under `<work_root>/install-attempts/`, and its verification commands find
that prefix's modules first, as [the target reference](https://eb-stack.rgoswami.me/targets.html.md)
describes. Transport, executor, runtime, interrupted,
checksum, patch, dependency, configure, compile, link, test, install, sanity,
resource, timeout, and unknown failures are persisted as typed findings.

Expand Down Expand Up @@ -9895,6 +9901,23 @@ The routed build command adds `--robot=<colon-separated paths>` and
`--buildpath=<work_root>/build`. Later robot roots override earlier recipes
with the same EasyBuild identity.

A campaign gives each attempt its own prefix. It sets `EASYBUILD_INSTALLPATH`
to `<work_root>/install-attempts/<package>-<version>/attempt-<N>`, and the
build command passes that as `--installpath`. The flag takes precedence over
an install path from the environment, such as the one `EESSI-extend` derives
from `EESSI_USER_INSTALL`, so a campaign does not install into that prefix.

A verification command runs with the module tree of `EASYBUILD_INSTALLPATH`
first on `MODULEPATH` and on `EESSI_EXTRA_MODULEPATH`. The tree is
`<installpath>/modules/all` unless the environment sets
`EASYBUILD_INSTALLPATH_MODULES`, `EASYBUILD_SUBDIR_MODULES`, or
`EASYBUILD_SUFFIX_MODULES_PATH`. So `module load {module}` finds the attempt's
module, also after the EESSI init, which replaces `MODULEPATH` and keeps
`EESSI_EXTRA_MODULEPATH`. That init puts its own trees first, so a module
EESSI also provides loads from EESSI. To load the attempt's build instead,
run `module use $EASYBUILD_INSTALLPATH/modules/all` after the init and before
`module load EESSI-extend`, which sets `EASYBUILD_INSTALLPATH` again.

Treat `EASYBUILD_PARALLEL` and the executor allocation as one resource
contract. Parallel C++ compiler processes can each consume more than a
gigabyte, so CPU count alone is not a safe job count. The runnable local target
Expand Down
48 changes: 47 additions & 1 deletion src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,16 +541,49 @@ impl BuildTarget {
///
/// Uses the same workload prefix as a build: `EASYBUILD_TMPDIR` and the
/// target environment. Wrapper variables are scrubbed only when `program`
/// is EasyBuild itself.
/// is EasyBuild itself. With `EASYBUILD_INSTALLPATH` set, the module tree
/// under it goes first on `MODULEPATH` and on `EESSI_EXTRA_MODULEPATH`,
/// so `module load` finds what the build installed there.
pub fn verification_command(&self, program: &str, args: &[String]) -> CommandPlan {
let scrub_wrappers =
self.should_scrub_compiler_wrappers() && self.is_easybuild_program(program);
let mut tokens = self.easybuild_workload_prefix(scrub_wrappers);
if let Some(tree) = self.installed_module_tree() {
tokens.extend([
"sh".into(),
"-c".into(),
PREPEND_MODULE_TREE.into(),
"sh".into(),
tree,
]);
}
tokens.push(program.to_string());
tokens.extend(args.iter().cloned());
self.route_tokens(self.runtime_tokens(tokens), true)
}

/// Where EasyBuild writes module files for `EASYBUILD_INSTALLPATH`.
///
/// `EASYBUILD_INSTALLPATH_MODULES` replaces `<installpath>/<subdir>`, as
/// in EasyBuild's own `install_path('mod')`.
fn installed_module_tree(&self) -> Option<String> {
let environment = &self.easybuild.environment;
let installpath = environment.get("EASYBUILD_INSTALLPATH")?;
let base = match environment.get("EASYBUILD_INSTALLPATH_MODULES") {
Some(modules) => modules.clone(),
None => {
let subdir = environment
.get("EASYBUILD_SUBDIR_MODULES")
.map_or("modules", String::as_str);
format!("{installpath}/{subdir}")
}
};
let suffix = environment
.get("EASYBUILD_SUFFIX_MODULES_PATH")
.map_or("all", String::as_str);
Some(format!("{base}/{suffix}"))
}

/// `env` prefix shared by builds, verification, and the doctor EasyBuild probe.
fn easybuild_workload_prefix(&self, scrub_wrappers: bool) -> Vec<String> {
let mut tokens = vec!["env".to_string()];
Expand Down Expand Up @@ -943,6 +976,19 @@ fn is_compiler_wrapper_env(name: &str) -> bool {
|| (name.starts_with("CMAKE_") && name.ends_with("_COMPILER_LAUNCHER"))
}

/// Puts `$1` first on `MODULEPATH` and on `EESSI_EXTRA_MODULEPATH`, then
/// execs the remaining arguments.
///
/// It runs on the target, so both values extend the ones there. The EESSI
/// init replaces `MODULEPATH` and keeps `EESSI_EXTRA_MODULEPATH`, after the
/// EESSI module trees.
const PREPEND_MODULE_TREE: &str = r#"tree=$1
shift
MODULEPATH="$tree${MODULEPATH:+:$MODULEPATH}"
EESSI_EXTRA_MODULEPATH="$tree${EESSI_EXTRA_MODULEPATH:+:$EESSI_EXTRA_MODULEPATH}"
export MODULEPATH EESSI_EXTRA_MODULEPATH
exec "$@""#;

#[derive(Debug, Error)]
/// Why a target could not be configured or reached.
pub enum TargetError {
Expand Down
61 changes: 61 additions & 0 deletions tests/campaign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,3 +1600,64 @@ fn two_identical_signatures_are_stuck() {
state.findings.push(finding(2));
assert!(is_stuck_on_signature(&state, &signature));
}

/// Each attempt installs into its own prefix, so `module load {module}`
/// finds the build only through that prefix's module tree. The EESSI init
/// replaces `MODULEPATH` and keeps only `EESSI_EXTRA_MODULEPATH`.
#[test]
fn a_verification_command_loads_the_module_the_attempt_installed() {
let temp = tempfile::tempdir().expect("tempdir");
let bundle = temp.path().join("bundle");
let recipes = bundle.join("easyconfigs/e/eOn");
std::fs::create_dir_all(&recipes).expect("recipes");
std::fs::create_dir_all(bundle.join("locks")).expect("locks");
let module_load = r#"IFS=:; for tree in $MODULEPATH; do [ -f "$tree/{module}.lua" ] && exit 0; done; echo "The following module(s) are unknown: {module}" >&2; exit 1"#;
let eessi_init =
"MODULEPATH=/cvmfs/software.eessi.io/init/modules${EESSI_EXTRA_MODULEPATH:+:$EESSI_EXTRA_MODULEPATH}";
let manifest = serde_json::json!({
"package": {"name": "eOn", "version": "2.16.0"},
"build": {"toolchain": {"name": "foss", "version": "2026.1"}},
"profiles": [{
"name": "default",
"default": true,
"versionsuffix": [],
"verification_commands": [
{"program": "sh", "args": ["-c", module_load]},
{"program": "sh", "args": ["-c", format!("{eessi_init}; {module_load}")]},
],
}],
});
std::fs::write(
bundle.join("package.plan.json"),
serde_json::to_string(&manifest).expect("manifest JSON"),
)
.expect("manifest");
std::fs::write(
bundle.join("locks/default.lock.json"),
r#"{"profile":"default","solver":"resolvo"}"#,
)
.expect("lock");
write_valid_recipe(&recipes.join("eOn.eb"), "eOn", "2.16.0");
let eb = temp.path().join("fake-eb");
write_executable(
&eb,
"#!/bin/sh\nfor arg do\n case $arg in --installpath=*) prefix=${arg#--installpath=} ;; esac\ndone\nmkdir -p \"$prefix/modules/all/eOn\"\necho 'whatis(\"eOn\")' > \"$prefix/modules/all/eOn/2.16.0-foss-2026.1.lua\"\n",
)
.expect("fake eb");
let mut builder = target(eb.to_str().expect("eb path"));
builder.easybuild.work_root = temp.path().join("work").display().to_string();

let state = run_campaign(&CampaignRequest {
bundle,
target: builder,
state_path: temp.path().join("campaign.json"),
})
.expect("campaign");
assert_eq!(
state.status,
CampaignStatus::Completed,
"{:#?}",
state.findings
);
assert!(state.claims.binary_verified);
}
61 changes: 61 additions & 0 deletions tests/target_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,67 @@ fn verification_command_sets_tmpdir_and_workload_environment() {
assert_eq!(plan.args.get(module + 1).map(String::as_str), Some("load"));
}

#[test]
fn verification_command_puts_the_installed_module_tree_first() {
let paths = |environment: &[(&str, &str)]| {
let target = BuildTarget {
name: "local".into(),
transport: TargetTransport::Local,
executor: TargetExecutor::Direct,
runtime: TargetRuntime::Host,
easybuild: EasyBuildWorkload {
command: "eb".into(),
robot_paths: Vec::new(),
work_root: "/work".into(),
tmp_root: "/tmp".into(),
environment: environment
.iter()
.map(|(name, value)| (name.to_string(), value.to_string()))
.collect(),
},
};
let plan = target.verification_command(
"sh",
&[
"-c".into(),
r#"printf '%s\n' "$MODULEPATH" "$EESSI_EXTRA_MODULEPATH""#.into(),
],
);
let output = plan.execute().expect("verification command");
assert!(output.status.success(), "{plan:?}");
String::from_utf8(output.stdout).expect("utf-8")
};
let site = [
("MODULEPATH", "/site/modules"),
("EESSI_EXTRA_MODULEPATH", "/site/extra"),
];
let with = |extra: &[(&'static str, &'static str)]| {
let mut environment = site.to_vec();
environment.extend_from_slice(extra);
paths(&environment)
};
assert_eq!(
with(&[("EASYBUILD_INSTALLPATH", "/work/attempt-1")]),
"/work/attempt-1/modules/all:/site/modules\n/work/attempt-1/modules/all:/site/extra\n"
);
assert_eq!(
with(&[
("EASYBUILD_INSTALLPATH", "/work/attempt-1"),
("EASYBUILD_SUBDIR_MODULES", "mods"),
("EASYBUILD_SUFFIX_MODULES_PATH", "collection"),
]),
"/work/attempt-1/mods/collection:/site/modules\n/work/attempt-1/mods/collection:/site/extra\n"
);
assert_eq!(
with(&[
("EASYBUILD_INSTALLPATH", "/work/attempt-1"),
("EASYBUILD_INSTALLPATH_MODULES", "/work/modules"),
]),
"/work/modules/all:/site/modules\n/work/modules/all:/site/extra\n"
);
assert_eq!(with(&[]), "/site/modules\n/site/extra\n");
}

#[test]
fn doctor_easybuild_probe_sets_tmpdir_and_workload_environment() {
let mut environment = BTreeMap::new();
Expand Down
Loading