class

Bootstrap::SysrootBuildState

Inherits JSON::Serializable < Reference < Object

Persistent, human-readable state for in-container sysroot/rootfs iterations.

The build plan JSON is treated as immutable during iterations. Instead, the runner records progress into this state file so subsequent runs can pick up where they left off without re-running already successful steps.

Constants

FORMAT_VERSION = 1
OVERRIDES_FILE = "sysroot-build-overrides.json"
PLAN_FILE = "sysroot-build-plan.json"
REPORT_DIR_NAME = "sysroot-build-reports"
STATE_FILE = "sysroot-build-state.json"

Constructors

new(workspace : SysrootWorkspace = SysrootWorkspace.new, rootfs_id : String = Random::Secure.hex(8), created_at : String = Time.utc.to_s, updated_at : String | Nil = nil, plan_digest : String | Nil = nil, overrides_digest : String | Nil = nil, invalidated_at : String | Nil = nil, invalidation_reason : String | Nil = nil, progress : Progress = Progress.new, format_version : Int32 = FORMAT_VERSION, ignore_overrides : Bool = false, invalidate_on_overrides : Bool = false)

Initialize the build state, loading any persisted state from disk.

Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Class methods

digest_for?(path : Path) : String | Nil

Return the SHA256 hex digest for path, or nil when the file is missing.

Source

Instance methods

completed?(phase_name : String, step_name : String) : Bool

Returns true when the given step_name has already completed successfully within phase_name.

Source
created_at

Timestamp for when this state file was initially created (UTC, ISO8601).

Source
filtered_phases(by_name : String = "all", by_state : Bool = false, by_namespace : SysrootWorkspace | Nil = nil, by_packages : Array(String) = [] of String) : Array(BuildPhase)
Source
format_version

Schema version for forward-compatible upgrades.

Source
invalidate_progress!(reason : String) : Nil

Clear completed steps and record a reason for invalidation.

Source
invalidated_at

Timestamp (UTC, ISO8601) for the most recent state invalidation.

Source
invalidated_at=(invalidated_at : String | Nil)

Timestamp (UTC, ISO8601) for the most recent state invalidation.

Source
invalidation_reason

Human-readable reason for invalidating runner progress.

Source
invalidation_reason=(invalidation_reason : String | Nil)

Human-readable reason for invalidating runner progress.

Source
mark_current_phase(phase_name : String | Nil) : Nil

Update the current phase tracking marker.

Source
mark_failure(phase_name : String, step_name : String, error : String | Nil, report_path : String | Nil) : Nil

Record that step_name failed within phase_name.

Source
mark_success(phase_name : String, step_name : String) : Nil

Record that step_name finished successfully within phase_name.

Source
next_incomplete_step

Return the next incomplete phase/step for the plan.

Source
on_disk_overrides

Load overrides JSON from the workspace, or nil when missing.

Source
on_disk_overrides_digest

Return the digest for the on-disk overrides file, if present.

Source
on_disk_plan

Load the build plan JSON from the workspace, or nil when missing.

Source
on_disk_plan_digest

Return the digest for the on-disk build plan, if present.

Source
on_disk_state

Load persisted state from the workspace, or nil when missing.

Source
overrides
Source
overrides=(overrides : BuildPlanOverrides | Nil)
Source
overrides_changed

true when the overrides digest changed since the last load.

Source
overrides_changed=(overrides_changed : Bool)

true when the overrides digest changed since the last load.

Source
overrides_digest

SHA256 digest (hex) of the overrides file used to produce this state.

Source
overrides_digest=(overrides_digest : String | Nil)

SHA256 digest (hex) of the overrides file used to produce this state.

Source
overrides_exists?

Returns true when the overrides file exists for this workspace.

Source
overrides_path

Resolve overrides path into the active namespace.

Source
plan
Source
plan=(plan : BuildPlan)
Source
plan_digest

SHA256 digest (hex) of the build plan file used to produce this state.

Source
plan_digest=(plan_digest : String | Nil)

SHA256 digest (hex) of the build plan file used to produce this state.

Source
plan_exists?

Returns true when the build plan file exists for this workspace.

Source
plan_path

Resolve the plan path into the active namespace.

Source
progress

Runner progress tracked per phase/package.

Source
report_dir

Resolve report directory path into the active namespace.

Source
resolve_plan(plan : BuildPlan, use_overrides : Bool = true) : BuildPlan

Apply overrides to plan and return the resolved plan.

Source
rootfs_id

Identifier for the prepared rootfs. This changes whenever the rootfs is regenerated from scratch.

Source
save(path : Path = state_path)

Persist the state JSON to disk.

Source
save_overrides

Persist overrides to disk and refresh their digest.

Source
save_plan

Persist the current build plan to the workspace and refresh its digest.

Source
state_exists?

Returns true when the build state file exists for this workspace.

Source
state_path

Current rootfs-relative state path

Source
touch

Update updated_at to the current UTC time.

Source
updated_at

Timestamp for the most recent update (UTC, ISO8601).

Source
updated_at=(updated_at : String | Nil)

Timestamp for the most recent update (UTC, ISO8601).

Source
workspace

Active workspace for this build state.

Source
workspace=(workspace : SysrootWorkspace) : SysrootWorkspace
Source

Nested types