teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.4.2-prefer-elf32.patch

Paul Nasrat 94a151
--- rpm-4.4.2/lib/transaction.c.prefer32	2007-04-25 12:10:25.000000000 +0100
Paul Nasrat 94a151
+++ rpm-4.4.2/lib/transaction.c	2007-04-25 12:38:32.000000000 +0100
Paul Nasrat 94a151
@@ -122,6 +122,7 @@ static int handleInstInstalledFiles(cons
Paul Nasrat 94a151
 	/*@modifies ts, fi, rpmGlobalMacroContext, fileSystem, internalState @*/
Paul Nasrat 94a151
 {
Paul Nasrat 94a151
     uint_32 tscolor = rpmtsColor(ts);
Paul Nasrat 94a151
+    uint_32 prefcolor = rpmtsPrefColor(ts);
Paul Nasrat 94a151
     uint_32 otecolor, tecolor;
Paul Nasrat 94a151
     uint_32 oFColor, FColor;
Paul Nasrat 94a151
     const char * altNEVR = NULL;
Paul Nasrat 94a151
@@ -199,11 +200,11 @@ static int handleInstInstalledFiles(cons
Paul Nasrat 94a151
 	    /* Resolve file conflicts to prefer Elf64 (if not forced). */
Paul Nasrat 94a151
 	    if (tscolor != 0 && FColor != 0 && FColor != oFColor)
Paul Nasrat 94a151
 	    {
Paul Nasrat 94a151
-		if (oFColor & 0x2) {
Paul Nasrat 94a151
+		if (oFColor & prefcolor) {
Paul Nasrat 94a151
 		    fi->actions[fileNum] = FA_SKIPCOLOR;
Paul Nasrat 94a151
 		    rConflicts = 0;
Paul Nasrat 94a151
 		} else
Paul Nasrat 94a151
-		if (FColor & 0x2) {
Paul Nasrat 94a151
+		if (FColor & prefcolor) {
Paul Nasrat 94a151
 		    fi->actions[fileNum] = FA_CREATE;
Paul Nasrat 94a151
 		    rConflicts = 0;
Paul Nasrat 94a151
 		}
Paul Nasrat 94a151
@@ -458,6 +459,7 @@ static void handleOverlappedFiles(const 
Paul Nasrat 94a151
     if (fi != NULL)
Paul Nasrat 94a151
     while ((i = rpmfiNext(fi)) >= 0) {
Paul Nasrat 94a151
 	uint_32 tscolor = rpmtsColor(ts);
Paul Nasrat 94a151
+	uint_32 prefcolor = rpmtsPrefColor(ts);
Paul Nasrat 94a151
 	uint_32 oFColor, FColor;
Paul Nasrat 94a151
 	struct fingerPrint_s * fiFps;
Paul Nasrat 94a151
 	int otherPkgNum, otherFileNum;
Paul Nasrat 94a151
@@ -570,19 +572,19 @@ assert(otherFi != NULL);
Paul Nasrat 94a151
 		rConflicts = reportConflicts;
Paul Nasrat 94a151
 		/* Resolve file conflicts to prefer Elf64 (if not forced) ... */
Paul Nasrat 94a151
 		if (tscolor != 0) {
Paul Nasrat 94a151
-		    if (FColor & 0x2) {
Paul Nasrat 94a151
-			/* ... last Elf64 file is installed ... */
Paul Nasrat 94a151
+		    if (FColor & prefcolor) {
Paul Nasrat 94a151
+			/* ... last file of preferred colour is installed ... */
Paul Nasrat 94a151
 			if (!XFA_SKIPPING(fi->actions[i])) {
Paul Nasrat 94a151
 			    /* XXX static helpers are order dependent. Ick. */
Paul Nasrat 94a151
 			    if (strcmp(fn, "/usr/sbin/libgcc_post_upgrade")
Paul Nasrat 94a151
 			     && strcmp(fn, "/usr/sbin/glibc_post_upgrade"))
Paul Nasrat 94a151
-				otherFi->actions[otherFileNum] = FA_SKIP;
Paul Nasrat 94a151
+				otherFi->actions[otherFileNum] = FA_SKIPCOLOR;
Paul Nasrat 94a151
 			}
Paul Nasrat 94a151
 			fi->actions[i] = FA_CREATE;
Paul Nasrat 94a151
 			rConflicts = 0;
Paul Nasrat 94a151
 		    } else
Paul Nasrat 94a151
-		    if (oFColor & 0x2) {
Paul Nasrat 94a151
-			/* ... first Elf64 file is installed ... */
Paul Nasrat 94a151
+		    if (oFColor & prefcolor) {
Paul Nasrat 94a151
+			/* ... first file of preferred colour is installed ... */
Paul Nasrat 94a151
 			if (XFA_SKIPPING(fi->actions[i]))
Paul Nasrat 94a151
 			    otherFi->actions[otherFileNum] = FA_CREATE;
Paul Nasrat 94a151
 			fi->actions[i] = FA_SKIPCOLOR;
Paul Nasrat 94a151
--- rpm-4.4.2/lib/rpmts.c.prefer32	2005-02-13 03:12:03.000000000 +0000
Paul Nasrat 94a151
+++ rpm-4.4.2/lib/rpmts.c	2007-04-25 12:37:45.000000000 +0100
Paul Nasrat 94a151
@@ -1475,6 +1475,11 @@ uint_32 rpmtsSetColor(rpmts ts, uint_32 
Paul Nasrat 94a151
     return ocolor;
Paul Nasrat 94a151
 }
Paul Nasrat 94a151
 
Paul Nasrat 94a151
+uint_32 rpmtsPrefColor(rpmts ts)
Paul Nasrat 94a151
+{
Paul Nasrat 94a151
+    return (ts != NULL ? ts->prefcolor : 0);
Paul Nasrat 94a151
+}
Paul Nasrat 94a151
+
Paul Nasrat 94a151
 rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Paul Nasrat 94a151
 {
Paul Nasrat 94a151
     rpmop op = NULL;
Paul Nasrat 94a151
@@ -1554,6 +1559,7 @@ rpmts rpmtsCreate(void)
Paul Nasrat 94a151
     ts->delta = 5;
Paul Nasrat 94a151
 
Paul Nasrat 94a151
     ts->color = rpmExpandNumeric("%{?_transaction_color}");
Paul Nasrat 94a151
+    ts->prefcolor = rpmExpandNumeric("%{?_prefer_color}")?:2;
Paul Nasrat 94a151
 
Paul Nasrat 94a151
     ts->numRemovedPackages = 0;
Paul Nasrat 94a151
     ts->allocedRemovedPackages = ts->delta;
Paul Nasrat 94a151
--- rpm-4.4.2/lib/rpmts.h.prefer32	2005-01-04 16:35:05.000000000 +0000
Paul Nasrat 94a151
+++ rpm-4.4.2/lib/rpmts.h	2007-04-25 12:33:39.000000000 +0100
Paul Nasrat 94a151
@@ -309,6 +309,7 @@ struct rpmts_s {
Paul Nasrat 94a151
     int_32 tid;			/*!< Transaction id. */
Paul Nasrat 94a151
 
Paul Nasrat 94a151
     uint_32 color;		/*!< Transaction color bits. */
Paul Nasrat 94a151
+    uint_32 prefcolor;		/*!< Preferred file color. */
Paul Nasrat 94a151
 
Paul Nasrat 94a151
     rpmVSFlags vsflags;		/*!< Signature/digest verification flags. */
Paul Nasrat 94a151
 
Paul Nasrat 94a151
@@ -983,6 +984,14 @@ uint_32 rpmtsColor(rpmts ts)
Paul Nasrat 94a151
 	/*@*/;
Paul Nasrat 94a151
 
Paul Nasrat 94a151
 /**
Paul Nasrat 94a151
+ * Retrieve prefered file color
Paul Nasrat 94a151
+ * @param ts		transaction set
Paul Nasrat 94a151
+ * @return		color bits
Paul Nasrat 94a151
+ */
Paul Nasrat 94a151
+uint_32 rpmtsPrefColor(rpmts ts)
Paul Nasrat 94a151
+	/*@*/;
Paul Nasrat 94a151
+
Paul Nasrat 94a151
+/**
Paul Nasrat 94a151
  * Set color bits of transaction set.
Paul Nasrat 94a151
  * @param ts		transaction set
Paul Nasrat 94a151
  * @param color		new color bits