/[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.6 - (show annotations) (download) (as text)
Tue Aug 2 01:05:34 2005 UTC (19 years, 3 months ago) by slords
Branch: MAIN
Changes since 1.5: +1 -3 lines
Content type: text/x-python
Hold off on checking filesystem for now

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 if productName.find("SME Server") == -1:
53 dispatch.skipStep("installtype", skip = 1)
54 else:
55 dispatch.skipStep("findinstall", skip = 1)
56 dispatch.skipStep("installtype", skip = 0)
57
58 def findExistingRoots(intf, id, chroot, upgradeany = 0):
59 if not flags.setupFilesystems:
60 relstr = partedUtils.getCentOSReleaseString (chroot)
61 if ((cmdline.find("upgradeany") != -1) or
62 (upgradeany == 1) or
63 (partedUtils.productMatches(relstr, productName))):
64 return [(chroot, 'ext2', "")]
65 return []
66
67 diskset = partedUtils.DiskSet()
68 diskset.openDevices()
69
70 win = intf.progressWindow(_("Searching"),
71 _("Searching for %s installations...") %
72 (productName,), 5)
73
74 rootparts = diskset.findExistingRootPartitions(intf, chroot,
75 upgradeany = upgradeany)
76 for i in range(1, 6):
77 time.sleep(0.25)
78 win.set(i)
79
80 win.pop()
81
82 # close the devices to make sure we don't leave things sitting open
83 diskset.closeDevices()
84
85 # this is a hack... need to clear the skipped disk list after this
86 partedUtils.DiskSet.skippedDisks = []
87
88 return rootparts
89
90 def getDirtyDevString(dirtyDevs):
91 ret = ""
92 for dev in dirtyDevs:
93 if dev != "loop":
94 ret = "/dev/%s\n" % (dev,)
95 else:
96 ret = "%s\n" % (dev,)
97 return ret
98
99 def mountRootPartition(intf, rootInfo, oldfsset, instPath, allowDirty = 0,
100 raiseErrors = 0, warnDirty = 0, readOnly = 0):
101 (root, rootFs) = rootInfo
102
103 diskset = partedUtils.DiskSet()
104 diskset.openDevices()
105 diskset.startAllRaid()
106 lvm.vgscan()
107 lvm.vgactivate()
108
109 log("going to mount %s on %s as %s" %(root, instPath, rootFs))
110 isys.mount(root, instPath, rootFs)
111
112 oldfsset.reset()
113 newfsset = fsset.readFstab(instPath + '/etc/fstab', intf)
114 for entry in newfsset.entries:
115 oldfsset.add(entry)
116
117 isys.umount(instPath)
118
119 dirtyDevs = oldfsset.hasDirtyFilesystems(instPath)
120 if not allowDirty and dirtyDevs != []:
121 diskset.stopAllRaid()
122 lvm.vgdeactivate()
123 intf.messageWindow(_("Dirty File Systems"),
124 _("The following file systems for your Linux system "
125 "were not unmounted cleanly. Please boot your "
126 "Linux installation, let the file systems be "
127 "checked and shut down cleanly to upgrade.\n"
128 "%s" %(getDirtyDevString(dirtyDevs),)))
129 sys.exit(0)
130 elif warnDirty and dirtyDevs != []:
131 rc = intf.messageWindow(_("Dirty File Systems"),
132 _("The following file systems for your Linux "
133 "system were not unmounted cleanly. Would "
134 "you like to mount them anyway?\n"
135 "%s" % (getDirtyDevString(dirtyDevs,))),
136 type = "yesno")
137 if rc == 0:
138 return -1
139
140 if flags.setupFilesystems:
141 oldfsset.mountFilesystems(instPath, readOnly = readOnly)
142
143 # XXX we should properly support 'auto' at some point
144 if (not oldfsset.getEntryByMountPoint("/") or
145 not oldfsset.getEntryByMountPoint("/").fsystem or
146 not oldfsset.getEntryByMountPoint("/").fsystem.isMountable()):
147 raise RuntimeError, "/etc/fstab did not list a fstype for the root partition which we support"
148
149 # returns None if no filesystem exist to migrate
150 def upgradeMigrateFind(dispatch, thefsset):
151 migents = thefsset.getMigratableEntries()
152 if not migents or len(migents) < 1:
153 dispatch.skipStep("upgrademigratefs")
154 else:
155 dispatch.skipStep("upgrademigratefs", skip = 0)
156
157
158 # returns None if no more swap is needed
159 def upgradeSwapSuggestion(dispatch, id, instPath):
160 # mem is in kb -- round it up to the nearest 4Mb
161 mem = iutil.memInstalled()
162 rem = mem % 16384
163 if rem:
164 mem = mem + (16384 - rem)
165 mem = mem / 1024
166
167 dispatch.skipStep("addswap", 0)
168
169 # don't do this if we have more then 250 MB
170 if mem > 250:
171 dispatch.skipStep("addswap", 1)
172 return
173
174 swap = iutil.swapAmount() / 1024
175
176 # if we have twice as much swap as ram and at least 192 megs
177 # total, we're safe
178 if (swap >= (mem * 1.5)) and (swap + mem >= 192):
179 dispatch.skipStep("addswap", 1)
180 return
181
182 # if our total is 512 megs or more, we should be safe
183 if (swap + mem >= 512):
184 dispatch.skipStep("addswap", 1)
185 return
186
187 fsList = []
188
189 for entry in id.fsset.entries:
190 if entry.fsystem.getName() in fsset.getUsableLinuxFs():
191 if flags.setupFilesystems and not entry.isMounted():
192 continue
193 space = isys.pathSpaceAvailable(instPath + entry.mountpoint)
194 if space > 16:
195 info = (entry.mountpoint, entry.device.getDevice(), space)
196 fsList.append(info)
197
198 suggestion = mem * 2 - swap
199 if (swap + mem + suggestion) < 192:
200 suggestion = 192 - (swap + mem)
201 if suggestion < 32:
202 suggestion = 32
203 suggSize = 0
204 suggMnt = None
205 for (mnt, part, size) in fsList:
206 if (size > suggSize) and (size > (suggestion + 100)):
207 suggMnt = mnt
208
209 id.upgradeSwapInfo = (fsList, suggestion, suggMnt)
210
211 def swapfileExists(swapname):
212 try:
213 os.lstat(swapname)
214 return 1
215 except:
216 return 0
217
218 def createSwapFile(instPath, theFsset, mntPoint, size):
219 fstabPath = instPath + "/etc/fstab"
220 prefix = ""
221
222 if mntPoint != "/":
223 file = mntPoint + "/SWAP"
224 else:
225 file = "/SWAP"
226
227 swapFileDict = {}
228 for entry in theFsset.entries:
229 if entry.fsystem.getName() == "swap":
230 swapFileDict[entry.device.getName()] = 1
231
232 count = 0
233 while (swapfileExists(instPath + file) or
234 swapFileDict.has_key(file)):
235 count = count + 1
236 tmpFile = "/SWAP-%d" % (count)
237 if mntPoint != "/":
238 file = mntPoint + tmpFile
239 else:
240 file = tmpFile
241
242 device = SwapFileDevice(file)
243 device.setSize(size)
244 fsystem = fileSystemTypeGet("swap")
245 entry = FileSystemSetEntry(device, "swap", fsystem)
246 entry.setFormat(1)
247 theFsset.add(entry)
248 theFsset.formatEntry(entry, instPath)
249 theFsset.turnOnSwap(instPath)
250
251 # XXX generalize fstab modification
252 f = open(fstabPath, "a")
253 format = "%-23s %-23s %-7s %-15s %d %d\n";
254 f.write(format % (prefix + file, "swap", "swap", "defaults", 0, 0))
255 f.close()
256
257 # XXX handle going backwards
258 def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath):
259 # mount everything and turn on swap
260
261 if flags.setupFilesystems:
262 try:
263 mountRootPartition(intf, rootInfo[0], oldfsset, instPath,
264 allowDirty = 0)
265 except SystemError, msg:
266 intf.messageWindow(_("Mount failed"),
267 _("One or more of the file systems listed in the "
268 "/etc/fstab on your Linux system cannot be mounted. "
269 "Please fix this problem and try to upgrade again."))
270 sys.exit(0)
271 except RuntimeError, msg:
272 intf.messageWindow(_("Mount failed"),
273 _("One or more of the file systems listed in the "
274 "/etc/fstab of your Linux system are inconsistent and "
275 "cannot be mounted. Please fix this problem and try to "
276 "upgrade again."))
277 sys.exit(0)
278
279 checkLinks = ( '/etc', '/var', '/var/lib', '/var/lib/rpm',
280 '/boot', '/tmp', '/var/tmp', '/root',
281 '/bin/sh', '/usr/tmp')
282 badLinks = []
283 for n in checkLinks:
284 if not os.path.islink(instPath + n): continue
285 l = os.readlink(instPath + n)
286 if l[0] == '/':
287 badLinks.append(n)
288
289 if badLinks:
290 message = _("The following files are absolute symbolic "
291 "links, which we do not support during an "
292 "upgrade. Please change them to relative "
293 "symbolic links and restart the upgrade.\n\n")
294 for n in badLinks:
295 message = message + '\t' + n + '\n'
296 intf.messageWindow(_("Absolute Symlinks"), message)
297 sys.exit(0)
298
299 # fix for 80446
300 badLinks = []
301 mustBeLinks = ( '/usr/tmp', )
302 for n in mustBeLinks:
303 if not os.path.islink(instPath + n):
304 badLinks.append(n)
305
306 if badLinks:
307 message = _("The following are directories which should instead "
308 "be symbolic links, which will cause problems with the "
309 "upgrade. Please return them to their original state "
310 "as symbolic links and restart the upgrade.\n\n")
311 for n in badLinks:
312 message = message + '\t' + n + '\n'
313 intf.messageWindow(_("Invalid Directories"), message)
314 sys.exit(0)
315
316 else:
317 if not os.access (instPath + "/etc/fstab", os.R_OK):
318 rc = intf.messageWindow(_("Warning"),
319 _("%s not found")
320 % (instPath + "/etc/fstab",),
321 type="ok")
322 return DISPATCH_BACK
323
324 newfsset = fsset.readFstab(instPath + '/etc/fstab', intf)
325 for entry in newfsset.entries:
326 oldfsset.add(entry)
327
328 if flags.setupFilesystems:
329 oldfsset.turnOnSwap(instPath)
330
331 # move the old pre-convert db back in case of problems
332 def resetRpmdb(olddb, instPath):
333 if olddb is not None:
334 iutil.rmrf(instPath + "/var/lib/rpm")
335 os.rename (olddb, instPath + "/var/lib/rpm")
336
337 rebuildTime = None
338
339 def upgradeFindPackages(intf, method, id, instPath, dir):
340 if dir == DISPATCH_BACK:
341 return
342 global rebuildTime
343 if not rebuildTime:
344 rebuildTime = str(int(time.time()))
345 try:
346 method.mergeFullHeaders(id.grpset.hdrlist)
347 except FileCopyException:
348 method.unmountCD()
349 intf.messageWindow(_("Error"),
350 _("Unable to merge header list. This may be "
351 "due to a missing file or bad media. "
352 "Press <return> to try again."))
353
354 # if we've been through here once for this root, then short-circuit
355 if ((id.upgradeInfoFound is not None) and
356 (id.upgradeInfoFound == id.upgradeRoot)):
357 log("already found packages to upgrade for %s" %(id.upgradeRoot,))
358 return
359 else:
360 id.upgradeInfoFound = id.upgradeRoot
361
362 win = intf.waitWindow(_("Finding"),
363 _("Finding packages to upgrade..."))
364
365 # now, set the system clock so the timestamps will be right:
366 if flags.setupFilesystems:
367 iutil.setClock(instPath)
368
369 # we should only have to rebuild for upgrades of pre rpm 4.0.x systems
370 # according to jbj
371 if (os.access(instPath + "/var/lib/rpm/packages.rpm", os.R_OK) and
372 not os.access(instPath + "/var/lib/rpm/Packages", os.R_OK)):
373 win.pop()
374 intf.messageWindow(_("Error"),
375 _("The installation program is unable to upgrade "
376 "systems with a pre-rpm 4.x database. "
377 "Please install the errata rpm packages "
378 "for your release as described in the release "
379 "notes and then run the upgrade procedure."))
380 sys.exit(0)
381
382 else:
383 id.dbpath = None
384
385 try:
386 import findpackageset
387
388 # FIXME: make sure that the rpmdb doesn't have stale locks :/
389 for file in ["__db.001", "__db.002", "__db.003"]:
390 try:
391 os.unlink("%s/var/lib/rpm/%s" %(instPath, file))
392 except:
393 log("failed to unlink /var/lib/rpm/%s" %(file,))
394
395 packages = findpackageset.findpackageset(id.grpset.hdrlist.hdlist,
396 instPath)
397 except rpm.error:
398 if id.dbpath is not None:
399 resetRpmdb(id.dbpath, instPath)
400 win.pop()
401 intf.messageWindow(_("Error"),
402 _("An error occurred when finding the packages to "
403 "upgrade."))
404 sys.exit(0)
405
406 # Turn off all comps
407 id.grpset.unselectAll()
408
409 # unselect all packages
410 for package in id.grpset.hdrlist.pkgs.values():
411 package.usecount = 0
412 package.manual_state = 0
413
414 # turn on the packages in the upgrade set
415 for package in packages:
416 id.grpset.hdrlist[hdrlist.nevra(package)].select()
417
418 # open up the database to check dependencies and currently
419 # installed packages
420 ts = rpm.TransactionSet(instPath)
421 ts.setVSFlags(~(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA))
422
423 # make sure we have an arch match. (#87655)
424 # FIXME: bash wasn't good enough (#129677). let's try initscripts
425 mi = ts.dbMatch('name', 'initscripts')
426 myarch = id.grpset.hdrlist["initscripts"][rpm.RPMTAG_ARCH]
427 for h in mi:
428 if h[rpm.RPMTAG_ARCH] != myarch:
429 rc = intf.messageWindow(_("Warning"),
430 _("The arch of the release of %s you "
431 "are upgrading to appears to be %s "
432 "which does not match your previously "
433 "installed arch of %s. This is likely "
434 "to not succeed. Are you sure you "
435 "wish to continue the upgrade process?")
436 %(productName, h[rpm.RPMTAG_ARCH],
437 myarch),
438 type="yesno")
439 if rc == 0:
440 try:
441 resetRpmdb(id.dbpath, instPath)
442 except Exception, e:
443 log("error returning rpmdb to old state: %s" %(e,))
444 pass
445 sys.exit(0)
446 else:
447 log("WARNING: upgrade between possibly incompatible "
448 "arches %s -> %s" %(h[rpm.RPMTAG_ARCH], myarch))
449
450 mi = ts.dbMatch()
451 found = 0
452 hasX = 0
453 hasFileManager = 0
454
455 for h in mi:
456 release = h[rpm.RPMTAG_RELEASE]
457 # I'm going to try to keep this message as politically correct
458 # as possible. I think the Ximian GNOME is a very pretty desktop
459 # and the hackers there do an extraordinary amount of work on
460 # them. But it throws a huge wrench in our upgrade process. We
461 # just want to warn our users that there are packages on the system
462 # that might get messed up during the upgrade process. Nothing
463 # personal, guys. - msw
464 if (string.find(release, "helix") > -1
465 or string.find(release, "ximian") > -1
466 or string.find(release, "eazel") > -1):
467 log("Third party package %s-%s-%s could cause problems." %
468 (h[rpm.RPMTAG_NAME],
469 h[rpm.RPMTAG_VERSION],
470 h[rpm.RPMTAG_RELEASE]))
471 found = 1
472 if h[rpm.RPMTAG_NAME] == "XFree86" or h[rpm.RPMTAG_NAME] == "xorg-x11":
473 hasX = 1
474 if h[rpm.RPMTAG_NAME] == "nautilus":
475 hasFileManager = 1
476 if h[rpm.RPMTAG_NAME] == "kdebase":
477 hasFileManager = 1
478 if h[rpm.RPMTAG_NAME] == "gmc":
479 hasFileManager = 1
480
481 if found:
482 rc = intf.messageWindow(_("Warning"),
483 _("This system appears to have third "
484 "party packages installed that "
485 "overlap with packages included in "
486 "%s. Because these packages "
487 "overlap, continuing the upgrade "
488 "process may cause them to stop "
489 "functioning properly or may cause "
490 "other system instability. Please see "
491 "the release notes for more information."
492 "\n\n"
493 "Do you wish to continue the upgrade "
494 "process?") % (productName,),
495 type="yesno")
496 if rc == 0:
497 try:
498 resetRpmdb(id.dbpath, instPath)
499 except Exception, e:
500 log("error returning rpmdb to old state: %s" %(e,))
501 pass
502 sys.exit(0)
503
504 if not os.access(instPath + "/etc/e-smith-release", os.R_OK):
505 rc = intf.messageWindow(_("Warning"),
506 _("This system does not have an "
507 "/etc/e-smith-release file. It is possible "
508 "that this is not a %s system. "
509 "Continuing with the upgrade process may "
510 "leave the system in an unusable state. Do "
511 "you wish to continue the upgrade process?") % (productName,),
512 type="yesno")
513 if rc == 0:
514 try:
515 resetRpmdb(id.dbpath, instPath)
516 except Exception, e:
517 log("error returning rpmdb to old state: %s" %(e,))
518 pass
519 sys.exit(0)
520
521 # Figure out current version for upgrade nag and for determining weird
522 # upgrade cases
523 supportedUpgradeVersion = -1
524 mi = ts.dbMatch('provides', 'e-smith-release')
525 for h in mi:
526 if h[rpm.RPMTAG_EPOCH] is None:
527 epoch = None
528 else:
529 epoch = str(h[rpm.RPMTAG_EPOCH])
530
531 if supportedUpgradeVersion <= 0:
532 val = rpm.labelCompare(('21', '6.0', '11'),
533 (epoch, h[rpm.RPMTAG_VERSION],
534 h[rpm.RPMTAG_RELEASE]))
535 if val > 0:
536 supportedUpgradeVersion = 0
537 else:
538 supportedUpgradeVersion = 1
539 break
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