eb-local.lmodcache

module eb-local.lmodcache  src/lmodcache.zig[source][autodoc]

eb-local lmod-cache: write the spider cache Lmod trusts.

Lmod treats a timestamp newer than spiderT.lua as a stale cache and then ignores the modules that file names. The cache is written only after spider succeeds, and the timestamp is then set one second older than the cache file.

Types

pub const Target = struct[source][autodoc]

One CPU target tree to refresh when walking --prefix.

archdir: []const u8[source]
modulepath: []const u8[source]
cache_dir: []const u8[source]
timestamp: []const u8[source]
pub const Options = struct[source][autodoc]

Names the directories, cache paths and spider command for lmod-cache.

modulepath: []const u8 = ""[source]
cache_dir: []const u8 = ""[source]
timestamp: []const u8 = ""[source]
spider: []const u8 = ""[source]

Empty means the program spider on PATH.

prefix: []const u8 = ""[source]

Walk software/…/<cpu>/modules/all when set (absolute).

eessi_version: []const u8 = ""[source]

When set with --prefix, only versions/<VER>/software.

update_cmd: []const u8 = ""[source]

Path to Lmod’s update_lmod_system_cache_files; resolved from prefix when empty.

dry_run: bool = false[source]
verify: bool = false[source]

Functions

pub fn moduleDirs(a: std.mem.Allocator, spec: []const u8) ![]const []const u8[source][autodoc]

Directories in a colon-separated module path, empty segments dropped.

pub fn spiderArgv(a: std.mem.Allocator, spider: []const u8, dirs: []const []const u8) ![]const []const u8[source][autodoc]

spider -o spiderT and one argument per module directory.

pub fn olderThan(cache: std.Io.Timestamp) std.Io.Timestamp[source][autodoc]

One second before the cache file, which is what makes Lmod trust it.

pub fn modulepathForArch(a: std.mem.Allocator, archdir: []const u8, accel_alls: []const []const u8) ![]const u8[source][autodoc]

Colon-separated paths for archdir, with accelerator trees prepended like EESSI’s script.

pub fn discoverTargets(a: std.mem.Allocator, opts: Options) ![]Target[source][autodoc]

Discover CPU targets under prefix, matching EESSI’s update_lmod_caches.sh layout.

pub fn runUpdate(io: std.Io, a: std.mem.Allocator, update_cmd: []const u8, target: Target) u8[source][autodoc]

Run Lmod’s update_lmod_system_cache_files for one target.

pub fn run(io: std.Io, a: std.mem.Allocator, env: *const std.process.Environ.Map, opts: Options) u8[source][autodoc]

Write cache_dir/spiderT.lua from spider’s stdout, then the timestamp. A spider that cannot start, exits non-zero, or writes nothing leaves both files as they were. Returns the process exit status.