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
|
use std::collections::HashSet;
use chrono::{DateTime, Utc};
use crate::gentoo::UseFlag;
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
pub struct PackageKey {
pub category: String,
pub name: String,
}
impl PackageKey {
pub fn from_atom(s: &str) -> Option<Self> {
let (category, name) = s.split_once('/')?;
Some(Self {
category: category.to_string(),
name: name.to_string(),
})
}
pub fn qualified_name(&self) -> String {
format!("{}/{}", self.category, self.name)
}
}
#[derive(Debug, Clone)]
pub struct Metadata {
pub maintainer: Option<String>,
pub description: Option<String>,
pub homepage: Vec<String>,
pub license: Option<String>,
pub repository: String,
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct InstalledPackage {
pub atom: PackageKey,
pub version: String,
pub build_time: DateTime<Utc>,
pub slot: i32,
pub metadata: Metadata,
pub enabled_use_flags: HashSet<String>,
pub iuse: Vec<UseFlag>,
pub size: usize,
}
#[derive(Debug)]
pub struct Package {
pub atom: PackageKey,
pub versions: Vec<PackageVersion>,
}
#[derive(Debug, Clone)]
pub struct PackageVersion {
pub version: String,
pub metadata: Metadata,
pub keywords: Vec<String>,
pub iuse: Vec<UseFlag>,
}
|