From 4aca4980a7ddf66c27feacae96c6153d993c65c9 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 1 Mar 2007 05:42:53 +0000 Subject: *** empty log message *** --- lib/libalpm/package.c | 23 +++++++++++++++++++---- lib/libalpm/trans.c | 5 ++++- 2 files changed, 23 insertions(+), 5 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 91fb3333..e979af63 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -530,7 +530,7 @@ int _alpm_pkg_splitname(const char *target, char *name, char *version, int witha void _alpm_pkg_update_requiredby(pmpkg_t *pkg) { - alpm_list_t *i, *j; + alpm_list_t *i, *j, *k; pmdb_t *localdb = alpm_option_get_localdb(); for(i = _alpm_db_get_pkgcache(localdb, INFRQ_DEPENDS); i; i = i->next) { @@ -543,11 +543,26 @@ void _alpm_pkg_update_requiredby(pmpkg_t *pkg) if(!j->data) { continue; } - if(_alpm_splitdep(j->data, &dep) == 0 - && strcmp(dep.name, pkg->name) == 0) { - _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), cachepkg->name, pkg->name); + if(_alpm_splitdep(j->data, &dep) != 0) { + continue; + } + + /* check the actual package itself */ + if(strcmp(dep.name, pkg->name) == 0) { + _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), + cachepkg->name, pkg->name); pkg->requiredby = alpm_list_add(pkg->requiredby, strdup(cachepkg->name)); } + + /* check for provisions as well */ + for(k = pkg->provides; k; k = k->next) { + const char *provname = k->data; + if(strcmp(dep.name, provname) == 0) { + _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s' (provides: %s)"), + cachepkg->name, pkg->name, provname); + pkg->requiredby = alpm_list_add(pkg->requiredby, strdup(cachepkg->name)); + } + } } } } diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 334cb4a4..dc767f8b 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -259,7 +259,10 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg) ASSERT(pkg != NULL, RET_ERR(PM_ERR_PKG_INVALID, -1)); if(pkg->depends) { - _alpm_log(PM_LOG_DEBUG, _("updating dependency packages 'requiredby' fields")); + _alpm_log(PM_LOG_DEBUG, _("updating dependency packages 'requiredby' fields for %s-%s"), + pkg->name, pkg->version); + } else { + _alpm_log(PM_LOG_DEBUG, _("package has no dependencies, no other packages to update")); } localdb = alpm_option_get_localdb(); -- cgit v1.2.3-70-g09d2