Starting to clean up the public API, move private stuff into xbps_api_impl.h.
This commit is contained in:
parent
3b931475c0
commit
ffc255b715
@ -28,6 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "defs.h"
|
||||
|
@ -26,6 +26,16 @@
|
||||
#ifndef _XBPS_BIN_DEFS_H_
|
||||
#define _XBPS_BIN_DEFS_H_
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DPRINTF(x) printf x
|
||||
#else
|
||||
#define DPRINTF(x)
|
||||
#endif
|
||||
|
||||
#ifndef __UNCONST
|
||||
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||
#endif
|
||||
|
||||
int xbps_install_new_pkg(const char *);
|
||||
int xbps_update_pkg(const char *);
|
||||
int xbps_autoupdate_pkgs(bool);
|
||||
@ -40,4 +50,5 @@ int show_pkg_info_from_metadir(const char *);
|
||||
int show_pkg_files_from_metadir(const char *);
|
||||
int find_files_in_packages(const char *);
|
||||
|
||||
|
||||
#endif /* !_XBPS_BIN_DEFS_H_ */
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "defs.h"
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "defs.h"
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "defs.h"
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <libgen.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "defs.h"
|
||||
|
@ -29,10 +29,15 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fnmatch.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "defs.h"
|
||||
|
||||
#ifndef __UNCONST
|
||||
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||
#endif
|
||||
|
||||
void
|
||||
show_pkg_info_only_repo(prop_dictionary_t dict)
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
|
||||
|
@ -30,26 +30,21 @@
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
/**
|
||||
* @cond
|
||||
*/
|
||||
#ifndef DEBUG
|
||||
# define NDEBUG
|
||||
#endif
|
||||
#include <assert.h>
|
||||
/**
|
||||
* @endcond
|
||||
*/
|
||||
#include <prop/proplib.h>
|
||||
#include <archive.h>
|
||||
#include <archive_entry.h>
|
||||
|
||||
#include <sys/queue.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#ifdef __cplusplus
|
||||
# define __BEGIN_DECLS extern "C" {
|
||||
# define __END_DECLS }
|
||||
#else
|
||||
# define __BEGIN_DECLS
|
||||
# define __END_DECLS
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @file include/xbps_api.h
|
||||
* @brief XBPS Library API header
|
||||
@ -125,49 +120,7 @@ extern "C" {
|
||||
*/
|
||||
#define XBPS_FLAG_FORCE 0x00000002
|
||||
|
||||
|
||||
/**
|
||||
* @cond
|
||||
*/
|
||||
#define ARCHIVE_READ_BLOCKSIZE 10240
|
||||
|
||||
#define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \
|
||||
ARCHIVE_EXTRACT_SECURE_SYMLINKS
|
||||
#define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | \
|
||||
ARCHIVE_EXTRACT_TIME | EXTRACT_FLAGS
|
||||
|
||||
#ifndef __UNCONST
|
||||
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DPRINTF(x) printf x
|
||||
#else
|
||||
#define DPRINTF(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* By default all public functions have default visibility, unless
|
||||
* gcc >= 4.x and the HIDDEN definition is used.
|
||||
*/
|
||||
#if __GNUC__ >= 4
|
||||
#define HIDDEN __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define HIDDEN
|
||||
#endif
|
||||
/**
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/package_config_files.c
|
||||
*/
|
||||
int HIDDEN xbps_config_file_from_archive_entry(prop_dictionary_t,
|
||||
struct archive_entry *,
|
||||
const char *,
|
||||
int *,
|
||||
bool *);
|
||||
__BEGIN_DECLS
|
||||
|
||||
/** @addtogroup configure */
|
||||
/*@{*/
|
||||
@ -525,20 +478,6 @@ prop_object_iterator_t xbps_get_array_iter_from_dict(prop_dictionary_t dict,
|
||||
prop_dictionary_t xbps_get_pkg_dict_from_metadata_plist(const char *pkgn,
|
||||
const char *plist);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Finds a proplib dictionary in an archive, matching a specific
|
||||
* entry on it.
|
||||
*
|
||||
* @param[in] ar Pointer to an archive object, as returned by libarchive.
|
||||
* @param[in] entry Pointer to an archive entry object, as returned by libarchive.
|
||||
*
|
||||
* @return The proplib dictionary associated with entry, NULL otherwise
|
||||
* and errno is set appropiately.
|
||||
*/
|
||||
prop_dictionary_t HIDDEN xbps_read_dict_from_archive_entry(struct archive *ar,
|
||||
struct archive_entry *entry);
|
||||
|
||||
/**
|
||||
* Removes the package's proplib dictionary matching \a pkgname
|
||||
* in a plist file.
|
||||
@ -685,12 +624,6 @@ int xbps_remove_pkg_files(prop_dictionary_t dict, const char *key);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/package_remove_obsoletes.c
|
||||
*/
|
||||
int HIDDEN xbps_remove_obsoletes(prop_dictionary_t, prop_dictionary_t);
|
||||
|
||||
/** @addtogroup repo_register */
|
||||
/*@{*/
|
||||
|
||||
@ -714,13 +647,6 @@ int xbps_repository_unregister(const char *uri);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/repository_finddeps.c
|
||||
*/
|
||||
int HIDDEN xbps_repository_find_pkg_deps(prop_dictionary_t,
|
||||
prop_dictionary_t);
|
||||
|
||||
/** @addtogroup repo_pkgs */
|
||||
/*@{*/
|
||||
|
||||
@ -747,7 +673,7 @@ int xbps_repository_install_pkg(const char *pkg, bool bypattern);
|
||||
*
|
||||
* @param pkgname The package name to update.
|
||||
* @param instpkg Installed package dictionary, as returned by
|
||||
* xbps_find_pkg_installed_from_plist().
|
||||
* xbps_find_pkg_dict_installed().
|
||||
*
|
||||
* @return 0 on success, or an errno value otherwise.
|
||||
*/
|
||||
@ -776,7 +702,7 @@ int xbps_repository_update_allpkgs(void);
|
||||
* xbps_repository_update_pkg() functions are not called previously.
|
||||
*
|
||||
* @return The transaction dictionary to install/update/replace
|
||||
* a package list.
|
||||
* a package list. NULL on failure and errno set appropiately.
|
||||
*/
|
||||
prop_dictionary_t xbps_repository_get_transaction_dict(void);
|
||||
|
||||
@ -923,26 +849,6 @@ void xbps_repository_pool_release(void);
|
||||
*/
|
||||
int xbps_repository_sync_pkg_index(const char *uri);
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
char HIDDEN *xbps_get_remote_repo_string(const char *uri);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/package_requiredby.c
|
||||
*/
|
||||
int HIDDEN xbps_requiredby_pkg_add(prop_array_t, prop_dictionary_t);
|
||||
int HIDDEN xbps_requiredby_pkg_remove(const char *);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/sortdeps.c
|
||||
*/
|
||||
int HIDDEN xbps_sort_pkg_deps(prop_dictionary_t);
|
||||
|
||||
/** @addtogroup pkgstates */
|
||||
/*@{*/
|
||||
|
||||
@ -1251,8 +1157,6 @@ bool xbps_noyes(const char *, ...);
|
||||
|
||||
/*@}*/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_XBPS_API_H_ */
|
||||
|
124
include/xbps_api_impl.h
Normal file
124
include/xbps_api_impl.h
Normal file
@ -0,0 +1,124 @@
|
||||
/*-
|
||||
* Copyright (c) 2010 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*-
|
||||
*/
|
||||
|
||||
#ifndef _XBPS_API_IMPL_H_
|
||||
#define _XBPS_API_IMPL_H_
|
||||
|
||||
#ifndef DEBUG
|
||||
# define NDEBUG
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <xbps_api.h>
|
||||
|
||||
#define ARCHIVE_READ_BLOCKSIZE 10240
|
||||
|
||||
#define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \
|
||||
ARCHIVE_EXTRACT_SECURE_SYMLINKS
|
||||
#define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | \
|
||||
ARCHIVE_EXTRACT_TIME | EXTRACT_FLAGS
|
||||
|
||||
#ifndef __UNCONST
|
||||
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DPRINTF(x) printf x
|
||||
#else
|
||||
#define DPRINTF(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* By default all public functions have default visibility, unless
|
||||
* gcc >= 4.x and the HIDDEN definition is used.
|
||||
*/
|
||||
#if __GNUC__ >= 4
|
||||
#define HIDDEN __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define HIDDEN
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
/**
|
||||
* @private
|
||||
* From lib/package_config_files.c
|
||||
*/
|
||||
int HIDDEN xbps_config_file_from_archive_entry(prop_dictionary_t,
|
||||
struct archive_entry *,
|
||||
const char *,
|
||||
int *,
|
||||
bool *);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/plist.c
|
||||
*
|
||||
* Finds a proplib dictionary in an archive, matching a specific
|
||||
* entry on it.
|
||||
*
|
||||
* @param[in] ar Pointer to an archive object, as returned by libarchive.
|
||||
* @param[in] entry Pointer to an archive entry object, as returned by libarchive.
|
||||
*
|
||||
* @return The proplib dictionary associated with entry, NULL otherwise
|
||||
* and errno is set appropiately.
|
||||
*/
|
||||
prop_dictionary_t HIDDEN
|
||||
xbps_read_dict_from_archive_entry(struct archive *ar,
|
||||
struct archive_entry *entry);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/package_remove_obsoletes.c
|
||||
*/
|
||||
int HIDDEN xbps_remove_obsoletes(prop_dictionary_t, prop_dictionary_t);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/repository_finddeps.c
|
||||
*/
|
||||
int HIDDEN xbps_repository_find_pkg_deps(prop_dictionary_t,
|
||||
prop_dictionary_t);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/package_requiredby.c
|
||||
*/
|
||||
int HIDDEN xbps_requiredby_pkg_add(prop_array_t, prop_dictionary_t);
|
||||
int HIDDEN xbps_requiredby_pkg_remove(const char *);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* From lib/sortdeps.c
|
||||
*/
|
||||
int HIDDEN xbps_sort_pkg_deps(prop_dictionary_t);
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
char HIDDEN *xbps_get_remote_repo_string(const char *);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_XBPS_API_IMPL_H_ */
|
@ -23,7 +23,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/*
|
||||
* split_version(pkgname, endname, epoch, revision) returns a pointer to
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/fexec.c
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
int HIDDEN
|
||||
xbps_config_file_from_archive_entry(prop_dictionary_t d,
|
||||
|
@ -28,6 +28,9 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/configure.c
|
||||
* @brief Package configuration routines
|
||||
@ -44,7 +47,6 @@
|
||||
* (or packages) will be reconfigured even if its state is
|
||||
* XBPS_PKG_STATE_INSTALLED.
|
||||
*/
|
||||
#include <xbps_api.h>
|
||||
|
||||
int
|
||||
xbps_configure_all_pkgs(void)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <dirent.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/purge.c
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/register.c
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <libgen.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/remove.c
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <libgen.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
int HIDDEN
|
||||
xbps_remove_obsoletes(prop_dictionary_t oldd, prop_dictionary_t newd)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
static int
|
||||
add_pkg_into_reqby(prop_dictionary_t pkgd, const char *reqname)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/state.c
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/unpack.c
|
||||
|
@ -29,8 +29,9 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include <zlib.h>
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/plist.c
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/regpkgs_dictionary.c
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <libgen.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/repository.c
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
static int
|
||||
store_dependency(prop_dictionary_t trans_dict, prop_dictionary_t repo_pkg_dict,
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/repository_findpkg.c
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
#include "fetch.h"
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/repository_pool.c
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
#include "fetch.h"
|
||||
|
||||
/**
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
struct sorted_dependency {
|
||||
SIMPLEQ_ENTRY(sorted_dependency) chain;
|
||||
|
@ -35,9 +35,10 @@
|
||||
#include <sys/mman.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include <openssl/sha.h>
|
||||
#include "config.h"
|
||||
#include <openssl/sha.h>
|
||||
#include <xbps_api.h>
|
||||
#include "xbps_api_impl.h"
|
||||
|
||||
/**
|
||||
* @file lib/util.c
|
||||
|
Loading…
Reference in New Issue
Block a user