diff options
author | Allan McRae <allan@archlinux.org> | 2015-07-14 13:45:59 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-07-15 02:57:29 +0200 |
commit | f6c55b3c3f395839c0973c36b7a7e05984636a61 (patch) | |
tree | 16d85d4e4fca3bb8249a58f4b93f9088d6f5df55 /lib/libalpm/handle.c | |
parent | 1ada16f0177f9bfcaed95cf3b71b7029290a5f1d (diff) | |
download | pacman-f6c55b3c3f395839c0973c36b7a7e05984636a61.tar.gz pacman-f6c55b3c3f395839c0973c36b7a7e05984636a61.tar.xz |
Allow frontends to specify the sync database extension
This allows frontends to select between the .db and .files databases
currently supplied by repo-add or any other compatible database.
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r-- | lib/libalpm/handle.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 4915d0bf..5c665dbb 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -81,6 +81,7 @@ void _alpm_handle_free(alpm_handle_t *handle) _alpm_trans_free(handle->trans); FREE(handle->root); FREE(handle->dbpath); + FREE(handle->dbext); FREELIST(handle->cachedirs); FREE(handle->logfile); FREE(handle->lockfile); @@ -284,6 +285,12 @@ int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle) return handle->checkspace; } +const char SYMEXPORT *alpm_option_get_dbext(alpm_handle_t *handle) +{ + CHECK_HANDLE(handle, return NULL); + return handle->dbext; +} + int SYMEXPORT alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb) { CHECK_HANDLE(handle, return -1); @@ -664,6 +671,21 @@ int SYMEXPORT alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace) return 0; } +int SYMEXPORT alpm_option_set_dbext(alpm_handle_t *handle, const char *dbext) +{ + CHECK_HANDLE(handle, return -1); + ASSERT(dbext, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); + + if(handle->dbext) { + FREE(handle->dbext); + } + + STRDUP(handle->dbext, dbext, RET_ERR(handle, ALPM_ERR_MEMORY, -1)); + + _alpm_log(handle, ALPM_LOG_DEBUG, "option 'dbext' = %s\n", handle->dbext); + return 0; +} + int SYMEXPORT alpm_option_set_default_siglevel(alpm_handle_t *handle, alpm_siglevel_t level) { |