impl profile evaluation

This commit is contained in:
2025-11-29 20:43:28 +00:00
parent e67e20ef29
commit 12d362983d
15 changed files with 1364 additions and 1 deletions

View File

@@ -11,11 +11,15 @@ use mon::{Parser, ParserIter, ascii_whitespace1, input::InputIter, tag};
use crate::{
Parseable,
atom::{self, Atom},
repo::ebuild::{Depend, Eapi, Ebuild, Eclass, License, SrcUri},
repo::{
ebuild::{Depend, Eapi, Ebuild, Eclass, License, SrcUri},
profile::Profile,
},
useflag::IUseFlag,
};
pub mod ebuild;
pub mod profile;
#[derive(Debug, thiserror::Error)]
pub enum Error {
@@ -27,6 +31,8 @@ pub enum Error {
Unicode(PathBuf),
#[error("parser error: {0}")]
Parser(String),
#[error("profile error: {0}")]
Profile(profile::Error),
}
#[derive(Debug, Clone, Get)]
@@ -63,6 +69,10 @@ impl Repo {
fs::read_dir(&path).map_err(|e| Error::Io(path, e))?,
))
}
pub fn evaluate_profile<P: AsRef<Path>>(&self, path: P) -> Result<Profile, Error> {
Profile::evaluate(self.path.join("profiles").join(path)).map_err(Error::Profile)
}
}
impl Category {