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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
use alpm_sys::*;
use package::{Package, PackageOperation};
pub enum Event<'a> {
CheckDepsStart,
CheckDepsDone,
FileConflictsStart,
FileConflictsDone,
ResolveDepsStart,
ResolveDepsDone,
InterConflictsStart,
InterConflictsDone,
TransactionStart,
TransactionDone,
PackageOperationStart(PackageOperation<'a>),
PackageOperationDone(PackageOperation<'a>),
IntegrityStart,
IntegrityDone,
LoadStart,
LoadDone,
DeltaIntegrityStart,
DeltaIntegrityDone,
DeltaPatchesStart,
DeltaPatchesDone,
DeltaPatchStart,
DeltaPatchDone,
DeltaPatchFailed,
ScriptletInfo,
RetrieveStart,
RetrieveDone,
RetrieveFailed,
PkgDownloadStart,
PkgDownloadDone,
PkgDownloadFailed,
DiskspaceStart,
DiskspaceDone,
OptDepRemoval,
DatabaseMissing,
KeyringStart,
KeyringDone,
KeyDownloadStart,
KeyDownloadDone,
PacnewCreated,
PacsaveCreated,
HookStart,
HookDone,
HookRunStart,
HookRunDone,
__Unknown
}
impl<'a> Event<'a> {
pub(crate) unsafe fn new(e: *const alpm_event_t) -> Event<'static> {
match (*e).type_ {
ALPM_EVENT_CHECKDEPS_START => Event::CheckDepsStart,
ALPM_EVENT_CHECKDEPS_DONE => Event::CheckDepsDone,
ALPM_EVENT_FILECONFLICTS_START => Event::FileConflictsStart,
ALPM_EVENT_FILECONFLICTS_DONE => Event::FileConflictsDone,
ALPM_EVENT_RESOLVEDEPS_START => Event::ResolveDepsStart,
ALPM_EVENT_RESOLVEDEPS_DONE => Event::ResolveDepsDone,
ALPM_EVENT_INTERCONFLICTS_START => Event::InterConflictsStart,
ALPM_EVENT_INTERCONFLICTS_DONE => Event::InterConflictsDone,
ALPM_EVENT_TRANSACTION_START => Event::TransactionStart,
ALPM_EVENT_TRANSACTION_DONE => Event::TransactionDone,
ALPM_EVENT_PACKAGE_OPERATION_START => Event::PackageOperationStart(
PackageOperation::new(&(*e).package_operation)),
ALPM_EVENT_PACKAGE_OPERATION_DONE => Event::PackageOperationDone(
PackageOperation::new(&(*e).package_operation)),
ALPM_EVENT_INTEGRITY_START => Event::IntegrityStart,
ALPM_EVENT_INTEGRITY_DONE => Event::IntegrityDone,
ALPM_EVENT_LOAD_START => Event::LoadStart,
ALPM_EVENT_LOAD_DONE => Event::LoadDone,
ALPM_EVENT_DELTA_INTEGRITY_START => Event::DeltaIntegrityStart,
ALPM_EVENT_DELTA_INTEGRITY_DONE => Event::DeltaIntegrityDone,
ALPM_EVENT_DELTA_PATCHES_START => Event::DeltaPatchesStart,
ALPM_EVENT_DELTA_PATCHES_DONE => Event::DeltaPatchesDone,
ALPM_EVENT_DELTA_PATCH_START => Event::DeltaPatchStart,
ALPM_EVENT_DELTA_PATCH_DONE => Event::DeltaPatchDone,
ALPM_EVENT_DELTA_PATCH_FAILED => Event::DeltaPatchFailed,
ALPM_EVENT_SCRIPTLET_INFO => Event::ScriptletInfo,
ALPM_EVENT_RETRIEVE_START => Event::RetrieveStart,
ALPM_EVENT_RETRIEVE_DONE => Event::RetrieveDone,
ALPM_EVENT_RETRIEVE_FAILED => Event::RetrieveFailed,
ALPM_EVENT_PKGDOWNLOAD_START => Event::PkgDownloadStart,
ALPM_EVENT_PKGDOWNLOAD_DONE => Event::PkgDownloadDone,
ALPM_EVENT_PKGDOWNLOAD_FAILED => Event::PkgDownloadFailed,
ALPM_EVENT_DISKSPACE_START => Event::DiskspaceStart,
ALPM_EVENT_DISKSPACE_DONE => Event::DiskspaceDone,
ALPM_EVENT_OPTDEP_REMOVAL => Event::OptDepRemoval,
ALPM_EVENT_DATABASE_MISSING => Event::DatabaseMissing,
ALPM_EVENT_KEYRING_START => Event::KeyringStart,
ALPM_EVENT_KEYRING_DONE => Event::KeyringDone,
ALPM_EVENT_KEY_DOWNLOAD_START => Event::KeyDownloadStart,
ALPM_EVENT_KEY_DOWNLOAD_DONE => Event::KeyDownloadDone,
ALPM_EVENT_PACNEW_CREATED => Event::PacnewCreated,
ALPM_EVENT_PACSAVE_CREATED => Event::PacsaveCreated,
ALPM_EVENT_HOOK_START => Event::HookStart,
ALPM_EVENT_HOOK_DONE => Event::HookDone,
ALPM_EVENT_HOOK_RUN_START => Event::HookRunStart,
ALPM_EVENT_HOOK_RUN_DONE => Event::HookRunDone,
_ => Event::__Unknown
}
}
}