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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
use get::Get;
use std::path::PathBuf;
use crate::{
atom::{Atom, Name, Slot, Version},
useflag::{IUseFlag, UseFlag},
};
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)]
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 {
pub(super) name: Name,
pub(super) version: Version,
pub(super) slot: Option<Slot>,
pub(super) homepage: Option<String>,
#[get(kind = "deref")]
pub(super) src_uri: Vec<Depend<SrcUri>>,
pub(super) eapi: Option<Eapi>,
#[get(kind = "deref")]
pub(super) inherit: Vec<Eclass>,
#[get(kind = "deref")]
pub(super) iuse: Vec<IUseFlag>,
#[get(kind = "deref")]
pub(super) license: Vec<Depend<License>>,
pub(super) description: Option<String>,
#[get(kind = "deref")]
pub(super) depend: Vec<Depend<Atom>>,
#[get(kind = "deref")]
pub(super) bdepend: Vec<Depend<Atom>>,
#[get(kind = "deref")]
pub(super) rdepend: Vec<Depend<Atom>>,
#[get(kind = "deref")]
pub(super) idepend: Vec<Depend<Atom>>,
}
|