Files
gentoo-utils/src/ebuild/mod.rs

85 lines
1.7 KiB
Rust

use get::Get;
use std::path::PathBuf;
use crate::{
atom::{Atom, Name, Slot, Version},
useflag::{IUseFlag, UseFlag},
};
pub mod parsers;
pub mod repo;
#[derive(Clone, Debug)]
pub enum Conditional {
Negative(UseFlag),
Positive(UseFlag),
}
#[derive(Clone, Debug)]
pub enum Depend<T> {
Element(T),
AllOf(Vec<Self>),
AnyOf(Vec<Self>),
OneOf(Vec<Self>),
ConditionalGroup(Conditional, Vec<Self>),
}
#[derive(Debug, Clone)]
pub enum UriPrefix {
Mirror,
Fetch,
}
#[derive(Debug, Clone, Get)]
pub struct Uri {
#[get(kind = "deref")]
protocol: String,
#[get(kind = "deref")]
path: String,
}
#[derive(Debug, Clone)]
pub enum SrcUri {
Filename(PathBuf),
Uri {
prefix: Option<UriPrefix>,
uri: Uri,
filename: Option<PathBuf>,
},
}
#[derive(Debug, Clone, Get)]
pub struct License(#[get(method = "get", kind = "deref")] String);
#[derive(Debug, Clone, Get)]
pub struct Eapi(#[get(method = "get", kind = "deref")] String);
#[derive(Debug, Clone, Get)]
pub struct Eclass(#[get(method = "get", kind = "deref")] String);
#[derive(Debug, Clone, Get)]
pub struct Ebuild {
name: Name,
version: Version,
slot: Option<Slot>,
homepage: Option<String>,
#[get(kind = "deref")]
src_uri: Vec<Depend<SrcUri>>,
eapi: Option<Eapi>,
#[get(kind = "deref")]
inherit: Vec<Eclass>,
#[get(kind = "deref")]
iuse: Vec<IUseFlag>,
#[get(kind = "deref")]
license: Vec<Depend<License>>,
description: Option<String>,
#[get(kind = "deref")]
depend: Vec<Depend<Atom>>,
#[get(kind = "deref")]
bdepend: Vec<Depend<Atom>>,
#[get(kind = "deref")]
rdepend: Vec<Depend<Atom>>,
#[get(kind = "deref")]
idepend: Vec<Depend<Atom>>,
}