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 bodhi::*;
use super::progress_bar;
pub fn query_testing(bodhi: &BodhiService, release: FedoraRelease) -> Result<Vec<Update>, String> {
let testing = "Updates (testing)";
let testing_progress = |p, ps| progress_bar(testing, p, ps);
let testing_query = bodhi::query::UpdateQuery::new()
.releases(release)
.content_type(ContentType::RPM)
.status(UpdateStatus::Testing)
.callback(testing_progress);
let testing_updates = match bodhi.query(testing_query) {
Ok(updates) => updates,
Err(error) => {
return Err(error.to_string());
},
};
Ok(testing_updates)
}
pub fn query_pending(bodhi: &BodhiService, release: FedoraRelease) -> Result<Vec<Update>, String> {
let pending = "Updates (pending)";
let pending_progress = |p, ps| progress_bar(pending, p, ps);
let pending_query = bodhi::query::UpdateQuery::new()
.releases(release)
.content_type(ContentType::RPM)
.status(UpdateStatus::Pending)
.callback(pending_progress);
let pending_updates = match bodhi.query(pending_query) {
Ok(updates) => updates,
Err(error) => {
return Err(error.to_string());
},
};
Ok(pending_updates)
}
pub fn query_unpushed(bodhi: &BodhiService, release: FedoraRelease) -> Result<Vec<Update>, String> {
let unpushed = "Updates (unpushed)";
let unpushed_progress = |p, ps| progress_bar(unpushed, p, ps);
let unpushed_query = bodhi::query::UpdateQuery::new()
.releases(release)
.content_type(ContentType::RPM)
.status(UpdateStatus::Unpushed)
.callback(unpushed_progress);
let unpushed_updates = match bodhi.query(unpushed_query) {
Ok(updates) => updates,
Err(error) => {
return Err(error.to_string());
},
};
Ok(unpushed_updates)
}