diff options
author | Aaron Griffin <aaron@archlinux.org> | 2007-03-01 05:42:53 +0000 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2007-03-01 05:42:53 +0000 |
commit | 4aca4980a7ddf66c27feacae96c6153d993c65c9 (patch) | |
tree | c8111eccdc99bd92afbc66eea4a1b9ad6b8b4f0a /lib/libalpm/package.c | |
parent | 0974e046a3c006b57b1ec6c0b8d066751fbee1a3 (diff) | |
download | pacman-4aca4980a7ddf66c27feacae96c6153d993c65c9.tar.xz |
*** empty log message ***
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r-- | lib/libalpm/package.c | 23 |
1 files changed, 19 insertions, 4 deletions
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)); + } + } } } } |