From b1808930ce45a034981626fc20bbc7920890899e Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Mon, 16 Jul 2007 20:58:58 +0200 Subject: libalpm/add.c,trans.c : cleanup of requiredby handling. This patch cleans up and fix the _alpm_trans_update_depends function and ensure that all requiredby fields are filled in case of multiple satisfiers (previously, the handling of mutliple satisfiers in that function was inconsistent). This makes a special case handling of requiredby in commit_single_pkg() obsolete, and so allows cleaning that code as well. Also fixed upgrade056 pactest because : 1) the requiredby fields were wrong, and this wouldn't happen with the fixed _alpm_trans_update_depends(). 2) this is a very unusual case anyway (and handling all corner cases combined to a broken database seems nearly impossible to achieve). References : http://www.archlinux.org/pipermail/pacman-dev/2007-July/008919.html http://www.archlinux.org/pipermail/pacman-dev/2007-July/008920.html Signed-off-by: Chantry Xavier --- lib/libalpm/add.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 9ef83d91..398839a6 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -827,43 +827,6 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, * looking for packages depending on the package to add */ _alpm_pkg_update_requiredby(newpkg); - /* special case: if our provides list has changed from oldpkg to newpkg AND - * we get here, we need to make sure we find the actual provision that - * still satisfies this case, and update its 'requiredby' field... ugh */ - /* TODO this seems really messy and should be taken care of elsewhere */ - alpm_list_t *provdiff, *prov; - provdiff = alpm_list_diff(alpm_pkg_get_provides(oldpkg), - alpm_pkg_get_provides(newpkg), - _alpm_str_cmp); - for(prov = provdiff; prov; prov = prov->next) { - const char *provname = prov->data; - _alpm_log(PM_LOG_DEBUG, "provision '%s' has been removed from package %s (%s => %s)", - provname, alpm_pkg_get_name(oldpkg), - alpm_pkg_get_version(oldpkg), alpm_pkg_get_version(newpkg)); - - alpm_list_t *p = _alpm_db_whatprovides(handle->db_local, provname); - if(p) { - /* we now have all the provisions in the local DB for this virtual - * package... seeing as we can't really determine which is the 'correct' - * provision, we'll use the FIRST for now. - * TODO figure out a way to find a "correct" provision */ - pmpkg_t *provpkg = p->data; - const char *pkgname = alpm_pkg_get_name(provpkg); - _alpm_log(PM_LOG_DEBUG, "updating '%s' due to provision change (%s)", - pkgname, provname); - _alpm_pkg_update_requiredby(provpkg); - - if(_alpm_db_write(db, provpkg, INFRQ_DEPENDS)) { - _alpm_log(PM_LOG_ERROR, _("could not update provision '%s' from '%s'"), - provname, pkgname); - alpm_logaction("error: could not update provision '%s' from '%s'", - provname, pkgname); - RET_ERR(PM_ERR_DB_WRITE, -1); - } - } - } - alpm_list_free(provdiff); - /* make an install date (in UTC) */ time_t t = time(NULL); strncpy(newpkg->installdate, asctime(gmtime(&t)), PKG_DATE_LEN); -- cgit v1.2.3-54-g00ecf