Florian Festi wrote:
Hi!

Attached patch completes the behavior change Jeremy introduced with 5badc2b67b9885d2993b6f77423bc632b8595b01 - "when an obsolete is available for a package, only install most matching arch rather than all available arches (rh#301661)". Currently arch is ignored for versioned obsoletes as the now added lines are missing in that code path. Please commit!

There is a test case in my "gold" branch but the patch depends on other patch sets in that branch - feel free to pull them in.

Special thanks to Zdenek Kabelac for reporting that problem and Thomas Wörner for hunting it down.

A probably better way to fix this is to avoid different code path at all. Attached patch removes the code duplication in doObsoletes() and fixes the versioned obsoletes problem en passant.

Florian
>From 98e124b091eabc36a61de83e6c12ae1d4491d7fa Mon Sep 17 00:00:00 2001
From: Florian Festi <[EMAIL PROTECTED]>
Date: Mon, 12 Nov 2007 17:48:21 +0100
Subject: [PATCH] Do arch checks for versioned obsoletes, too
 Reduce duplicated code in doObsoletes

---
 rpmUtils/updates.py |   29 +++++------------------------
 1 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/rpmUtils/updates.py b/rpmUtils/updates.py
index 861037f..94d8aa1 100644
--- a/rpmUtils/updates.py
+++ b/rpmUtils/updates.py
@@ -207,9 +207,11 @@ class Updates:
         for pkgtup in self.rawobsoletes.keys():
             (name, arch, epoch, ver, rel) = pkgtup
             for (obs_n, flag, (obs_e, obs_v, obs_r)) in self.rawobsoletes[(pkgtup)]:
-                if flag in [None, 0]: # unversioned obsolete
-                    if self.installdict.has_key((obs_n, None)):
-                        for (rpm_a, rpm_e, rpm_v, rpm_r) in self.installdict[(obs_n, None)]:
+                if self.installdict.has_key((obs_n, None)):
+                    for (rpm_a, rpm_e, rpm_v, rpm_r) in self.installdict[(obs_n, None)]:
+                        if flag in [None, 0] or \
+                                rpmUtils.miscutils.rangeCheck((obs_n, flag, (obs_e, obs_v, obs_r)),
+                                                              (obs_n, rpm_a, rpm_e, rpm_v, rpm_r)):
                             # make sure the obsoleting pkg is not already installed
                             willInstall = 1
                             if self.installdict.has_key((name, None)):
@@ -225,27 +227,6 @@ class Updates:
                                 if not obsdict.has_key(pkgtup):
                                     obsdict[pkgtup] = []
                                 obsdict[pkgtup].append((obs_n, rpm_a, rpm_e, rpm_v, rpm_r))
-
-                else: # versioned obsolete
-                    if self.installdict.has_key((obs_n, None)):
-                        for (rpm_a, rpm_e, rpm_v, rpm_r) in self.installdict[(obs_n, None)]:
-                            if rpmUtils.miscutils.rangeCheck((obs_n, flag, (obs_e, \
-                                                        obs_v, obs_r)), (obs_n,\
-                                                        rpm_a, rpm_e, rpm_v, rpm_r)):
-                                # make sure the obsoleting pkg is not already installed
-                                willInstall = 1
-                                if self.installdict.has_key((name, None)):
-                                    for (ins_a, ins_e, ins_v, ins_r) in self.installdict[(name, None)]:
-                                        pkgver = (epoch, ver, rel)
-                                        installedver = (ins_e, ins_v, ins_r)
-                                        if self.returnNewest((pkgver, installedver)) == installedver:
-                                            willInstall = 0
-                                            break
-                                if willInstall:
-                                    if not obsdict.has_key(pkgtup):
-                                        obsdict[pkgtup] = []
-                                    obsdict[pkgtup].append((obs_n, rpm_a, rpm_e, rpm_v, rpm_r))
-           
         self.obsoletes = obsdict
         self.makeObsoletedDict()
 
-- 
1.5.3.3

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to