mod easyblock_skeleton

module easyblock_skeleton

When a package owes an easyblock, and what a first draft of one looks like.

A package with variant options, a binary name that follows them, or hand-written test and sanity parameters carries logic that an easyconfig can only repeat as data, once per profile. That logic belongs in a software-specific easyblock, and the easyconfigs then lean on it.

owed_easyblock decides whether a plan owes one. render turns a plan into the Python module a human then completes, and apply_takeover removes from the plan what the module now owns, so the emitted recipes carry no variant flag the easyblock sets itself.

Functions

fn apply_takeover(plan: &mut PackagePlan)

Remove from the plan what the rendered easyblock owns.

Every option the class sets from a feature leaves the build-level and the profile config_options, so the emitted recipes carry no -D flag the easyblock passes itself. Each non-default profile gains one boolean easyconfig parameter per feature that drives the class and differs from the default profile, which is how a recipe selects its variant.

fn derived_class(plan: &PackagePlan) -> String

The class EasyBuild derives from the software name.

fn has_generic_easyblock(plan: &PackagePlan) -> bool

Whether the recipe resolves to a generic easyblock.

The plan names no easyblock or one other than the derived class, and no shipped module defines the derived class.

fn module_filename(plan: &PackagePlan) -> String

File name of the module that holds the derived class, e.g. wrf.py.

fn owed_easyblock(plan: &PackagePlan) -> Option<OwedEasyblock>

What a generic-easyblock plan owes, or None when no trigger applies.

Three triggers, any one of which suffices:

  1. two or more profiles whose config_options differ from each other;

  2. test or sanity parameters written into the easyconfig, namely sanity_check_paths, sanity_check_commands, test_cmd, testopts, pretestopts, or runtest as a string command;

  3. a binary named in the sanity files or commands that differs between profiles.

fn render(plan: &PackagePlan) -> Result<String, String>

Render an easyblock skeleton from the plan.

The module derives the class EasyBuild looks up for the software name from the plan’s generic easyblock (CMakeMake when the plan names none). It carries one CUSTOM parameter per feature, a configure_step that maps each feature to the options the profiles set with it, a test_step, a sanity_check_step with variant binary names templated on the feature that flips them, and make_module_extra. It is a starting point that a human completes.

The text is parsed back with defined_classes and checked for line length and trailing whitespace before it is returned.

fn ships_class(plan: &PackagePlan, class: &str) -> bool

Whether a shipped module defines class.

Uses the classes recorded on the artifact when the plan has been checked, and parses the module from disk otherwise.

Structs and Unions

struct OwedEasyblock

Why a plan owes a software-specific easyblock.

class_name: String

Class EasyBuild derives from the software name, e.g. EB_WRF for WRF.

variant_options: Vec<String>

Build-option differences between profiles, each naming the option and the profiles that carry it.

parameters: Vec<String>

Hand-written test and sanity parameters, each naming the parameter and the scope that sets it.

binaries: Vec<String>

Binary names that differ between profiles, each naming the profile.

Implementations

impl OwedEasyblock

Functions

fn evidence(&self) -> String

The profiles and parameters that would move into the class, one line per trigger.