[pacman-dev] Huge cleanup of add.c and my attempt at fixing FS#7484

ngaba at petra.hos.u-szeged.hu ngaba at petra.hos.u-szeged.hu
Mon Jul 16 05:16:28 EDT 2007


Well, it needs further investigation and testing, but I don't see why 
that provdiff stuff needed in add.c: upgrade is a "remove then add" 
process, remove_commit and add_commit should manage requiredby fields 
properly. However, see my next e-mail today.
Bye, ngaba

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------- next part --------------
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 54447ae..7725e5e 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -821,43 +821,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);


More information about the pacman-dev mailing list