compose_local_cache_key

Function compose_local_cache_key 

Source
pub fn compose_local_cache_key(
    arch: &str,
    short_hash: &Option<String>,
    canonical: &Path,
    user_config_hash: Option<&str>,
) -> String
Expand description

Compose the cache key for a local source given its arch, optional HEAD short hash, canonical source path, and optional user .config hash.

Three shapes:

  • local-{hash7}-{arch}-kc{suffix} — clean git tree, no user .config (plain make defconfig path or no config file yet)
  • local-{hash7}-{arch}-cfg{user_config}-kc{suffix} — clean git tree with a user .config whose hash differs from defconfig
  • local-unknown-{path_hash}-{arch}-kc{suffix} — dirty / non-git tree (HEAD does not describe the source; the path-derived crc32 salt keeps two distinct dirty trees from colliding on the same local-unknown-... slot)

path_hash is the full 8-char (32-bit) lowercase-hex CRC32 of the canonical source-path bytes. CRC32 keeps the per-path disambiguator stable across runs without pulling in a crypto-grade hash for what is fundamentally a slot disambiguator.

user_config_hash is None whenever the source tree has no .config file yet (the build will run make defconfig and produce one). This collapses the user-config branch back into the hash-only key so a fresh checkout’s first build still hits a later cache lookup keyed without the cfg segment.