diff options
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/alpm.h | 9 | ||||
-rw-r--r-- | lib/libalpm/handle.c | 52 | ||||
-rw-r--r-- | lib/libalpm/handle.h | 4 |
3 files changed, 59 insertions, 6 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index f524c190..b6818407 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -115,6 +115,9 @@ typedef enum _alpm_siglevel_t { ALPM_SIG_DATABASE_MARGINAL_OK = (1 << 12), ALPM_SIG_DATABASE_UNKNOWN_OK = (1 << 13), + ALPM_SIG_PACKAGE_SET = (1 << 27), + ALPM_SIG_PACKAGE_TRUST_SET = (1 << 28), + ALPM_SIG_USE_DEFAULT = (1 << 31) } alpm_siglevel_t; @@ -561,6 +564,12 @@ int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace); alpm_siglevel_t alpm_option_get_default_siglevel(alpm_handle_t *handle); int alpm_option_set_default_siglevel(alpm_handle_t *handle, alpm_siglevel_t level); +alpm_siglevel_t alpm_option_get_local_file_siglevel(alpm_handle_t *handle); +int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, alpm_siglevel_t level); + +alpm_siglevel_t alpm_option_get_remote_file_siglevel(alpm_handle_t *handle); +int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, alpm_siglevel_t level); + /** @} */ /** @addtogroup alpm_api_databases Database Functions diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 1a840ab8..53c86c57 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -594,6 +594,18 @@ int SYMEXPORT alpm_option_set_deltaratio(alpm_handle_t *handle, double ratio) return 0; } +alpm_db_t SYMEXPORT *alpm_get_localdb(alpm_handle_t *handle) +{ + CHECK_HANDLE(handle, return NULL); + return handle->db_local; +} + +alpm_list_t SYMEXPORT *alpm_get_syncdbs(alpm_handle_t *handle) +{ + CHECK_HANDLE(handle, return NULL); + return handle->dbs_sync; +} + int SYMEXPORT alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace) { CHECK_HANDLE(handle, return -1); @@ -621,16 +633,44 @@ alpm_siglevel_t SYMEXPORT alpm_option_get_default_siglevel(alpm_handle_t *handle return handle->siglevel; } -alpm_db_t SYMEXPORT *alpm_get_localdb(alpm_handle_t *handle) +int SYMEXPORT alpm_option_set_local_file_siglevel(alpm_handle_t *handle, + alpm_siglevel_t level) { - CHECK_HANDLE(handle, return NULL); - return handle->db_local; + CHECK_HANDLE(handle, return -1); +#ifdef HAVE_LIBGPGME + handle->localfilesiglevel = level; +#else + if(level != 0 && level != ALPM_SIG_USE_DEFAULT) { + RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1); + } +#endif + return 0; } -alpm_list_t SYMEXPORT *alpm_get_syncdbs(alpm_handle_t *handle) +alpm_siglevel_t SYMEXPORT alpm_option_get_local_file_siglevel(alpm_handle_t *handle) { - CHECK_HANDLE(handle, return NULL); - return handle->dbs_sync; + CHECK_HANDLE(handle, return -1); + return handle->localfilesiglevel; +} + +int SYMEXPORT alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, + alpm_siglevel_t level) +{ + CHECK_HANDLE(handle, return -1); +#ifdef HAVE_LIBGPGME + handle->remotefilesiglevel = level; +#else + if(level != 0 && level != ALPM_SIG_USE_DEFAULT) { + RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1); + } +#endif + return 0; +} + +alpm_siglevel_t SYMEXPORT alpm_option_get_remote_file_siglevel(alpm_handle_t *handle) +{ + CHECK_HANDLE(handle, return -1); + return handle->remotefilesiglevel; } /* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index c24e97ad..5e84d586 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -92,6 +92,10 @@ struct __alpm_handle_t { int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */ int checkspace; /* Check disk space before installing */ alpm_siglevel_t siglevel; /* Default signature verification level */ + alpm_siglevel_t localfilesiglevel; /* Signature verification level for local file + upgrade operations */ + alpm_siglevel_t remotefilesiglevel; /* Signature verification level for remote file + upgrade operations */ /* error code */ alpm_errno_t pm_errno; |