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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
from testbase import *
import simpleobsoletestests
# Obsolete for conflict
class ComplicatedTests(OperationsTests):
@staticmethod
def buildPkgs(pkgs, *args):
simpleobsoletestests.SimpleObsoletesTests.buildPkgs(pkgs)
# conflicts
pkgs.conflicts = FakePackage('super-zippy', '0.3', '1', '0', 'i386')
pkgs.conflicts.addConflicts('zsh', 'EQ', ('0', '1', '1'))
def testObsoleteForConflict(self):
p = self.pkgs
res, msg = self.runOperation(['install', 'super-zippy'], [p.installed_i386], [p.obsoletes_i386, p.obsoletes_x86_64, p.conflicts])
if new_behavior:
self.assertTrue(res=='ok', msg)
self.assertResult((p.obsoletes_i386, p.conflicts))
class CombinedUpdateObsoletesTest(OperationsTests):
@staticmethod
def buildPkgs(pkgs, *args):
pkgs.k_1 = FakePackage('k', '3.5')
pkgs.kdevel_1 = FakePackage('k-devel', '3.5')
pkgs.kdevel_1.addRequires('k')
pkgs.klibs_1_i386 = FakePackage('klibs', '3.5', arch='i386')
pkgs.klibs_1_x86_64 = FakePackage('klibs', '3.5', arch='x86_64')
pkgs.k_2 = FakePackage('k', '3.5', '2')
pkgs.kdevel_2 = FakePackage('k-devel', '3.5', '2')
pkgs.kdevel_2.addRequires('k')
pkgs.klibs_2_i386 = FakePackage('klibs', '3.5', '2', arch='i386')
pkgs.klibs_2_i386.addObsoletes('klibs', 'LT', (None, '3.5', '2'))
pkgs.klibs_2_i386.addObsoletes('k', 'LT', (None, '3.5', '2'))
pkgs.klibs_2_x86_64 = FakePackage('klibs', '3.5', '2', arch='x86_64')
pkgs.klibs_2_x86_64.addObsoletes('klibs', 'LT', (None, '3.5', '2'))
pkgs.klibs_2_x86_64.addObsoletes('k', 'LT', (None, '3.5', '2'))
def testSelfObsolete(self):
p = self.pkgs
res, msg = self.runOperation(['update'], [p.klibs_1_x86_64], [p.klibs_2_i386, p.klibs_2_x86_64])
self.assertTrue(res=='ok', msg)
self.assertResult((p.klibs_2_x86_64,))
def testPackageSplitWithObsoleteAndRequiresForUpdate(self):
p = self.pkgs
res, msg = self.runOperation(['update'], [p.k_1, p.kdevel_1, p.klibs_1_x86_64],
[p.k_2, p.kdevel_2, p.klibs_2_x86_64])
self.assertTrue(res=='ok', msg)
self.assertResult((p.k_2, p.kdevel_2, p.klibs_2_x86_64,))
class ComplicatedObsoletesTests(OperationsTests):
@staticmethod
def buildPkgs(pkgs, *args):
pkgs.installed = FakePackage('foo', '1.4', '1')
pkgs.obsoletecircle = FakePackage('foo', '1.4', '1')
pkgs.obsoletecircle.addObsoletes('baz')
pkgs.obsoletes = FakePackage('bar', '1.2', '1')
pkgs.obsoletes.addObsoletes('foo')
pkgs.obsoletes2 = FakePackage('baz', '1.8', '1')
pkgs.obsoletes2.addObsoletes('bar')
def testObsoleteChain(self):
p = self.pkgs
res, msg = self.runOperation(['update'], [p.installed], [p.obsoletes, p.obsoletes2])
self.assertTrue(res=='ok', msg)
if True or new_behavior:
self.assertResult((p.obsoletes2,))
else:
self.assertResult((p.obsoletes,))
def testObsoleteChainNext(self):
p = self.pkgs
res, msg = self.runOperation(['update'], [p.obsoletes], [p.obsoletes2])
self.assertTrue(res=='ok', msg)
self.assertResult((p.obsoletes2,))
def testObsoleteCircle(self):
p = self.pkgs
res, msg = self.runOperation(['update'], [p.obsoletecircle], [p.obsoletes, p.obsoletes2])
self.assertTrue(res=='ok', msg)
if new_behavior:
self.assertResult((p.obsoletecircle,))
else:
self.assertResult((p.obsoletes2,))
def testObsoleteCircleNext(self):
p = self.pkgs
res, msg = self.runOperation(['update'], [p.obsoletes], [p.obsoletecircle, p.obsoletes, p.obsoletes2])
self.assertTrue(res=='ok', msg)
if new_behavior:
self.assertResult((p.obsoletes,))
else:
self.assertResult((p.obsoletes2,))
def testObsoleteCircleNextNext(self):
p = self.pkgs
res, msg = self.runOperation(['update'], [p.obsoletes2], [p.obsoletecircle, p.obsoletes, p.obsoletes2])
self.assertTrue(res=='ok', msg)
if new_behavior:
self.assertResult((p.obsoletes2,))
else:
self.assertResult((p.obsoletecircle,))
def testObsoleteCircleNextNextNext(self):
p = self.pkgs
res, msg = self.runOperation(['update'], [p.obsoletecircle], [p.obsoletes, p.obsoletes2])
self.assertTrue(res=='ok', msg)
if new_behavior:
self.assertResult((p.obsoletecircle,))
else:
self.assertResult((p.obsoletes2,))
# continue endlessly
class KernelTests(OperationsTests):
@staticmethod
def buildPkgs(pkgs, *args):
pkgs.inst = []
pkgs.inst.append(FakePackage('kernel', '2.6.23.8', '63',arch='i686'))
pkgs.inst.append(FakePackage('kernel', '2.6.23.1', '49',arch='i686'))
pkgs.avail = []
pkgs.avail.append(FakePackage('kernel', '2.6.23.8', '63',arch='i686'))
pkgs.avail.append(FakePackage('kernel', '2.6.23.8', '63',arch='i586'))
pkgs.avail.append(FakePackage('kernel', '2.6.23.1', '49',arch='i686'))
pkgs.avail.append(FakePackage('kernel', '2.6.23.1', '49',arch='i586'))
pkgs.avail.append(FakePackage('kernel', '2.6.23.1', '42',arch='i686'))
pkgs.avail.append(FakePackage('kernel', '2.6.23.1', '42',arch='i586'))
def testKernelInstall1(self):
p = self.pkgs
res, msg = self.runOperation(['install','kernel'], p.inst, p.avail)
self.assertResult(p.inst)
def testKernelInstall2(self):
p = self.pkgs
res, msg = self.runOperation(['install','kernel-2.6.23.1-42'], p.inst, p.avail)
self.assertResult(p.inst + [ p.avail[4] ] )
def testKernelInstall3(self):
p = self.pkgs
res, msg = self.runOperation(['install','kernel-2.6.23.8'], p.inst, p.avail)
self.assertResult(p.inst)
class MultiLibTests(OperationsTests):
@staticmethod
def buildPkgs(pkgs, *args):
pkgs.inst = []
pkgs.i_foo_1_12_x = FakePackage('foo', '1', '12',arch='x86_64')
pkgs.i_wbar_1_12_i = FakePackage('wbar', '1', '12', arch='i586')
pkgs.inst.append(pkgs.i_foo_1_12_x)
pkgs.inst.append(pkgs.i_wbar_1_12_i)
pkgs.avail = []
pkgs.a_foo_0_2_x = FakePackage('foo', '0', '2', arch='x86_64')
pkgs.a_foo_0_2_i = FakePackage('foo', '0', '2', arch='i686')
pkgs.a_foo_1_12_x = FakePackage('foo', '1', '12', arch='x86_64')
pkgs.a_foo_1_12_i = FakePackage('foo', '1', '12', arch='i686')
pkgs.a_foo_2_22_x = FakePackage('foo', '2', '22', arch='x86_64')
pkgs.a_foo_2_22_i = FakePackage('foo', '2', '22', arch='i686')
pkgs.a_bar_1_12_x = FakePackage('bar', '1', '12', arch='x86_64')
pkgs.a_bar_1_12_i = FakePackage('bar', '1', '12', arch='i686')
pkgs.a_bar_2_22_x = FakePackage('bar', '2', '22', arch='x86_64')
pkgs.a_bar_2_22_i = FakePackage('bar', '2', '22', arch='i686')
# ibar is .i?86 older
pkgs.a_ibar_2_22_x = FakePackage('ibar', '2', '22', arch='x86_64')
pkgs.a_ibar_1_12_i = FakePackage('ibar', '1', '12', arch='i686')
# xbar is .x86_64 older
pkgs.a_xbar_1_12_x = FakePackage('xbar', '1', '12', arch='x86_64')
pkgs.a_xbar_2_22_i = FakePackage('xbar', '2', '22', arch='i686')
# wbar is arch changing update/downgrade
pkgs.a_wbar_0_2_i = FakePackage('wbar', '0', '2', arch='i386')
pkgs.a_wbar_2_22_i = FakePackage('wbar', '2', '22', arch='i686')
for i in ('a_foo_0_2', 'a_foo_1_12', 'a_foo_2_22',
'a_bar_1_12', 'a_bar_2_22'):
pkgs.avail.append(getattr(pkgs, i + '_x'))
pkgs.avail.append(getattr(pkgs, i + '_i'))
pkgs.avail.append(pkgs.a_ibar_2_22_x)
pkgs.avail.append(pkgs.a_ibar_1_12_i)
pkgs.avail.append(pkgs.a_xbar_1_12_x)
pkgs.avail.append(pkgs.a_xbar_2_22_i)
pkgs.avail.append(pkgs.a_wbar_0_2_i)
pkgs.avail.append(pkgs.a_wbar_2_22_i)
def testBestInstall1(self):
p = self.pkgs
ninst = p.inst[:]
ninst.append(p.a_bar_2_22_x)
res, msg = self.runOperation(['install', 'bar'], p.inst, p.avail)
self.assertResult(ninst)
def testBestInstall2(self):
p = self.pkgs
ninst = p.inst[:]
ninst.append(p.a_bar_1_12_x)
res, msg = self.runOperation(['install', 'bar-1'], p.inst, p.avail)
self.assertResult(ninst)
def testAllInstall1(self):
p = self.pkgs
ninst = p.inst[:]
ninst.append(p.a_bar_2_22_x)
ninst.append(p.a_bar_2_22_i)
res, msg = self.runOperation(['install', 'bar'], p.inst, p.avail,
{'multilib_policy' : 'all'})
self.assertResult(ninst)
def testAllInstall2(self):
p = self.pkgs
ninst = p.inst[:]
ninst.append(p.a_bar_1_12_x)
ninst.append(p.a_bar_1_12_i)
res, msg = self.runOperation(['install', 'bar-1'], p.inst, p.avail,
{'multilib_policy' : 'all'})
self.assertResult(ninst)
def testAllInstall3(self):
p = self.pkgs
ninst = p.inst[:]
ninst.append(p.a_ibar_2_22_x)
res, msg = self.runOperation(['install', 'ibar'], p.inst, p.avail,
{'multilib_policy' : 'all'})
self.assertResult(ninst)
def testAllInstall4(self):
p = self.pkgs
ninst = p.inst[:]
ninst.append(p.a_xbar_2_22_i)
res, msg = self.runOperation(['install', 'xbar'], p.inst, p.avail,
{'multilib_policy' : 'all'})
self.assertResult(ninst)
def testDowngrade1(self):
p = self.pkgs
ninst = [p.i_foo_1_12_x, p.a_wbar_0_2_i]
res, msg = self.runOperation(['downgrade', 'wbar'], p.inst, p.avail)
self.assertResult(ninst)
def testDowngrade2(self):
p = self.pkgs
oinst = [p.i_foo_1_12_x, p.a_wbar_2_22_i]
ninst = [p.i_foo_1_12_x, p.i_wbar_1_12_i]
p.avail.append(p.i_wbar_1_12_i)
res, msg = self.runOperation(['downgrade', 'wbar'], oinst, p.avail)
self.assertResult(ninst)
def testDowngrade3(self):
p = self.pkgs
oinst = [p.i_foo_1_12_x, p.a_wbar_2_22_i]
ninst = [p.i_foo_1_12_x, p.a_wbar_0_2_i]
res, msg = self.runOperation(['downgrade', 'wbar'], oinst, p.avail)
self.assertResult(ninst)
def testDowngrade4(self):
p = self.pkgs
oinst = p.inst[:] + [p.a_ibar_2_22_x]
p.a_ibar_1_12_i.arch = 'noarch'
ninst = p.inst[:] + [p.a_ibar_1_12_i]
res, msg = self.runOperation(['downgrade', 'ibar'], oinst, p.avail)
self.assertResult(ninst)
def testDowngrade5(self):
p = self.pkgs
ninst = p.inst[:] + [p.a_xbar_1_12_x]
p.a_xbar_2_22_i.arch = 'noarch'
oinst = p.inst[:] + [p.a_xbar_2_22_i]
res, msg = self.runOperation(['downgrade', 'xbar'], oinst, p.avail)
self.assertResult(ninst)
|