/[smeserver]/cdrom.image/updates/upgrade.py
ViewVC logotype

Contents of /cdrom.image/updates/upgrade.py

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Sat Jul 30 07:28:39 2005 UTC (19 years, 3 months ago) by slords
Branch: MAIN
Changes since 1.1: +0 -3 lines
Content type: text/x-python
First major pass as anaconda installer
- Install/Upgrade detection working
- Only screens we want are being displayed
- Raid/LVM partitioning all done for installer
- Except for post-install (run, status) install is done
- TODO: post-install script isn't running
- TODO: post-upgrade script isn't working
- TODO: raid migration for upgrades
- TODO: status message for post-{install,upgrade}

1 #
2 # upgrade.py - Existing install probe and upgrade procedure
3 #
4 # Matt Wilson <msw@redhat.com>
5 #
6 # Copyright 2001-2003 Red Hat, Inc.
7 #
8 # This software may be freely redistributed under the terms of the GNU
9 # library public license.
10 #
11 # You should have received a copy of the GNU Library Public License
12 # along with this program; if not, write to the Free Software
13 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
14 #
15
16 import isys
17 import os
18 import iutil
19 import time
20 import rpm
21 import sys
22 import os.path
23 import partedUtils
24 import string
25 import shutil
26 import lvm
27 import hdrlist
28 from flags import flags
29 from fsset import *
30 from partitioning import *
31 from constants import *
32 from installmethod import FileCopyException
33 from product import productName
34
35 from rhpl.log import log
36 from rhpl.translate import _
37
38 upgrade_remove_blacklist = ()
39
40 def findRootParts(intf, id, dispatch, dir, chroot):
41 if dir == DISPATCH_BACK:
42 return
43 if id.rootParts is None:
44 id.rootParts = findExistingRoots(intf, id, chroot)
45
46 id.upgradeRoot = []
47 for (dev, fs, meta) in id.rootParts:
48 id.upgradeRoot.append( (dev, fs) )
49
50 if id.rootParts is not None and len(id.rootParts) > 0:
51 dispatch.skipStep("findinstall", skip = 0)
52 else:
53 dispatch.skipStep("findinstall", skip = 1)
54
55 def findExistingRoots(intf, id, chroot, upgradeany = 0):
56 if not flags.setupFilesystems:
57 relstr = partedUtils.getCentOSReleaseString (chroot)
58 if ((cmdline.find("upgradeany") != -1) or
59 (upgradeany == 1) or
60 (partedUtils.productMatches(relstr, productName))):
61 return [(chroot, 'ext2', "")]
62 return []
63
64 diskset = partedUtils.DiskSet()
65 diskset.openDevices()
66
67 win = intf.progressWindow(_("Searching"),
68 _("Searching for %s installations...") %
69 (productName,), 5)
70
71 rootparts = diskset.findExistingRootPartitions(intf, chroot,
72 upgradeany = upgradeany)
73 for i in range(1, 6):
74 time.sleep(0.25)
75 win.set(i)
76
77 win.pop()
78
79 # close the devices to make sure we don't leave things sitting open
80 diskset.closeDevices()
81
82 # this is a hack... need to clear the skipped disk list after this
83 partedUtils.DiskSet.skippedDisks = []
84
85 return rootparts
86
87 def getDirtyDevString(dirtyDevs):
88 ret = ""
89 for dev in dirtyDevs:
90 if dev != "loop":
91 ret = "/dev/%s\n" % (dev,)
92 else:
93 ret = "%s\n" % (dev,)
94 return ret
95
96 def mountRootPartition(intf, rootInfo, oldfsset, instPath, allowDirty = 0,
97 raiseErrors = 0, warnDirty = 0, readOnly = 0):
98 (root, rootFs) = rootInfo
99
100 diskset = partedUtils.DiskSet()
101 diskset.openDevices()
102 diskset.startAllRaid()
103 lvm.vgscan()
104 lvm.vgactivate()
105
106 log("going to mount %s on %s as %s" %(root, instPath, rootFs))
107 isys.mount(root, instPath, rootFs)
108
109 oldfsset.reset()
110 newfsset = fsset.readFstab(instPath + '/etc/fstab', intf)
111 for entry in newfsset.entries:
112 oldfsset.add(entry)
113
114 isys.umount(instPath)
115
116 dirtyDevs = oldfsset.hasDirtyFilesystems(instPath)
117 if not allowDirty and dirtyDevs != []:
118 diskset.stopAllRaid()
119 lvm.vgdeactivate()
120 intf.messageWindow(_("Dirty File Systems"),
121 _("The following file systems for your Linux system "
122 "were not unmounted cleanly. Please boot your "
123 "Linux installation, let the file systems be "
124 "checked and shut down cleanly to upgrade.\n"
125 "%s" %(getDirtyDevString(dirtyDevs),)))
126 sys.exit(0)
127 elif warnDirty and dirtyDevs != []:
128 rc = intf.messageWindow(_("Dirty File Systems"),
129 _("The following file systems for your Linux "
130 "system were not unmounted cleanly. Would "
131 "you like to mount them anyway?\n"
132 "%s" % (getDirtyDevString(dirtyDevs,))),
133 type = "yesno")
134 if rc == 0:
135 return -1
136
137 if flags.setupFilesystems:
138 oldfsset.mountFilesystems(instPath, readOnly = readOnly)
139
140 # XXX we should properly support 'auto' at some point
141 if (not oldfsset.getEntryByMountPoint("/") or
142 not oldfsset.getEntryByMountPoint("/").fsystem or
143 not oldfsset.getEntryByMountPoint("/").fsystem.isMountable()):
144 raise RuntimeError, "/etc/fstab did not list a fstype for the root partition which we support"
145
146 # returns None if no filesystem exist to migrate
147 def upgradeMigrateFind(dispatch, thefsset):
148 migents = thefsset.getMigratableEntries()
149 if not migents or len(migents) < 1:
150 dispatch.skipStep("upgrademigratefs")
151 else:
152 dispatch.skipStep("upgrademigratefs", skip = 0)
153
154
155 # returns None if no more swap is needed
156 def upgradeSwapSuggestion(dispatch, id, instPath):
157 # mem is in kb -- round it up to the nearest 4Mb
158 mem = iutil.memInstalled()
159 rem = mem % 16384
160 if rem:
161 mem = mem + (16384 - rem)
162 mem = mem / 1024
163
164 dispatch.skipStep("addswap", 0)
165
166 # don't do this if we have more then 250 MB
167 if mem > 250:
168 dispatch.skipStep("addswap", 1)
169 return
170
171 swap = iutil.swapAmount() / 1024
172
173 # if we have twice as much swap as ram and at least 192 megs
174 # total, we're safe
175 if (swap >= (mem * 1.5)) and (swap + mem >= 192):
176 dispatch.skipStep("addswap", 1)
177 return
178
179 # if our total is 512 megs or more, we should be safe
180 if (swap + mem >= 512):
181 dispatch.skipStep("addswap", 1)
182 return
183
184 fsList = []
185
186 for entry in id.fsset.entries:
187 if entry.fsystem.getName() in fsset.getUsableLinuxFs():
188 if flags.setupFilesystems and not entry.isMounted():
189 continue
190 space = isys.pathSpaceAvailable(instPath + entry.mountpoint)
191 if space > 16:
192 info = (entry.mountpoint, entry.device.getDevice(), space)
193 fsList.append(info)
194
195 suggestion = mem * 2 - swap
196 if (swap + mem + suggestion) < 192:
197 suggestion = 192 - (swap + mem)
198 if suggestion < 32:
199 suggestion = 32
200 suggSize = 0
201 suggMnt = None
202 for (mnt, part, size) in fsList:
203 if (size > suggSize) and (size > (suggestion + 100)):
204 suggMnt = mnt
205
206 id.upgradeSwapInfo = (fsList, suggestion, suggMnt)
207
208 def swapfileExists(swapname):
209 try:
210 os.lstat(swapname)
211 return 1
212 except:
213 return 0
214
215 def createSwapFile(instPath, theFsset, mntPoint, size):
216 fstabPath = instPath + "/etc/fstab"
217 prefix = ""
218
219 if mntPoint != "/":
220 file = mntPoint + "/SWAP"
221 else:
222 file = "/SWAP"
223
224 swapFileDict = {}
225 for entry in theFsset.entries:
226 if entry.fsystem.getName() == "swap":
227 swapFileDict[entry.device.getName()] = 1
228
229 count = 0
230 while (swapfileExists(instPath + file) or
231 swapFileDict.has_key(file)):
232 count = count + 1
233 tmpFile = "/SWAP-%d" % (count)
234 if mntPoint != "/":
235 file = mntPoint + tmpFile
236 else:
237 file = tmpFile
238
239 device = SwapFileDevice(file)
240 device.setSize(size)
241 fsystem = fileSystemTypeGet("swap")
242 entry = FileSystemSetEntry(device, "swap", fsystem)
243 entry.setFormat(1)
244 theFsset.add(entry)
245 theFsset.formatEntry(entry, instPath)
246 theFsset.turnOnSwap(instPath)
247
248 # XXX generalize fstab modification
249 f = open(fstabPath, "a")
250 format = "%-23s %-23s %-7s %-15s %d %d\n";
251 f.write(format % (prefix + file, "swap", "swap", "defaults", 0, 0))
252 f.close()
253
254 # XXX handle going backwards
255 def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath):
256 # mount everything and turn on swap
257
258 if flags.setupFilesystems:
259 try:
260 mountRootPartition(intf, rootInfo[0], oldfsset, instPath,
261 allowDirty = 0)
262 except SystemError, msg:
263 intf.messageWindow(_("Mount failed"),
264 _("One or more of the file systems listed in the "
265 "/etc/fstab on your Linux system cannot be mounted. "
266 "Please fix this problem and try to upgrade again."))
267 sys.exit(0)
268 except RuntimeError, msg:
269 intf.messageWindow(_("Mount failed"),
270 _("One or more of the file systems listed in the "
271 "/etc/fstab of your Linux system are inconsistent and "
272 "cannot be mounted. Please fix this problem and try to "
273 "upgrade again."))
274 sys.exit(0)
275
276 checkLinks = ( '/etc', '/var', '/var/lib', '/var/lib/rpm',
277 '/boot', '/tmp', '/var/tmp', '/root',
278 '/bin/sh', '/usr/tmp')
279 badLinks = []
280 for n in checkLinks:
281 if not os.path.islink(instPath + n): continue
282 l = os.readlink(instPath + n)
283 if l[0] == '/':
284 badLinks.append(n)
285
286 if badLinks:
287 message = _("The following files are absolute symbolic "
288 "links, which we do not support during an "
289 "upgrade. Please change them to relative "
290 "symbolic links and restart the upgrade.\n\n")
291 for n in badLinks:
292 message = message + '\t' + n + '\n'
293 intf.messageWindow(_("Absolute Symlinks"), message)
294 sys.exit(0)
295
296 # fix for 80446
297 badLinks = []
298 mustBeLinks = ( '/usr/tmp', )
299 for n in mustBeLinks:
300 if not os.path.islink(instPath + n):
301 badLinks.append(n)
302
303 if badLinks:
304 message = _("The following are directories which should instead "
305 "be symbolic links, which will cause problems with the "
306 "upgrade. Please return them to their original state "
307 "as symbolic links and restart the upgrade.\n\n")
308 for n in badLinks:
309 message = message + '\t' + n + '\n'
310 intf.messageWindow(_("Invalid Directories"), message)
311 sys.exit(0)
312
313 else:
314 if not os.access (instPath + "/etc/fstab", os.R_OK):
315 rc = intf.messageWindow(_("Warning"),
316 _("%s not found")
317 % (instPath + "/etc/fstab",),
318 type="ok")
319 return DISPATCH_BACK
320
321 newfsset = fsset.readFstab(instPath + '/etc/fstab', intf)
322 for entry in newfsset.entries:
323 oldfsset.add(entry)
324
325 if flags.setupFilesystems:
326 oldfsset.turnOnSwap(instPath)
327
328 # move the old pre-convert db back in case of problems
329 def resetRpmdb(olddb, instPath):
330 if olddb is not None:
331 iutil.rmrf(instPath + "/var/lib/rpm")
332 os.rename (olddb, instPath + "/var/lib/rpm")
333
334 rebuildTime = None
335
336 def upgradeFindPackages(intf, method, id, instPath, dir):
337 if dir == DISPATCH_BACK:
338 return
339 global rebuildTime
340 if not rebuildTime:
341 rebuildTime = str(int(time.time()))
342 try:
343 method.mergeFullHeaders(id.grpset.hdrlist)
344 except FileCopyException:
345 method.unmountCD()
346 intf.messageWindow(_("Error"),
347 _("Unable to merge header list. This may be "
348 "due to a missing file or bad media. "
349 "Press <return> to try again."))
350
351 # if we've been through here once for this root, then short-circuit
352 if ((id.upgradeInfoFound is not None) and
353 (id.upgradeInfoFound == id.upgradeRoot)):
354 log("already found packages to upgrade for %s" %(id.upgradeRoot,))
355 return
356 else:
357 id.upgradeInfoFound = id.upgradeRoot
358
359 win = intf.waitWindow(_("Finding"),
360 _("Finding packages to upgrade..."))
361
362 # now, set the system clock so the timestamps will be right:
363 if flags.setupFilesystems:
364 iutil.setClock(instPath)
365
366 # we should only have to rebuild for upgrades of pre rpm 4.0.x systems
367 # according to jbj
368 if (os.access(instPath + "/var/lib/rpm/packages.rpm", os.R_OK) and
369 not os.access(instPath + "/var/lib/rpm/Packages", os.R_OK)):
370 win.pop()
371 intf.messageWindow(_("Error"),
372 _("The installation program is unable to upgrade "
373 "systems with a pre-rpm 4.x database. "
374 "Please install the errata rpm packages "
375 "for your release as described in the release "
376 "notes and then run the upgrade procedure."))
377 sys.exit(0)
378
379 else:
380 id.dbpath = None
381
382 try:
383 import findpackageset
384
385 # FIXME: make sure that the rpmdb doesn't have stale locks :/
386 for file in ["__db.001", "__db.002", "__db.003"]:
387 try:
388 os.unlink("%s/var/lib/rpm/%s" %(instPath, file))
389 except:
390 log("failed to unlink /var/lib/rpm/%s" %(file,))
391
392 packages = findpackageset.findpackageset(id.grpset.hdrlist.hdlist,
393 instPath)
394 except rpm.error:
395 if id.dbpath is not None:
396 resetRpmdb(id.dbpath, instPath)
397 win.pop()
398 intf.messageWindow(_("Error"),
399 _("An error occurred when finding the packages to "
400 "upgrade."))
401 sys.exit(0)
402
403 # Turn off all comps
404 id.grpset.unselectAll()
405
406 # unselect all packages
407 for package in id.grpset.hdrlist.pkgs.values():
408 package.usecount = 0
409 package.manual_state = 0
410
411 # turn on the packages in the upgrade set
412 for package in packages:
413 id.grpset.hdrlist[hdrlist.nevra(package)].select()
414
415 # open up the database to check dependencies and currently
416 # installed packages
417 ts = rpm.TransactionSet(instPath)
418 ts.setVSFlags(~(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA))
419
420 # make sure we have an arch match. (#87655)
421 # FIXME: bash wasn't good enough (#129677). let's try initscripts
422 mi = ts.dbMatch('name', 'initscripts')
423 myarch = id.grpset.hdrlist["initscripts"][rpm.RPMTAG_ARCH]
424 for h in mi:
425 if h[rpm.RPMTAG_ARCH] != myarch:
426 rc = intf.messageWindow(_("Warning"),
427 _("The arch of the release of %s you "
428 "are upgrading to appears to be %s "
429 "which does not match your previously "
430 "installed arch of %s. This is likely "
431 "to not succeed. Are you sure you "
432 "wish to continue the upgrade process?")
433 %(productName, h[rpm.RPMTAG_ARCH],
434 myarch),
435 type="yesno")
436 if rc == 0:
437 try:
438 resetRpmdb(id.dbpath, instPath)
439 except Exception, e:
440 log("error returning rpmdb to old state: %s" %(e,))
441 pass
442 sys.exit(0)
443 else:
444 log("WARNING: upgrade between possibly incompatible "
445 "arches %s -> %s" %(h[rpm.RPMTAG_ARCH], myarch))
446
447 mi = ts.dbMatch()
448 found = 0
449 hasX = 0
450 hasFileManager = 0
451
452 for h in mi:
453 release = h[rpm.RPMTAG_RELEASE]
454 # I'm going to try to keep this message as politically correct
455 # as possible. I think the Ximian GNOME is a very pretty desktop
456 # and the hackers there do an extraordinary amount of work on
457 # them. But it throws a huge wrench in our upgrade process. We
458 # just want to warn our users that there are packages on the system
459 # that might get messed up during the upgrade process. Nothing
460 # personal, guys. - msw
461 if (string.find(release, "helix") > -1
462 or string.find(release, "ximian") > -1
463 or string.find(release, "eazel") > -1):
464 log("Third party package %s-%s-%s could cause problems." %
465 (h[rpm.RPMTAG_NAME],
466 h[rpm.RPMTAG_VERSION],
467 h[rpm.RPMTAG_RELEASE]))
468 found = 1
469 if h[rpm.RPMTAG_NAME] == "XFree86" or h[rpm.RPMTAG_NAME] == "xorg-x11":
470 hasX = 1
471 if h[rpm.RPMTAG_NAME] == "nautilus":
472 hasFileManager = 1
473 if h[rpm.RPMTAG_NAME] == "kdebase":
474 hasFileManager = 1
475 if h[rpm.RPMTAG_NAME] == "gmc":
476 hasFileManager = 1
477
478 if found:
479 rc = intf.messageWindow(_("Warning"),
480 _("This system appears to have third "
481 "party packages installed that "
482 "overlap with packages included in "
483 "%s. Because these packages "
484 "overlap, continuing the upgrade "
485 "process may cause them to stop "
486 "functioning properly or may cause "
487 "other system instability. Please see "
488 "the release notes for more information."
489 "\n\n"
490 "Do you wish to continue the upgrade "
491 "process?") % (productName,),
492 type="yesno")
493 if rc == 0:
494 try:
495 resetRpmdb(id.dbpath, instPath)
496 except Exception, e:
497 log("error returning rpmdb to old state: %s" %(e,))
498 pass
499 sys.exit(0)
500
501 if not os.access(instPath + "/etc/e-smith-release", os.R_OK):
502 rc = intf.messageWindow(_("Warning"),
503 _("This system does not have an "
504 "/etc/e-smith-release file. It is possible "
505 "that this is not a %s system. "
506 "Continuing with the upgrade process may "
507 "leave the system in an unusable state. Do "
508 "you wish to continue the upgrade process?") % (productName,),
509 type="yesno")
510 if rc == 0:
511 try:
512 resetRpmdb(id.dbpath, instPath)
513 except Exception, e:
514 log("error returning rpmdb to old state: %s" %(e,))
515 pass
516 sys.exit(0)
517
518 # # Figure out current version for upgrade nag and for determining weird
519 # # upgrade cases
520 # supportedUpgradeVersion = -1
521 # mi = ts.dbMatch('provides', 'redhat-release')
522 # for h in mi:
523 # if h[rpm.RPMTAG_EPOCH] is None:
524 # epoch = None
525 # else:
526 # epoch = str(h[rpm.RPMTAG_EPOCH])
527 #
528 # if supportedUpgradeVersion <= 0:
529 # val = rpm.labelCompare((None, '3', '1'),
530 # (epoch, h[rpm.RPMTAG_VERSION],
531 # h[rpm.RPMTAG_RELEASE]))
532 # if val > 0:
533 # supportedUpgradeVersion = 0
534 # else:
535 # supportedUpgradeVersion = 1
536 # break
537 #
538 # if productName.find("Red Hat Enterprise Linux") == -1:
539 # supportedUpgradeVersion = 1
540 #
541 # if supportedUpgradeVersion == 0:
542 # rc = intf.messageWindow(_("Warning"),
543 # _("You appear to be upgrading from a system "
544 # "which is too old to upgrade to this "
545 # "version of %s. Are you sure you wish to "
546 # "continue the upgrade "
547 # "process?") %(productName,),
548 # type = "yesno")
549 # if rc == 0:
550 # try:
551 # resetRpmdb(id.dbpath, instPath)
552 # except Exception, e:
553 # log("error returning rpmdb to old state: %s" %(e,))
554 # pass
555 # sys.exit(0)
556 #
557
558 # during upgrade, make sure that we only install %lang colored files
559 # for the languages selected to be supported.
560 langs = ''
561 if os.access(instPath + "/etc/sysconfig/i18n", os.R_OK):
562 f = open(instPath + "/etc/sysconfig/i18n", 'r')
563 for line in f.readlines():
564 line = string.strip(line)
565 parts = string.split(line, '=')
566 if len(parts) < 2:
567 continue
568 if string.strip(parts[0]) == 'SUPPORTED':
569 langs = parts[1]
570 if len(langs) > 0:
571 if langs[0] == '"' and langs[-1:] == '"':
572 langs = langs[1:-1]
573 break
574 del f
575 ## if langs:
576 ## rpm.addMacro("_install_langs", langs)
577
578 # check the installed system to see if the packages just
579 # are not newer in this release.
580 if hasX and not hasFileManager:
581 for name in ("nautilus", "kdebase", "gmc"):
582 try:
583 h = ts.dbMatch('name', name).next()
584 except StopIteration:
585 continue
586 if h is not None:
587 hasFileManager = 1
588 break
589
590 # make sure the boot loader being used is being installed.
591 # FIXME: generalize so that specific bits aren't needed
592 if iutil.getArch() == "i386" and id.bootloader.useGrub():
593 log("Upgrade: User selected to use GRUB for bootloader")
594 if id.grpset.hdrlist.has_key("grub") and not id.grpset.hdrlist["grub"].isSelected():
595 log("Upgrade: grub is not currently selected to be upgraded")
596 h = None
597 try:
598 h = ts.dbMatch('name', 'grub').next()
599 except StopIteration:
600 pass
601 if h is None:
602 text = ("Upgrade: GRUB is not already installed on the "
603 "system, selecting GRUB")
604 id.upgradeDeps ="%s%s\n" % (id.upgradeDeps, text)
605 log(text)
606 id.grpset.hdrlist["grub"].select()
607 if iutil.getArch() == "i386" and not id.bootloader.useGrub():
608 log("Upgrade: User selected to use LILO for bootloader")
609 if id.grpset.hdrlist.has_key("lilo") and not id.grpset.hdrlist["lilo"].isSelected():
610 log("Upgrade: lilo is not currently selected to be upgraded")
611 h = None
612 try:
613 h = ts.dbMatch('name', 'lilo').next()
614 except StopIteration:
615 pass
616 if h is None:
617 text = ("Upgrade: LILO is not already installed on the "
618 "system, selecting LILO")
619 id.upgradeDeps ="%s%s\n" % (id.upgradeDeps, text)
620 log(text)
621 id.grpset.hdrlist["lilo"].select()
622
623
624 h = None
625 try:
626 h = ts.dbMatch('name', 'gnome-core').next()
627 except StopIteration:
628 pass
629 if h is not None:
630 log("Upgrade: gnome-core was on the system. Upgrading to GNOME 2")
631 upgraded = []
632 for pkg in ("gnome-terminal", "gnome-desktop", "gnome-session",
633 "gnome-panel", "metacity", "file-roller", "yelp",
634 "nautilus"):
635 if id.grpset.hdrlist.has_key(pkg) and not id.grpset.hdrlist[pkg].isSelected():
636 id.grpset.hdrlist[pkg].select()
637 upgraded.append(pkg)
638
639 text = ("Upgrade: gnome-core is on the system. Selecting packages "
640 "to upgrade to GNOME2: %s" %(str(upgraded),))
641 id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
642
643 # if they have up2date-gnome, they probably want the applet now too
644 # since it works in both gnome and kde
645 if (id.grpset.hdrlist.has_key("rhn-applet")
646 and not id.grpset.hdrlist["rhn-applet"].isSelected()):
647 log("Upgrade: rhn-applet is not currently selected to be upgraded")
648 h = None
649 try:
650 h = ts.dbMatch('name', 'up2date-gnome').next()
651 except StopIteration:
652 pass
653
654 if h is not None:
655 hdr = None
656 try:
657 hdr = ts.dbMatch('name', 'rhn-applet').next()
658 except StopIteration:
659 pass
660 if hdr is None:
661 text = ("Upgrade: up2date-gnome is on the "
662 "system, but rhn-applet isn't. Selecting "
663 "rhn-applet to be installed")
664 id.upgradeDeps = "%s%s\n" % (id.upgradeDeps, text)
665 log(text)
666 id.grpset.hdrlist["rhn-applet"].select()
667
668 # and since xterm is now split out from XFree86 (#98254)
669 if (id.grpset.hdrlist.has_key("xterm") and
670 not id.grpset.hdrlist["xterm"].isSelected()):
671 h = None
672 try:
673 h = ts.dbMatch('name', 'XFree86').next()
674 except StopIteration:
675 pass
676 if h is not None:
677 text = ("Upgrade: XFree86 was on the system. Pulling in xterm "
678 "for upgrade.")
679 id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
680 log(text)
681 id.grpset.hdrlist["xterm"].select()
682
683 # input methods all changed. hooray!
684 imupg = ( ("ami", "iiimf-le-hangul"),
685 ("kinput2-canna-wnn6", "iiimf-le-canna"),
686 ("miniChinput", "iiimf-le-chinput"),
687 ("xcin", "iiimf-le-xcin") )
688 iiimf = 0
689 for (old, new) in imupg:
690 mi = ts.dbMatch("name", old)
691 if (mi.count() > 0 and id.grpset.hdrlist.has_key(new) and
692 not id.grpset.hdrlist[new].isSelected()):
693 text = "Upgrade: %s was on the system. Pulling in %s" %(old, new)
694 id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
695 log(text)
696 id.grpset.hdrlist[new].select()
697 iiimf = 1
698 if iiimf:
699 imupg = ( ("iiimf-gnome-im-switcher", "control-center"),
700 ("iiimf-gnome-im-switcher", "gnome-panel"),
701 ("iiimf-gtk", "gtk2"),
702 ("system-switch-im", "gtk2"),
703 ("iiimf-x", "xorg-x11"),
704 ("iiimf-x", "XFree86"))
705 for (new, old) in imupg:
706 mi = ts.dbMatch("name", old)
707 if (not id.grpset.hdrlist.has_key(new) or
708 id.grpset.hdrlist[new].isSelected()):
709 continue
710 if (mi.count() > 0 or
711 id.grpset.hdrlist.has_key(old) and
712 id.grpset.hdrlist[old].isSelected()):
713 text = "Upgrade: Need iiimf base package %s" %(new,)
714 id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
715 log(text)
716 id.grpset.hdrlist[new].select()
717
718 # firefox replaces mozilla/netscape (#137244)
719 if (id.grpset.hdrlist.has_key("firefox") and
720 not id.grpset.hdrlist["firefox"].isSelected()):
721 found = 0
722 for p in ("mozilla", "netscape-navigator", "netscape-communicator"):
723 mi = ts.dbMatch("name", p)
724 found += mi.count()
725 if found > 0:
726 text = "Upgrade: Found a graphical browser. Pulling in firefox"
727 id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
728 log(text)
729 id.grpset.hdrlist["firefox"].select()
730
731 # now some upgrade removal black list checking... there are things that
732 # if they were installed in the past, we want to remove them because
733 # they'll screw up the upgrade otherwise
734 for pkg in upgrade_remove_blacklist:
735 h = None
736 try:
737 h = ts.dbMatch('name', pkg).next()
738 except StopIteration:
739 pass
740 if h is not None:
741 text = ("Upgrade: %s is on the system but will cause problems "
742 "with the upgrade transaction. Removing." %(pkg,))
743 log(text)
744 id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
745 id.upgradeRemove.append(pkg)
746
747 # new package dependency fixup
748 depcheck = hdrlist.DependencyChecker(id.grpset, how = "u")
749 for p in id.grpset.hdrlist.pkgs.values():
750 if p.isSelected():
751 ts.addInstall(p.hdr, p.hdr, "u")
752 deps = ts.check(depcheck.callback)
753 for pkgnevra in deps:
754 text = ("Upgrade Dependency: Needs %s, "
755 "automatically added." % (pkgnevra,))
756 # log(text)
757 id.upgradeDeps = "%s%s\n" % (id.upgradeDeps, text)
758
759 win.pop()
760
761

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed