1 /*#############################################################################
3 # Pakfire - The IPFire package management system #
4 # Copyright (C) 2017 Pakfire development team #
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. #
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. #
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/>. #
19 #############################################################################*/
21 #ifndef PAKFIRE_PAKFIRE_H
22 #define PAKFIRE_PAKFIRE_H
32 enum pakfire_digests
{
33 PAKFIRE_DIGEST_NONE
= 0,
34 PAKFIRE_DIGEST_SHA1
= 1 << 0,
35 PAKFIRE_DIGEST_SHA256
= 1 << 1,
36 PAKFIRE_DIGEST_SHA512
= 1 << 2,
39 #include <pakfire/key.h>
40 #include <pakfire/packagelist.h>
41 #include <pakfire/parser.h>
42 #include <pakfire/repo.h>
43 #include <pakfire/repolist.h>
46 PAKFIRE_FLAGS_INTERACTIVE
= (1 << 0),
47 PAKFIRE_FLAGS_OFFLINE
= (1 << 1),
48 PAKFIRE_FLAGS_BUILD
= (1 << 2),
49 PAKFIRE_FLAGS_DISABLE_CCACHE
= (1 << 3),
50 PAKFIRE_FLAGS_DISABLE_SNAPSHOT
= (1 << 4),
51 PAKFIRE_FLAGS_DISABLE_RAMDISK
= (1 << 5),
56 struct pakfire_callbacks
{
60 void (*log
)(void* data
, int priority
, const char* file
,
61 int line
, const char* fn
, const char* format
, va_list args
);
63 // Status, Progress & Speed
64 void (*status
)(void* data
, const char* message
);
65 void (*progress
)(void* data
, int progress
);
66 void (*speed
)(void* data
, const char* speed
);
69 int pakfire_create(struct pakfire
** pakfire
, const char* path
, const char* arch
,
70 const char* conf
, int flags
, const struct pakfire_callbacks
* callbacks
);
72 struct pakfire
* pakfire_ref(struct pakfire
* pakfire
);
73 struct pakfire
* pakfire_unref(struct pakfire
* pakfire
);
75 const char* pakfire_get_path(struct pakfire
* pakfire
);
77 int pakfire_clean(struct pakfire
* pakfire
, int flags
);
78 int pakfire_refresh(struct pakfire
* pakfire
, int flags
);
80 int pakfire_bind(struct pakfire
* pakfire
, const char* src
, const char* dst
, int flags
);
82 int pakfire_list_keys(struct pakfire
* pakfire
, struct pakfire_key
*** keys
);
84 int pakfire_copy_in(struct pakfire
* pakfire
, const char* src
, const char* dst
);
85 int pakfire_copy_out(struct pakfire
* pakfire
, const char* src
, const char* dst
);
87 const char* pakfire_get_arch(struct pakfire
* pakfire
);
89 int pakfire_version_compare(struct pakfire
* pakfire
, const char* evr1
, const char* evr2
);
91 struct pakfire_repolist
* pakfire_get_repos(struct pakfire
* pakfire
);
92 struct pakfire_repo
* pakfire_get_repo(struct pakfire
* pakfire
, const char* name
);
94 int pakfire_whatprovides(struct pakfire
* pakfire
, const char* what
, int flags
,
95 struct pakfire_packagelist
** list
);
96 int pakfire_whatrequires(struct pakfire
* pakfire
, const char* what
, int flags
,
97 struct pakfire_packagelist
** list
);
101 enum pakfire_search_flags
{
102 PAKFIRE_SEARCH_NAME_ONLY
= (1 << 0),
105 int pakfire_search(struct pakfire
* pakfire
, const char* what
, int flags
,
106 struct pakfire_packagelist
** list
);
110 int pakfire_log_get_priority(struct pakfire
* pakfire
);
111 void pakfire_log_set_priority(struct pakfire
* pakfire
, int priority
);
113 // Install/Erase/Update
115 int pakfire_install(struct pakfire
* pakfire
, int solver_flags
, const char** packages
,
116 const char** locks
, int job_flags
, int* changed
);
117 int pakfire_erase(struct pakfire
* pakfire
, int solver_flags
, const char** packages
,
118 const char** locks
, int job_flags
, int* changed
);
119 int pakfire_update(struct pakfire
* pakfire
, int solver_flags
, const char** packages
,
120 const char** locks
, int jobs_flags
, int* changed
);
124 int pakfire_check(struct pakfire
* pakfire
);
128 int pakfire_sync(struct pakfire
* pakfire
, int solver_flags
, int flags
, int* changed
);
130 #ifdef PAKFIRE_PRIVATE
133 #include <solv/pool.h>
135 #include <pakfire/config.h>
137 int pakfire_on_root(struct pakfire
* pakfire
);
139 void pakfire_log(struct pakfire
* pakfire
, int priority
, const char *file
,
140 int line
, const char *fn
, const char *format
, ...)
141 __attribute__((format(printf
, 6, 7)));
143 int pakfire_has_flag(struct pakfire
* pakfire
, int flag
);
145 struct pakfire_config
* pakfire_get_config(struct pakfire
* pakfire
);
146 int pakfire_is_mountpoint(struct pakfire
* pakfire
, const char* path
);
148 void pakfire_call_status_callback(struct pakfire
* pakfire
, const char* message
, ...);
149 void pakfire_call_progress_callback(struct pakfire
* pakfire
, int progress
);
151 gpgme_ctx_t
pakfire_get_gpgctx(struct pakfire
* pakfire
);
153 const char* pakfire_get_distro_name(struct pakfire
* pakfire
);
154 const char* pakfire_get_distro_id(struct pakfire
* pakfire
);
155 const char* pakfire_get_distro_vendor(struct pakfire
* pakfire
);
156 const char* pakfire_get_distro_version(struct pakfire
* pakfire
);
157 const char* pakfire_get_distro_version_id(struct pakfire
* pakfire
);
159 const char* pakfire_get_keystore_path(struct pakfire
* pakfire
);
161 #define pakfire_make_path(pakfire, dst, path) \
162 __pakfire_make_path(pakfire, dst, sizeof(dst) - 1, path)
163 int __pakfire_make_path(struct pakfire
* pakfire
, char* dst
, size_t length
, const char* path
);
165 #define pakfire_make_cache_path(pakfire, path, format, ...) \
166 __pakfire_make_cache_path(pakfire, path, sizeof(path) - 1, format, __VA_ARGS__)
168 int __pakfire_make_cache_path(struct pakfire
* pakfire
, char* path
, size_t length
,
169 const char* format
, ...) __attribute__((format(printf
, 4, 5)));
171 void pakfire_pool_has_changed(struct pakfire
* pakfire
);
172 void pakfire_pool_internalize(struct pakfire
* pakfire
);
174 Pool
* pakfire_get_solv_pool(struct pakfire
* pakfire
);
176 struct pakfire_repo
* pakfire_get_installed_repo(struct pakfire
* pakfire
);
179 struct archive
* pakfire_make_archive_disk_reader(struct pakfire
* pakfire
, int internal
);
180 struct archive
* pakfire_make_archive_disk_writer(struct pakfire
* pakfire
);
183 int pakfire_build_setup(struct pakfire
* pakfire
);
187 #endif /* PAKFIRE_PAKFIRE_H */