WIP: impl profile evaluation #7
@@ -52,6 +52,7 @@ pub struct Profile {
|
||||
#[get(kind = "deref")]
|
||||
path: PathBuf,
|
||||
eapi: Option<Eapi>,
|
||||
deprecated: Option<String>,
|
||||
#[get(kind = "deref")]
|
||||
parents: Vec<Profile>,
|
||||
make_defaults: HashMap<String, String>,
|
||||
@@ -100,6 +101,13 @@ impl Profile {
|
||||
Err(e) => return Err(Error::Io(eapi_path, e)),
|
||||
};
|
||||
|
||||
let deprecated_path = path.as_ref().join("deprecated");
|
||||
let deprecated = match fs::read_to_string(&deprecated_path) {
|
||||
Ok(string) => Some(string),
|
||||
Err(e) if matches!(e.kind(), io::ErrorKind::NotFound) => None,
|
||||
Err(e) => return Err(Error::Io(deprecated_path, e)),
|
||||
};
|
||||
|
||||
let make_defaults = make_defaults::evaluate(&parents, &path)?;
|
||||
|
||||
|
jturnerusa marked this conversation as resolved
Outdated
|
||||
let packages = packages::evaluate(&parents, &path)?;
|
||||
@@ -124,6 +132,7 @@ impl Profile {
|
||||
path: path.as_ref().to_path_buf(),
|
||||
parents,
|
||||
eapi,
|
||||
deprecated,
|
||||
make_defaults,
|
||||
packages,
|
||||
package_mask,
|
||||
|
||||
Reference in New Issue
Block a user
I think the default behavior for no eapi file per the spec is to treat it as eapi 0. Do we do that here, or are we erroring out if there's no eapi file?
Maybe it should assign eapi 0 on failure to parse (no eapi file), then later during evaluation of the parsed profile you throw an error saying you don't support eapi 0. That way eapi 0 (or other versions) could be supported later without having to change parsing logic.