XBPS Library API 20240111
The X Binary Package System
xbps_api_impl.h
1/*-
2 * Copyright (c) 2010-2015 Juan Romero Pardines.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *-
25 */
26
27#ifndef _XBPS_API_IMPL_H_
28#define _XBPS_API_IMPL_H_
29
30#include <assert.h>
31#include "xbps.h"
32
33/*
34 * By default all public functions have default visibility, unless
35 * visibility has been detected by configure and the HIDDEN definition
36 * is used.
37 */
38#if HAVE_VISIBILITY
39#define HIDDEN __attribute__ ((visibility("hidden")))
40#else
41#define HIDDEN
42#endif
43
44#include "queue.h"
45#include "compat.h"
46
47#ifndef __UNCONST
48#define __UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
49#endif
50
51#ifndef __arraycount
52#define __arraycount(x) (sizeof(x) / sizeof(*x))
53#endif
54
55struct archive_entry;
56
57/**
58 * @private
59 */
60int HIDDEN dewey_match(const char *, const char *);
61int HIDDEN xbps_pkgdb_init(struct xbps_handle *);
62void HIDDEN xbps_pkgdb_release(struct xbps_handle *);
63int HIDDEN xbps_pkgdb_conversion(struct xbps_handle *);
64int HIDDEN xbps_array_replace_dict_by_name(xbps_array_t, xbps_dictionary_t,
65 const char *);
66int HIDDEN xbps_array_replace_dict_by_pattern(xbps_array_t, xbps_dictionary_t,
67 const char *);
68bool HIDDEN xbps_remove_pkg_from_array_by_name(xbps_array_t, const char *);
69bool HIDDEN xbps_remove_pkg_from_array_by_pattern(xbps_array_t, const char *);
70bool HIDDEN xbps_remove_pkg_from_array_by_pkgver(xbps_array_t, const char *);
71void HIDDEN xbps_fetch_set_cache_connection(int, int);
72void HIDDEN xbps_fetch_unset_cache_connection(void);
73int HIDDEN xbps_cb_message(struct xbps_handle *, xbps_dictionary_t, const char *);
74int HIDDEN xbps_entry_is_a_conf_file(xbps_dictionary_t, const char *);
75int HIDDEN xbps_entry_install_conf_file(struct xbps_handle *, xbps_dictionary_t,
76 xbps_dictionary_t, struct archive_entry *, const char *,
77 const char *, bool);
78xbps_dictionary_t HIDDEN xbps_find_virtualpkg_in_conf(struct xbps_handle *,
79 xbps_dictionary_t, const char *);
80xbps_dictionary_t HIDDEN xbps_find_pkg_in_dict(xbps_dictionary_t, const char *);
81xbps_dictionary_t HIDDEN xbps_find_virtualpkg_in_dict(struct xbps_handle *,
82 xbps_dictionary_t, const char *);
83xbps_dictionary_t HIDDEN xbps_find_pkg_in_array(xbps_array_t, const char *,
85xbps_dictionary_t HIDDEN xbps_find_virtualpkg_in_array(struct xbps_handle *,
86 xbps_array_t, const char *, xbps_trans_type_t);
87
88/* transaction */
89bool HIDDEN xbps_transaction_check_revdeps(struct xbps_handle *, xbps_array_t);
90bool HIDDEN xbps_transaction_check_shlibs(struct xbps_handle *, xbps_array_t);
91bool HIDDEN xbps_transaction_check_replaces(struct xbps_handle *, xbps_array_t);
92bool HIDDEN xbps_transaction_check_conflicts(struct xbps_handle *, xbps_array_t);
93bool HIDDEN xbps_transaction_store(struct xbps_handle *, xbps_array_t, xbps_dictionary_t, bool);
94int HIDDEN xbps_transaction_init(struct xbps_handle *);
95int HIDDEN xbps_transaction_files(struct xbps_handle *,
96 xbps_object_iterator_t);
97int HIDDEN xbps_transaction_fetch(struct xbps_handle *,
98 xbps_object_iterator_t);
99int HIDDEN xbps_transaction_pkg_deps(struct xbps_handle *, xbps_array_t, xbps_dictionary_t);
100int HIDDEN xbps_transaction_internalize(struct xbps_handle *, xbps_object_iterator_t);
101
102char HIDDEN *xbps_get_remote_repo_string(const char *);
103int HIDDEN xbps_repo_sync(struct xbps_handle *, const char *);
104int HIDDEN xbps_file_hash_check_dictionary(struct xbps_handle *,
105 xbps_dictionary_t, const char *, const char *);
106int HIDDEN xbps_file_exec(struct xbps_handle *, const char *, ...);
107void HIDDEN xbps_set_cb_fetch(struct xbps_handle *, off_t, off_t, off_t,
108 const char *, bool, bool, bool);
109int HIDDEN xbps_set_cb_state(struct xbps_handle *, xbps_state_t, int,
110 const char *, const char *, ...);
111int HIDDEN xbps_unpack_binary_pkg(struct xbps_handle *, xbps_dictionary_t);
112int HIDDEN xbps_remove_pkg(struct xbps_handle *, const char *, bool);
113int HIDDEN xbps_register_pkg(struct xbps_handle *, xbps_dictionary_t);
114char HIDDEN *xbps_archive_get_file(struct archive *, struct archive_entry *);
115xbps_dictionary_t HIDDEN xbps_archive_get_dictionary(struct archive *,
116 struct archive_entry *);
117const char HIDDEN *vpkg_user_conf(struct xbps_handle *, const char *, bool);
118xbps_array_t HIDDEN xbps_get_pkg_fulldeptree(struct xbps_handle *,
119 const char *, bool);
120struct xbps_repo HIDDEN *xbps_regget_repo(struct xbps_handle *,
121 const char *);
122int HIDDEN xbps_conf_init(struct xbps_handle *);
123
124#endif /* !_XBPS_API_IMPL_H_ */
Generic XBPS structure handler for initialization.
Definition xbps.h:550
xbps_state_t
Definition xbps.h:329
Repository structure.
Definition xbps.h:1409
xbps_trans_type_t
Definition xbps.h:1320