Hi! To be continued... ;-) ----------------------- diff -Naur pacman-lib/lib/libalpm/package.c pacman-lib.new/lib/libalpm/package.c --- pacman-lib/lib/libalpm/package.c 2007-03-12 05:47:58.000000000 +0100 +++ pacman-lib.new/lib/libalpm/package.c 2007-04-10 23:33:57.000000000 +0200 @@ -536,11 +536,12 @@ return(0); } - +/* This function scans the whole local db to fill in the + 'requiredby' field of a package + (this is useful if we want to install this package) */ void _alpm_pkg_update_requiredby(pmpkg_t *pkg) { - alpm_list_t *i, *j, *k; - const char *pkgname = alpm_pkg_get_name(pkg); + alpm_list_t *i, *j; pmdb_t *localdb = alpm_option_get_localdb(); for(i = _alpm_db_get_pkgcache(localdb); i; i = i->next) { @@ -555,38 +556,20 @@ if(!j->data) { continue; } - dep = alpm_splitdep(j->data); - if(dep == NULL) { - continue; - } - - /* check the actual package itself */ - if(strcmp(dep->name, pkgname) == 0) { + dep = alpm_splitdep(j->data); + if(dep == NULL) { + continue; + } + int satisfies = alpm_depcmp(pkg, dep); + free(dep); + if(satisfies) { alpm_list_t *reqs = alpm_pkg_get_requiredby(pkg); - - if(!alpm_list_find_str(reqs, cachepkgname)) { - _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), - cachepkgname, pkg->name); - reqs = alpm_list_add(reqs, strdup(cachepkgname)); - pkg->requiredby = reqs; - } + _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), + cachepkgname, pkg->name); + reqs = alpm_list_add(reqs, strdup(cachepkgname)); + pkg->requiredby = reqs; + break; // we add an entry only once } - - /* check for provisions as well */ - for(k = alpm_pkg_get_provides(pkg); k; k = k->next) { - const char *provname = k->data; - if(strcmp(dep->name, provname) == 0) { - alpm_list_t *reqs = alpm_pkg_get_requiredby(pkg); - - if(!alpm_list_find_str(reqs, cachepkgname)) { - _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s' (provides: %s)"), - cachepkgname, pkgname, provname); - reqs = alpm_list_add(reqs, strdup(cachepkgname)); - pkg->requiredby = reqs; - } - } - } - free(dep); } } } ------------------------ Bye, Nagy Gabor