mod robot_lookup¶
- module robot_lookup¶
EasyBuild 5.4.2’s robot lookup, for planning over the robot path a build will run with.
A dependency is found by
robot_find_easyconfig(name, version)(easybuild/framework/easyconfig/easyconfig.py), withversionthe full versiondet_full_ec_versiongives:versionprefix, the version, then -<toolchain name>-<toolchain version>` unless the toolchain issystem`, then ``versionsuffix. For each robot path in order it tries the four pathscreate_pathsgives, in this order, and takes the first file that exists:<root>/<name>/<version>.eb
<root>/<name>/<name>-<version>.eb
<root>/<letter_dir_for(name)>/<name>/<name>-<version>.eb
<root>/<name>-<version>.eb
The robot then checks the file it found (
verify_easyconfig_filename): its name must be <name>-<version>.eb and its content must give that name and full version. A file that fails is not skipped for a later layout or root; EasyBuild stops with an error. So a <root>/<name>/<version>.eb file is found and always refused, and it hides every later file of that name and version.With
consider_archived_easyconfigsthe paths <root>/__archive__ of every root are searched after all the roots, the same way. Any other file under a root, however deep and whatever its content, is never a dependency’s easyconfig. The path index EasyBuild keeps per root only records which files exist; it adds no candidates.An easyconfig a build list names by file is found by
locate_files(easybuild/tools/filetools.py): the first robot path whose file index has a file of that name, searched recursively with the directories inignore_dirs(and__archive__, unless archived easyconfigs are considered) left out. The index is a Python set, so two files of that name under one root leave the choice to set order; that case is refused here instead of guessed.Variables
- const ARCHIVE_DIR: &str¶
The directory archived easyconfigs live in under a robot path.
- const DEFAULT_IGNORE_DIRS: &[&str]¶
EasyBuild’s default
ignore_dirs.
Functions
- fn candidate_full_version(candidate: &Candidate, _text: &str) -> Result<String, String>¶
The full version of a parsed candidate, as EasyBuild’s robot looks it up. Uses
Candidate::versionprefix(parsed once at the easyconfig boundary); does not re-read the file._textis retained so existing call sites keep compiling; it is not consulted. A part that still holds a%(...)stemplate is an error: the file name cannot be told.
- fn candidate_paths(root: &Path, name: &str, full_version: &str) -> [PathBuf; 4]¶
The four paths
create_pathstries underroot, in EasyBuild’s order.
- fn full_version(version: &str, toolchain: &Toolchain, versionprefix: &str, versionsuffix: &str) -> String¶
det_full_ec_version:versionprefix,version, the toolchain unless it issystem, thenversionsuffix. EasyBuild 5 treats onlysystemas the system toolchain.
- fn is_module_system_toolchain(toolchain: &Toolchain) -> bool¶
EasyBuild 5.4.2
is_system_toolchain: only the exact namesystem(seeSYSTEM_TOOLCHAIN_NAME).dummy,System, andSYSTEMare not. Hierarchy matching may still treatdummyas an alias ofsystemfor old robot trees; module naming and robot full versions do not.
- fn letter_dir_for(name: &str) -> String¶
EasyBuild’s
letter_dir_for: the lowercased first character, or0when that is outsidea-z.
- fn versionprefix_of(text: &str) -> Result<String, String>¶
The
versionprefixan easyconfig sets, from its text:""when it sets none. Only a plain string literal is understood; any other top-level assignment is an error, because the full version cannot be told.
Enums
- enum ArchivedEasyconfigs¶
Whether the robot also searches <root>/__archive__ (
--consider-archived-easyconfigs).- Ignored¶
EasyBuild’s default: archived easyconfigs are not searched.
- Considered¶
<root>/__archive__ of every root is searched after all the roots.
- enum Resolution¶
What EasyBuild’s robot does for one dependency.
- Found(PathBuf)¶
The robot uses this file.
- Missing¶
No candidate path exists: the dependency is missing.
Structs and Unions
- struct EffectiveCandidates¶
Which files of a parsed robot tree EasyBuild’s robot would use.
- kept: Vec<Candidate>¶
The candidates the robot finds for their own name and full version, highest precedence first: by search root, then by
create_pathsorder.
- unreachable: Vec<String>¶
Paths of candidates the robot never reads: another file wins for their name and full version, or no lookup reaches them.
- undecidable: Vec<(String, String)>¶
Paths whose full version cannot be told, with the reason.
- refused: Vec<(String, String)>¶
Paths the robot finds for their own name and full version and then refuses, with the reason: their name and version are not usable.
- struct RobotPath¶
A robot path: its roots in EasyBuild’s order, first searched first, and whether archived easyconfigs are searched.
Implementations
- impl RobotPath¶
Functions
- fn effective(&self, candidates: Vec<Candidate>, _read: impl Fn(&Path) -> Option<String>) -> EffectiveCandidates¶
The candidates of a parsed tree EasyBuild’s robot would use: each candidate whose own name and full version lead
Self::findto its own file. Full versions come from candidate fields (no text re-read).readis retained for call-site compatibility and is unused.
- fn find(&self, name: &str, full_version: &str) -> Option<PathBuf>¶
Self::find_withon the file system.
- fn find_with(&self, name: &str, full_version: &str, exists: impl Fn(&Path) -> bool) -> Option<(usize, PathBuf)>¶
robot_find_easyconfig(name, full_version)withexiststelling which files exist: the first candidate path, overSelf::search_roots, that does. Returns the path and its index insearch_roots.
- fn locate_named(&self, file_name: &str, ignore_dirs: &[&str]) -> Result<Option<PathBuf>, String>¶
locate_filesfor one file name: the file of that name under the first root whose tree has one, leaving outignore_dirsand, unless archived easyconfigs are considered,__archive__. Two files of that name under the first root that has any is an error.
- fn new(roots: Vec<PathBuf>, archived: ArchivedEasyconfigs) -> Self¶
The robot path
roots, first searched first.
- fn require_directories(&self) -> Result<(), String>¶
A root that is not a directory, which EasyBuild would skip without a word; planning over it cannot match the build.
- fn resolve(&self, name: &str, full_version: &str, identity: impl Fn(&Path) -> Result<(String, String), String>) -> Resolution¶
The robot’s answer for a dependency:
Self::find, then the file check.identitygives the name and full version a file’s content states, or why that cannot be told.
- fn roots(&self) -> &[PathBuf]¶
The roots, first searched first.
- fn search_roots(&self) -> Vec<PathBuf>¶
Every root a dependency lookup searches, in order: the roots, then <root>/__archive__ of each when archived easyconfigs are considered.