API clean up (part 2), plus misc changes and improvements.

- Rename regpkgs_dictionary to regpkgdb_dictionary to better describe what is is.
- Change some funcs in plist.c to return a boolean rather than int.
- Hide more internal funcs off the API.
- Simplify xbps_repository_update_pkg() and remove its second arg.
- Hide implementation details in xbps_repository_pool, now to iterate over the
  pool you have to use xbps_repository_pool_foreach and its struct
  repository_pool_index.
- Introduce xbps_{init,end}, to initialize/destroy some stuff in the library.
- Introduce xbps_dbg_printf to printf stuff for debugging purposes.
- xbps-{bin,repo}:  added -d arg to enable debugging output.
- Before checking if a config file needs to be installed or such, check that
  package contains the "conf_files" array.
- Remove obsolete dirs as well while updating packages.
- If transaction dictionary is ready remove the "missing_deps" array.

Bump XBPS_RELVER to 20101118.

--HG--
rename : lib/regpkgs_dictionary.c => lib/regpkgdb_dictionary.c
This commit is contained in:
Juan RP
2010-11-19 13:40:13 +01:00
parent ffc255b715
commit fdec663855
33 changed files with 1426 additions and 943 deletions

View File

@ -31,6 +31,9 @@
# define NDEBUG
#endif
#include <assert.h>
#include <archive.h>
#include <archive_entry.h>
#include <xbps_api.h>
#define ARCHIVE_READ_BLOCKSIZE 10240
@ -60,17 +63,47 @@
#define HIDDEN
#endif
/**
* @def XBPS_FETCH_CACHECONN
*
* Default (global) limit of cached connections used in libfetch.
*/
#define XBPS_FETCH_CACHECONN 6
/**
* @def XBPS_FETCH_CACHECONN_HOST
*
* Default (per host) limit of cached connections used in libfetch.
*/
#define XBPS_FETCH_CACHECONN_HOST 2
__BEGIN_DECLS
/**
* @private
* Sets the libfetch's cache connection limits.
*
* @param[in] global Number of global cached connections, if set to 0
* by default it's set to XBPS_FETCH_CACHECONN.
* @param[in] per_host Number of per host cached connections, if set to 0
* by default it's set to XBPS_FETCH_CACHECONN_HOST.
*/
void HIDDEN xbps_fetch_set_cache_connection(int global, int per_host);
/**
* Destroys the libfetch's cache connection established.
*/
void HIDDEN xbps_fetch_unset_cache_connection(void);
/**
* @private
* From lib/package_config_files.c
*/
int HIDDEN xbps_config_file_from_archive_entry(prop_dictionary_t,
prop_dictionary_t,
struct archive_entry *,
const char *,
int *,
bool *);
/**
* @private
* From lib/plist.c
@ -119,6 +152,43 @@ int HIDDEN xbps_sort_pkg_deps(prop_dictionary_t);
*/
char HIDDEN *xbps_get_remote_repo_string(const char *);
/**
* Forks and executes a command in the current working directory
* with an arbitrary number of arguments.
*
* @param[in] arg Arguments passed to execvp(3) when forked, the last
* argument must be NULL.
*
* @return 0 on success, -1 on error and errno set appropiately.
*/
int HIDDEN xbps_file_exec(const char *arg, ...);
/**
* Forks and executes a command in the current working directory
* with an arbitrary number of arguments.
*
* @param[in] arg Arguments passed to execvp(3) when forked, does not need
* to be terminated with a NULL argument.
*
* @return 0 on success, -1 on error and errno set appropiately.
*/
int HIDDEN xbps_file_exec_skipempty(const char *arg, ...);
/**
* Forks and executes a command with an arbitrary number of arguments
* in a specified path.
*
* If uid==0 and /bin/sh (relative to path) exists, a chroot(2) call
* will be done, otherwise chdir(2) to path.
*
* @param[in] path Destination path to chroot(2) or chdir(2).
* @param[in] arg Arguments passed to execvp(3) when forked, the last
* argument must be NULL.
*
* @return 0 on success, -1 on error and errno set appropiately.
*/
int HIDDEN xbps_file_chdir_exec(const char *path, const char *arg, ...);
__END_DECLS
#endif /* !_XBPS_API_IMPL_H_ */