[pacman-dev] [PATCH 1/2] support ALPM_SIG_USE_DEFAULT for file siglevels
Andrew Gregory
andrew.gregory.8 at gmail.com
Mon Oct 28 09:58:28 EDT 2013
This brings file siglevels in line with how db siglevels are handled.
Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
As an aside, why is alpm storing these values at all? They're only used by the
frontend.
lib/libalpm/handle.c | 12 ++++++++++--
src/pacman/conf.c | 4 +---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 53c86c5..ea033b2 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -650,7 +650,11 @@ int SYMEXPORT alpm_option_set_local_file_siglevel(alpm_handle_t *handle,
alpm_siglevel_t SYMEXPORT alpm_option_get_local_file_siglevel(alpm_handle_t *handle)
{
CHECK_HANDLE(handle, return -1);
- return handle->localfilesiglevel;
+ if(handle->localfilesiglevel & ALPM_SIG_USE_DEFAULT) {
+ return handle->siglevel;
+ } else {
+ return handle->localfilesiglevel;
+ }
}
int SYMEXPORT alpm_option_set_remote_file_siglevel(alpm_handle_t *handle,
@@ -670,7 +674,11 @@ int SYMEXPORT alpm_option_set_remote_file_siglevel(alpm_handle_t *handle,
alpm_siglevel_t SYMEXPORT alpm_option_get_remote_file_siglevel(alpm_handle_t *handle)
{
CHECK_HANDLE(handle, return -1);
- return handle->remotefilesiglevel;
+ if(handle->remotefilesiglevel & ALPM_SIG_USE_DEFAULT) {
+ return handle->siglevel;
+ } else {
+ return handle->remotefilesiglevel;
+ }
}
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index cd357ab..231fe2a 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -405,9 +405,7 @@ static int process_siglevel(alpm_list_t *values, alpm_siglevel_t *storage,
static void merge_siglevel(alpm_siglevel_t *base, alpm_siglevel_t *over)
{
alpm_siglevel_t level = *over;
- if(level & ALPM_SIG_USE_DEFAULT) {
- level = *base;
- } else {
+ if(!(level & ALPM_SIG_USE_DEFAULT)) {
if(!(level & ALPM_SIG_PACKAGE_SET)) {
level |= *base & ALPM_SIG_PACKAGE;
level |= *base & ALPM_SIG_PACKAGE_OPTIONAL;
--
1.8.4.1
More information about the pacman-dev
mailing list