Paul Nasrat d8085d
--- rpm-4.4.2/rpmdb/fprint.h.exclude	2003-05-08 16:39:31.000000000 -0400
Paul Nasrat d8085d
+++ rpm-4.4.2/rpmdb/fprint.h	2005-11-29 11:40:29.000000000 -0500
Paul Nasrat d8085d
@@ -79,6 +79,12 @@
Paul Nasrat d8085d
 	/*@modifies db, *matchList, rpmGlobalMacroContext,
Paul Nasrat d8085d
 		fileSystem, internalState @*/;
Paul Nasrat d8085d
 
Paul Nasrat d8085d
+int rpmdbFindFpListExclude(/*@null@*/ rpmdb db, fingerPrint  * fpList,
Paul Nasrat d8085d
+		/*@out@*/ dbiIndexSet * matchList, int numItems, unsigned int exclude)
Paul Nasrat d8085d
+	/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
Paul Nasrat d8085d
+	/*@modifies db, *matchList, rpmGlobalMacroContext,
Paul Nasrat d8085d
+		fileSystem, internalState @*/;
Paul Nasrat d8085d
+
Paul Nasrat d8085d
 /* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */
Paul Nasrat d8085d
 
Paul Nasrat d8085d
 /**
Paul Nasrat d8085d
--- rpm-4.4.2/rpmdb/rpmdb.c.exclude	2005-02-15 22:18:19.000000000 -0500
Paul Nasrat d8085d
+++ rpm-4.4.2/rpmdb/rpmdb.c	2005-11-29 11:47:10.000000000 -0500
Paul Nasrat d8085d
@@ -3388,11 +3388,17 @@
Paul Nasrat d8085d
     return 0;
Paul Nasrat d8085d
 }
Paul Nasrat d8085d
 
Paul Nasrat d8085d
-/* XXX transaction.c */
Paul Nasrat d8085d
-/*@-compmempass@*/
Paul Nasrat d8085d
 int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList, 
Paul Nasrat d8085d
 		    int numItems)
Paul Nasrat d8085d
 {
Paul Nasrat d8085d
+    return rpmdbFindFpListExclude(db, fpList, matchList, numItems, 0);
Paul Nasrat d8085d
+}
Paul Nasrat d8085d
+
Paul Nasrat d8085d
+/* XXX transaction.c */
Paul Nasrat d8085d
+/*@-compmempass@*/
Paul Nasrat d8085d
+int rpmdbFindFpListExclude(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList, 
Paul Nasrat d8085d
+		    int numItems, unsigned int exclude)
Paul Nasrat d8085d
+{
Paul Nasrat d8085d
 DBT * key;
Paul Nasrat d8085d
 DBT * data;
Paul Nasrat d8085d
     HGE_t hge = (HGE_t)headerGetEntryMinMemory;
Paul Nasrat d8085d
@@ -3424,7 +3430,10 @@
Paul Nasrat d8085d
 key->size = strlen((char *)key->data);
Paul Nasrat d8085d
 if (key->size == 0) key->size++;	/* XXX "/" fixup. */
Paul Nasrat d8085d
 
Paul Nasrat d8085d
-	if (skipDir(fpList[i].entry->dirName))
Paul Nasrat d8085d
+	/* HACK HACK HACK: don't skip dirs while removing
Paul Nasrat d8085d
+	 * packages as we will loose files on conflicts.
Paul Nasrat d8085d
+	 * exclude is not zero when removing */
Paul Nasrat d8085d
+	if (!exclude && skipDir(fpList[i].entry->dirName))
Paul Nasrat d8085d
 	    continue;
Paul Nasrat d8085d
 
Paul Nasrat d8085d
 	xx = rpmdbGrowIterator(mi, i);
Paul Nasrat d8085d
--- rpm-4.4.2/lib/transaction.c.exclude	2005-11-29 11:40:29.000000000 -0500
Paul Nasrat d8085d
+++ rpm-4.4.2/lib/transaction.c	2005-11-29 11:40:29.000000000 -0500
Paul Nasrat d8085d
@@ -1750,7 +1750,7 @@
Paul Nasrat d8085d
 	(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0);
Paul Nasrat d8085d
 	/* Extract file info for all files in this package from the database. */
Paul Nasrat d8085d
 	matches = xcalloc(fc, sizeof(*matches));
Paul Nasrat d8085d
-	if (rpmdbFindFpList(rpmtsGetRdb(ts), fi->fps, matches, fc)) {
Paul Nasrat d8085d
+	if (rpmdbFindFpListExclude(rpmtsGetRdb(ts), fi->fps, matches, fc, rpmteType(p) == TR_REMOVED ? fi->record : 0)) {
Paul Nasrat d8085d
 	    ps = rpmpsFree(ps);
Paul Nasrat d8085d
 	    rpmtsFreeLock(lock);
Paul Nasrat d8085d
 	    return 1;	/* XXX WTFO? */