Move default siglevel value from backend to frontend
This takes the libraries hidden default out of the equation: hidden in the sense that we can't even find out what it is until we create a handle. This is a chicken-and-egg problem where we have probably already parsed the config, so it is hard to get the bitmask value right. Move it to the frontend so the caller can do whatever the heck they want. This also exposes a shortcoming where the frontend doesn't know if the library even supports signatures, so we should probably add a alpm_capabilities() method which exposes things like HAS_DOWNLOADER, HAS_SIGNATURES, etc. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
01f5c9e79a
commit
33f2518531
2 changed files with 4 additions and 13 deletions
|
@ -39,17 +39,12 @@
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
alpm_handle_t *_alpm_handle_new()
|
alpm_handle_t *_alpm_handle_new(void)
|
||||||
{
|
{
|
||||||
alpm_handle_t *handle;
|
alpm_handle_t *handle;
|
||||||
|
|
||||||
CALLOC(handle, 1, sizeof(alpm_handle_t), return NULL);
|
CALLOC(handle, 1, sizeof(alpm_handle_t), return NULL);
|
||||||
|
|
||||||
#ifdef HAVE_LIBGPGME
|
|
||||||
handle->siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL |
|
|
||||||
ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,8 @@ config_t *config_new(void)
|
||||||
newconfig->op = PM_OP_MAIN;
|
newconfig->op = PM_OP_MAIN;
|
||||||
newconfig->logmask = ALPM_LOG_ERROR | ALPM_LOG_WARNING;
|
newconfig->logmask = ALPM_LOG_ERROR | ALPM_LOG_WARNING;
|
||||||
newconfig->configfile = strdup(CONFFILE);
|
newconfig->configfile = strdup(CONFFILE);
|
||||||
newconfig->siglevel = ALPM_SIG_USE_DEFAULT;
|
newconfig->siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL |
|
||||||
|
ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
|
||||||
|
|
||||||
return newconfig;
|
return newconfig;
|
||||||
}
|
}
|
||||||
|
@ -567,12 +568,7 @@ static int setup_libalpm(void)
|
||||||
alpm_option_set_cachedirs(handle, config->cachedirs);
|
alpm_option_set_cachedirs(handle, config->cachedirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config->siglevel != ALPM_SIG_USE_DEFAULT) {
|
alpm_option_set_default_siglevel(handle, config->siglevel);
|
||||||
alpm_option_set_default_siglevel(handle, config->siglevel);
|
|
||||||
}
|
|
||||||
/* retrieve the set or default siglevel from the backend at this point;
|
|
||||||
* this way all future DB settings base their setting off this value */
|
|
||||||
config->siglevel = alpm_option_get_default_siglevel(handle);
|
|
||||||
|
|
||||||
if(config->xfercommand) {
|
if(config->xfercommand) {
|
||||||
alpm_option_set_fetchcb(handle, download_with_xfercommand);
|
alpm_option_set_fetchcb(handle, download_with_xfercommand);
|
||||||
|
|
Loading…
Add table
Reference in a new issue