]>
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 | ||
bd261c01 | 32 | #include <pakfire/filelist.h> |
56f34ab4 | 33 | #include <pakfire/key.h> |
ac4c607b | 34 | #include <pakfire/packagelist.h> |
e4cfcbaa | 35 | #include <pakfire/parser.h> |
4651122b | 36 | #include <pakfire/repo.h> |
78cc8800 | 37 | #include <pakfire/repolist.h> |
6e46b18e | 38 | |
fb909902 | 39 | enum pakfire_flags { |
52dd5dec | 40 | PAKFIRE_FLAGS_OFFLINE = (1 << 0), |
fb909902 MT |
41 | }; |
42 | ||
836f71d2 | 43 | // Callbacks |
09f1436a MT |
44 | typedef void (*pakfire_log_callback)(void* data, int priority, const char* file, |
45 | int line, const char* fn, const char* format, va_list args); | |
46 | void pakfire_set_log_callback(struct pakfire* pakfire, | |
47 | pakfire_log_callback callback, void* data); | |
d6409945 MT |
48 | typedef int (*pakfire_confirm_callback)(struct pakfire* pakfire, void* data, |
49 | const char* message, const char* question); | |
50 | void pakfire_set_confirm_callback(struct pakfire* pakfire, | |
51 | pakfire_confirm_callback callback, void* data); | |
8a2ff479 MT |
52 | typedef void (*pakfire_status_callback)(struct pakfire* pakfire, void* data, |
53 | int progress, const char* status); | |
836f71d2 | 54 | |
ac4c607b | 55 | int pakfire_create(struct pakfire** pakfire, const char* path, const char* arch, |
bcb98c7b MT |
56 | const char* conf, int flags, |
57 | int loglevel, pakfire_log_callback log_callback, void* log_data); | |
6e46b18e | 58 | |
ac4c607b MT |
59 | struct pakfire* pakfire_ref(struct pakfire* pakfire); |
60 | struct pakfire* pakfire_unref(struct pakfire* pakfire); | |
6e46b18e | 61 | |
ac4c607b | 62 | const char* pakfire_get_path(struct pakfire* pakfire); |
d1ed1ada | 63 | |
ac4c607b MT |
64 | int pakfire_clean(struct pakfire* pakfire, int flags); |
65 | int pakfire_refresh(struct pakfire* pakfire, int flags); | |
097b6ca6 | 66 | |
ac4c607b | 67 | int pakfire_list_keys(struct pakfire* pakfire, struct pakfire_key*** keys); |
56f34ab4 | 68 | |
ac4c607b MT |
69 | int pakfire_copy_in(struct pakfire* pakfire, const char* src, const char* dst); |
70 | int pakfire_copy_out(struct pakfire* pakfire, const char* src, const char* dst); | |
78f7a47c | 71 | |
ac4c607b | 72 | const char* pakfire_get_arch(struct pakfire* pakfire); |
6e46b18e | 73 | |
ac4c607b | 74 | int pakfire_version_compare(struct pakfire* pakfire, const char* evr1, const char* evr2); |
f989dacd | 75 | |
ac4c607b MT |
76 | struct pakfire_repolist* pakfire_get_repos(struct pakfire* pakfire); |
77 | struct pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name); | |
843fcc66 | 78 | |
ac4c607b | 79 | int pakfire_whatprovides(struct pakfire* pakfire, const char* what, int flags, |
54334355 | 80 | struct pakfire_packagelist** list); |
ac4c607b | 81 | int pakfire_whatrequires(struct pakfire* pakfire, const char* what, int flags, |
b055ddf1 | 82 | struct pakfire_packagelist** list); |
4952c631 MT |
83 | |
84 | // Search | |
85 | ||
86 | enum pakfire_search_flags { | |
87 | PAKFIRE_SEARCH_NAME_ONLY = (1 << 0), | |
88 | }; | |
89 | ||
ac4c607b | 90 | int pakfire_search(struct pakfire* pakfire, const char* what, int flags, |
689b4aca | 91 | struct pakfire_packagelist** list); |
f989dacd | 92 | |
12656820 MT |
93 | // Logging |
94 | ||
ac4c607b MT |
95 | int pakfire_log_get_priority(struct pakfire* pakfire); |
96 | void pakfire_log_set_priority(struct pakfire* pakfire, int priority); | |
12656820 | 97 | |
f0893704 MT |
98 | // Install/Erase/Update |
99 | ||
46f60d93 MT |
100 | int pakfire_install(struct pakfire* pakfire, int transaction_flags, int solver_flags, |
101 | const char** packages, const char** locks, int job_flags, int* changed, | |
8a2ff479 | 102 | pakfire_status_callback status_callback, void* status_callback_data); |
46f60d93 MT |
103 | int pakfire_erase(struct pakfire* pakfire, int transaction_flags, int solver_flags, |
104 | const char** packages, const char** locks, int job_flags, int* changed, | |
8a2ff479 | 105 | pakfire_status_callback status_callback, void* status_callback_data); |
46f60d93 MT |
106 | int pakfire_update(struct pakfire* pakfire, int transaction_flags, int solver_flags, |
107 | const char** packages, const char** locks, int jobs_flags, int* changed, | |
8a2ff479 | 108 | pakfire_status_callback status_callback, void* status_callback_data); |
f0893704 | 109 | |
d37d8d56 MT |
110 | // Check |
111 | ||
bd261c01 | 112 | int pakfire_check(struct pakfire* pakfire, struct pakfire_filelist* errors); |
d37d8d56 | 113 | |
5ca41ab1 MT |
114 | // Sync |
115 | ||
8a2ff479 MT |
116 | int pakfire_sync(struct pakfire* pakfire, int solver_flags, int flags, int* changed, |
117 | pakfire_status_callback status_callback, void* status_callback_data); | |
5ca41ab1 | 118 | |
19f3d106 MT |
119 | #ifdef PAKFIRE_PRIVATE |
120 | ||
b3727f62 | 121 | #include <gpgme.h> |
19f3d106 MT |
122 | #include <solv/pool.h> |
123 | ||
59106773 | 124 | #include <pakfire/config.h> |
705541ab | 125 | #include <pakfire/pwd.h> |
59106773 | 126 | |
ac4c607b | 127 | int pakfire_on_root(struct pakfire* pakfire); |
708096fe | 128 | |
a1ff2863 MT |
129 | const struct pakfire_subid* pakfire_subuid(struct pakfire* pakfire); |
130 | const struct pakfire_subid* pakfire_subgid(struct pakfire* pakfire); | |
705541ab | 131 | |
ac4c607b | 132 | void pakfire_log(struct pakfire* pakfire, int priority, const char *file, |
e9f2fb43 MT |
133 | int line, const char *fn, const char *format, ...) |
134 | __attribute__((format(printf, 6, 7))); | |
135 | ||
ac4c607b | 136 | int pakfire_has_flag(struct pakfire* pakfire, int flag); |
457feacb | 137 | |
b5cc6424 MT |
138 | // Locking |
139 | int pakfire_acquire_lock(struct pakfire* pakfire); | |
140 | void pakfire_release_lock(struct pakfire* pakfire); | |
141 | ||
ac4c607b MT |
142 | struct pakfire_config* pakfire_get_config(struct pakfire* pakfire); |
143 | int pakfire_is_mountpoint(struct pakfire* pakfire, const char* path); | |
59106773 | 144 | |
d6409945 | 145 | int pakfire_confirm(struct pakfire* pakfire, const char* message, const char* question); |
836f71d2 | 146 | |
ac4c607b | 147 | gpgme_ctx_t pakfire_get_gpgctx(struct pakfire* pakfire); |
b3727f62 | 148 | |
ac4c607b MT |
149 | const char* pakfire_get_distro_name(struct pakfire* pakfire); |
150 | const char* pakfire_get_distro_id(struct pakfire* pakfire); | |
151 | const char* pakfire_get_distro_vendor(struct pakfire* pakfire); | |
152 | const char* pakfire_get_distro_version(struct pakfire* pakfire); | |
153 | const char* pakfire_get_distro_version_id(struct pakfire* pakfire); | |
59ab223d | 154 | |
9399c9d8 MT |
155 | const char* pakfire_get_keystore_path(struct pakfire* pakfire); |
156 | ||
77e26129 MT |
157 | #define pakfire_path(pakfire, path, format, ...) \ |
158 | __pakfire_path(pakfire, path, sizeof(path), format, __VA_ARGS__) | |
159 | int __pakfire_path(struct pakfire* pakfire, char* path, const size_t length, | |
160 | const char* format, ...) __attribute__((format(printf, 4, 5))); | |
cc18c7b1 | 161 | |
ec9c752f MT |
162 | const char* pakfire_relpath(struct pakfire* pakfire, const char* path); |
163 | ||
df1409ef MT |
164 | #define pakfire_cache_path(pakfire, path, format, ...) \ |
165 | __pakfire_cache_path(pakfire, path, sizeof(path), format, __VA_ARGS__) | |
166 | int __pakfire_cache_path(struct pakfire* pakfire, char* path, size_t length, | |
f8015584 MT |
167 | const char* format, ...) __attribute__((format(printf, 4, 5))); |
168 | ||
ac4c607b | 169 | void pakfire_pool_has_changed(struct pakfire* pakfire); |
9eba3d65 | 170 | void pakfire_pool_internalize(struct pakfire* pakfire); |
f989dacd | 171 | |
ac4c607b | 172 | Pool* pakfire_get_solv_pool(struct pakfire* pakfire); |
19f3d106 | 173 | |
ac4c607b | 174 | struct pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire); |
f8015584 | 175 | |
2bd03111 | 176 | // Archive helpers |
ac4c607b | 177 | struct archive* pakfire_make_archive_disk_reader(struct pakfire* pakfire, int internal); |
4ca4f324 | 178 | struct archive* pakfire_make_archive_disk_writer(struct pakfire* pakfire, int internal); |
2bd03111 | 179 | |
19f3d106 MT |
180 | #endif |
181 | ||
6e46b18e | 182 | #endif /* PAKFIRE_PAKFIRE_H */ |