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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
use std::path::Path;
const MIRROR: &'static str = "http://archlinux.polymorf.fr/$repo/os/$arch";
pub struct Options {
pub root_dir: String,
pub db_path: String,
pub cache_dir: String,
pub log_file: String,
pub gpg_dir: String,
pub hook_dir: String,
pub hold_pkg: Vec<String>,
pub ignore_pkg: Vec<String>,
pub ignore_group: Vec<String>,
pub no_upgrade: Vec<String>,
pub no_extract: Vec<String>,
pub use_syslog: bool,
pub color: bool,
pub total_download: bool,
pub check_space: bool,
pub verbose_pkg_lists: bool,
pub repositories: Vec<RepoOptions>,
}
impl Options {
pub fn from_ini(loc: &Path) -> Option<Options> {
unimplemented!()
}
}
impl Default for Options {
fn default() -> Options {
Options {
root_dir: "/".into(),
db_path: "/var/lib/pacman/".into(),
cache_dir: "/var/cache/pacman/pkg/".into(),
log_file: "/var/log/pacman.log".into(),
gpg_dir: "/etc/pacman.d/gnupg/".into(),
hook_dir: "/etc/pacman.d/hooks/".into(),
hold_pkg: vec!["pacman".into(), "glibc".into()],
ignore_pkg: vec![],
ignore_group: vec![],
no_upgrade: vec![],
no_extract: vec![],
use_syslog: false,
color: false,
total_download: false,
check_space: true,
verbose_pkg_lists: false,
repositories: vec![
RepoOptions::new("core", vec![MIRROR.into()]),
RepoOptions::new("extra", vec![MIRROR.into()]),
RepoOptions::new("community", vec![MIRROR.into()]),
RepoOptions::new("multilib", vec![MIRROR.into()]),
],
}
}
}
pub struct RepoOptions {
pub name: String,
pub servers: Vec<String>
}
impl RepoOptions {
fn new<Name: Into<String>>(name: Name, servers: Vec<String>) -> RepoOptions {
RepoOptions { name: name.into(), servers: servers }
}
}