]>
Commit | Line | Data |
---|---|---|
6e46b18e MT |
1 | /*############################################################################# |
2 | # # | |
3 | # Pakfire - The IPFire package management system # | |
4 | # Copyright (C) 2017 Pakfire development team # | |
5 | # # | |
6 | # This program is free software: you can redistribute it and/or modify # | |
7 | # it under the terms of the GNU General Public License as published by # | |
8 | # the Free Software Foundation, either version 3 of the License, or # | |
9 | # (at your option) any later version. # | |
10 | # # | |
11 | # This program is distributed in the hope that it will be useful, # | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
14 | # GNU General Public License for more details. # | |
15 | # # | |
16 | # You should have received a copy of the GNU General Public License # | |
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
18 | # # | |
19 | #############################################################################*/ | |
20 | ||
21 | #ifndef PAKFIRE_PAKFIRE_H | |
22 | #define PAKFIRE_PAKFIRE_H | |
23 | ||
a1e801f8 | 24 | #include <stdarg.h> |
b36355f7 | 25 | #include <stddef.h> |
8301098b | 26 | #include <stdio.h> |
3a5d37c5 | 27 | #include <sys/stat.h> |
8301098b | 28 | #include <time.h> |
b36355f7 | 29 | |
ac4c607b MT |
30 | struct pakfire; |
31 | ||
7cea394c MT |
32 | enum pakfire_digests { |
33 | PAKFIRE_DIGEST_NONE = 0, | |
0a31f8fe MT |
34 | PAKFIRE_DIGEST_SHA256 = 1, |
35 | PAKFIRE_DIGEST_SHA512 = 2, | |
7cea394c MT |
36 | }; |
37 | ||
56f34ab4 | 38 | #include <pakfire/key.h> |
ac4c607b | 39 | #include <pakfire/packagelist.h> |
e4cfcbaa | 40 | #include <pakfire/parser.h> |
4651122b | 41 | #include <pakfire/repo.h> |
78cc8800 | 42 | #include <pakfire/repolist.h> |
6e46b18e | 43 | |
fb909902 | 44 | enum pakfire_flags { |
52dd5dec | 45 | PAKFIRE_FLAGS_OFFLINE = (1 << 0), |
fb909902 MT |
46 | }; |
47 | ||
836f71d2 | 48 | // Callbacks |
09f1436a MT |
49 | typedef void (*pakfire_log_callback)(void* data, int priority, const char* file, |
50 | int line, const char* fn, const char* format, va_list args); | |
51 | void pakfire_set_log_callback(struct pakfire* pakfire, | |
52 | pakfire_log_callback callback, void* data); | |
d6409945 MT |
53 | typedef int (*pakfire_confirm_callback)(struct pakfire* pakfire, void* data, |
54 | const char* message, const char* question); | |
55 | void pakfire_set_confirm_callback(struct pakfire* pakfire, | |
56 | pakfire_confirm_callback callback, void* data); | |
8a2ff479 MT |
57 | typedef void (*pakfire_status_callback)(struct pakfire* pakfire, void* data, |
58 | int progress, const char* status); | |
836f71d2 | 59 | |
ac4c607b | 60 | int pakfire_create(struct pakfire** pakfire, const char* path, const char* arch, |
bcb98c7b MT |
61 | const char* conf, int flags, |
62 | int loglevel, pakfire_log_callback log_callback, void* log_data); | |
6e46b18e | 63 | |
ac4c607b MT |
64 | struct pakfire* pakfire_ref(struct pakfire* pakfire); |
65 | struct pakfire* pakfire_unref(struct pakfire* pakfire); | |
6e46b18e | 66 | |
ac4c607b | 67 | const char* pakfire_get_path(struct pakfire* pakfire); |
d1ed1ada | 68 | |
ac4c607b MT |
69 | int pakfire_clean(struct pakfire* pakfire, int flags); |
70 | int pakfire_refresh(struct pakfire* pakfire, int flags); | |
097b6ca6 | 71 | |
ac4c607b | 72 | int pakfire_list_keys(struct pakfire* pakfire, struct pakfire_key*** keys); |
56f34ab4 | 73 | |
ac4c607b MT |
74 | int pakfire_copy_in(struct pakfire* pakfire, const char* src, const char* dst); |
75 | int pakfire_copy_out(struct pakfire* pakfire, const char* src, const char* dst); | |
78f7a47c | 76 | |
ac4c607b | 77 | const char* pakfire_get_arch(struct pakfire* pakfire); |
6e46b18e | 78 | |
ac4c607b | 79 | int pakfire_version_compare(struct pakfire* pakfire, const char* evr1, const char* evr2); |
f989dacd | 80 | |
ac4c607b MT |
81 | struct pakfire_repolist* pakfire_get_repos(struct pakfire* pakfire); |
82 | struct pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name); | |
843fcc66 | 83 | |
ac4c607b | 84 | int pakfire_whatprovides(struct pakfire* pakfire, const char* what, int flags, |
54334355 | 85 | struct pakfire_packagelist** list); |
ac4c607b | 86 | int pakfire_whatrequires(struct pakfire* pakfire, const char* what, int flags, |
b055ddf1 | 87 | struct pakfire_packagelist** list); |
4952c631 MT |
88 | |
89 | // Search | |
90 | ||
91 | enum pakfire_search_flags { | |
92 | PAKFIRE_SEARCH_NAME_ONLY = (1 << 0), | |
93 | }; | |
94 | ||
ac4c607b | 95 | int pakfire_search(struct pakfire* pakfire, const char* what, int flags, |
689b4aca | 96 | struct pakfire_packagelist** list); |
f989dacd | 97 | |
12656820 MT |
98 | // Logging |
99 | ||
ac4c607b MT |
100 | int pakfire_log_get_priority(struct pakfire* pakfire); |
101 | void pakfire_log_set_priority(struct pakfire* pakfire, int priority); | |
12656820 | 102 | |
f0893704 MT |
103 | // Install/Erase/Update |
104 | ||
46f60d93 MT |
105 | int pakfire_install(struct pakfire* pakfire, int transaction_flags, int solver_flags, |
106 | const char** packages, const char** locks, int job_flags, int* changed, | |
8a2ff479 | 107 | pakfire_status_callback status_callback, void* status_callback_data); |
46f60d93 MT |
108 | int pakfire_erase(struct pakfire* pakfire, int transaction_flags, int solver_flags, |
109 | const char** packages, const char** locks, int job_flags, int* changed, | |
8a2ff479 | 110 | pakfire_status_callback status_callback, void* status_callback_data); |
46f60d93 MT |
111 | int pakfire_update(struct pakfire* pakfire, int transaction_flags, int solver_flags, |
112 | const char** packages, const char** locks, int jobs_flags, int* changed, | |
8a2ff479 | 113 | pakfire_status_callback status_callback, void* status_callback_data); |
f0893704 | 114 | |
d37d8d56 MT |
115 | // Check |
116 | ||
ac4c607b | 117 | int pakfire_check(struct pakfire* pakfire); |
d37d8d56 | 118 | |
5ca41ab1 MT |
119 | // Sync |
120 | ||
8a2ff479 MT |
121 | int pakfire_sync(struct pakfire* pakfire, int solver_flags, int flags, int* changed, |
122 | pakfire_status_callback status_callback, void* status_callback_data); | |
5ca41ab1 | 123 | |
19f3d106 MT |
124 | #ifdef PAKFIRE_PRIVATE |
125 | ||
b3727f62 | 126 | #include <gpgme.h> |
19f3d106 MT |
127 | #include <solv/pool.h> |
128 | ||
59106773 | 129 | #include <pakfire/config.h> |
705541ab | 130 | #include <pakfire/pwd.h> |
59106773 | 131 | |
ac4c607b | 132 | int pakfire_on_root(struct pakfire* pakfire); |
708096fe | 133 | |
a1ff2863 MT |
134 | const struct pakfire_subid* pakfire_subuid(struct pakfire* pakfire); |
135 | const struct pakfire_subid* pakfire_subgid(struct pakfire* pakfire); | |
705541ab | 136 | |
ac4c607b | 137 | void pakfire_log(struct pakfire* pakfire, int priority, const char *file, |
e9f2fb43 MT |
138 | int line, const char *fn, const char *format, ...) |
139 | __attribute__((format(printf, 6, 7))); | |
140 | ||
ac4c607b | 141 | int pakfire_has_flag(struct pakfire* pakfire, int flag); |
457feacb | 142 | |
b5cc6424 MT |
143 | // Locking |
144 | int pakfire_acquire_lock(struct pakfire* pakfire); | |
145 | void pakfire_release_lock(struct pakfire* pakfire); | |
146 | ||
ac4c607b MT |
147 | struct pakfire_config* pakfire_get_config(struct pakfire* pakfire); |
148 | int pakfire_is_mountpoint(struct pakfire* pakfire, const char* path); | |
59106773 | 149 | |
d6409945 | 150 | int pakfire_confirm(struct pakfire* pakfire, const char* message, const char* question); |
836f71d2 | 151 | |
ac4c607b | 152 | gpgme_ctx_t pakfire_get_gpgctx(struct pakfire* pakfire); |
b3727f62 | 153 | |
ac4c607b MT |
154 | const char* pakfire_get_distro_name(struct pakfire* pakfire); |
155 | const char* pakfire_get_distro_id(struct pakfire* pakfire); | |
156 | const char* pakfire_get_distro_vendor(struct pakfire* pakfire); | |
157 | const char* pakfire_get_distro_version(struct pakfire* pakfire); | |
158 | const char* pakfire_get_distro_version_id(struct pakfire* pakfire); | |
59ab223d | 159 | |
9399c9d8 MT |
160 | const char* pakfire_get_keystore_path(struct pakfire* pakfire); |
161 | ||
77e26129 MT |
162 | #define pakfire_path(pakfire, path, format, ...) \ |
163 | __pakfire_path(pakfire, path, sizeof(path), format, __VA_ARGS__) | |
164 | int __pakfire_path(struct pakfire* pakfire, char* path, const size_t length, | |
165 | const char* format, ...) __attribute__((format(printf, 4, 5))); | |
cc18c7b1 | 166 | |
ec9c752f MT |
167 | const char* pakfire_relpath(struct pakfire* pakfire, const char* path); |
168 | ||
df1409ef MT |
169 | #define pakfire_cache_path(pakfire, path, format, ...) \ |
170 | __pakfire_cache_path(pakfire, path, sizeof(path), format, __VA_ARGS__) | |
171 | int __pakfire_cache_path(struct pakfire* pakfire, char* path, size_t length, | |
f8015584 MT |
172 | const char* format, ...) __attribute__((format(printf, 4, 5))); |
173 | ||
ac4c607b | 174 | void pakfire_pool_has_changed(struct pakfire* pakfire); |
9eba3d65 | 175 | void pakfire_pool_internalize(struct pakfire* pakfire); |
f989dacd | 176 | |
ac4c607b | 177 | Pool* pakfire_get_solv_pool(struct pakfire* pakfire); |
19f3d106 | 178 | |
ac4c607b | 179 | struct pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire); |
f8015584 | 180 | |
2bd03111 | 181 | // Archive helpers |
ac4c607b | 182 | struct archive* pakfire_make_archive_disk_reader(struct pakfire* pakfire, int internal); |
4ca4f324 | 183 | struct archive* pakfire_make_archive_disk_writer(struct pakfire* pakfire, int internal); |
2bd03111 | 184 | |
19f3d106 MT |
185 | #endif |
186 | ||
6e46b18e | 187 | #endif /* PAKFIRE_PAKFIRE_H */ |