default to Eapi 0 if no eapi file exists
All checks were successful
Gentoo Utils / build-oci-image (pull_request) Successful in 9s
Gentoo Utils / build (pull_request) Successful in 36s

This commit is contained in:
2025-12-11 23:50:12 +00:00
parent 71e413b986
commit 90feca00b6

View File

@@ -64,7 +64,7 @@ pub enum Error {
pub struct Profile {
#[get(kind = "deref")]
path: PathBuf,
eapi: Option<Eapi>,
eapi: Eapi,
deprecated: Option<String>,
#[get(kind = "deref")]
parents: Vec<Profile>,
@@ -108,9 +108,9 @@ impl Profile {
let eapi = match fs::read_to_string(&eapi_path)
.map(|s| Eapi::parse(s.trim()).map_err(str::to_string))
{
Ok(Ok(eapi)) => Some(eapi),
Ok(Ok(eapi)) => eapi,
Ok(Err(rest)) => return Err(Error::Parser(rest)),
Err(e) if matches!(e.kind(), io::ErrorKind::NotFound) => None,
Err(e) if matches!(e.kind(), io::ErrorKind::NotFound) => Eapi::parse("0").unwrap(),
Err(e) => return Err(Error::Io(eapi_path, e)),
};