MCPcopy Create free account
hub / github.com/bootc-dev/bootc / check_baseimage_root_norecurse

Function check_baseimage_root_norecurse

crates/lib/src/lints.rs:596–619  ·  view source on GitHub ↗

Check for a few files and directories we expect in the base image.

(dir: &Dir, _config: &LintExecutionConfig)

Source from the content-addressed store, hash-verified

594
595/// Check for a few files and directories we expect in the base image.
596fn check_baseimage_root_norecurse(dir: &Dir, _config: &LintExecutionConfig) -> LintResult {
597 // Check /sysroot
598 let meta = dir.symlink_metadata_optional("sysroot")?;
599 match meta {
600 Some(meta) if !meta.is_dir() => return lint_err("Expected a directory for /sysroot"),
601 None => return lint_err("Missing /sysroot"),
602 _ => {}
603 }
604
605 // Check /ostree -> sysroot/ostree
606 let Some(meta) = dir.symlink_metadata_optional("ostree")? else {
607 return lint_err("Missing ostree -> sysroot/ostree link");
608 };
609 if !meta.is_symlink() {
610 return lint_err("/ostree should be a symlink");
611 }
612 let link = dir.read_link_contents("ostree")?;
613 let expected = "sysroot/ostree";
614 if link.as_os_str().as_bytes() != expected.as_bytes() {
615 return lint_err(format!("Expected /ostree -> {expected}, not {link:?}"));
616 }
617
618 lint_ok()
619}
620
621/// Check ostree-related base image content.
622#[distributed_slice(LINTS)]

Callers 1

check_baseimage_rootFunction · 0.85

Calls 2

lint_errFunction · 0.85
lint_okFunction · 0.85

Tested by

no test coverage detected