Compare commits
2 Commits
ccf45347c4
...
82b292263c
| Author | SHA1 | Date | |
|---|---|---|---|
|
82b292263c
|
|||
|
b41593eb0b
|
@@ -2,4 +2,4 @@
|
|||||||
ninja rustfmt -C build
|
ninja rustfmt -C build
|
||||||
ninja rustdoc -C build
|
ninja rustdoc -C build
|
||||||
ninja clippy -C build
|
ninja clippy -C build
|
||||||
meson test -v -C build
|
meson test -C build
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use std::{
|
|||||||
use get::Get;
|
use get::Get;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use crate::{Parseable, atom::Atom, repo::ebuild::Eapi, useflag::UseFlag};
|
use crate::{atom::Atom, useflag::UseFlag};
|
||||||
|
|
||||||
mod make_defaults;
|
mod make_defaults;
|
||||||
mod package;
|
mod package;
|
||||||
@@ -43,15 +43,12 @@ pub enum Error {
|
|||||||
PackageUse(#[from] package_use::Error),
|
PackageUse(#[from] package_use::Error),
|
||||||
#[error("error evaluating use settings: {0}")]
|
#[error("error evaluating use settings: {0}")]
|
||||||
Use(#[from] useflags::Error),
|
Use(#[from] useflags::Error),
|
||||||
#[error("parser error: {0}")]
|
|
||||||
Parser(String),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Get)]
|
#[derive(Debug, Clone, Get)]
|
||||||
pub struct Profile {
|
pub struct Profile {
|
||||||
#[get(kind = "deref")]
|
#[get(kind = "deref")]
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
eapi: Option<Eapi>,
|
|
||||||
#[get(kind = "deref")]
|
#[get(kind = "deref")]
|
||||||
parents: Vec<Profile>,
|
parents: Vec<Profile>,
|
||||||
make_defaults: HashMap<String, String>,
|
make_defaults: HashMap<String, String>,
|
||||||
@@ -90,16 +87,6 @@ impl Profile {
|
|||||||
Err(e) => return Err(Error::Io(parents_path, e)),
|
Err(e) => return Err(Error::Io(parents_path, e)),
|
||||||
};
|
};
|
||||||
|
|
||||||
let eapi_path = path.as_ref().join("eapi");
|
|
||||||
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(Err(rest)) => return Err(Error::Parser(rest)),
|
|
||||||
Err(e) if matches!(e.kind(), io::ErrorKind::NotFound) => None,
|
|
||||||
Err(e) => return Err(Error::Io(eapi_path, e)),
|
|
||||||
};
|
|
||||||
|
|
||||||
let make_defaults = make_defaults::evaluate(&parents, &path)?;
|
let make_defaults = make_defaults::evaluate(&parents, &path)?;
|
||||||
|
|
||||||
let packages = packages::evaluate(&parents, &path)?;
|
let packages = packages::evaluate(&parents, &path)?;
|
||||||
@@ -123,7 +110,6 @@ impl Profile {
|
|||||||
Ok(Self {
|
Ok(Self {
|
||||||
path: path.as_ref().to_path_buf(),
|
path: path.as_ref().to_path_buf(),
|
||||||
parents,
|
parents,
|
||||||
eapi,
|
|
||||||
make_defaults,
|
make_defaults,
|
||||||
packages,
|
packages,
|
||||||
package_mask,
|
package_mask,
|
||||||
|
|||||||
Reference in New Issue
Block a user