#[non_exhaustive]pub enum KernelSource {
Tarball,
Git {
git_hash: Option<String>,
git_ref: Option<String>,
},
Local {
source_tree_path: Option<PathBuf>,
git_hash: Option<String>,
},
}Expand description
How a cached kernel’s source was acquired, with per-variant
payload (git details for Git, source-tree path and git hash for
Local).
Serialized as {"type": "tarball"}, {"type": "git", "git_hash": ..., "ref": ...},
or {"type": "local", "source_tree_path": ..., "git_hash": ...}.
Every per-variant payload field is emitted explicitly — Option
fields serialize as null when None rather than being skipped,
so JSON consumers see stable keys across every variant regardless
of which optional payload values are set.
On deserialize, serde_json treats absent Option keys as None,
so an old metadata.json that drops git_hash, ref, or
source_tree_path still round-trips. Cache-integrity enforcement
(truncated metadata.json surfacing as ListedEntry::Corrupt
via crate::cache::CacheDir::list) rides on the required
non-Option fields of KernelMetadata, not on the optional
payloads here.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Tarball
Downloaded tarball from kernel.org (version / prefix / EOL probe paths).
Git
Shallow clone of a git URL at a caller-specified ref.
Fields
Local
Build of a local on-disk kernel source tree.
Fields
source_tree_path: Option<PathBuf>Path to the source tree on disk. None when the tree has
been sanitized for remote cache transport or is otherwise
unavailable.
git_hash: Option<String>Git commit hash of the source tree at build time (short
form). None when the tree is not a git repository, the
hash could not be read, or the worktree is dirty — a
HEAD hash does not describe a tree with uncommitted
changes, so identifying it by that hash would mislead a
reproducer.
Implementations§
Source§impl KernelSource
impl KernelSource
Sourcepub fn as_local_git_hash(&self) -> Option<&str>
pub fn as_local_git_hash(&self) -> Option<&str>
Borrow the git_hash field on a KernelSource::Local
variant. Returns None for any other variant or when the
Local variant carries git_hash: None (dirty / non-git
tree at acquire time).
Mainly used by crate::cli::kernel_build_pipeline’s
post-build dirty re-check, which compares the post-build
HEAD hash against the acquire-time hash to detect mid-build
commits or branch flips. Borrows rather than clones so the
caller does not pay an allocation when only comparing.
Trait Implementations§
Source§impl Clone for KernelSource
impl Clone for KernelSource
Source§fn clone(&self) -> KernelSource
fn clone(&self) -> KernelSource
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KernelSource
impl Debug for KernelSource
Source§impl<'de> Deserialize<'de> for KernelSource
impl<'de> Deserialize<'de> for KernelSource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for KernelSource
impl Display for KernelSource
Source§impl PartialEq for KernelSource
impl PartialEq for KernelSource
Source§impl Serialize for KernelSource
impl Serialize for KernelSource
impl Eq for KernelSource
impl StructuralPartialEq for KernelSource
Auto Trait Implementations§
impl Freeze for KernelSource
impl RefUnwindSafe for KernelSource
impl Send for KernelSource
impl Sync for KernelSource
impl Unpin for KernelSource
impl UnwindSafe for KernelSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more