commit 3869d3c274d604c119487e9f0d1d29581a53396b
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Jun 1 13:55:15 2010 +0300

    On colored transactions, require matching arch for freshen (RhBug:553108)
    - What we'd really want to compare here is the color or ISA of the packages
      but color isn't realiable as eg -devel packages often aren't correctly
      colored, and ISA isn't currently available in the header as a standalone
      entry. Comparing arch prevents otherwise reasoable i386 -> i686 type
      arch changes on freshen but at least it avoids the most pathological
      issues.
    (cherry picked from commit 7a8b716187804cd6bbe113dab8c2ad5d9d5ef57c)

diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 653c874..503370a 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -355,27 +355,25 @@ static int checkFreshenStatus(rpmts ts, struct rpmEIU * eiu)
 {
     rpmdbMatchIterator mi = NULL;
     const char * name = headerGetString(eiu->h, RPMTAG_NAME);
-    Header oldH;
-    int count;
+    const char *arch = headerGetString(eiu->h, RPMTAG_ARCH);
+    Header oldH = NULL;
 
     if (name != NULL)
         mi = rpmtsInitIterator(ts, RPMTAG_NAME, name, 0);
-    count = rpmdbGetIteratorCount(mi);
+    if (rpmtsColor(ts) && arch)
+	rpmdbSetIteratorRE(mi, RPMTAG_ARCH, RPMMIRE_DEFAULT, arch);
+
     while ((oldH = rpmdbNextIterator(mi)) != NULL) {
+	/* Package is newer than those currently installed. */
         if (rpmVersionCompare(oldH, eiu->h) < 0)
-	    continue;
-	/* same or newer package already installed */
-	count = 0;
-	break;
+	    break;
     }
+
     mi = rpmdbFreeIterator(mi);
-    if (count == 0) {
+    if (oldH == NULL) {
         eiu->h = headerFree(eiu->h);
-	return -1;
     }
-    /* Package is newer than those currently installed. */
-
-   return 1;
+   return (oldH != NULL);
 }
 
 /** @todo Generalize --freshen policies. */