From 94a151f740a21d62e79f986ba0ea70c145f79ed8 Mon Sep 17 00:00:00 2001 From: Paul Nasrat Date: May 01 2007 04:58:35 +0000 Subject: - Configurable policy for prefered ELF (#235757) - Resolves: rhbz#235757 --- diff --git a/rpm-4.4.2-prefer-elf32.patch b/rpm-4.4.2-prefer-elf32.patch new file mode 100644 index 0000000..cf2770a --- /dev/null +++ b/rpm-4.4.2-prefer-elf32.patch @@ -0,0 +1,104 @@ +--- 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 diff --git a/rpm.spec b/rpm.spec index af1873e..593acab 100644 --- a/rpm.spec +++ b/rpm.spec @@ -17,7 +17,7 @@ Summary: The RPM package management system Name: rpm Version: 4.4.2 %{expand: %%define rpm_version %{version}} -Release: 45%{?dist} +Release: 46%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source: rpm-%{rpm_version}.tar.gz @@ -67,6 +67,7 @@ Patch40: rpm-4.4.2-forkfailed.patch Patch41: rpm-4.4.2-cdiff.patch Patch42: rpm-4.4.2-docflags.patch Patch43: rpm-debugedit-incremental-fix.patch +Patch44: rpm-4.4.2-prefer-elf32.patch License: GPL Requires: patch > 2.5 Prereq: shadow-utils @@ -212,6 +213,7 @@ shell-like rules. %patch41 -p1 -b .cdiff %patch42 -p1 -b .docflags %patch43 -p1 -b .debugcan2 +%patch44 -p1 -b .elfprefer # rebuild configure for ipv6 autoconf @@ -573,6 +575,9 @@ exit 0 %{__includedir}/popt.h %changelog +* Tue May 01 2007 Paul Nasrat - 4.4.2-46 +- Configurable policy for prefered ELF (#235757) + * Mon Apr 23 2007 Paul Nasrat - 4.4.2-45 - Fix debugedit for relative paths (#232222)