summaryrefslogtreecommitdiff
path: root/src/ebuild/mod.rs
blob: 2558cf49bbfb0d9c03e1bb5d103f628f10e145cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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>>,
}