mod input_hash

module input_hash

What a module was built from, as one hash over its whole input closure.

A version number says what a recipe is called, not what it was built from. Two stacks can name the same versions and still differ, because a patch changed, or a dependency two levels down moved. Functional deployment answers this by identifying a build with a hash over its inputs rather than with its version, so an identical hash means an identical build (doi:10.1017/s0956796810000195), and it is the same property the reproducible-builds work measures across a distribution (doi:10.1109/ms.2021.3073045, doi:10.1109/msr66628.2025.00115).

The hash here is over the easyconfig’s own bytes and the hashes of everything it needs. Recipe bytes are the honest input because everything a build depends on that is not a dependency is stated in that file: sources, checksums, patches, configure options, the toolchain line. Change any of them and the hash changes. Change a dependency and every dependent’s hash changes with it, which is what makes the answer transitive rather than local.

What this is for: saying whether two plans are the same plan, and which modules a change actually forces a rebuild of.

Functions

fn changed(before: &BTreeMap<ModuleKey, InputHash>, after: &BTreeMap<ModuleKey, InputHash>) -> Vec<ModuleKey>

What changed between two sets of input hashes, and therefore what has to be rebuilt.

A module is listed when its own hash differs, which by construction covers everything downstream of a change as well.

fn input_hashes(graph: &BuildGraph, order: &[ModuleKey], recipe_paths: &BTreeMap<ModuleKey, String>) -> BTreeMap<ModuleKey, InputHash>

Input hashes for every module in a build graph.

The graph must be acyclic, which is what crate::build_order::build_order has already established by the time it hands one over; order supplies the topological sequence so a module is hashed after everything it needs.

Structs and Unions

struct InputHash

The input hash of one module, and what went into it.

hash: String

Hex sha256 over the whole input closure.

recipe: Option<String>

Hex sha256 of the easyconfig file, or None when it could not be read.

complete: bool

Whether every input was known. A recipe that could not be read leaves the hash defined but not trustworthy, and saying so is the difference between a plan that can be compared and one that only looks like it.