From 93311212bddb7d7e75ea91f04604ca42e85ef823 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Sat, 21 Oct 2006 20:16:55 +0000 Subject: Fixes from frugalware: few 'typos' included while patching Also re-added Judd's dependancy fix in libalpm/deps.c --- lib/libalpm/alpm.c | 3 ++- lib/libalpm/db.c | 1 - lib/libalpm/deps.c | 40 ++++++++++++++++++++++++++++------------ lib/libalpm/server.h | 1 + 4 files changed, 31 insertions(+), 14 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 5868ddfe..386eee4d 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -303,6 +303,7 @@ int alpm_db_setserver(pmdb_t *db, char *url) /** Update a package database * @param force if true, then forces the update, otherwise update only in case + * the database isn't up to date * @param db pointer to the package database to update * @return 0 on success, > 0 on error (pm_errno is set accordingly), < 0 if up * to date @@ -996,7 +997,7 @@ void *alpm_dep_getinfo(pmdepmissing_t *miss, unsigned char parm) } /** @} */ -/** @defgroup alpm_dep File Conflicts Functions +/** @defgroup alpm_conflict File Conflicts Functions * @brief Functions to get informations about a libalpm file conflict * @{ */ diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 39134680..fe421261 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -124,7 +124,6 @@ pmlist_t *_alpm_db_search(pmdb_t *db, pmlist_t *needles) } else if(retval) { _alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'", targ, haystack); match = 1; - } else { } FREE(haystack); diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 8249c651..2d28fde0 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -307,11 +307,28 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist } } } - /* check other targets */ - for(k = packages; k && !found; k = k->next) { - pmpkg_t *p = (pmpkg_t *)k->data; - /* see if the package names match OR if p provides depend.name */ - if(!strcmp(p->name, depend.name) || _alpm_list_is_strin(depend.name, p->provides)) { + /* check database for provides matches */ + if(!found) { + pmlist_t *m; + k = _alpm_db_whatprovides(db, depend.name); + for(m = k; m && !found; m = m->next) { + /* look for a match that isn't one of the packages we're trying + * to install. this way, if we match against a to-be-installed + * package, we'll defer to the NEW one, not the one already + * installed. */ + pmpkg_t *p = m->data; + pmlist_t *n; + int skip = 0; + for(n = packages; n && !skip; n = n->next) { + pmpkg_t *ptp = n->data; + if(!strcmp(ptp->name, p->name)) { + skip = 1; + } + } + if(skip) { + continue; + } + if(depend.mod == PM_DEP_MOD_ANY) { /* accept any version */ found = 1; @@ -334,13 +351,13 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist FREE(ver); } } + FREELISTPTR(k); } - /* check database for provides matches */ - if(!found){ - k = _alpm_db_whatprovides(db, depend.name); - if(k) { - /* grab the first one (there should only really be one, anyway) */ - pmpkg_t *p = k->data; + /* check other targets */ + for(k = packages; k && !found; k = k->next) { + pmpkg_t *p = (pmpkg_t *)k->data; + /* see if the package names match OR if p provides depend.name */ + if(!strcmp(p->name, depend.name) || _alpm_list_is_strin(depend.name, p->provides)) { if(depend.mod == PM_DEP_MOD_ANY) { /* accept any version */ found = 1; @@ -362,7 +379,6 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist } FREE(ver); } - FREELISTPTR(k); } } /* else if still not found... */ diff --git a/lib/libalpm/server.h b/lib/libalpm/server.h index f3dad39b..218c172a 100644 --- a/lib/libalpm/server.h +++ b/lib/libalpm/server.h @@ -22,6 +22,7 @@ #define _ALPM_SERVER_H #include "list.h" +#include #include #define FREESERVER(p) \ -- cgit v1.2.3-70-g09d2