[pacman-dev] [patch] II. deps.c/checkdeps serious bugFIX + upgrade060.py

Nagy Gabor ngaba at petra.hos.u-szeged.hu
Sat Apr 21 14:29:36 EDT 2007


Gave this a try (my previous clean-up is merged too):
-----------------------
diff -Naur pacman-lib/lib/libalpm/deps.c pacman-lib.new/lib/libalpm/deps.c
--- pacman-lib/lib/libalpm/deps.c	2007-03-19 05:23:45.000000000 +0100
+++ pacman-lib.new/lib/libalpm/deps.c	2007-04-21 20:23:10.000000000 +0200
@@ -319,41 +319,19 @@
 				}
 				
 				found = 0;
-				/* check database for literal packages */
-				for(k = _alpm_db_get_pkgcache(db); k && !found; k = k->next) {
-					pmpkg_t *p = (pmpkg_t *)k->data;
-					found = alpm_depcmp(p, depend);
-				}
- 				/* check database for provides matches */
- 				if(!found) {
- 					alpm_list_t *m;
- 					for(m = _alpm_db_whatprovides(db, depend->name); m && !found; m = m->next) {
- 						/* look for a match that isn't one of the packages we're trying
- 						 * to install.  this way, if we match against a to-be-installed
- 						 * package, we'll defer to the NEW one, not the one already
- 						 * installed. */
- 						pmpkg_t *p = m->data;
- 						alpm_list_t *n;
- 						int skip = 0;
- 						for(n = packages; n && !skip; n = n->next) {
- 							pmpkg_t *ptp = n->data;
- 							if(strcmp(alpm_pkg_get_name(ptp), alpm_pkg_get_name(p)) == 0) {
- 								skip = 1;
- 							}
- 						}
- 						if(skip) {
- 							continue;
- 						}
-
-						found = alpm_depcmp(p, depend);
-					}
-					FREELISTPTR(k);
-				}
  				/* check other targets */
  				for(k = packages; k && !found; k = k->next) {
  					pmpkg_t *p = k->data;
 					found = alpm_depcmp(p, depend);
 				}
+
+				/* check database for satisfying packages */
+				/* we can ignore packages which will be updated, they were checked above*/
+				for(k = _alpm_db_get_pkgcache(db); k && !found; k = k->next) {
+					pmpkg_t *p = (pmpkg_t *)k->data;
+					found = alpm_depcmp(p, depend) && !_alpm_pkg_find(alpm_pkg_get_name(p), packages);
+				}
+
 				/* else if still not found... */
 				if(!found) {
 					_alpm_log(PM_LOG_DEBUG, _("missing dependency '%s' for package '%s'"),
----------------------
enjoy, ngaba




More information about the pacman-dev mailing list