From 325e3b6b98ee4ca217b153157936b77dc570bb57 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Sun, 5 Feb 2006 09:27:26 +0000 Subject: added a pmconflict_t structure to handle file conflicts --- lib/libalpm/alpm.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/alpm.c') diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 2ec59b2a..9336bc4c 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -1,7 +1,7 @@ /* * alpm.c * - * Copyright (c) 2002 by Judd Vinet + * Copyright (c) 2002-2006 by Judd Vinet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,6 +43,7 @@ #include "db.h" #include "cache.h" #include "deps.h" +#include "conflict.h" #include "backup.h" #include "add.h" #include "remove.h" @@ -415,6 +416,7 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm) if(pkg->origin == PKG_FROM_CACHE) { switch(parm) { /* Desc entry */ + /* not needed: the cache is loaded with DESC by default case PM_PKG_NAME: case PM_PKG_VERSION: case PM_PKG_DESC: @@ -433,7 +435,7 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm) snprintf(target, PKG_FULLNAME_LEN, "%s-%s", pkg->name, pkg->version); db_read(pkg->data, target, INFRQ_DESC, pkg); } - break; + break;*/ /* Depends entry */ /* not needed: the cache is loaded with DEPENDS by default case PM_PKG_DEPENDS: @@ -806,6 +808,37 @@ void *alpm_dep_getinfo(pmdepmissing_t *miss, unsigned char parm) } /** @} */ +/** @defgroup alpm_dep File Conflicts Functions + * @brief Functions to get informations about a libalpm file conflict + * @{ + */ + +/** Get informations about a file conflict. + * @param db conflict pointer + * @param parm name of the info to get + * @return a void* on success (the value), NULL on error + */ +void *alpm_conflict_getinfo(pmconflict_t *conflict, unsigned char parm) +{ + void *data; + + /* Sanity checks */ + ASSERT(conflict != NULL, return(NULL)); + + switch(parm) { + case PM_CONFLICT_TARGET: data = conflict->target; break; + case PM_CONFLICT_TYPE: data = (void *)(int)conflict->type; break; + case PM_CONFLICT_FILE: data = conflict->file; break; + case PM_CONFLICT_CTARGET: data = conflict->ctarget; break; + default: + data = NULL; + break; + } + + return(data); +} +/** @} */ + /** @defgroup alpm_log Logging Functions * @brief Functions to log using libalpm * @{ -- cgit v1.2.3-54-g00ecf