source: yum/trunk/test/simpleupdatetests.py@ 1569

Last change on this file since 1569 was 516, checked in by Yuri Dario, 11 years ago

yum: update trunk to 3.4.3.

  • Property svn:eol-style set to native
File size: 46.7 KB
Line 
1from testbase import *
2
3import rpmUtils.arch
4
5class SimpleUpdateTests(OperationsTests):
6
7 """This test suite runs three different type of tests - for all possible
8 combinations of arches installed and available as update.
9
10 1. Update: as done with "yum update"
11 2. UpdateForDependency: pkgs.requires_update requires a new version of the
12 already installed pkg(s)
13 3. UpdateForDependency2: A requirement of the installed pkg(s) is removed during
14 an update. Yum tries to update these packages to resolve the situation.
15 """
16
17 @staticmethod
18 def buildPkgs(pkgs, *args):
19 # installed
20 pkgs.installed_i386 = FakePackage('zsh', '1', '1', '0', 'i386')
21 pkgs.installed_i386.addRequires('bar', 'EQ', ('0', '1', '1'))
22 pkgs.installed_x86_64 = FakePackage('zsh', '1', '1', '0', 'x86_64')
23 pkgs.installed_x86_64.addRequires('bar', 'EQ', ('0', '1', '1'))
24 pkgs.installed_noarch = FakePackage('zsh', '1', '1', '0', 'noarch')
25 pkgs.installed_noarch.addRequires('bar', 'EQ', ('0', '1', '1'))
26 # updates
27 pkgs.update_i386 = FakePackage('zsh', '2', '1', '0', 'i386')
28 pkgs.update_x86_64 = FakePackage('zsh', '2', '1', '0', 'x86_64')
29 pkgs.update_noarch = FakePackage('zsh', '2', '1', '0', 'noarch')
30 # requires update (UpdateForDependency tests)
31 pkgs.requires_update = FakePackage('zsh-utils', '2', '1', '0', 'noarch')
32 pkgs.requires_update.addRequires('zsh', 'EQ', ('0', '2', '1'))
33 # removed requirement due to update (UpdateForDependency2 tests)
34 pkgs.required = FakePackage('bar', '1', '1', '0')
35 pkgs.required_updated = FakePackage('bar', version='2')
36
37 # noarch to X
38
39
40 def testUpdatenoarchTonoarch(self):
41 p = self.pkgs
42 res, msg = self.runOperation(['update'], [p.installed_noarch], [p.update_noarch,])
43 self.assert_(res=='ok', msg)
44 self.assertResult((p.update_noarch,))
45 def testUpdatenoarchTonoarchForDependency(self):
46 p = self.pkgs
47 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_noarch], [p.update_noarch, p.requires_update])
48 self.assert_(res=='ok', msg)
49 self.assertResult((p.update_noarch, p.requires_update))
50 def testUpdatenoarchTonoarchForDependency2(self):
51 p = self.pkgs
52 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_noarch],
53 [p.required_updated, p.update_noarch,])
54 self.assert_(res=='ok', msg)
55 self.assertResult((p.required_updated, p.update_noarch,))
56
57 def testUpdatenoarchToi386(self):
58 p = self.pkgs
59 res, msg = self.runOperation(['update'], [p.installed_noarch], [p.update_i386,])
60 self.assert_(res=='ok', msg)
61 self.assertResult((p.update_i386,))
62 def testUpdatenoarchToi386ForDependency(self):
63 p = self.pkgs
64 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_noarch], [p.update_i386, p.requires_update])
65 self.assert_(res=='ok', msg)
66 self.assertResult((p.update_i386, p.requires_update))
67 def testUpdatenoarchToi386ForDependency2(self):
68 p = self.pkgs
69 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_noarch],
70 [p.required_updated, p.update_i386])
71 self.assert_(res=='ok', msg)
72 self.assertResult((p.required_updated, p.update_i386))
73
74 def testUpdatenoarchTox86_64(self):
75 p = self.pkgs
76 res, msg = self.runOperation(['update'], [p.installed_noarch], [p.update_x86_64,])
77 self.assert_(res=='ok', msg)
78 self.assertResult((p.update_x86_64,))
79 def testUpdatenoarchTox86_64ForDependency(self):
80 p = self.pkgs
81 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_noarch], [p.update_x86_64, p.requires_update])
82 self.assert_(res=='ok', msg)
83 self.assertResult((p.update_x86_64, p.requires_update))
84 def testUpdatenoarchTox86_64ForDependency2(self):
85 p = self.pkgs
86 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_noarch],
87 [p.required_updated, p.update_x86_64])
88 self.assert_(res=='ok', msg)
89 self.assertResult((p.required_updated, p.update_x86_64))
90
91 def testUpdatenoarchToMultilib(self):
92 p = self.pkgs
93 res, msg = self.runOperation(['update'], [p.installed_noarch], [p.update_i386, p.update_x86_64])
94 self.assert_(res=='ok', msg)
95 if True or new_behavior: # We update from .noarch to just the .x86_64
96 self.assertResult((p.update_x86_64,), (p.update_i386,)) # ?
97 else: # Updates to both...
98 self.assertResult((p.update_i386, p.update_x86_64))
99 def testUpdatenoarchToMultilibForDependencyRev(self):
100 p = self.pkgs
101 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_noarch], [p.update_x86_64, p.update_i386, p.requires_update])
102 self.assert_(res=='ok', msg)
103 self.assertResult((p.update_x86_64, p.requires_update))
104 def testUpdatenoarchToMultilibForDependency(self):
105 p = self.pkgs
106 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_noarch], [p.update_i386, p.update_x86_64, p.requires_update])
107 self.assert_(res=='ok', msg)
108 self.assertResult((p.update_x86_64, p.requires_update))
109 def testUpdatenoarchToMultilibForDependency2(self):
110 p = self.pkgs
111 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_noarch],
112 [p.required_updated, p.update_i386, p.update_x86_64])
113 self.assert_(res=='ok', msg)
114 self.assertResult((p.required_updated, p.update_x86_64), (p.update_i386,))
115
116 # i386 to X
117
118 def testUpdatei386Tonoarch(self):
119 p = self.pkgs
120 res, msg = self.runOperation(['update'], [p.installed_i386], [p.update_noarch])
121 self.assert_(res=='ok', msg)
122 self.assertResult((p.update_noarch,))
123 def testUpdatei386TonoarchForDependency(self):
124 p = self.pkgs
125 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_i386], [p.update_noarch, p.requires_update])
126 self.assert_(res=='ok', msg)
127 self.assertResult((p.update_noarch, p.requires_update))
128 def testUpdatei386TonoarchForDependency2(self):
129 p = self.pkgs
130 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_i386],
131 [p.required_updated, p.update_noarch,])
132 self.assert_(res=='ok', msg)
133 self.assertResult((p.required_updated, p.update_noarch,))
134
135 def testUpdatei386Toi386(self):
136 p = self.pkgs
137 res, msg = self.runOperation(['update'], [p.installed_i386], [p.update_i386])
138 self.assert_(res=='ok', msg)
139 self.assertResult((p.update_i386,))
140 def testUpdatei386Toi386ForDependency(self):
141 p = self.pkgs
142 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_i386], [p.update_i386, p.requires_update])
143 self.assert_(res=='ok', msg)
144 self.assertResult((p.update_i386, p.requires_update))
145 def testUpdatei386Toi386ForDependency2(self):
146 p = self.pkgs
147 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_i386],
148 [p.required_updated, p.update_i386])
149 self.assert_(res=='ok', msg)
150 self.assertResult((p.required_updated, p.update_i386))
151
152 def testUpdatei386Tox86_64(self):
153 p = self.pkgs
154 res, msg = self.runOperation(['update'], [p.installed_i386], [p.update_x86_64])
155 self.assert_(res=='ok', msg)
156 self.assertResult((p.update_x86_64,))
157 def testUpdatei386Tox86_64ForDependency(self):
158 p = self.pkgs
159 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_i386], [p.update_x86_64, p.requires_update])
160 self.assert_(res=='ok', msg)
161 self.assertResult((p.update_x86_64, p.requires_update))
162 def testUpdatei386Tox86_64ForDependency2(self):
163 p = self.pkgs
164 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_i386],
165 [p.required_updated, p.update_x86_64])
166 self.assert_(res=='ok', msg)
167 self.assertResult((p.required_updated, p.update_x86_64))
168
169 def testUpdatei386ToMultilib(self):
170 p = self.pkgs
171 res, msg = self.runOperation(['update'], [p.installed_i386], [p.update_i386, p.update_x86_64])
172 self.assert_(res=='ok', msg)
173 self.assertResult((p.update_i386,))
174 def testUpdatei386ToMultilibForDependency(self):
175 p = self.pkgs
176 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_i386], [p.update_i386, p.update_x86_64, p.requires_update])
177 self.assert_(res=='ok', msg)
178 self.assertResult((p.update_i386, p.requires_update))
179 def testUpdatei386ToMultilibForDependency2(self):
180 p = self.pkgs
181 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_i386],
182 [p.required_updated, p.update_i386, p.update_x86_64])
183 self.assert_(res=='ok', msg)
184 self.assertResult((p.required_updated, p.update_i386))
185
186 # x86_64 to X
187
188 def testUpdatex86_64Tonoarch(self):
189 p = self.pkgs
190 res, msg = self.runOperation(['update'], [p.installed_x86_64], [p.update_noarch,])
191 self.assert_(res=='ok', msg)
192 self.assertResult((p.update_noarch,))
193 def testUpdatex86_64TonoarchForDependency(self):
194 p = self.pkgs
195 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_x86_64],
196 [p.update_noarch, p.requires_update])
197 self.assert_(res=='ok', msg)
198 self.assertResult((p.update_noarch, p.requires_update))
199 def testUpdatex86_64TonoarchForDependency2(self):
200 p = self.pkgs
201 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_x86_64],
202 [p.required_updated, p.update_noarch])
203 self.assert_(res=='ok', msg)
204 self.assertResult((p.required_updated, p.update_noarch))
205
206 def testUpdatex86_64Toi386(self):
207 p = self.pkgs
208 res, msg = self.runOperation(['update'], [p.installed_x86_64], [p.update_i386,])
209 self.assert_(res=='ok', msg)
210 self.assertResult((p.update_i386,))
211 def testUpdatex86_64Toi386ForDependency(self):
212 p = self.pkgs
213 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_x86_64],
214 [p.update_i386, p.requires_update])
215 self.assert_(res=='ok', msg)
216 self.assertResult((p.update_i386, p.requires_update))
217 def testUpdatex86_64Toi386ForDependency2(self):
218 p = self.pkgs
219 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_x86_64],
220 [p.required_updated, p.update_i386])
221 self.assert_(res=='ok', msg)
222 self.assertResult((p.required_updated, p.update_i386))
223
224 def testUpdatex86_64Tox86_64(self):
225 p = self.pkgs
226 res, msg = self.runOperation(['update'], [p.installed_x86_64], [p.update_x86_64,])
227 self.assert_(res=='ok', msg)
228 self.assertResult((p.update_x86_64,))
229 def testUpdatex86_64Tox86_64ForDependency(self):
230 p = self.pkgs
231 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_x86_64],
232 [p.update_x86_64, p.requires_update])
233 self.assert_(res=='ok', msg)
234 self.assertResult((p.update_x86_64, p.requires_update))
235 def testUpdatex86_64Tox86_64ForDependency2(self):
236 p = self.pkgs
237 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_x86_64],
238 [p.required_updated, p.update_x86_64])
239 self.assert_(res=='ok', msg)
240 self.assertResult((p.required_updated, p.update_x86_64))
241
242 def testUpdatex86_64ToMultilib(self):
243 p = self.pkgs
244 res, msg = self.runOperation(['update'], [p.installed_x86_64], [p.update_i386, p.update_x86_64])
245 self.assert_(res=='ok', msg)
246 self.assertResult((p.update_x86_64,))
247 def testUpdatex86_64ToMultilibForDependency(self):
248 p = self.pkgs
249 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_x86_64],
250 [p.update_i386, p.update_x86_64, p.requires_update])
251 self.assert_(res=='ok', msg)
252 self.assertResult((p.update_x86_64, p.requires_update))
253 def testUpdatex86_64ToMultilibForDependency2(self):
254 p = self.pkgs
255 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_x86_64],
256 [p.required_updated, p.update_i386, p.update_x86_64])
257 self.assert_(res=='ok', msg)
258 self.assertResult((p.required_updated, p.update_x86_64))
259
260 # multilib to X
261
262 def testUpdateMultilibTonoarch(self):
263 p = self.pkgs
264 res, msg = self.runOperation(['update'], [p.installed_i386, p.installed_x86_64], [p.update_noarch])
265 self.assert_(res=='ok', msg)
266 self.assertResult((p.update_noarch,))
267 def testUpdateMultilibTonoarchForDependency(self):
268 p = self.pkgs
269 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_i386, p.installed_x86_64], [p.update_noarch, p.requires_update])
270 self.assert_(res=='ok', msg)
271 self.assertResult((p.update_noarch, p.requires_update))
272 def testUpdateMultilibTonoarchForDependency2(self):
273 p = self.pkgs
274 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_i386, p.installed_x86_64],
275 [p.required_updated, p.update_noarch])
276 self.assert_(res=='ok', msg)
277 self.assertResult((p.required_updated, p.update_noarch))
278
279 def testUpdateMultilibToi386(self):
280 p = self.pkgs
281 res, msg = self.runOperation(['update'], [p.installed_i386, p.installed_x86_64], [p.update_i386])
282 self.assert_(res=='ok', msg)
283 if new_behavior:
284 self.assertResult((p.update_i386, p.installed_x86_64))
285 # self.assertResult((p.update_i386,)) # XXX is this right?
286 else:
287 self.assertResult((p.update_i386, p.installed_x86_64))
288 def testUpdateMultilibToi386ForDependency(self):
289 p = self.pkgs
290 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_i386, p.installed_x86_64], [p.update_i386, p.requires_update])
291 self.assert_(res=='ok', msg)
292 if new_behavior:
293 self.assertResult((p.update_i386, p.installed_x86_64, p.requires_update))
294 # self.assertResult((p.update_i386, p.requires_update)) # XXX is this right?
295 else:
296 self.assertResult((p.update_i386, p.installed_x86_64, p.requires_update))
297 def testUpdateMultilibToi386ForDependency2(self):
298 p = self.pkgs
299 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_i386, p.installed_x86_64],
300 [p.required_updated, p.update_i386])
301 self.assert_(res=='err', msg)
302 self.assertResult((p.required_updated, p.update_i386, p.installed_x86_64))
303
304 def testUpdateMultilibTox86_64(self):
305 p = self.pkgs
306 res, msg = self.runOperation(['update'], [p.installed_i386, p.installed_x86_64], [p.update_x86_64])
307 self.assert_(res=='ok', msg)
308 if new_behavior:
309 self.assertResult((p.update_x86_64, p.installed_i386))
310 # self.assertResult((p.update_x86_64,)) # XXX is this right?
311 else:
312 self.assertResult((p.update_x86_64, p.installed_i386))
313 def testUpdateMultilibTox86_64ForDependency(self):
314 p = self.pkgs
315 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_i386, p.installed_x86_64], [p.update_x86_64, p.requires_update])
316 self.assert_(res=='ok', msg)
317 if new_behavior:
318 self.assertResult((p.update_x86_64, p.installed_i386, p.requires_update))
319 # self.assertResult((p.update_x86_64, p.requires_update)) # XXX is this right?
320 else:
321 self.assertResult((p.update_x86_64, p.installed_i386, p.requires_update))
322 def testUpdateMultilibTox86_64ForDependency2(self):
323 p = self.pkgs
324 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_i386, p.installed_x86_64],
325 [p.required_updated, p.update_x86_64])
326 self.assert_(res=='err', msg)
327 self.assertResult((p.required_updated, p.update_x86_64, p.installed_i386))
328
329 def testUpdateMultilibToMultilib(self):
330 p = self.pkgs
331 res, msg = self.runOperation(['update'], [p.installed_i386, p.installed_x86_64], [p.update_i386, p.update_x86_64])
332 self.assert_(res=='ok', msg)
333 self.assertResult((p.update_i386, p.update_x86_64))
334 def testUpdateMultilibToMultilibForDependency(self):
335 p = self.pkgs
336 res, msg = self.runOperation(['install', 'zsh-utils'], [p.installed_i386, p.installed_x86_64], [p.update_i386, p.update_x86_64, p.requires_update])
337 self.assert_(res=='ok', msg)
338 self.assertResult((p.update_i386, p.update_x86_64, p.requires_update))
339 def testUpdateMultilibToMultilibForDependency2(self):
340 p = self.pkgs
341 res, msg = self.runOperation(['update', 'bar'], [p.required, p.installed_i386, p.installed_x86_64],
342 [p.required_updated, p.update_i386, p.update_x86_64])
343 self.assert_(res=='ok', msg)
344 self.assertResult((p.required_updated, p.update_i386, p.update_x86_64))
345
346 def testUpdateNotLatestDep(self):
347 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
348 foo11.addRequires('bar', 'EQ', ('0', '1', '1'))
349 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
350 foo12.addRequires('bar', 'EQ', ('0', '1', '2'))
351 bar11 = FakePackage('bar', '1', '1', '0', 'i386')
352 bar12 = FakePackage('bar', '1', '2', '0', 'i386')
353 bar21 = FakePackage('bar', '2', '1', '0', 'i386')
354 res, msg = self.runOperation(['install', 'foo'], [foo11, bar11], [foo12, bar12, bar21])
355 self.assert_(res=='ok', msg)
356 self.assertResult((foo12, bar12))
357
358 def testUpdateBadMultiInstall1(self):
359 # This is a bug, but we shouldn't die too badly on it...
360 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
361 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
362 foo13 = FakePackage('foo', '1', '3', '0', 'i386')
363 foo20 = FakePackage('foo', '2', '0', '0', 'i386')
364
365 res, msg = self.runOperation(['install', 'foo'],
366 [foo11, foo12, foo13],
367 [foo20])
368 self.assert_(res=='ok', msg)
369 self.assertResult((foo20,))
370
371 def testUpdateBadMultiInstall2(self):
372 # This is a bug, but we shouldn't die too badly on it...
373 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
374 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
375 foo13 = FakePackage('foo', '1', '3', '0', 'i386')
376 foo20 = FakePackage('foo', '2', '0', '0', 'i386')
377
378 res, msg = self.runOperation(['update', 'foo'],
379 [foo11, foo12, foo13],
380 [foo20])
381 self.assert_(res=='ok', msg)
382 self.assertResult((foo20,))
383
384 def testUpdateBadMultiInstall3(self):
385 # This is a bug, but we shouldn't die too badly on it...
386 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
387 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
388 foo13 = FakePackage('foo', '1', '3', '0', 'i386')
389 foo20 = FakePackage('foo', '2', '0', '0', 'i386')
390
391 res, msg = self.runOperation(['update'],
392 [foo11, foo12, foo13],
393 [foo20])
394 self.assert_(res=='ok', msg)
395 self.assertResult((foo20,))
396
397 def testUpdateBadMultiInstall4(self):
398 # This is a bug, but we shouldn't die too badly on it...
399 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
400 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
401 foo13 = FakePackage('foo', '1', '3', '0', 'i386')
402 foo20 = FakePackage('foo', '2', '0', '0', 'i386')
403 bar11 = FakePackage('bar', '1', '1', '0', 'i386')
404 bar12 = FakePackage('bar', '1', '2', '0', 'i386')
405 bar12.addRequires('foo', 'EQ', ('0', '2', '0'))
406
407 res, msg = self.runOperation(['update', 'bar'],
408 [foo11, foo12, foo13, bar11],
409 [foo20, bar12])
410 self.assert_(res=='ok', msg)
411 self.assertResult((foo20,bar12))
412
413 def testUpdateBadMultiInstall5(self):
414 # This is a bug, but we shouldn't die too badly on it...
415 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
416 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
417 foo13 = FakePackage('foo', '1', '3', '0', 'i386')
418 foo20 = FakePackage('foo', '2', '0', '0', 'i386')
419 bar11 = FakePackage('bar', '1', '1', '0', 'i386')
420 bar12 = FakePackage('bar', '1', '2', '0', 'i386')
421 bar12.addRequires('foo', 'EQ', ('0', '2', '0'))
422
423 res, msg = self.runOperation(['update'],
424 [foo11, foo12, foo13, bar11],
425 [foo20, bar12])
426 self.assert_(res=='ok', msg)
427 self.assertResult((foo20,bar12))
428
429 def testUpdateBadMultiInstall6(self):
430 # This is a bug, but we shouldn't die too badly on it...
431 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
432 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
433 foo13 = FakePackage('foo', '1', '3', '0', 'i386')
434 foo20 = FakePackage('foo', '2', '0', '0', 'i386')
435 bar11 = FakePackage('bar', '1', '1', '0', 'i386')
436 bar12 = FakePackage('bar', '1', '2', '0', 'i386')
437 bar12.addObsoletes('foo', None, (None, None, None))
438
439 res, msg = self.runOperation(['update'],
440 [foo11, foo12, foo13, bar11],
441 [foo20, bar12])
442 self.assert_(res=='ok', msg)
443 self.assertResult((bar12,))
444
445 def testUpdateBadMultiInstall7(self):
446 # This is a bug, but we shouldn't die too badly on it...
447 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
448 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
449 foo13 = FakePackage('foo', '1', '3', '0', 'i386')
450 foo20 = FakePackage('foo', '2', '0', '0', 'i386')
451 bar11 = FakePackage('bar', '1', '1', '0', 'i386')
452 bar12 = FakePackage('bar', '1', '2', '0', 'i386')
453 bar12.addRequires('foo', 'EQ', ('0', '2', '0'))
454
455 res, msg = self.runOperation(['update', '*'],
456 [foo11, foo12, foo13, bar11],
457 [foo20, bar12])
458 self.assert_(res=='ok', msg)
459 self.assertResult((foo20,bar12))
460
461 def testUpdateBadMultiInstall8(self):
462 # This is a bug, but we shouldn't die too badly on it...
463 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
464 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
465 foo13 = FakePackage('foo', '1', '3', '0', 'i386')
466 foo20 = FakePackage('foo', '2', '0', '0', 'i386')
467 bar11 = FakePackage('bar', '1', '1', '0', 'i386')
468 bar12 = FakePackage('bar', '1', '2', '0', 'i386')
469 bar12.addObsoletes('foo', None, (None, None, None))
470
471 res, msg = self.runOperation(['update', '*'],
472 [foo11, foo12, foo13, bar11],
473 [foo20, bar12])
474 self.assert_(res=='ok', msg)
475 self.assertResult((bar12,))
476
477 def testUpdateMultiRequiresVersions1(self):
478 pi11 = FakePackage('perl', '1', '1', '0', 'i386')
479 pr11 = FakePackage('perl', '1', '1', '0', 'i386')
480 p12 = FakePackage('perl', '1', '2', '0', 'i386')
481
482 pvi11 = FakePackage('perl-version', '1', '1', '0', 'i386')
483 pvi11.addRequires('perl', 'GE', ('0', '0', '0'))
484 pvi11.addRequires('perl', 'EQ', ('0', '1', '1'))
485 pvr11 = FakePackage('perl-version', '1', '1', '0', 'i386')
486 pvr11.addRequires('perl', 'GE', ('0', '0', '0'))
487 pvr11.addRequires('perl', 'EQ', ('0', '1', '1'))
488 pv12 = FakePackage('perl-version', '1', '2', '0', 'i386')
489 pv12.addRequires('perl', 'GE', ('0', '0', '0'))
490 pv12.addRequires('perl', 'EQ', ('0', '1', '2'))
491
492 res, msg = self.runOperation(['update', 'perl'],
493 [pi11, pvi11],
494 [p12, pv12])
495 self.assert_(res=='ok', msg)
496 self.assertResult((p12,pv12))
497
498 def testUpdateMultiRequiresVersions2(self):
499 pi11 = FakePackage('perl', '1', '1', '0', 'i386')
500 pr11 = FakePackage('perl', '1', '1', '0', 'i386')
501 p12 = FakePackage('perl', '1', '2', '0', 'i386')
502
503 pvi11 = FakePackage('perl-version', '1', '1', '0', 'i386')
504 pvi11.addRequires('perl', 'GE', ('0', '0', '0'))
505 pvi11.addRequires('perl', 'EQ', ('0', '1', '1'))
506 pvr11 = FakePackage('perl-version', '1', '1', '0', 'i386')
507 pvr11.addRequires('perl', 'GE', ('0', '0', '0'))
508 pvr11.addRequires('perl', 'EQ', ('0', '1', '1'))
509 pv12 = FakePackage('perl-version', '1', '2', '0', 'i386')
510 pv12.addRequires('perl', 'GE', ('0', '0', '0'))
511 pv12.addRequires('perl', 'EQ', ('0', '1', '2'))
512
513 res, msg = self.runOperation(['update', 'perl'],
514 [pi11, pvi11],
515 [pr11,p12, pvr11,pv12])
516 self.assert_(res=='ok', msg)
517 self.assertResult((p12,pv12))
518
519 def testUpdateMultiRequiresVersions3(self):
520 pi11 = FakePackage('perl', '1', '1', '0', 'i386')
521 pr11 = FakePackage('perl', '1', '1', '0', 'i386')
522 p12 = FakePackage('perl', '1', '2', '0', 'i386')
523
524 pvi11 = FakePackage('perl-version', '1', '1', '0', 'i386')
525 pvi11.addRequires('perl', 'GE', ('0', '0', '0'))
526 pvi11.addRequires('perl', 'EQ', ('0', '1', '1'))
527 pvr11 = FakePackage('perl-version', '1', '1', '0', 'i386')
528 pvr11.addRequires('perl', 'GE', ('0', '0', '0'))
529 pvr11.addRequires('perl', 'EQ', ('0', '1', '1'))
530 pv12 = FakePackage('perl-version', '1', '2', '0', 'i386')
531 pv12.addRequires('perl', 'GE', ('0', '0', '0'))
532 pv12.addRequires('perl', 'EQ', ('0', '1', '2'))
533
534 res, msg = self.runOperation(['update', 'perl-version'],
535 [pi11, pvi11],
536 [pr11,p12, pvr11,pv12])
537 self.assert_(res=='ok', msg)
538 self.assertResult((p12,pv12))
539
540 def testUpdateMultiRequiresVersions4(self):
541 pi11 = FakePackage('perl', '1', '1', '0', 'i386')
542 pr11 = FakePackage('perl', '1', '1', '0', 'i386')
543 p12 = FakePackage('perl', '1', '2', '0', 'i386')
544
545 pvi11 = FakePackage('perl-version', '1', '1', '0', 'i386')
546 pvi11.addRequires('perl', 'GE', ('0', '0', '0'))
547 pvi11.addRequires('perl', 'EQ', ('0', '1', '1'))
548 pvr11 = FakePackage('perl-version', '1', '1', '0', 'i386')
549 pvr11.addRequires('perl', 'GE', ('0', '0', '0'))
550 pvr11.addRequires('perl', 'EQ', ('0', '1', '1'))
551 pv12 = FakePackage('perl-version', '1', '2', '0', 'i386')
552 pv12.addRequires('perl', 'GE', ('0', '0', '0'))
553 pv12.addRequires('perl', 'EQ', ('0', '1', '2'))
554
555 pbi11 = FakePackage('perl-blah', '1', '1', '0', 'i386')
556 pbi11.addRequires('perl', 'EQ', ('0', '1', '1'))
557 pbi11.addRequires('perl', 'GE', ('0', '0', '0'))
558 pbr11 = FakePackage('perl-blah', '1', '1', '0', 'i386')
559 pbr11.addRequires('perl', 'EQ', ('0', '1', '1'))
560 pbr11.addRequires('perl', 'GE', ('0', '0', '0'))
561 pb12 = FakePackage('perl-blah', '1', '2', '0', 'i386')
562 pb12.addRequires('perl', 'EQ', ('0', '1', '2'))
563 pb12.addRequires('perl', 'GE', ('0', '0', '0'))
564
565 res, msg = self.runOperation(['update', 'perl-version'],
566 [pi11, pbi11, pvi11],
567 [pr11,p12, pbr11,pb12, pvr11,pv12])
568 self.assert_(res=='ok', msg)
569 self.assertResult((p12,pb12,pv12))
570
571 def testUpdateMultiRequiresVersions5(self):
572 pi11 = FakePackage('perl', '1', '1', '0', 'i386')
573 pr11 = FakePackage('perl', '1', '1', '0', 'i386')
574 p12 = FakePackage('perl', '1', '2', '0', 'i386')
575
576 pvi11 = FakePackage('perl-version', '1', '1', '0', 'i386')
577 pvi11.addRequires('perl', 'GE', ('0', '0', '0'))
578 pvi11.addRequires('perl', 'EQ', ('0', '1', '1'))
579 pvr11 = FakePackage('perl-version', '1', '1', '0', 'i386')
580 pvr11.addRequires('perl', 'GE', ('0', '0', '0'))
581 pvr11.addRequires('perl', 'EQ', ('0', '1', '1'))
582 pv12 = FakePackage('perl-version', '1', '2', '0', 'i386')
583 pv12.addRequires('perl', 'GE', ('0', '0', '0'))
584 pv12.addRequires('perl', 'EQ', ('0', '1', '2'))
585
586 pbi11 = FakePackage('perl-blah', '1', '1', '0', 'i386')
587 pbi11.addRequires('perl', 'EQ', ('0', '1', '1'))
588 pbi11.addRequires('perl', 'GE', ('0', '0', '0'))
589 pbr11 = FakePackage('perl-blah', '1', '1', '0', 'i386')
590 pbr11.addRequires('perl', 'EQ', ('0', '1', '1'))
591 pbr11.addRequires('perl', 'GE', ('0', '0', '0'))
592 pb12 = FakePackage('perl-blah', '1', '2', '0', 'i386')
593 pb12.addRequires('perl', 'EQ', ('0', '1', '2'))
594 pb12.addRequires('perl', 'GE', ('0', '0', '0'))
595
596 res, msg = self.runOperation(['update', 'perl-blah'],
597 [pi11, pbi11, pvi11],
598 [pr11,p12, pbr11,pb12, pvr11,pv12])
599 self.assert_(res=='ok', msg)
600 self.assertResult((p12,pb12,pv12))
601
602 def testUpdateMultiRequiresVersions8(self):
603 pi11 = FakePackage('perl', '1', '1', '0', 'i386')
604 pr11 = FakePackage('perl', '1', '1', '0', 'i386')
605 p12 = FakePackage('perl', '1', '2', '0', 'i386')
606
607 pvi11 = FakePackage('perl-version', '1', '1', '0', 'i386')
608 pvi11.addRequires('perl', 'GE', ('0', '0', '0'))
609 pvi11.addRequires('perl', 'EQ', ('0', '1', '1'))
610 pvr11 = FakePackage('perl-version', '1', '1', '0', 'i386')
611 pvr11.addRequires('perl', 'GE', ('0', '0', '0'))
612 pvr11.addRequires('perl', 'EQ', ('0', '1', '1'))
613 pv12 = FakePackage('perl-version', '1', '2', '0', 'i386')
614 pv12.addRequires('perl', 'GE', ('0', '0', '0'))
615 pv12.addRequires('perl', 'EQ', ('0', '1', '2'))
616 pv13 = FakePackage('perl-version', '1', '3', '0', 'i386')
617 pv13.addRequires('perl', 'GE', ('0', '0', '0'))
618 pv13.addRequires('perl', 'EQ', ('0', '1', '3'))
619
620 res, msg = self.runOperation(['update', 'perl'],
621 [pi11, pvi11],
622 [pr11,p12, pvr11,pv12,pv13])
623 # FIXME: This fails ... it tries to install pv13 instead
624 self.assert_(res=='err', msg)
625 # self.assert_(res=='ok', msg)
626 # self.assertResult((p12,pv12))
627
628 def testInstallFilenamePkgSplit1(self):
629 pi11 = FakePackage('phoo', '1', '1', '0', 'i386')
630 pi11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
631 pr11 = FakePackage('phoo', '1', '1', '0', 'i386')
632 pr11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
633 p12 = FakePackage('phoo', '1', '2', '0', 'i386')
634 py12 = FakePackage('phoo-y', '1', '2', '0', 'i386')
635 py12.addProvides('/path/to/phooy', 'EQ', ('0', '1', '2'))
636
637
638 res, msg = self.runOperation(['update', '/path/to/phooy'],
639 [pi11],
640 [pr11,p12, py12])
641 self.assert_(res=='ok', msg)
642 # FIXME: We'd really like it to be:
643 # self.assertResult((p12,py12))
644 # ...but there is no info. you can work this out with.
645 self.assertResult((p12,))
646
647 def testInstallFilenamePkgSplit2(self):
648 pi11 = FakePackage('phoo', '1', '1', '0', 'i386')
649 pi11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
650 pr11 = FakePackage('phoo', '1', '1', '0', 'i386')
651 pr11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
652 p12 = FakePackage('phoo', '1', '2', '0', 'i386')
653 p12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
654 py12 = FakePackage('phoo-y', '1', '2', '0', 'i386')
655 py12.addProvides('/path/to/phooy', 'EQ', ('0', '1', '2'))
656 py12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
657
658 res, msg = self.runOperation(['update', '/path/to/phooy'],
659 [pi11],
660 [pr11,p12, py12])
661 self.assert_(res=='ok', msg)
662 self.assertResult((p12,py12))
663
664 def testInstallFilenamePkgSplit3(self):
665 p11 = FakePackage('phoo', '1', '1', '0', 'i386')
666 p11.addProvides('/path/to/phooy', 'EQ', ('0', '1', '1'))
667 pi12 = FakePackage('phoo', '1', '2', '0', 'i386')
668 pi12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
669 pr12 = FakePackage('phoo', '1', '2', '0', 'i386')
670 pr12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
671 py12 = FakePackage('phoo-y', '1', '2', '0', 'i386')
672 py12.addProvides('/path/to/phooy', 'EQ', ('0', '1', '2'))
673 py12.addObsoletes('phoo', 'LE', ('0', '1', '1'))
674
675 res, msg = self.runOperation(['install', '/path/to/phooy'],
676 [pi12],
677 [p11, pr12, py12])
678 self.assert_(res=='ok', msg)
679 self.assertResult((pi12,py12))
680
681 def testUpdateMultiArchConflict(self):
682 pi1 = FakePackage('A', '1', '1', '0', 'i386')
683 pi2 = FakePackage('B', '1', '1', '0', 'i386')
684 pi3 = FakePackage('B', '1', '1', '0', 'x86_64')
685
686 pa1 = FakePackage('A', '1', '2', '0', 'i386')
687 pa2 = FakePackage('B', '1', '2', '0', 'i386')
688 pa2.addConflicts('A', 'LE', ('0', '1', '1'))
689 pa3 = FakePackage('B', '1', '2', '0', 'x86_64')
690 pa3.addConflicts('A', 'LE', ('0', '1', '1'))
691
692 res, msg = self.runOperation(['update', 'B'],
693 [pi1, pi2, pi3],
694 [pa1, pa2, pa3])
695 self.assert_(res=='ok', msg)
696 self.assertResult((pa1, pa2, pa3))
697
698 # What I was trying to model here is a problem where the Fedora builders
699 # tried to install "ncurses-libs" and got a choice of:
700 # ncurses-libs-1.x86_64, ncurses-libs-1.i586, ncurses-libs-1.x86_64
701 # ...and the we should have picked one of the .x86_64 packages in
702 # _compare_providers(), but we picked the .i586 one.
703 # However that didn't happen, as the testcases "just worked".
704 # But from experimenting it was observed that if you just had one .x86_64
705 # and one .i586 then _compare_providers() got the right answer. So these
706 # testcases model that problem in _compare_providers(), kinda.
707 # Then we can fix that problem, which should also fix the original problem
708 # whatever the hell that was.
709 def testUpdateMultiAvailPkgs1(self):
710 pa1 = FakePackage('A', '1', '1', '0', 'x86_64')
711 pa1.addRequires('blah', 'EQ', ('0', '1', '1'))
712 pa2 = FakePackage('B', '1', '1', '0', 'i586')
713 pa2.addProvides('blah', 'EQ', ('0', '1', '1'))
714 pa3 = FakePackage('B', '1', '1', '0', 'x86_64', repo=FakeRepo('one'))
715 pa3.addProvides('blah', 'EQ', ('0', '1', '1'))
716 pa4 = FakePackage('B', '1', '1', '0', 'x86_64', repo=FakeRepo('two'))
717 pa4.addProvides('blah', 'EQ', ('0', '1', '1'))
718
719 res, msg = self.runOperation(['install', 'A'],
720 [],
721 [pa1, pa2, pa3, pa4])
722 self.assert_(res=='ok', msg)
723 self.assertResult((pa1, pa3))
724
725 def testUpdateMultiAvailPkgs2(self):
726 pa1 = FakePackage('A', '1', '1', '0', 'x86_64')
727 pa1.addRequires('blah', 'EQ', ('0', '1', '1'))
728 pa2 = FakePackage('B', '1', '1', '0', 'i586')
729 pa2.addProvides('blah', 'EQ', ('0', '1', '1'))
730 pa3 = FakePackage('B', '1', '1', '0', 'x86_64', repo=FakeRepo('one'))
731 pa3.addProvides('blah', 'EQ', ('0', '1', '1'))
732 pa4 = FakePackage('B', '1', '1', '0', 'x86_64', repo=FakeRepo('two'))
733 pa4.addProvides('blah', 'EQ', ('0', '1', '1'))
734
735 res, msg = self.runOperation(['install', 'A'],
736 [],
737 [pa1, pa2, pa4, pa3])
738 self.assert_(res=='ok', msg)
739 self.assertResult((pa1, pa3))
740
741 def testUpdateMultiAvailPkgs3(self):
742 pa1 = FakePackage('A', '1', '1', '0', 'x86_64')
743 pa1.addRequires('B', 'EQ', ('0', '1', '1'))
744 pa2 = FakePackage('B', '1', '1', '0', 'i386')
745 pa3 = FakePackage('B', '1', '1', '0', 'x86_64', repo=FakeRepo('one'))
746 pa4 = FakePackage('B', '1', '1', '0', 'x86_64', repo=FakeRepo('two'))
747
748 res, msg = self.runOperation(['install', 'A'],
749 [],
750 [pa1, pa2, pa3, pa4])
751 self.assert_(res=='ok', msg)
752 self.assertResult((pa1, pa3))
753
754
755 def testUpdateMultiAvailPkgs4(self):
756 pa1 = FakePackage('A', '1', '1', '0', 'x86_64')
757 pa1.addRequires('B', 'EQ', ('0', '1', '1'))
758 pa2 = FakePackage('B', '1', '1', '0', 'i386')
759 pa3 = FakePackage('B', '1', '1', '0', 'x86_64', repo=FakeRepo('one'))
760 pa4 = FakePackage('B', '1', '1', '0', 'x86_64', repo=FakeRepo('two'))
761
762 res, msg = self.runOperation(['install', 'A'],
763 [],
764 [pa1, pa2, pa4, pa3])
765 self.assert_(res=='ok', msg)
766 self.assertResult((pa1, pa3))
767
768 def testUpdateRLEvince1(self):
769 """ This tests a dep. upgrade from a dep. upgrade, with a multilib. pkg.
770 where only half of the multilib. is installed. """
771 pi1 = FakePackage('evince', '1', '1', '0', 'x86_64')
772 pi1.addRequires('evince-libs', 'EQ', ('0', '1', '1'))
773 pi2 = FakePackage('evince-libs', '1', '1', '0', 'x86_64')
774 pi3 = FakePackage('evince-djvu', '1', '1', '0', 'x86_64')
775 pi3.addRequires('evince-libs', 'EQ', ('0', '1', '1'))
776
777 pa1 = FakePackage('evince', '2', '1', '0', 'x86_64')
778 pa1.addRequires('evince-libs', 'EQ', ('0', '2', '1'))
779 pa2i = FakePackage('evince-libs', '2', '1', '0', 'i686')
780 pa2x = FakePackage('evince-libs', '2', '1', '0', 'x86_64')
781 pa3 = FakePackage('evince-djvu', '2', '1', '0', 'x86_64')
782 pa3.addRequires('evince-libs', 'EQ', ('0', '2', '1'))
783
784 res, msg = self.runOperation(['update', 'evince'],
785 [pi1, pi2, pi3],
786 [pa1, pa2x, pa2i, pa3])
787 self.assert_(res=='ok', msg)
788 self.assertResult((pa1, pa2x, pa3))
789
790 def testUpdateRLEvince2(self):
791 """ Dito. testUpdateRLEvince1, except here pa2i is before pa2x, and
792 thus. will be seen first by .update() when it does an
793 archless "find". """
794 pi1 = FakePackage('evince', '1', '1', '0', 'x86_64')
795 pi1.addRequires('evince-libs', 'EQ', ('0', '1', '1'))
796 pi2 = FakePackage('evince-libs', '1', '1', '0', 'x86_64')
797 pi3 = FakePackage('evince-djvu', '1', '1', '0', 'x86_64')
798 pi3.addRequires('evince-libs', 'EQ', ('0', '1', '1'))
799
800 pa1 = FakePackage('evince', '2', '1', '0', 'x86_64')
801 pa1.addRequires('evince-libs', 'EQ', ('0', '2', '1'))
802 pa2i = FakePackage('evince-libs', '2', '1', '0', 'i686')
803 pa2x = FakePackage('evince-libs', '2', '1', '0', 'x86_64')
804 pa3 = FakePackage('evince-djvu', '2', '1', '0', 'x86_64')
805 pa3.addRequires('evince-libs', 'EQ', ('0', '2', '1'))
806
807 res, msg = self.runOperation(['update', 'evince'],
808 [pi1, pi2, pi3],
809 [pa1, pa2i, pa2x, pa3])
810 self.assert_(res=='ok', msg)
811 self.assertResult((pa1, pa2x, pa3))
812
813 def testShellRmUp1(self):
814 """ Do an rm for a package, and then update it. """
815 pi1 = FakePackage('foo', '1', '1', '0', 'x86_64')
816
817 pa1 = FakePackage('foo', '2', '1', '0', 'x86_64')
818
819 res, msg = self.runOperation((['remove', 'foo'],
820 ['update', 'foo'],
821 ),
822 [pi1],
823 [pa1], multi_cmds=True)
824 self.assert_(res=='ok', msg)
825 self.assertResult((pa1,))
826
827 def testShellRmUp2(self):
828 """ Do an rm for a package, and then update it. """
829 pi1 = FakePackage('foo', '1', '1', '0', 'x86_64')
830 pi2 = FakePackage('foo', '1', '1', '0', 'i686')
831
832 pa1 = FakePackage('foo', '2', '1', '0', 'x86_64')
833 pa2 = FakePackage('foo', '2', '1', '0', 'i686')
834
835 res, msg = self.runOperation((['remove', 'foo.i686'],
836 ['update', 'foo'],
837 ),
838 [pi1, pi2],
839 [pa1, pa2], multi_cmds=True)
840 self.assert_(res=='ok', msg)
841 self.assertResult((pa1, pa2))
842
843 def testShellRmUp3(self):
844 """ Do an rm for a package, and then update it. """
845 pi1 = FakePackage('foo', '1', '1', '0', 'x86_64')
846 pi2 = FakePackage('foo', '1', '1', '0', 'i686')
847
848 pa1 = FakePackage('foo', '2', '1', '0', 'x86_64')
849 pa2 = FakePackage('foo', '2', '1', '0', 'i686')
850
851 res, msg = self.runOperation((['remove', 'foo.x86_64'],
852 ['update', 'foo'],
853 ),
854 [pi1, pi2],
855 [pa1, pa2], multi_cmds=True)
856 self.assert_(res=='ok', msg)
857 self.assertResult((pa1, pa2))
858
859 def testShellRmUp4(self):
860 """ Do an rm for a package, and then update it. """
861 pi1 = FakePackage('foo', '1', '1', '0', 'x86_64')
862 pi2 = FakePackage('foo', '1', '1', '0', 'i686')
863
864 pa1 = FakePackage('foo', '2', '1', '0', 'x86_64')
865 pa2 = FakePackage('foo', '2', '1', '0', 'i686')
866
867 res, msg = self.runOperation((['remove', 'foo.i686'],
868 ['update', 'foo-2-1'],
869 ),
870 [pi1, pi2],
871 [pa1, pa2], multi_cmds=True)
872 self.assert_(res=='ok', msg)
873 self.assertResult((pa1, pa2))
874
875 # Test how update-to != update.
876 def _setupUpdateTo(self):
877 foo11 = FakePackage('foo', '1', '1', '0', 'i386')
878 foo11.addProvides('foobar', 'EQ', ('0', '1', '1'))
879 foo12 = FakePackage('foo', '1', '2', '0', 'i386')
880 foo12.addProvides('foobar', 'EQ', ('0', '1', '2'))
881 foo13 = FakePackage('foo', '1', '3', '0', 'i386')
882 foo13.addProvides('foobar', 'EQ', ('0', '1', '3'))
883 foo20 = FakePackage('foo', '2', '0', '0', 'i386')
884 foo20.addProvides('foobar', 'EQ', ('0', '2', '0'))
885 all = (foo11, foo12, foo13, foo20)
886 return locals()
887
888 def testUpdateTo1_1(self):
889 pkgs = self._setupUpdateTo()
890 res, msg = self.runOperation(['update', 'foo'],
891 [pkgs['foo11']],
892 pkgs['all'])
893 self.assert_(res=='ok', msg)
894 self.assertResult((pkgs['foo20'],))
895
896 def testUpdateTo1_2(self):
897 pkgs = self._setupUpdateTo()
898 res, msg = self.runOperation(['update-to', 'foo'],
899 [pkgs['foo11']],
900 pkgs['all'])
901 self.assert_(res=='ok', msg)
902 self.assertResult((pkgs['foo20'],))
903
904 def testUpdateTo2_1(self):
905 pkgs = self._setupUpdateTo()
906 res, msg = self.runOperation(['update', 'foo-1-2'],
907 [pkgs['foo11']],
908 pkgs['all'])
909 self.assert_(res=='ok', msg)
910 self.assertResult((pkgs['foo12'],))
911
912 def testUpdateTo2_2(self):
913 pkgs = self._setupUpdateTo()
914 res, msg = self.runOperation(['update-to', 'foo-1-2'],
915 [pkgs['foo11']],
916 pkgs['all'])
917 self.assert_(res=='ok', msg)
918 self.assertResult((pkgs['foo12'],))
919
920 def testUpdateTo3_1(self):
921 pkgs = self._setupUpdateTo()
922 res, msg = self.runOperation(['update', 'foo-1-2'],
923 [pkgs['foo12']],
924 pkgs['all'])
925 self.assert_(res=='ok', msg)
926 self.assertResult((pkgs['foo20'],))
927
928 def testUpdateTo3_2(self):
929 pkgs = self._setupUpdateTo()
930 res, msg = self.runOperation(['update-to', 'foo-1-2'],
931 [pkgs['foo12']],
932 pkgs['all'])
933 # Nothing to do...
934 self.assert_(res==0, msg)
935
936
937 def testUpdateToProv1_1(self):
938 pkgs = self._setupUpdateTo()
939 res, msg = self.runOperation(['update', 'foobar'],
940 [pkgs['foo11']],
941 pkgs['all'])
942 self.assert_(res=='ok', msg)
943 self.assertResult((pkgs['foo20'],))
944
945 def testUpdateToProv1_2(self):
946 pkgs = self._setupUpdateTo()
947 res, msg = self.runOperation(['update-to', 'foobar'],
948 [pkgs['foo11']],
949 pkgs['all'])
950 self.assert_(res=='ok', msg)
951 self.assertResult((pkgs['foo20'],))
952
953 def testUpdateToProv2_1(self):
954 pkgs = self._setupUpdateTo()
955 # This is kind of annoying, maybe even a bug (but an old one) what
956 # happens is that in "update" we only look for provides matches on
957 # installed pkgs. ... so we can't see a version mismatch. Thus. we
958 # don't see any pkgs.
959 # It also prints an annoying msg. at critical level. So ignoring.
960 if True:
961 return
962 res, msg = self.runOperation(['update', 'foobar = 1-2'],
963 [pkgs['foo11']],
964 pkgs['all'])
965 # self.assert_(res=='ok', msg)
966 # self.assertResult((pkgs['foo12'],))
967 self.assert_(res==0, msg)
968
969 def testUpdateToProv2_2(self):
970 pkgs = self._setupUpdateTo()
971 res, msg = self.runOperation(['update-to', 'foobar = 1-2'],
972 [pkgs['foo11']],
973 pkgs['all'])
974 self.assert_(res=='ok', msg)
975 self.assertResult((pkgs['foo12'],))
976
977 def testUpdateToProv3_1(self):
978 pkgs = self._setupUpdateTo()
979 res, msg = self.runOperation(['update', 'foobar = 1-2'],
980 [pkgs['foo12']],
981 pkgs['all'])
982 self.assert_(res=='ok', msg)
983 self.assertResult((pkgs['foo20'],))
984
985 def testUpdateToProv3_2(self):
986 pkgs = self._setupUpdateTo()
987 res, msg = self.runOperation(['update-to', 'foobar = 1-2'],
988 [pkgs['foo12']],
989 pkgs['all'])
990 # Nothing to do...
991 self.assert_(res==0, msg)
992
Note: See TracBrowser for help on using the repository browser.