[Frugalware-darcs] pacman: sync with upstream

VMiklos vmiklos at frugalware.org
Tue Jan 24 18:47:28 CET 2006


[sync with upstream
VMiklos <vmiklos at frugalware.org>**20060124150812
 2006-01-22 03:30  judd
 
 	* lib/libalpm/add.c: changed behaviour with
 	  original=X,current=Y,new=Z backup scenario -- install new file as
 	  .pacnew and keep old one in place
 
 2006-01-22 03:17  judd
 
 	* etc/makepkg.conf: cleaned up format a bit, added global KEEPDOCS
 	  and NOSTRIP flags
 
 2006-01-22 03:16  judd
 
 	* scripts/: gensync, makepkg, updatesync: added new options field
 	  to PKGBUILDs for package-by-package overrides
 
 2006-01-21 20:29  aurelien
 
 	* lib/libalpm/alpm.c: document package, group, sync and transaction
 	  functions (patch from VMiklos <vmiklos at frugalware.org>)
 
 2006-01-21 19:29  aurelien
 
 	* src/pacman/sync.c: fixed a typo
 
 2006-01-21 19:28  aurelien
 
 	* lib/libalpm/: deps.c, deps.h, error.c, sync.c, alpm.h:
 	  resolvedeps: return the depmiss info to the frontend in case of
 	  failure
 
 2006-01-21 17:50  aurelien
 
 	* configure.ac, lib/libalpm/handle.c, src/pacman/pacman.c: added a
 	  FAKEROOT define allowing to use pacman in a fakeroot enivronment
 	  (for tests purpose)
 
 2006-01-18 23:37  aurelien
 
 	* lib/libalpm/: cache.c, conflict.c, deps.c, deps.h, package.c,
 	  package.h, remove.c, sync.c: more code cleanup yet
 
 2006-01-17 23:01  aurelien
 
 	* lib/libalpm/: deps.h, deps.c, conflict.c: fixed detection for
 	  duplicate entries in list of deps/conflicts
 
 2006-01-17 22:30  aurelien
 
 	* src/pacman/: pacman.c, sync.c: added the possibility to "-Syy"
 	  (can be used to force synctrees update, even if mtimes are ok)
 
 2006-01-17 22:27  aurelien
 
 	* src/pacman/sync.c: code cleanup
 
 2006-01-17 22:19  aurelien
 
 	* src/pacman/: add.c, remove.c, sync.c: code cleanup
 
 2006-01-17 22:18  aurelien
 
 	* lib/libalpm/sync.c: even more code cleanup
 
 2006-01-17 22:18  aurelien
 
 	* lib/libalpm/conflict.c: reworked log messages
 
 2006-01-17 19:38  aurelien
 
 	* lib/libalpm/: add.c, remove.c, conflict.c: - code cleanup - log
 	  improvements
 
 2006-01-16 23:27  aurelien
 
 	* lib/libalpm/: add.c, cache.c, group.c, remove.c, sync.c: more
 	  code cleanup
 
 2006-01-16 22:21  aurelien
 
 	* NEWS: fixed tabs
 
 2006-01-15 16:55  aurelien
 
 	* lib/libalpm/: add.c, conflict.c, conflict.h, deps.c, remove.c,
 	  sync.c: pulled out conflict checkings from checkdeps() in its own
 	  function: checkconflicts()
 
 2006-01-14 16:08  aurelien
 
 	* lib/libalpm/sync.c: sync_prepare: added a missing chunk of code
 	  for dependency checks of packages elected for removal
 
 2006-01-14 16:05  aurelien
 
 	* lib/libalpm/deps.c: checkdeps: - merged missing chunks of code
 	  from pacman 2.9.7 - more debug logs
 
 2006-01-14 09:14  aurelien
 
 	* TODO, lib/libalpm/sync.c, src/pacman/download.c: sysupgrade: skip
 	  version cmp for pkg elected for removal  (patch from VMiklos
 	  <vmiklos at frugalware.org>)
 
 2006-01-13 22:51  aurelien
 
 	* src/pacman/sync.c: code cleanup
 
 2006-01-13 22:27  aurelien
 
 	* src/pacman/: pacman.c, sync.c: maked verbose group listing
 	  enabled by -Sgg instead of -Sgv
 
 2006-01-13 22:16  aurelien
 
 	* src/pacman/add.c: code cleanup
 
 2006-01-13 22:02  aurelien
 
 	* src/pacman/deptest.c: added a missing commentary from pacman
 	  2.9.x code
 
 2006-01-13 21:59  aurelien
 
 	* src/pacman/remove.c: fixed a possible memory corruption
 
 2006-01-13 21:55  aurelien
 
 	* lib/libalpm/: alpm.h, error.c: removed unuseful error codes
 
 2006-01-13 21:54  aurelien
 
 	* src/pacman/download.c: code cleanup
 
 2006-01-13 21:47  aurelien
 
 	* src/pacman/sync.c: code cleanup
 
 2006-01-13 21:46  aurelien
 
 	* lib/libalpm/sync.c: improved log and debug messages
 
 2006-01-13 21:14  aurelien
 
 	* README: removed "^M" symbols at end of lines
] {
hunk ./NEWS 294
-								  - removed the hit-^C-and-delete-the-downloading-file safety
+                - removed the hit-^C-and-delete-the-downloading-file safety
hunk ./TODO 20
-
-- implement missing functionnalities (mainly handling of package conflicts
-during packages replacement)
hunk ./configure.ac 96
+dnl Help line for fakeroot
+AC_ARG_ENABLE(fakeroot,
+    AC_HELP_STRING([--disable-fakeoot], [Disable fakeroot proof  support]),
+    [fakeroot=$enableval], [fakeroot=yes])
+
hunk ./configure.ac 176
+
+dnl Enable or disable fakeroot code
+AC_MSG_CHECKING(for fakeroot proof support)
+if test x$fakeroot = xyes ; then
+	AC_MSG_RESULT(yes)
+else
+	CFLAGS="$CFLAGS -DFAKEROOT"
+	AC_MSG_RESULT(no)
+fi
hunk ./lib/libalpm/add.c 110
+	_alpm_log(PM_LOG_FLOW2, "loading target %s", name);
+
hunk ./lib/libalpm/add.c 117
-	_alpm_log(PM_LOG_FLOW2, "loading target %s", name);
-
hunk ./lib/libalpm/add.c 202
-	if(data) {
-		*data = NULL;
-	}
-
hunk ./lib/libalpm/add.c 207
-		_alpm_log(PM_LOG_FLOW1, "looking for conflicts or unsatisfied dependencies");
+		/* look for unsatisfied dependencies */
+		_alpm_log(PM_LOG_FLOW1, "looking for unsatisfied dependencies");
hunk ./lib/libalpm/add.c 211
-			PMList *i;
-			int errorout = 0;
-
-			/* look for unsatisfied dependencies */
-			_alpm_log(PM_LOG_FLOW2, "looking for unsatisfied dependencies");
-			for(i = lp; i; i = i->next) {
-				pmdepmissing_t* miss = i->data;
-
-				if(miss->type == PM_DEP_TYPE_DEPEND || miss->type == PM_DEP_TYPE_REQUIRED) {
-					if(!errorout) {
-						errorout = 1;
-					}
-					if(data) {
-						if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
-							FREELIST(lp);
-							FREELIST(*data);
-							RET_ERR(PM_ERR_MEMORY, -1);
-						}
-						*miss = *(pmdepmissing_t*)i->data;
-						*data = pm_list_add(*data, miss);
-					}
-				}
-			}
-			if(errorout) {
+			if(data) {
+				*data = lp;
+			} else {
hunk ./lib/libalpm/add.c 215
-				RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1);
hunk ./lib/libalpm/add.c 216
+			RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1);
+		}
hunk ./lib/libalpm/add.c 219
-			/* no unsatisfied deps, so look for conflicts */
-			_alpm_log(PM_LOG_FLOW2, "looking for conflicts");
-			for(i = lp; i; i = i->next) {
-				pmdepmissing_t* miss = (pmdepmissing_t *)i->data;
-				if(miss->type == PM_DEP_TYPE_CONFLICT) {
-					if(!errorout) {
-						errorout = 1;
-					}
-					if(data) {
-						if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
-							FREELIST(lp);
-							FREELIST(*data);
-							RET_ERR(PM_ERR_MEMORY, -1);
-						}
-						*miss = *(pmdepmissing_t*)i->data;
-						*data = pm_list_add(*data, miss);
-					}
-				}
-			}
-			FREELIST(lp);
-			if(errorout) {
-				RET_ERR(PM_ERR_CONFLICTING_DEPS, -1);
+		/* no unsatisfied deps, so look for conflicts */
+		_alpm_log(PM_LOG_FLOW1, "looking for conflicts");
+		lp = checkconflicts(db, trans->packages);
+		if(lp != NULL) {
+			if(data) {
+				*data = lp;
+			} else {
+				FREELIST(lp);
hunk ./lib/libalpm/add.c 228
+			RET_ERR(PM_ERR_CONFLICTING_DEPS, -1);
hunk ./lib/libalpm/add.c 266
+			} else {
+				FREELIST(lp);
hunk ./lib/libalpm/add.c 274
-		for(lp = skiplist; lp; lp = lp->next) {
-			trans->skiplist = pm_list_add(trans->skiplist, lp->data);
-		}
-		FREELISTPTR(skiplist);
+		trans->skiplist = skiplist;
hunk ./lib/libalpm/add.c 355
-					for(lp = trans->skiplist; lp; lp = lp->next) {
-						tr->skiplist = pm_list_add(tr->skiplist, strdup(lp->data));
-					}
+					tr->skiplist = _alpm_list_strdup(trans->skiplist);
hunk ./lib/libalpm/add.c 702
-			_alpm_log(PM_LOG_ERROR, "could not update database entry %s/%s-%s", db->treename, info->name, info->version);
+			_alpm_log(PM_LOG_ERROR, "could not update database entry %s-%s",
+			          info->name, info->version);
hunk ./lib/libalpm/add.c 730
-					if(depinfo == NULL) {
-						/* wtf */
-						continue;
-					}
-				} else {
+				}
+				if(depinfo == NULL) {
+					_alpm_log(PM_LOG_ERROR, "could not find dependency %s", depend.name);
+					/* wtf */
hunk ./lib/libalpm/add.c 740
-				_alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s/%s-%s", db->treename, depinfo->name, depinfo->version);
+				_alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s-%s",
+				          depinfo->name, depinfo->version);
hunk ./lib/libalpm/alpm.h 337
-	PM_ERR_NOERROR = 1,
-	PM_ERR_MEMORY,
+	PM_ERR_MEMORY = 1,
hunk ./lib/libalpm/alpm.h 354
-	/* Cache */
-	PM_ERR_CACHE_NULL,
hunk ./lib/libalpm/alpm.h 382
-	PM_ERR_UNRESOLVABLE_DEPS,
hunk ./lib/libalpm/cache.c 77
-	if(db == NULL) {
+	if(db == NULL || db->pkgcache == NULL) {
hunk ./lib/libalpm/cache.c 148
-	PMList *i;
-
-	if(db == NULL || target == NULL || strlen(target) == 0) {
+	if(db == NULL) {
hunk ./lib/libalpm/cache.c 152
-	for(i = db_get_pkgcache(db); i; i = i->next) {
-		pmpkg_t *info = i->data;
-
-		if(strcmp(info->name, target) == 0) {
-			return(info);
-		}
-	}
-
-	return(NULL);
+	return(pkg_isin(target, db_get_pkgcache(db)));
hunk ./lib/libalpm/cache.c 206
-	if(db == NULL) {
+	if(db == NULL || db->grpcache == NULL) {
hunk ./lib/libalpm/conflict.c 32
+#include "log.h"
+#include "cache.h"
+#include "deps.h"
hunk ./lib/libalpm/conflict.c 37
+/* Returns a PMList* of missing_t pointers.
+ *
+ * conflicts are always name only
+ */
+PMList *checkconflicts(pmdb_t *db, PMList *packages)
+{
+	pmpkg_t *info = NULL;
+	PMList *i, *j, *k;
+	PMList *baddeps = NULL;
+	pmdepmissing_t *miss = NULL;
+
+	if(db == NULL) {
+		return(NULL);
+	}
+
+	for(i = packages; i; i = i->next) {
+		pmpkg_t *tp = i->data;
+		if(tp == NULL) {
+			continue;
+		}
+
+		for(j = tp->conflicts; j; j = j->next) {
+			if(!strcmp(tp->name, j->data)) {
+				/* a package cannot conflict with itself -- that's just not nice */
+				continue;
+			}
+			/* CHECK 1: check targets against database */
+			for(k = db_get_pkgcache(db); k; k = k->next) {
+				pmpkg_t *dp = (pmpkg_t *)k->data;
+				if(!strcmp(dp->name, tp->name)) {
+					/* a package cannot conflict with itself -- that's just not nice */
+					continue;
+				}
+				if(!strcmp(j->data, dp->name)) {
+					/* conflict */
+					_alpm_log(PM_LOG_DEBUG, "targs vs db: adding %s as a conflict for %s",
+					          dp->name, tp->name);
+					miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
+					if(!depmiss_isin(miss, baddeps)) {
+						baddeps = pm_list_add(baddeps, miss);
+					} else {
+						FREE(miss);
+					}
+				} else {
+					/* see if dp provides something in tp's conflict list */
+					PMList *m;
+					for(m = dp->provides; m; m = m->next) {
+						if(!strcmp(m->data, j->data)) {
+							/* confict */
+							_alpm_log(PM_LOG_DEBUG, "targs vs db: found %s as a conflict for %s",
+							          dp->name, tp->name);
+							miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
+							if(!depmiss_isin(miss, baddeps)) {
+								baddeps = pm_list_add(baddeps, miss);
+							} else {
+								FREE(miss);
+							}
+						}
+					}
+				}
+			}
+			/* CHECK 2: check targets against targets */
+			for(k = packages; k; k = k->next) {
+				pmpkg_t *otp = (pmpkg_t *)k->data;
+				if(!strcmp(otp->name, tp->name)) {
+					/* a package cannot conflict with itself -- that's just not nice */
+					continue;
+				}
+				if(!strcmp(otp->name, (char *)j->data)) {
+					/* otp is listed in tp's conflict list */
+					_alpm_log(PM_LOG_DEBUG, "targs vs targs: found %s as a conflict for %s",
+					          otp->name, tp->name);
+					miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
+					if(!depmiss_isin(miss, baddeps)) {
+						baddeps = pm_list_add(baddeps, miss);
+					} else {
+						FREE(miss);
+					}
+				} else {
+					/* see if otp provides something in tp's conflict list */ 
+					PMList *m;
+					for(m = otp->provides; m; m = m->next) {
+						if(!strcmp(m->data, j->data)) {
+							_alpm_log(PM_LOG_DEBUG, "targs vs targs: found %s as a conflict for %s",
+							          otp->name, tp->name);
+							miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
+							if(!depmiss_isin(miss, baddeps)) {
+								baddeps = pm_list_add(baddeps, miss);
+							} else {
+								FREE(miss);
+							}
+						}
+					}
+				}
+			}
+		}
+		/* CHECK 3: check database against targets */
+		for(k = db_get_pkgcache(db); k; k = k->next) {
+			info = k->data;
+			if(!strcmp(info->name, tp->name)) {
+				/* a package cannot conflict with itself -- that's just not nice */
+				continue;
+			}
+			for(j = info->conflicts; j; j = j->next) {
+				if(!strcmp((char *)j->data, tp->name)) {
+					_alpm_log(PM_LOG_DEBUG, "db vs targs: found %s as a conflict for %s",
+					          info->name, tp->name);
+					miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
+					if(!depmiss_isin(miss, baddeps)) {
+						baddeps = pm_list_add(baddeps, miss);
+					} else {
+						FREE(miss);
+					}
+				} else {
+					/* see if the db package conflicts with something we provide */
+					PMList *m;
+					for(m = info->conflicts; m; m = m->next) {
+						PMList *n;
+						for(n = tp->provides; n; n = n->next) {
+							if(!strcmp(m->data, n->data)) {
+								_alpm_log(PM_LOG_DEBUG, "db vs targs: adding %s as a conflict for %s",
+								          info->name, tp->name);
+								miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
+								if(!depmiss_isin(miss, baddeps)) {
+									baddeps = pm_list_add(baddeps, miss);
+								} else {
+									FREE(miss);
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	return(baddeps);
+}
+
hunk ./lib/libalpm/conflict.h 26
+PMList *checkconflicts(pmdb_t *db, PMList *packages);
hunk ./lib/libalpm/deps.c 40
+pmdepmissing_t *depmiss_new(const char *target, unsigned char type, unsigned char depmod,
+                            const char *depname, const char *depversion)
+{
+	pmdepmissing_t *miss;
+
+	miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t));
+	if(miss == NULL) {
+		return(NULL);
+	}
+
+	STRNCPY(miss->target, target, PKG_NAME_LEN);
+	miss->type = type;
+	miss->depend.mod = depmod;
+	STRNCPY(miss->depend.name, depname, PKG_NAME_LEN);
+	if(depversion) {
+		STRNCPY(miss->depend.version, depversion, PKG_VERSION_LEN);
+	} else {
+		miss->depend.version[0] = 0;
+	}
+
+	return(miss);
+}
+
+int depmiss_isin(pmdepmissing_t *needle, PMList *haystack)
+{
+	PMList *i;
+
+	for(i = haystack; i; i = i->next) {
+		pmdepmissing_t *miss = i->data;
+		if(!memcmp(needle, miss, sizeof(pmdepmissing_t))
+		   && !memcmp(&needle->depend, &miss->depend, sizeof(pmdepend_t))) {
+			return(1);
+		}
+	}
+
+	return(0);
+}
+
hunk ./lib/libalpm/deps.c 133
-						if(!pkg_isin(q, tmptargs)) {
+						if(!pkg_isin(q->name, tmptargs)) {
hunk ./lib/libalpm/deps.c 141
-			if(!pkg_isin(p, tmptargs)) {
+			if(!pkg_isin(p->name, tmptargs)) {
hunk ./lib/libalpm/deps.c 162
- * conflicts are always name only, but dependencies can include versions
- * with depmod operators.
+ * dependencies can include versions with depmod operators.
hunk ./lib/libalpm/deps.c 167
-	pmpkg_t *info = NULL;
hunk ./lib/libalpm/deps.c 200
-				if(pkg_isin(p, packages)) {
+				if(pkg_isin(p->name, packages)) {
hunk ./lib/libalpm/deps.c 241
-					MALLOC(miss, sizeof(pmdepmissing_t));
-					miss->type = PM_DEP_TYPE_REQUIRED;
-					miss->depend.mod = depend.mod;
-					STRNCPY(miss->target, p->name, PKG_NAME_LEN);
-					STRNCPY(miss->depend.name, depend.name, PKG_NAME_LEN);
-					STRNCPY(miss->depend.version, depend.version, PKG_VERSION_LEN);
-					if(!pm_list_is_in(miss, baddeps)) {
+					_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s as required by %s", depend.name, p->name);
+					miss = depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
+					if(!depmiss_isin(miss, baddeps)) {
hunk ./lib/libalpm/deps.c 253
+		/* DEPENDENCIES -- look for unsatisfied dependencies */
hunk ./lib/libalpm/deps.c 260
-			/* CONFLICTS */
-			for(j = tp->conflicts; j; j = j->next) {
-				if(!strcmp(tp->name, j->data)) {
-					/* a package cannot conflict with itself -- that's just not nice */
-					continue;
-				}
-				/* CHECK 1: check targets against database */
-				for(k = db_get_pkgcache(db); k; k = k->next) {
-					pmpkg_t *dp = (pmpkg_t *)k->data;
-					if(!strcmp(j->data, dp->name)) {
-						/* confict */
-						MALLOC(miss, sizeof(pmdepmissing_t));
-						miss->type = PM_DEP_TYPE_CONFLICT;
-						miss->depend.mod = PM_DEP_MOD_ANY;
-						miss->depend.version[0] = '\0';
-						STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
-						STRNCPY(miss->depend.name, dp->name, PKG_NAME_LEN);
-						if(!pm_list_is_in(miss, baddeps)) {
-							baddeps = pm_list_add(baddeps, miss);
-						} else {
-							FREE(miss);
-						}
-					} else {
-						/* see if dp provides something in tp's conflict list */
-						PMList *m;
-						for(m = dp->provides; m; m = m->next) {
-							if(!strcmp(m->data, j->data)) {
-								/* confict */
-								MALLOC(miss, sizeof(pmdepmissing_t));
-								miss->type = PM_DEP_TYPE_CONFLICT;
-								miss->depend.mod = PM_DEP_MOD_ANY;
-								miss->depend.version[0] = '\0';
-								STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
-								STRNCPY(miss->depend.name, dp->name, PKG_NAME_LEN);
-								if(!pm_list_is_in(miss, baddeps)) {
-									baddeps = pm_list_add(baddeps, miss);
-								} else {
-									FREE(miss);
-								}
-							}
-						}
-					}
-				}
-				/* CHECK 2: check targets against targets */
-				for(k = packages; k; k = k->next) {
-					pmpkg_t *a = (pmpkg_t *)k->data;
-					if(!strcmp(a->name, (char *)j->data)) {
-						MALLOC(miss, sizeof(pmdepmissing_t));
-						miss->type = PM_DEP_TYPE_CONFLICT;
-						miss->depend.mod = PM_DEP_MOD_ANY;
-						miss->depend.version[0] = '\0';
-						STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
-						STRNCPY(miss->depend.name, a->name, PKG_NAME_LEN);
-						if(!pm_list_is_in(miss, baddeps)) {
-							baddeps = pm_list_add(baddeps, miss);
-						} else {
-							FREE(miss);
-						}
-					}
-				}
-			}
-			/* CHECK 3: check database against targets */
-			for(k = db_get_pkgcache(db); k; k = k->next) {
-				info = k->data;
-				for(j = info->conflicts; j; j = j->next) {
-					if(!strcmp((char *)j->data, tp->name)) {
-						MALLOC(miss, sizeof(pmdepmissing_t));
-						miss->type = PM_DEP_TYPE_CONFLICT;
-						miss->depend.mod = PM_DEP_MOD_ANY;
-						miss->depend.version[0] = '\0';
-						STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
-						STRNCPY(miss->depend.name, info->name, PKG_NAME_LEN);
-						if(!pm_list_is_in(miss, baddeps)) {
-							baddeps = pm_list_add(baddeps, miss);
-						} else {
-							FREE(miss);
-						}
-					} else {
-						/* see if the db package conflicts with something we provide */
-						PMList *m;
-						for(m = info->conflicts; m; m = m->next) {
-							PMList *n;
-							for(n = tp->provides; n; n = n->next) {
-								if(!strcmp(m->data, n->data)) {
-									MALLOC(miss, sizeof(pmdepmissing_t));
-									miss->type = PM_DEP_TYPE_CONFLICT;
-									miss->depend.mod = PM_DEP_MOD_ANY;
-									miss->depend.version[0] = '\0';
-									STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
-									STRNCPY(miss->depend.name, info->name, PKG_NAME_LEN);
-									if(!pm_list_is_in(miss, baddeps)) {
-										baddeps = pm_list_add(baddeps, miss);
-									} else {
-										FREE(miss);
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-
-			/* DEPENDENCIES -- look for unsatisfied dependencies */
hunk ./lib/libalpm/deps.c 351
-					MALLOC(miss, sizeof(pmdepmissing_t));
-					miss->type = PM_DEP_TYPE_DEPEND;
-					miss->depend.mod = depend.mod;
-					STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
-					STRNCPY(miss->depend.name, depend.name, PKG_NAME_LEN);
-					STRNCPY(miss->depend.version, depend.version, PKG_VERSION_LEN);
-					if(!pm_list_is_in(miss, baddeps)) {
+					_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s as a dependency for %s",
+					          depend.name, tp->name);
+					miss = depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, depend.name, depend.version);
+					if(!depmiss_isin(miss, baddeps)) {
hunk ./lib/libalpm/deps.c 365
-			pmpkg_t *tp;
-			if(i->data == NULL) {
+			pmpkg_t *tp = i->data;
+			if(tp == NULL) {
hunk ./lib/libalpm/deps.c 369
-			tp = (pmpkg_t*)i->data;
+
hunk ./lib/libalpm/deps.c 372
-					MALLOC(miss, sizeof(pmdepmissing_t));
-					miss->type = PM_DEP_TYPE_REQUIRED;
-					miss->depend.mod = PM_DEP_MOD_ANY;
-					miss->depend.version[0] = '\0';
-					STRNCPY(miss->target, tp->name, PKG_NAME_LEN);
-					STRNCPY(miss->depend.name, (char *)j->data, PKG_NAME_LEN);
-					if(!pm_list_is_in(miss, baddeps)) {
+					_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s as required by %s", (char *)j->data, tp->name);
+					miss = depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED, PM_DEP_MOD_ANY, j->data, NULL);
+					if(!depmiss_isin(miss, baddeps)) {
hunk ./lib/libalpm/deps.c 465
+					/* wtf */
hunk ./lib/libalpm/deps.c 470
-			if(pkg_isin(dep, targs)) {
+			if(pkg_isin(dep->name, targs)) {
hunk ./lib/libalpm/deps.c 483
-				if(!pkg_isin(dummy, targs)) {
+				if(!pkg_isin(dummy->name, targs)) {
hunk ./lib/libalpm/deps.c 513
-int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list, PMList *trail, pmtrans_t *trans)
+int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
+                PMList *trail, pmtrans_t *trans, PMList **data)
hunk ./lib/libalpm/deps.c 516
-	PMList *i, *j, *k;
+	PMList *i, *j;
hunk ./lib/libalpm/deps.c 535
+		pmpkg_t *sync = NULL;
hunk ./lib/libalpm/deps.c 544
-		if(miss->type == PM_DEP_TYPE_DEPEND) {
-			pmpkg_t *sync = NULL;
-			int provisio_match = 0;
-
-			_alpm_log(PM_LOG_DEBUG, "resolving dependency %s", miss->depend.name);
hunk ./lib/libalpm/deps.c 545
-			/* check if one of the packages in *list already provides this dependency */
-			for(j = list; j; j = j->next) {
-				pmpkg_t *sp = (pmpkg_t*)j->data;
-				for(k = sp->provides; k; k = k->next) {
-					if(!strcmp(miss->depend.name, k->data)) {
-						_alpm_log(PM_LOG_DEBUG, "%s provides dependency %s -- skipping", sp->name, miss->depend.name);
-						provisio_match = 1;
-					}
-				}
-			}
-			if(provisio_match) {
-				continue;
+		/* check if one of the packages in *list already provides this dependency */
+		for(j = list; j && !found; j = j->next) {
+			pmpkg_t *sp = (pmpkg_t *)j->data;
+			if(pm_list_is_strin(miss->depend.name, sp->provides)) {
+				_alpm_log(PM_LOG_DEBUG, "%s provides dependency %s -- skipping",
+				          sp->name, miss->depend.name);
+				found = 1;
hunk ./lib/libalpm/deps.c 553
+		}
+		if(found) {
+			continue;
+		}
hunk ./lib/libalpm/deps.c 558
-			/* find the package in one of the repositories */
-			/* check literals */
-			for(j = dbs_sync; !sync && j; j = j->next) {
-				PMList *k;
-				pmdb_t *dbs = j->data;
-				for(k = db_get_pkgcache(dbs); !sync && k; k = k->next) {
-					pmpkg_t *pkg = k->data;
-					if(!strcmp(miss->depend.name, pkg->name)) {
-						sync = pkg;
-					}
-				}
-			}
-			/* check provides */
-			for(j = dbs_sync; !sync && j; j = j->next) {
-				PMList *provides;
-				pmdb_t *dbs = j->data;
-				provides = _alpm_db_whatprovides(dbs, miss->depend.name);
-				if(provides) {
-					sync = provides->data;
-				}
-				FREELISTPTR(provides);
-			}
-			if(sync == NULL) {
-				_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\" (\"%s\" is not in the package set)",
-				          miss->target, miss->depend.name);
-				pm_errno = PM_ERR_UNRESOLVABLE_DEPS;
-				goto error;
+		/* find the package in one of the repositories */
+		/* check literals */
+		for(j = dbs_sync; !sync && j; j = j->next) {
+			sync = db_get_pkgfromcache(j->data, miss->depend.name);
+		}
+		/* check provides */
+		for(j = dbs_sync; !sync && j; j = j->next) {
+			PMList *provides;
+			provides = _alpm_db_whatprovides(j->data, miss->depend.name);
+			if(provides) {
+				sync = provides->data;
hunk ./lib/libalpm/deps.c 570
-			found = 0;
-			for(j = list; j && !found; j = j->next) {
-				pmpkg_t *tmp = j->data;
-				if(tmp && !strcmp(tmp->name, sync->name)) {
-					_alpm_log(PM_LOG_DEBUG, "dependency %s is already in the target list - skipping",
-					          sync->name);
-					found = 1;
+			FREELISTPTR(provides);
+		}
+		if(sync == NULL) {
+			_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\" (\"%s\" is not in the package set)",
+			          miss->target, miss->depend.name);
+			if(data) {
+				if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+					FREELIST(*data);
+					pm_errno = PM_ERR_MEMORY;
+					goto error;
hunk ./lib/libalpm/deps.c 581
+				*miss = *(pmdepmissing_t *)i->data;
+				*data = pm_list_add(*data, miss);
hunk ./lib/libalpm/deps.c 584
-			if(found) {
-				/* this dep is already in the target list */
-				continue;
-			}
+			pm_errno = PM_ERR_UNSATISFIED_DEPS;
+			goto error;
+		}
+		if(pkg_isin(sync->name, list)) {
+			/* this dep is already in the target list */
+			_alpm_log(PM_LOG_DEBUG, "dependency %s is already in the target list -- skipping",
+			          sync->name);
+			continue;
+		}
hunk ./lib/libalpm/deps.c 594
-			found = 0;
-			for(j = trail; j; j = j->next) {
-				pmpkg_t *tmp = j->data;
-				if(tmp && !strcmp(tmp->name, sync->name)) {
-					found = 1;
-				}
+		if(!pkg_isin(sync->name, trail)) {
+			/* check pmo_ignorepkg and pmo_s_ignore to make sure we haven't pulled in
+			 * something we're not supposed to.
+			 */
+			int usedep = 1;
+			if(pm_list_is_strin(sync->name, handle->ignorepkg)) {
+				pmpkg_t *dummypkg = pkg_new(miss->target, NULL);
+				QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep);
+				FREEPKG(dummypkg);
hunk ./lib/libalpm/deps.c 604
-			if(!found) {
-				/* check pmo_ignorepkg and pmo_s_ignore to make sure we haven't pulled in
-				 * something we're not supposed to.
-				 */
-				int usedep = 1;
-				found = 0;
-				for(j = handle->ignorepkg; j && !found; j = j->next) {
-					if(!strcmp(j->data, sync->name)) {
-						found = 1;
-					}
-				}
-				if(found) {
-					pmpkg_t *dummypkg = pkg_new(miss->target, NULL);
-					QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep);
-					FREEPKG(dummypkg);
+			if(usedep) {
+				trail = pm_list_add(trail, sync);
+				if(resolvedeps(local, dbs_sync, sync, list, trail, trans, data)) {
+					goto error;
hunk ./lib/libalpm/deps.c 609
-				if(usedep) {
-					trail = pm_list_add(trail, sync);
-					if(resolvedeps(local, dbs_sync, sync, list, trail, trans)) {
+				_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)",
+				          sync->name, syncpkg->name);
+				list = pm_list_add(list, sync);
+			} else {
+				_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\"", miss->target);
+				if(data) {
+					if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+						FREELIST(*data);
+						pm_errno = PM_ERR_MEMORY;
hunk ./lib/libalpm/deps.c 620
-					_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)",
-					          sync->name, syncpkg->name);
-					list = pm_list_add(list, sync);
-				} else {
-					_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\"", miss->target);
-					pm_errno = PM_ERR_UNRESOLVABLE_DEPS;
-					goto error;
+					*miss = *(pmdepmissing_t *)i->data;
+					*data = pm_list_add(*data, miss);
hunk ./lib/libalpm/deps.c 623
-			} else {
-				/* cycle detected -- skip it */
-				_alpm_log(PM_LOG_DEBUG, "dependency cycle detected: %s", sync->name);
+				pm_errno = PM_ERR_UNSATISFIED_DEPS;
+				goto error;
hunk ./lib/libalpm/deps.c 626
+		} else {
+			/* cycle detected -- skip it */
+			_alpm_log(PM_LOG_DEBUG, "dependency cycle detected: %s", sync->name);
hunk ./lib/libalpm/deps.h 39
+pmdepmissing_t *depmiss_new(const char *target, unsigned char type, unsigned char depmod,
+                            const char *depname, const char *depversion);
+int depmiss_isin(pmdepmissing_t *needle, PMList *haystack);
hunk ./lib/libalpm/deps.h 46
-int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list, PMList *trail, pmtrans_t *trans);
+int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
+                PMList *trail, pmtrans_t *trans, PMList **data);
hunk ./lib/libalpm/error.c 60
-		/* Cache */
-		case PM_ERR_CACHE_NULL:
-			return "cache not initialized";
hunk ./lib/libalpm/error.c 107
-		case PM_ERR_UNRESOLVABLE_DEPS:
-			return "could not resolve dependencies";
hunk ./lib/libalpm/group.c 32
-	pmgrp_t* grp = NULL;
+	pmgrp_t* grp;
hunk ./lib/libalpm/handle.c 58
+#ifndef FAKEROOT
hunk ./lib/libalpm/handle.c 63
+#endif
hunk ./lib/libalpm/handle.c 66
+#ifndef FAKEROOT
hunk ./lib/libalpm/handle.c 68
+#else
+	if(handle->uid == 0) {
+#endif
hunk ./lib/libalpm/package.c 381
- *
- * returns:  0 for no match
- *           1 for identical match
- *          -1 for name-only match (version mismatch)
hunk ./lib/libalpm/package.c 382
-int pkg_isin(pmpkg_t *needle, PMList *haystack)
+pmpkg_t *pkg_isin(char *needle, PMList *haystack)
hunk ./lib/libalpm/package.c 387
-		return(0);
+		return(NULL);
hunk ./lib/libalpm/package.c 393
-		if(info && !strcmp(info->name, needle->name)) {
-			if(!strcmp(info->version, needle->version)) {
-				return(1);
-			}
-			return(-1);
+		if(info && !strcmp(info->name, needle)) {
+			return(lp->data);
hunk ./lib/libalpm/package.c 397
-	return(0);
+	return(NULL);
hunk ./lib/libalpm/package.h 97
-int pkg_isin(pmpkg_t *needle, PMList *haystack);
+pmpkg_t *pkg_isin(char *needle, PMList *haystack);
hunk ./lib/libalpm/remove.c 59
-	_alpm_log(PM_LOG_FLOW2, "loading target %s", name);
+	if(pkg_isin(name, trans->packages)) {
+		RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
+	}
+
hunk ./lib/libalpm/remove.c 68
-	if(pkg_isin(info, trans->packages)) {
-		FREEPKG(info);
-		RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
-	}
-
+	_alpm_log(PM_LOG_FLOW2, "adding %s in the targets list", info->name);
hunk ./lib/libalpm/remove.c 85
-		if((lp = checkdeps(db, trans->type, trans->packages)) != NULL) {
+		lp = checkdeps(db, trans->type, trans->packages);
+		if(lp != NULL) {
hunk ./lib/libalpm/remove.c 89
-					PMList *j;
-					for(j = lp; j; j = j->next) {
-						pmdepmissing_t* miss = (pmdepmissing_t*)j->data;
-						pmpkg_t *info = db_get_pkgfromcache(db, miss->depend.name);
-						if(!pkg_isin(info, trans->packages)) {
-							info = db_scan(db, miss->depend.name, INFRQ_ALL);
+					PMList *i;
+					for(i = lp; i; i = i->next) {
+						pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
+						pmpkg_t *info = db_scan(db, miss->depend.name, INFRQ_ALL);
+						if(info) {
+							_alpm_log(PM_LOG_FLOW2, "pulling %s in the targets list", info->name);
hunk ./lib/libalpm/remove.c 96
+						} else {
+							_alpm_log(PM_LOG_ERROR, "could not find %s in database -- skipping",
+							          miss->depend.name);
hunk ./lib/libalpm/remove.c 107
+				} else {
+					FREELIST(lp);
hunk ./lib/libalpm/remove.c 208
-						_alpm_log(PM_LOG_FLOW2, "skipping removal of %s as it has moved to another package\n", file);
+						_alpm_log(PM_LOG_FLOW2, "skipping removal of %s as it has moved to another package",
+						          file);
hunk ./lib/libalpm/remove.c 253
-			_alpm_log(PM_LOG_ERROR, "could not remove database entry %s/%s-%s", db->treename, info->name, info->version);
+			_alpm_log(PM_LOG_ERROR, "could not remove database entry %s-%s", info->name, info->version);
hunk ./lib/libalpm/remove.c 265
-
hunk ./lib/libalpm/remove.c 268
-
+			/* if this dependency is in the transaction targets, no need to update 
+			 * its requiredby info: it is in the process of being removed (if not 
+			 * already done!)
+			 */
+			if(pkg_isin(depend.name, trans->packages)) {
+				continue;
+			}
hunk ./lib/libalpm/remove.c 286
-					if(depinfo == NULL) {
-						/* wtf */
-						continue;
-					}
-				} else {
+				}
+				if(depinfo == NULL) {
+					_alpm_log(PM_LOG_ERROR, "could not find dependency %s", depend.name);
+					/* wtf */
hunk ./lib/libalpm/remove.c 298
-				_alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s/%s-%s", db->treename, depinfo->name, depinfo->version);
+				_alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s-%s",
+				          depinfo->name, depinfo->version);
hunk ./lib/libalpm/sync.c 40
+#include "conflict.h"
hunk ./lib/libalpm/sync.c 84
-static pmsyncpkg_t* find_pkginsync(char *needle, PMList *haystack)
+static pmsyncpkg_t *find_pkginsync(char *needle, PMList *haystack)
hunk ./lib/libalpm/sync.c 126
-	/* readdir tmp_dir */
+	/* ORE - readdir tmp_dir */
hunk ./lib/libalpm/sync.c 128
+	/* then db_write it */
hunk ./lib/libalpm/sync.c 149
+	_alpm_log(PM_LOG_FLOW1, "checking for package replacements");
hunk ./lib/libalpm/sync.c 155
-				_alpm_log(PM_LOG_DEBUG, "looking replacement %s for package %s", k->data, spkg->name);
hunk ./lib/libalpm/sync.c 158
+						_alpm_log(PM_LOG_DEBUG, "checking replacement %s for package %s", k->data, spkg->name);
hunk ./lib/libalpm/sync.c 191
-									sync->data = pm_list_add(sync->data, dummy);
+									sync->data = pm_list_add(NULL, dummy);
hunk ./lib/libalpm/sync.c 194
-								_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (to be replaced by %s-%s)",
+								_alpm_log(PM_LOG_FLOW2, "%s-%s elected for upgrade (to be replaced by %s-%s)",
hunk ./lib/libalpm/sync.c 206
+	_alpm_log(PM_LOG_FLOW1, "checking for package upgrades");
hunk ./lib/libalpm/sync.c 215
-			for(k = db_get_pkgcache(j->data); !spkg && k; k = k->next) {
-				pmpkg_t *sp = k->data;
-				if(!strcmp(local->name, sp->name)) {
-					spkg = sp;
-				}
-			}
+			spkg = db_get_pkgfromcache(j->data, local->name);
hunk ./lib/libalpm/sync.c 218
-			/*_alpm_log(PM_LOG_ERROR, "%s: not found in sync db -- skipping.", local->name);*/
+			_alpm_log(PM_LOG_DEBUG, "%s: not found in sync db -- skipping", local->name);
hunk ./lib/libalpm/sync.c 243
-			_alpm_log(PM_LOG_FLOW1, "%s-%s: local version is newer",
+			_alpm_log(PM_LOG_WARNING, "%s-%s: local version is newer",
hunk ./lib/libalpm/sync.c 249
-			_alpm_log(PM_LOG_FLOW1, "%s-%s: ignoring package upgrade (%s)",
+			_alpm_log(PM_LOG_WARNING, "%s-%s: ignoring package upgrade (%s)",
hunk ./lib/libalpm/sync.c 263
-			_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (%s => %s)",
+			_alpm_log(PM_LOG_FLOW2, "%s-%s elected for upgrade (%s => %s)",
hunk ./lib/libalpm/sync.c 399
-			_alpm_log(PM_LOG_DEBUG, "resolving dependencies for package %s", spkg->name);
-			if(resolvedeps(db_local, dbs_sync, spkg, list, trail, trans) == -1) {
+			if(resolvedeps(db_local, dbs_sync, spkg, list, trail, trans, data) == -1) {
hunk ./lib/libalpm/sync.c 409
-				/* ORE - the trans->packages list should be sorted to stay compatible with
-				 * pacman 2.x */
hunk ./lib/libalpm/sync.c 460
+
+		_alpm_log(PM_LOG_FLOW1, "looking for unresolvable dependencies");
hunk ./lib/libalpm/sync.c 464
-			int errorout = 0;
-			_alpm_log(PM_LOG_FLOW1, "looking for unresolvable dependencies");
-			for(i = deps; i; i = i->next) {
-				pmdepmissing_t *miss = i->data;
-				if(miss->type == PM_DEP_TYPE_DEPEND || miss->type == PM_DEP_TYPE_REQUIRED) {
-					if(!errorout) {
-						errorout = 1;
-					}
-					if(data) {
-						if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
-							FREELIST(*data);
-							pm_errno = PM_ERR_MEMORY;
-							goto error;
-						}
-						*miss = *(pmdepmissing_t *)i->data;
-						*data = pm_list_add(*data, miss);
-					}
-				}
-			}
-			if(errorout) {
-				pm_errno = PM_ERR_UNSATISFIED_DEPS;
-				goto error;
+			if(data) {
+				*data = deps;
+				deps = NULL;
hunk ./lib/libalpm/sync.c 468
+			pm_errno = PM_ERR_UNSATISFIED_DEPS;
+			goto error;
+		}
+
+		/* no unresolvable deps, so look for conflicts */
+		_alpm_log(PM_LOG_FLOW1, "looking for conflicts");
+		deps = checkconflicts(db_local, list);
+		if(deps) {
+			int errorout = 0;
hunk ./lib/libalpm/sync.c 478
-			/* no unresolvable deps, so look for conflicts */
-			_alpm_log(PM_LOG_FLOW1, "looking for conflicts");
hunk ./lib/libalpm/sync.c 480
-				PMList *k;
hunk ./lib/libalpm/sync.c 481
+				pmsyncpkg_t *sync;
+				pmpkg_t *local;
hunk ./lib/libalpm/sync.c 484
-				if(miss->type != PM_DEP_TYPE_CONFLICT) {
-					continue;
-				}
-
-				_alpm_log(PM_LOG_DEBUG, "package %s is conflicting with %s",
+				_alpm_log(PM_LOG_FLOW2, "package %s is conflicting with %s",
hunk ./lib/libalpm/sync.c 491
-					pmsyncpkg_t *sync = j->data;
+					sync = j->data;
hunk ./lib/libalpm/sync.c 493
-						for(k = sync->data; k && !found; k = k->next) {
-							pmpkg_t *p = k->data;
-							if(!strcmp(p->name, miss->depend.name)) {
-								_alpm_log(PM_LOG_DEBUG, "%s is already elected for removal -- skipping",
-								          miss->depend.name);
-								found = 1;
-							}
+						if(pkg_isin(miss->depend.name, sync->data)) {
+							found = 1;
hunk ./lib/libalpm/sync.c 498
+				if(found) {
+					_alpm_log(PM_LOG_DEBUG, "%s is already elected for removal -- skipping",
+							miss->depend.name);
+					continue;
+				}
hunk ./lib/libalpm/sync.c 504
-				/* if we didn't find it in any sync->replaces lists, then it's a conflict */
-				if(!found) {
-					int solved = 0;
-					pmsyncpkg_t *sync = find_pkginsync(miss->target, trans->packages);
-					for(j = sync->pkg->provides; j && j->data && !solved; j = j->next) {
-						if(!strcmp(j->data, miss->depend.name)) {
-							/* this package also "provides" the package it's conflicting with,
-							 * so just treat it like a "replaces" item so the REQUIREDBY
-							 * fields are inherited properly.
-							 */
-							if(db_get_pkgfromcache(db_local, miss->depend.name) == NULL) {
-								char *rmpkg = NULL;
-								/* hmmm, depend.name isn't installed, so it must be conflicting
-								 * with another package in our final list.  For example:
-								 *
-								 *     pacman -S blackbox xfree86
-								 *
-								 * If no x-servers are installed and blackbox pulls in xorg, then
-								 * xorg and xfree86 will conflict with each other.  In this case,
-								 * we should follow the user's preference and rip xorg out of final,
-								 * opting for xfree86 instead.
-								 */
+				sync = find_pkginsync(miss->target, trans->packages);
+				local = db_get_pkgfromcache(db_local, miss->depend.name);
+				/* check if this package also "provides" the package it's conflicting with
+				 */
+				if(pm_list_is_strin(miss->depend.name, sync->pkg->provides)) {
+					/* so just treat it like a "replaces" item so the REQUIREDBY
+					 * fields are inherited properly.
+					 */
+					if(local) {
+						/* nothing to do for now: it will be handled later
+						 * (not the same behavior as in pacman 2.x) */
+					} else {
+						char *rmpkg = NULL;
+						/* hmmm, depend.name isn't installed, so it must be conflicting
+						 * with another package in our final list.  For example:
+						 *
+						 *     pacman -S blackbox xfree86
+						 *
+						 * If no x-servers are installed and blackbox pulls in xorg, then
+						 * xorg and xfree86 will conflict with each other.  In this case,
+						 * we should follow the user's preference and rip xorg out of final,
+						 * opting for xfree86 instead.
+						 */
hunk ./lib/libalpm/sync.c 528
-								/* figure out which one was requested in targets.  If they both were,
-								 * then it's still an unresolvable conflict. */
-								if(pm_list_is_strin(miss->depend.name, trans->targets)
-								   && !pm_list_is_strin(miss->target, trans->targets)) {
-									/* remove miss->target */
-									rmpkg = strdup(miss->target);
-								} else if(pm_list_is_strin(miss->target, trans->targets)
-								          && !pm_list_is_strin(miss->depend.name, trans->targets)) {
-									/* remove miss->depend.name */
-									rmpkg = strdup(miss->depend.name);
-								} else {
-									/* something's not right, bail out with a conflict error */
-								}
-								if(rmpkg) {
-									for(k= trans->packages; k; k=k->next) {
-										pmsyncpkg_t *sync = k->data;
-										if(!strcmp(sync->pkg->name, rmpkg)) {
-											pmsyncpkg_t *spkg;
-											trans->packages = _alpm_list_remove(trans->packages, sync, ptr_cmp, (void **)&spkg);
-											FREESYNC(spkg);
-											_alpm_log(PM_LOG_DEBUG, "removing %s from target list", rmpkg);
-											/* ORE - shouldn't "solved" be set to 1 here */
-										}
-									}
-									solved = 1;
-									FREE(rmpkg);
-								}
-							}
+						/* figure out which one was requested in targets.  If they both were,
+						 * then it's still an unresolvable conflict. */
+						if(pm_list_is_strin(miss->depend.name, trans->targets)
+								&& !pm_list_is_strin(miss->target, trans->targets)) {
+							/* remove miss->target */
+							rmpkg = strdup(miss->target);
+						} else if(pm_list_is_strin(miss->target, trans->targets)
+								&& !pm_list_is_strin(miss->depend.name, trans->targets)) {
+							/* remove miss->depend.name */
+							rmpkg = strdup(miss->depend.name);
+						} else {
+							/* something's not right, bail out with a conflict error */
+						}
+						if(rmpkg) {
+							pmsyncpkg_t *rsync = find_pkginsync(rmpkg, trans->packages);
+							pmsyncpkg_t *spkg;
+							_alpm_log(PM_LOG_DEBUG, "removing %s from target list", rmpkg);
+							trans->packages = _alpm_list_remove(trans->packages, rsync, ptr_cmp, (void **)&spkg);
+							FREESYNC(spkg);
+							FREE(rmpkg);
+							continue;
hunk ./lib/libalpm/sync.c 551
-					if(!solved) {
-						/* It's a conflict -- see if they want to remove it
-						 */
-
-						_alpm_log(PM_LOG_DEBUG, "resolving package %s conflict", miss->target);
-
-						if(db_get_pkgfromcache(db_local, miss->depend.name)) {
-							int doremove = 0;
-							if(!pm_list_is_strin(miss->depend.name, asked)) {
-								QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &doremove);
-								asked = pm_list_add(asked, strdup(miss->depend.name));
-								if(doremove) {
-									/* remove miss->depend.name */
-									k=_alpm_list_new();
-									pmpkg_t *q = pkg_new(miss->depend.name, NULL);
-									k = pm_list_add(k, q);
-									for(l = trans->packages; l; l=l->next) {
-										pmsyncpkg_t *s = l->data;
-										if(!strcmp(s->pkg->name, miss->target)) {
-											s->data = k;
-											s->type = PM_SYNC_TYPE_REPLACE;
-										}
-									}
-								} else {
-									/* abort */
-									_alpm_log(PM_LOG_ERROR, "package conflicts detected");
-									errorout=1;
-									if(data) {
-										if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
-											FREELIST(*data);
-											pm_errno = PM_ERR_MEMORY;
-											goto error;
-										}
-										*miss = *(pmdepmissing_t *)i->data;
-										*data = pm_list_add(*data, miss);
-									}
+				}
+				/* It's a conflict -- see if they want to remove it
+				*/
+				_alpm_log(PM_LOG_DEBUG, "resolving package %s conflict", miss->target);
+				if(local) {
+					int doremove = 0;
+					if(!pm_list_is_strin(miss->depend.name, asked)) {
+						QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &doremove);
+						asked = pm_list_add(asked, strdup(miss->depend.name));
+							if(doremove) {
+								/* remove miss->depend.name */
+								pmpkg_t *q = pkg_new(miss->depend.name, NULL);
+								q->requiredby = _alpm_list_strdup(local->requiredby);
+								if(sync->type != PM_SYNC_TYPE_REPLACE) {
+									/* switch this sync type to REPLACE */
+									sync->type = PM_SYNC_TYPE_REPLACE;
+									FREEPKG(sync->data);
hunk ./lib/libalpm/sync.c 569
-							}
+								/* append to the replaces list */
+								sync->data = pm_list_add(sync->data, q);
hunk ./lib/libalpm/sync.c 572
-							_alpm_log(PM_LOG_ERROR, "%s conflicts with %s", miss->target, miss->depend.name);
+							/* abort */
+							_alpm_log(PM_LOG_ERROR, "unresolvable package conflicts detected");
hunk ./lib/libalpm/sync.c 586
+				} else {
+					_alpm_log(PM_LOG_ERROR, "%s conflicts with %s", miss->target, miss->depend.name);
+					errorout = 1;
+					if(data) {
+						if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+							FREELIST(*data);
+							pm_errno = PM_ERR_MEMORY;
+							goto error;
+						}
+						*miss = *(pmdepmissing_t *)i->data;
+						*data = pm_list_add(*data, miss);
+					}
hunk ./lib/libalpm/sync.c 638
-				if(data) {
-					*data = deps;
+				int errorout = 0;
+				for(i = deps; i; i = i->next) {
+					pmdepmissing_t *miss = i->data;
+					if(!find_pkginsync(miss->depend.name, trans->packages)) {
+						if(!errorout) {
+							errorout = 1;
+						}
+						if(data) {
+							if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+								FREELIST(*data);
+								pm_errno = PM_ERR_MEMORY;
+								goto error;
+							}
+							*miss = *(pmdepmissing_t *)i->data;
+							*data = pm_list_add(*data, miss);
+						}
+					}
hunk ./lib/libalpm/sync.c 656
-				pm_errno = PM_ERR_UNSATISFIED_DEPS;
-				goto error;
+				if(errorout) {
+					pm_errno = PM_ERR_UNSATISFIED_DEPS;
+					goto error;
+				}
+				FREELIST(deps);
hunk ./lib/libalpm/sync.c 754
-				if(!pkg_isin(pkg, tr->packages)) {
+				if(!pkg_isin(pkg->name, tr->packages)) {
hunk ./lib/libalpm/sync.c 852
-								_alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s/%s-%s", db_local->treename, new->name, new->version);
+								_alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s-%s",
+								          new->name, new->version);
hunk ./lib/libalpm/sync.c 861
-					_alpm_log(PM_LOG_ERROR, "could not update new database entry %s/%s-%s", db_local->treename, new->name, new->version);
+					_alpm_log(PM_LOG_ERROR, "could not update new database entry %s-%s",
+					          new->name, new->version);
hunk ./scripts/gensync 23
-myver='2.9.7'
+myver='2.9.8'
hunk ./scripts/gensync 61
+check_option() {
+	local i
+	for i in ${options[@]}; do
+		local uc=`echo $i | tr [:lower:] [:upper:]`
+		local lc=`echo $i | tr [:upper:] [:lower:]`
+		if [ "$uc" = "$1" -o "$lc" = "$1" ]; then
+			echo $1
+			return
+		fi
+	done
+}
+
hunk ./scripts/gensync 139
-	if [ "$force" = "y" -o "$force" = "Y" ]; then
+	if [ "$force" = "y" -o "$force" = "Y" -o "`check_option FORCE`" ]; then
hunk ./scripts/gensync 219
-	unset groups replaces provides depends rodepends conflicts
+	unset groups replaces provides depends rodepends conflicts options
hunk ./scripts/makepkg 23
-myver='2.9.7'
+myver='2.9.8'
hunk ./scripts/makepkg 28
+# Options
+BUILDSCRIPT="./FrugalBuild"
+CLEANUP=0
+CLEANCACHE=0
+DEP_BIN=0
+DEP_SRC=0
+DEP_SUDO=0
+FORCE=0
+GENSHA1=0
+GENMD5=0
+INSTALL=0
+DOWNLOAD=""
+NOLASTMOD=0
+NOBUILD=0
+NOCCACHE=0
+NODEPS=0
+NOEXTRACT=0
+NOSTRIP=0
+RMDEPS=0
+CHROOT=0
+LOGGING=0
+NOUP2DATE=0
+GZIP=0
+
hunk ./scripts/makepkg 108
+check_option() {
+	local i
+	for i in ${options[@]}; do
+		local uc=`echo $i | tr [:lower:] [:upper:]`
+		local lc=`echo $i | tr [:upper:] [:lower:]`
+		if [ "$uc" = "$1" -o "$lc" = "$1" ]; then
+			echo $1
+			return
+		fi
+	done
+}
+
hunk ./scripts/makepkg 447
-# Options
-BUILDSCRIPT="./FrugalBuild"
-CLEANUP=0
-CLEANCACHE=0
-DEP_BIN=0
-DEP_SRC=0
-DEP_SUDO=0
-FORCE=0
-GENSHA1=0
-GENMD5=0
-INSTALL=0
-DOWNLOAD=""
-NOLASTMOD=0
-NOBUILD=0
-NOCCACHE=0
-NODEPS=0
-NOEXTRACT=0
-NOSTRIP=0
-RMDEPS=0
-CHROOT=0
-LOGGING=0
-NOUP2DATE=0
-GZIP=0
-
hunk ./scripts/makepkg 560
-unset rodepends
+unset rodepends options
hunk ./scripts/makepkg 1149
-mkdir -p pkg/usr/share/doc/$pkgname-$pkgver
-for i in `find src -maxdepth 2 -name ANNOUNCE -o -name AUTHORS -o -name *BUGS* -o -name CHANGES -o -name CONFIGURATION -o -name *COPYING* -o -name *COPYRIGHT* -o -name CREDITS -o -name ChangeLog -o -name Changelog -o -name CHANGELOG -o -name CONTRIBUTORS -o -name *FAQ* -o -name FEATURES -o -name FILES -o -name HACKING -o -name History -o -name HISTORY -o -name INSTALL* -o -name LICENSE -o -name LSM -o -name MANIFEST -o -name NEWS -o -name *README* -o -name *Readme* -o -name SITES -o -name *RELEASE* -o -name RELNOTES -o -name THANKS -o -name TIPS -o -name TODO -o -name VERSION -o -name CONFIGURATION* -o -name GPLLicense`
-do
-	cp -a $i pkg/usr/share/doc/$pkgname-$pkgver/
-done
+if [ ! "`check_option NODOCS`" -a "$NODOCS" = "0" ]; then
+	mkdir -p pkg/usr/share/doc/$pkgname-$pkgver
+	for i in `find src -maxdepth 2 -name ANNOUNCE -o -name AUTHORS -o -name *BUGS* -o -name CHANGES -o -name CONFIGURATION -o -name *COPYING* -o -name *COPYRIGHT* -o -name CREDITS -o -name ChangeLog -o -name Changelog -o -name CHANGELOG -o -name CONTRIBUTORS -o -name *FAQ* -o -name FEATURES -o -name FILES -o -name HACKING -o -name History -o -name HISTORY -o -name INSTALL* -o -name LICENSE -o -name LSM -o -name MANIFEST -o -name NEWS -o -name *README* -o -name *Readme* -o -name SITES -o -name *RELEASE* -o -name RELNOTES -o -name THANKS -o -name TIPS -o -name TODO -o -name VERSION -o -name CONFIGURATION* -o -name GPLLicense`
+	do
+		cp -a $i pkg/usr/share/doc/$pkgname-$pkgver/
+	done
+fi
hunk ./scripts/makepkg 1205
-if [ "$NOSTRIP" = "0" ]; then
+if [ ! "`check_option NOSTRIP`" -a "$NOSTRIP" = "0" ]; then
hunk ./scripts/updatesync 24
-myver='2.9.7'
+myver='2.9.8'
hunk ./scripts/updatesync 64
+check_option() {
+	local i
+	for i in ${options[@]}; do
+		local uc=`echo $i | tr [:lower:] [:upper:]`
+		local lc=`echo $i | tr [:upper:] [:lower:]`
+		if [ "$uc" = "$1" -o "$lc" = "$1" ]; then
+			echo $1
+			return
+		fi
+	done
+}
+
hunk ./scripts/updatesync 143
-	if [ "$force" = "y" -o "$force" = "Y" ]; then
+	if [ "$force" = "y" -o "$force" = "Y" -o "`check_option FORCE`" ]; then
hunk ./scripts/updatesync 245
-		unset groups replaces provides depends rodepends conflicts
+		unset groups replaces provides depends rodepends conflicts options
hunk ./scripts/updatesync 247
-		unset subdepends subrodepends subremoves subconflicts
+		unset subdepends subrodepends subremoves subconflicts suboptions
hunk ./scripts/updatesync 255
-				unset pkgdesc groups replaces force depends rodepends conflicts provides
+				unset pkgdesc groups replaces force depends rodepends conflicts provides options
hunk ./scripts/updatesync 264
+				options="${suboptions[$i]}"
hunk ./src/pacman/add.c 73
-			return(1);
+			goto error;
hunk ./src/pacman/add.c 111
-					MSG(NL, ":: %s\n", (char *)alpm_list_getdata(i));
+					MSG(NL, ":: %s", (char *)alpm_list_getdata(i));
hunk ./src/pacman/add.c 119
-		alpm_trans_release();
-		return(1);
+		goto error;
hunk ./src/pacman/add.c 126
-		return(1);
+		goto error;
hunk ./src/pacman/add.c 130
+
+error:
+	if(alpm_trans_release() == -1) {
+		ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno));
+	}
+	return(1);
hunk ./src/pacman/deptest.c 98
-
+		/* return 126 = deps were missing, but successfully resolved
+		 * return 127 = deps were missing, and failed to resolve; OR
+		 *            = deps were missing, but no resolution was attempted; OR
+		 *            = unresolvable conflicts were found
+		 */
hunk ./src/pacman/download.c 367
-								if(mtime2) {								
+								if(mtime2) {
hunk ./src/pacman/download.c 565
-		list_t *files = NULL;
+		list_t *files;
hunk ./src/pacman/download.c 577
-		files = list_add(files, fn);
+		files = list_add(NULL, fn);
hunk ./src/pacman/download.c 579
-			fprintf(stderr, "error: failed to download %s\n", target);
+			ERR(NL, "failed to download %s\n", target);
hunk ./src/pacman/download.c 582
-		files->data = NULL;
-		FREELIST(files);
+		FREELISTPTR(files);
hunk ./src/pacman/pacman.c 104
+#ifndef FAKEROOT
hunk ./src/pacman/pacman.c 109
+#endif
hunk ./src/pacman/pacman.c 358
-			case 'g': config->group = 1; break;
+			case 'g': config->group++; break;
hunk ./src/pacman/pacman.c 394
-			case 'y': config->op_s_sync = 1; break;
+			case 'y': config->op_s_sync++; break;
hunk ./src/pacman/remove.c 99
-					MSG(NL, "  %s: is required by %s\n", alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
+					MSG(NL, "  %s: is required by %s\n", alpm_dep_getinfo(miss, PM_DEP_TARGET),
+					    alpm_dep_getinfo(miss, PM_DEP_NAME));
hunk ./src/pacman/remove.c 115
+		i = NULL;
hunk ./src/pacman/remove.c 121
-		list_free(i);
+		FREELIST(i);
hunk ./src/pacman/sync.c 155
-static int sync_synctree(list_t *syncs)
+static int sync_synctree(int level, list_t *syncs)
hunk ./src/pacman/sync.c 184
-		if(strlen(newmtime)) {
-			vprint("sync: new mtime for %s: %s\n", sync->treename, newmtime);
-		}
hunk ./src/pacman/sync.c 191
+			if(strlen(newmtime)) {
+				vprint("sync: new mtime for %s: %s\n", sync->treename, newmtime);
+			}
hunk ./src/pacman/sync.c 197
-					ERR(NL, "failed to synchronize %s (%s)\n", sync->treename, alpm_strerror(pm_errno));
+					ERR(NL, "failed to update %s (%s)\n", sync->treename, alpm_strerror(pm_errno));
hunk ./src/pacman/sync.c 237
-static int sync_group(list_t *syncs, list_t *targets)
+static int sync_group(int level, list_t *syncs, list_t *targets)
hunk ./src/pacman/sync.c 262
-				if(config->verbose > 0) {
+				if(level > 1) {
hunk ./src/pacman/sync.c 396
-		if(sync_synctree(pmc_syncs)) {
+		if(sync_synctree(config->op_s_sync, pmc_syncs)) {
hunk ./src/pacman/sync.c 406
-		return(sync_group(pmc_syncs, targets));
+		return(sync_group(config->group, pmc_syncs, targets));
hunk ./src/pacman/sync.c 537
-	/* Step 2: "compute" the transaction based on targets and flags */
+	/* Step 2: "compute" the transaction based on targets and flags
+	 */
hunk ./src/pacman/sync.c 545
-
-					MSG(NL, ":: %s: requires %s", alpm_dep_getinfo(miss, PM_DEP_TARGET),
-					                              alpm_dep_getinfo(miss, PM_DEP_NAME));
+					MSG(NL, ":: %s: %s %s", alpm_dep_getinfo(miss, PM_DEP_TARGET),
+					    alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? "requires" : "is required by",
+					    alpm_dep_getinfo(miss, PM_DEP_NAME));
hunk ./src/pacman/sync.c 589
+			PM_PKG *pkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
+			char *pkgname, *pkgver;
+
hunk ./src/pacman/sync.c 603
+
+			pkgname = alpm_pkg_getinfo(pkg, PM_PKG_NAME);
+			pkgver = alpm_pkg_getinfo(pkg, PM_PKG_VERSION);
+			totalsize += (int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE);
+
+			asprintf(&str, "%s-%s", pkgname, pkgver);
+			list_install = list_add(list_install, str);
hunk ./src/pacman/sync.c 619
-		for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
-			char *pkgname, *pkgver;
-			PM_SYNCPKG *sync = alpm_list_getdata(lp);
-			PM_PKG *pkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
-
-			pkgname = alpm_pkg_getinfo(pkg, PM_PKG_NAME);
-			pkgver = alpm_pkg_getinfo(pkg, PM_PKG_VERSION);
-			totalsize += (int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE);
-
-			asprintf(&str, "%s-%s", pkgname, pkgver);
-			list_install = list_add(list_install, str);
-		}
hunk ./src/pacman/sync.c 737
-	/* Step 3: actually perform the installation */
+	/* Step 3: actually perform the installation
+	 */
hunk ./src/pacman/sync.c 767
-
}


More information about the Frugalware-darcs mailing list