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), with version the full version det_full_ec_version gives: versionprefix, the version, then -<toolchain name>-<toolchain version>` unless the toolchain is system`, then ``versionsuffix. For each robot path in order it tries the four paths create_paths gives, in this order, and takes the first file that exists:

  1. <root>/<name>/<version>.eb

  2. <root>/<name>/<name>-<version>.eb

  3. <root>/<letter_dir_for(name)>/<name>/<name>-<version>.eb

  4. <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_easyconfigs the 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 in ignore_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. _text is retained so existing call sites keep compiling; it is not consulted. A part that still holds a %(...)s template 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_paths tries under root, 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 is system, then versionsuffix. EasyBuild 5 treats only system as the system toolchain.

fn is_module_system_toolchain(toolchain: &Toolchain) -> bool

EasyBuild 5.4.2 is_system_toolchain: only the exact name system (see SYSTEM_TOOLCHAIN_NAME). dummy, System, and SYSTEM are not. Hierarchy matching may still treat dummy as an alias of system for 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, or 0 when that is outside a-z.

fn versionprefix_of(text: &str) -> Result<String, String>

The versionprefix an 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.

Refused

The robot finds this file and then stops with an error, because its name or content is not the name and full version it looked for.

path: PathBuf

The file found.

reason: String

What verify_easyconfig_filename would say.

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_paths order.

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::find to its own file. Full versions come from candidate fields (no text re-read). read is retained for call-site compatibility and is unused.

fn find(&self, name: &str, full_version: &str) -> Option<PathBuf>

Self::find_with on 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) with exists telling which files exist: the first candidate path, over Self::search_roots, that does. Returns the path and its index in search_roots.

fn locate_named(&self, file_name: &str, ignore_dirs: &[&str]) -> Result<Option<PathBuf>, String>

locate_files for one file name: the file of that name under the first root whose tree has one, leaving out ignore_dirs and, 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. identity gives 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.