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