eb-local.recipe_overlay

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

Declarative site overlays for upstream easyconfigs: parameter replacements, patch additions, dependency variants, keyed by the base file digest.

Types

pub const Parameter = struct[source][autodoc]

One parameter assignment to add to or replace in the upstream easyconfig.

action: []const u8 = "replace"[source]
name: []const u8[source]
value: []const u8[source]
pub const Patch = struct[source][autodoc]

One patch tuple to append to patches.

name: []const u8[source]
file: []const u8[source]
pub const Dependency = struct[source][autodoc]

One dependency variant to add or replace.

action: []const u8[source]
name: []const u8[source]
spec: []const u8[source]
pub const Spec = struct[source][autodoc]

A parsed overlay description; only the fields the format allows.

overlay_version: i64 = 1[source]
base_easyconfig: []const u8 = ""[source]
base_digest: []const u8 = ""[source]
rationale: []const u8 = ""[source]
parameters: []const Parameter = &.{}[source]
patches: []const Patch = &.{}[source]
dependencies: []const Dependency = &.{}[source]
pub const Diagnostic = struct[source][autodoc]

Where an overlay file or materialization was refused.

line: usize = 0[source]
message: []const u8 = ""[source]
pub const MaterializeOptions = struct[source][autodoc]

Paths for overlay materialize.

overlay_path: []const u8 = ""[source]
base_path: []const u8 = ""[source]
out_dir: []const u8 = ""[source]
dry_run: bool = false[source]
check: bool = false[source]

Error sets

pub const Error = error{...}[source][autodoc]

Refusal reasons while parsing or materializing an overlay.

error.Invalid
error.DigestMismatch
error.OutOfMemory

Functions

pub fn parseSpec(a: Allocator, text: []const u8, d: *Diagnostic) Error!Spec[source][autodoc]

Read overlay TOML from text. Tables [add], [replace], [patches], [dependencies.add] and [dependencies.replace] hold the edits.

pub fn sha256Hex(a: Allocator, data: []const u8) ![]const u8[source][autodoc]

SHA-256 of data as lowercase hex, for digests in overlay files.

pub fn materialize(a: Allocator, base_text: []const u8, spec: Spec, d: *Diagnostic) Error![]u8[source][autodoc]

Apply spec to base_text. Refuses when the digest of base_text differs from spec.base_digest.

pub fn runMaterialize(io: std.Io, a: Allocator, opts: MaterializeOptions) u8[source][autodoc]

Read overlay and base files, verify the digest, and write, preview, or check the outputs.