[pacman-dev] CVS update of pacman-lib/lib/libalpm (package.c sync.c)

Aaron Griffin aaron at archlinux.org
Fri Feb 23 02:53:25 EST 2007


    Date: Friday, February 23, 2007 @ 02:53:25
  Author: aaron
    Path: /home/cvs-pacman/pacman-lib/lib/libalpm

Modified: package.c (1.75 -> 1.76) sync.c (1.103 -> 1.104)

* Too much debugging output in the alpm_pkg_compare_versions function
* Using the wrong info level for replacements


-----------+
 package.c |    3 ---
 sync.c    |   20 +++++++++++++-------
 2 files changed, 13 insertions(+), 10 deletions(-)


Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.75 pacman-lib/lib/libalpm/package.c:1.76
--- pacman-lib/lib/libalpm/package.c:1.75	Thu Feb 22 21:10:56 2007
+++ pacman-lib/lib/libalpm/package.c	Fri Feb 23 02:53:25 2007
@@ -167,9 +167,6 @@
 		}
 	}
 
-  _alpm_log(PM_LOG_DEBUG, _("compare versions for %s: %s vs %s, result=%d"),
-						local_pkg->name, local_pkg->version, pkg->version, cmp);
-
 	return(cmp);
 }
 
Index: pacman-lib/lib/libalpm/sync.c
diff -u pacman-lib/lib/libalpm/sync.c:1.103 pacman-lib/lib/libalpm/sync.c:1.104
--- pacman-lib/lib/libalpm/sync.c:1.103	Thu Feb 22 21:10:56 2007
+++ pacman-lib/lib/libalpm/sync.c	Fri Feb 23 02:53:25 2007
@@ -121,28 +121,34 @@
 static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
 														 alpm_list_t *dbs_sync)
 {
-	alpm_list_t *i, *j, *k;
+	alpm_list_t *i, *j, *k, *m; /* wow */
 
 	ALPM_LOG_FUNC;
 
 	/* check for "recommended" package replacements */
 	_alpm_log(PM_LOG_DEBUG, _("checking for package replacements"));
 	for(i = dbs_sync; i; i = i->next) {
-		for(j = _alpm_db_get_pkgcache(i->data, INFRQ_DEPENDS); j; j = j->next) {
+		pmdb_t *db = i->data;
+
+		/* for each db, check each package's REPLACES list */
+		for(j = _alpm_db_get_pkgcache(db, INFRQ_DESC); j; j = j->next) {
 			pmpkg_t *spkg = j->data;
-			for(k = spkg->replaces; k; k = k->next) {
-				alpm_list_t *m;
+
+			for(k = alpm_pkg_get_replaces(spkg); k; k = k->next) {
+				const char *replacement = k->data;
+				/* compare to local DB */
 				for(m = _alpm_db_get_pkgcache(db_local, INFRQ_NONE); m; m = m->next) {
 					pmpkg_t *lpkg = m->data;
-					if(strcmp(k->data, lpkg->name) == 0) {
-						_alpm_log(PM_LOG_DEBUG, _("checking replacement '%s' for package '%s'"), k->data, spkg->name);
+
+					if(strcmp(replacement, lpkg->name) == 0) {
+						_alpm_log(PM_LOG_DEBUG, _("checking replacement '%s' for package '%s'"), replacement, spkg->name);
 						if(alpm_list_find_str(handle->ignorepkg, lpkg->name)) {
 							_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)"),
 								lpkg->name, lpkg->version, spkg->name, spkg->version);
 						} else {
 							/* get confirmation for the replacement */
 							int doreplace = 0;
-							QUESTION(trans, PM_TRANS_CONV_REPLACE_PKG, lpkg, spkg, ((pmdb_t *)i->data)->treename, &doreplace);
+							QUESTION(trans, PM_TRANS_CONV_REPLACE_PKG, lpkg, spkg, db->treename, &doreplace);
 
 							if(doreplace) {
 								/* if confirmed, add this to the 'final' list, designating 'lpkg' as




More information about the pacman-dev mailing list