create ebuild module

This commit is contained in:
2025-10-29 16:24:25 +00:00
parent b5765118fe
commit 8937e096a4
6 changed files with 215 additions and 111 deletions

57
src/ebuild/mod.rs Normal file
View File

@@ -0,0 +1,57 @@
use get::Get;
use std::path::PathBuf;
use crate::{
atom::{Atom, Name, Slot, Version},
useflag::{IUseFlag, UseFlag},
};
pub mod parsers;
#[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, Get)]
pub struct SrcUri {
uri: String,
file_name: 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>,
src_uri: Vec<Depend<SrcUri>>,
eapi: Option<Eapi>,
inherit: Vec<Eclass>,
iuse: Vec<IUseFlag>,
license: Vec<Depend<License>>,
description: Option<String>,
depend: Vec<Depend<Atom>>,
bdepend: Vec<Depend<Atom>>,
rdpened: Vec<Depend<Atom>>,
idepend: Vec<Depend<Atom>>,
}