-
Notifications
You must be signed in to change notification settings - Fork 0
/
BZ-593522-install-obs-arch.patch
155 lines (146 loc) · 6.98 KB
/
BZ-593522-install-obs-arch.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
commit bbddbbfc24156b17f263c4efea8ffece5595b1a6
Author: James Antill <[email protected]>
Date: Tue May 18 15:19:54 2010 -0400
Add testcase for obsoletes of to be installed pkgs. -- 593349
diff --git a/test/simpleobsoletestests.py b/test/simpleobsoletestests.py
index cf1821f..091e3a4 100644
--- a/test/simpleobsoletestests.py
+++ b/test/simpleobsoletestests.py
@@ -157,11 +157,27 @@ class SimpleObsoletesTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((p.obsoletes_x86_64, p.requires_obsoletes))
- def testObsoletex86_64ToMultiarch(self):
+ def testObsoletex86_64ToMultiarch1(self):
p = self.pkgs
res, msg = self.runOperation(['update'], [p.installed_x86_64], [p.obsoletes_i386, p.obsoletes_x86_64])
self.assert_(res=='ok', msg)
self.assertResult((p.obsoletes_x86_64,))
+ def testObsoletex86_64ToMultiarch2(self):
+ p = self.pkgs
+ res, msg = self.runOperation(['update'], [p.installed_x86_64], [p.obsoletes_x86_64, p.obsoletes_i386])
+ self.assert_(res=='ok', msg)
+ self.assertResult((p.obsoletes_x86_64,))
+ def testInstallObsoletex86_64ToMultiarch1(self):
+ # Found by BZ 593349, libgfortran43/44
+ p = self.pkgs
+ res, msg = self.runOperation(['install', 'zsh.x86_64'], [], [p.installed_x86_64, p.installed_i386, p.obsoletes_x86_64, p.obsoletes_i386])
+ self.assert_(res=='ok', msg)
+ self.assertResult((p.obsoletes_x86_64,))
+ def testInstallObsoletex86_64ToMultiarch2(self):
+ p = self.pkgs
+ res, msg = self.runOperation(['install', 'zsh.i386'], [], [p.installed_x86_64, p.installed_i386, p.obsoletes_x86_64, p.obsoletes_i386])
+ self.assert_(res=='ok', msg)
+ self.assertResult((p.obsoletes_i386,))
def testObsoletex86_64ToMultiarchForDependency(self):
p = self.pkgs
res, msg = self.runOperation(['install', 'superzippy'],
commit 0408550d397b266840eb84e1c856ed8830586952
Author: James Antill <[email protected]>
Date: Tue May 18 16:17:18 2010 -0400
Fix for obsoleting pkgs. we are trying to install
diff --git a/yum/__init__.py b/yum/__init__.py
index 612b6ab..f5f2b51 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2882,7 +2882,18 @@ class YumBase(depsolve.Depsolve):
we should install instead. Or None if there isn't one. """
thispkgobsdict = self.up.checkForObsolete([po.pkgtup])
if po.pkgtup in thispkgobsdict:
- obsoleting = thispkgobsdict[po.pkgtup][0]
+ obsoleting = thispkgobsdict[po.pkgtup]
+ oobsoleting = []
+ # We want to keep the arch. of the obsoleted pkg. if possible.
+ for opkgtup in obsoleting:
+ if not canCoinstall(po.arch, opkgtup[1]):
+ oobsoleting.append(opkgtup)
+ if oobsoleting:
+ obsoleting = oobsoleting
+ # NOTE: if we move from noarch => multilib. then the ordering
+ # here seems to always prefer i386 over x86_64 which is wrong.
+ # Need to sort by arch?
+ obsoleting = obsoleting[0]
obsoleting_pkg = self.getPackageObject(obsoleting)
return obsoleting_pkg
return None
commit 594a58bb622bc171782e9d0ec2943070507a6c79
Author: James Antill <[email protected]>
Date: Tue May 18 16:54:08 2010 -0400
Now do the same testcase for noarch => multilib
diff --git a/test/simpleobsoletestests.py b/test/simpleobsoletestests.py
index 091e3a4..dfaa7e5 100644
--- a/test/simpleobsoletestests.py
+++ b/test/simpleobsoletestests.py
@@ -178,6 +178,11 @@ class SimpleObsoletesTests(OperationsTests):
res, msg = self.runOperation(['install', 'zsh.i386'], [], [p.installed_x86_64, p.installed_i386, p.obsoletes_x86_64, p.obsoletes_i386])
self.assert_(res=='ok', msg)
self.assertResult((p.obsoletes_i386,))
+ def testInstallObsoletex86_64ToMultiarch3(self):
+ p = self.pkgs
+ res, msg = self.runOperation(['install', 'zsh'], [], [p.installed_noarch, p.obsoletes_x86_64, p.obsoletes_i386])
+ self.assert_(res=='ok', msg)
+ self.assertResult((p.obsoletes_x86_64,))
def testObsoletex86_64ToMultiarchForDependency(self):
p = self.pkgs
res, msg = self.runOperation(['install', 'superzippy'],
commit 9a2fa66d899c8c2cd0a91d7dfc61a26cd01bc382
Author: James Antill <[email protected]>
Date: Tue May 18 16:54:32 2010 -0400
Fix obsoleting pkgs. from <install norach> to multilib. using archdistance
diff --git a/yum/__init__.py b/yum/__init__.py
index f5f2b51..773b433 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -41,7 +41,8 @@ from config import ParsingError, ConfigParser
import Errors
import rpmsack
import rpmUtils.updates
-from rpmUtils.arch import canCoinstall, ArchStorage, isMultiLibArch
+from rpmUtils.arch import archDifference, canCoinstall, ArchStorage, isMultiLibArch
+from rpmUtils.miscutils import compareEVR
import rpmUtils.transaction
import comps
import pkgtag_db
@@ -2890,9 +2891,40 @@ class YumBase(depsolve.Depsolve):
oobsoleting.append(opkgtup)
if oobsoleting:
obsoleting = oobsoleting
- # NOTE: if we move from noarch => multilib. then the ordering
- # here seems to always prefer i386 over x86_64 which is wrong.
- # Need to sort by arch?
+ if len(obsoleting) > 1:
+ # Pick the first name, and run with it...
+ first = obsoleting[0]
+ obsoleting = [pkgtup for pkgtup in obsoleting
+ if first[0] == pkgtup[0]]
+ if len(obsoleting) > 1:
+ # Lock to the latest version...
+ def _sort_ver(x, y):
+ n1,a1,e1,v1,r1 = x
+ n2,a2,e2,v2,r2 = y
+ return compareEVR((e1,v1,r1), (e2,v2,r2))
+ obsoleting.sort(_sort_ver)
+ first = obsoleting[0]
+ obsoleting = [pkgtup for pkgtup in obsoleting
+ if not _sort_ver(first, pkgtup)]
+ if len(obsoleting) > 1:
+ # Now do arch distance (see depsolve:compare_providers)...
+ def _sort_arch_i(carch, a1, a2):
+ res1 = archDifference(carch, a1)
+ if not res1:
+ return 0
+ res2 = archDifference(carch, a2)
+ if not res2:
+ return 0
+ return res1 - res2
+ def _sort_arch(x, y):
+ n1,a1,e1,v1,r1 = x
+ n2,a2,e2,v2,r2 = y
+ ret = _sort_arch_i(po.arch, a1, a2)
+ if ret:
+ return ret
+ ret = _sort_arch_i(self.arch.bestarch, a1, a2)
+ return ret
+ obsoleting.sort(_sort_arch)
obsoleting = obsoleting[0]
obsoleting_pkg = self.getPackageObject(obsoleting)
return obsoleting_pkg