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

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

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


Revision 1.3 - (hide annotations) (download) (as text)
Sun Jul 31 16:24:58 2005 UTC (19 years, 4 months ago) by slords
Branch: MAIN
Changes since 1.2: +42 -40 lines
Content type: text/x-python
Second major pass as anaconda installer
- Install/Upgrade both functional in text & gui
- Added upgrade warning for systems < 21:6.0-11
- TODO: raid migration for upgrades
- TODO: status message for post-{install,upgrade}

1 gordonr 1.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 slords 1.3 if productName.find("SME Server") == -1:
53     dispatch.skipStep("installtype", skip = 1)
54 gordonr 1.1 else:
55     dispatch.skipStep("findinstall", skip = 1)
56 slords 1.3 dispatch.skipStep("installtype", skip = 0)
57 gordonr 1.1
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 slords 1.3 pass
394     # log("failed to unlink /var/lib/rpm/%s" %(file,))
395 gordonr 1.1
396     packages = findpackageset.findpackageset(id.grpset.hdrlist.hdlist,
397     instPath)
398     except rpm.error:
399     if id.dbpath is not None:
400     resetRpmdb(id.dbpath, instPath)
401     win.pop()
402     intf.messageWindow(_("Error"),
403     _("An error occurred when finding the packages to "
404     "upgrade."))
405     sys.exit(0)
406    
407     # Turn off all comps
408     id.grpset.unselectAll()
409    
410     # unselect all packages
411     for package in id.grpset.hdrlist.pkgs.values():
412     package.usecount = 0
413     package.manual_state = 0
414    
415     # turn on the packages in the upgrade set
416     for package in packages:
417     id.grpset.hdrlist[hdrlist.nevra(package)].select()
418    
419     # open up the database to check dependencies and currently
420     # installed packages
421     ts = rpm.TransactionSet(instPath)
422     ts.setVSFlags(~(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA))
423    
424     # make sure we have an arch match. (#87655)
425     # FIXME: bash wasn't good enough (#129677). let's try initscripts
426     mi = ts.dbMatch('name', 'initscripts')
427     myarch = id.grpset.hdrlist["initscripts"][rpm.RPMTAG_ARCH]
428     for h in mi:
429     if h[rpm.RPMTAG_ARCH] != myarch:
430     rc = intf.messageWindow(_("Warning"),
431     _("The arch of the release of %s you "
432     "are upgrading to appears to be %s "
433     "which does not match your previously "
434     "installed arch of %s. This is likely "
435     "to not succeed. Are you sure you "
436     "wish to continue the upgrade process?")
437     %(productName, h[rpm.RPMTAG_ARCH],
438     myarch),
439     type="yesno")
440     if rc == 0:
441     try:
442     resetRpmdb(id.dbpath, instPath)
443     except Exception, e:
444     log("error returning rpmdb to old state: %s" %(e,))
445     pass
446     sys.exit(0)
447     else:
448     log("WARNING: upgrade between possibly incompatible "
449     "arches %s -> %s" %(h[rpm.RPMTAG_ARCH], myarch))
450    
451     mi = ts.dbMatch()
452     found = 0
453     hasX = 0
454     hasFileManager = 0
455    
456     for h in mi:
457     release = h[rpm.RPMTAG_RELEASE]
458     # I'm going to try to keep this message as politically correct
459     # as possible. I think the Ximian GNOME is a very pretty desktop
460     # and the hackers there do an extraordinary amount of work on
461     # them. But it throws a huge wrench in our upgrade process. We
462     # just want to warn our users that there are packages on the system
463     # that might get messed up during the upgrade process. Nothing
464     # personal, guys. - msw
465     if (string.find(release, "helix") > -1
466     or string.find(release, "ximian") > -1
467     or string.find(release, "eazel") > -1):
468     log("Third party package %s-%s-%s could cause problems." %
469     (h[rpm.RPMTAG_NAME],
470     h[rpm.RPMTAG_VERSION],
471     h[rpm.RPMTAG_RELEASE]))
472     found = 1
473     if h[rpm.RPMTAG_NAME] == "XFree86" or h[rpm.RPMTAG_NAME] == "xorg-x11":
474     hasX = 1
475     if h[rpm.RPMTAG_NAME] == "nautilus":
476     hasFileManager = 1
477     if h[rpm.RPMTAG_NAME] == "kdebase":
478     hasFileManager = 1
479     if h[rpm.RPMTAG_NAME] == "gmc":
480     hasFileManager = 1
481    
482     if found:
483     rc = intf.messageWindow(_("Warning"),
484     _("This system appears to have third "
485     "party packages installed that "
486     "overlap with packages included in "
487     "%s. Because these packages "
488     "overlap, continuing the upgrade "
489     "process may cause them to stop "
490     "functioning properly or may cause "
491     "other system instability. Please see "
492     "the release notes for more information."
493     "\n\n"
494     "Do you wish to continue the upgrade "
495     "process?") % (productName,),
496     type="yesno")
497     if rc == 0:
498     try:
499     resetRpmdb(id.dbpath, instPath)
500     except Exception, e:
501     log("error returning rpmdb to old state: %s" %(e,))
502     pass
503     sys.exit(0)
504    
505     if not os.access(instPath + "/etc/e-smith-release", os.R_OK):
506     rc = intf.messageWindow(_("Warning"),
507     _("This system does not have an "
508     "/etc/e-smith-release file. It is possible "
509     "that this is not a %s system. "
510     "Continuing with the upgrade process may "
511     "leave the system in an unusable state. Do "
512     "you wish to continue the upgrade process?") % (productName,),
513     type="yesno")
514     if rc == 0:
515     try:
516     resetRpmdb(id.dbpath, instPath)
517     except Exception, e:
518     log("error returning rpmdb to old state: %s" %(e,))
519     pass
520     sys.exit(0)
521    
522 slords 1.3 # Figure out current version for upgrade nag and for determining weird
523     # upgrade cases
524     supportedUpgradeVersion = -1
525     mi = ts.dbMatch('provides', 'e-smith-release')
526     for h in mi:
527     if h[rpm.RPMTAG_EPOCH] is None:
528     epoch = None
529     else:
530     epoch = str(h[rpm.RPMTAG_EPOCH])
531    
532     if supportedUpgradeVersion <= 0:
533     val = rpm.labelCompare(('21', '6.0', '11'),
534     (epoch, h[rpm.RPMTAG_VERSION],
535     h[rpm.RPMTAG_RELEASE]))
536     log("epoch: %s, version: %s, release: %s, val: %s", h[rpm.RPMTAG_EPOCH], h[rpm.RPMTAG_VERSION], h[rpm.RPMTAG_RELEASE], val)
537     if val > 0:
538     supportedUpgradeVersion = 0
539     else:
540     supportedUpgradeVersion = 1
541     break
542    
543     if supportedUpgradeVersion == 0:
544     rc = intf.messageWindow(_("Warning"),
545     _("You appear to be upgrading from a system "
546     "which is too old to upgrade to this "
547     "version of %s. Are you sure you wish to "
548     "continue the upgrade "
549     "process?") %(productName,),
550     type = "yesno")
551     if rc == 0:
552     try:
553     resetRpmdb(id.dbpath, instPath)
554     except Exception, e:
555     log("error returning rpmdb to old state: %s" %(e,))
556     pass
557     sys.exit(0)
558    
559 gordonr 1.1
560     # during upgrade, make sure that we only install %lang colored files
561     # for the languages selected to be supported.
562     langs = ''
563     if os.access(instPath + "/etc/sysconfig/i18n", os.R_OK):
564     f = open(instPath + "/etc/sysconfig/i18n", 'r')
565     for line in f.readlines():
566     line = string.strip(line)
567     parts = string.split(line, '=')
568     if len(parts) < 2:
569     continue
570     if string.strip(parts[0]) == 'SUPPORTED':
571     langs = parts[1]
572     if len(langs) > 0:
573     if langs[0] == '"' and langs[-1:] == '"':
574     langs = langs[1:-1]
575     break
576     del f
577     ## if langs:
578     ## rpm.addMacro("_install_langs", langs)
579    
580     # check the installed system to see if the packages just
581     # are not newer in this release.
582     if hasX and not hasFileManager:
583     for name in ("nautilus", "kdebase", "gmc"):
584     try:
585     h = ts.dbMatch('name', name).next()
586     except StopIteration:
587     continue
588     if h is not None:
589     hasFileManager = 1
590     break
591    
592     # make sure the boot loader being used is being installed.
593     # FIXME: generalize so that specific bits aren't needed
594     if iutil.getArch() == "i386" and id.bootloader.useGrub():
595     log("Upgrade: User selected to use GRUB for bootloader")
596     if id.grpset.hdrlist.has_key("grub") and not id.grpset.hdrlist["grub"].isSelected():
597     log("Upgrade: grub is not currently selected to be upgraded")
598     h = None
599     try:
600     h = ts.dbMatch('name', 'grub').next()
601     except StopIteration:
602     pass
603     if h is None:
604     text = ("Upgrade: GRUB is not already installed on the "
605     "system, selecting GRUB")
606     id.upgradeDeps ="%s%s\n" % (id.upgradeDeps, text)
607     log(text)
608     id.grpset.hdrlist["grub"].select()
609     if iutil.getArch() == "i386" and not id.bootloader.useGrub():
610     log("Upgrade: User selected to use LILO for bootloader")
611     if id.grpset.hdrlist.has_key("lilo") and not id.grpset.hdrlist["lilo"].isSelected():
612     log("Upgrade: lilo is not currently selected to be upgraded")
613     h = None
614     try:
615     h = ts.dbMatch('name', 'lilo').next()
616     except StopIteration:
617     pass
618     if h is None:
619     text = ("Upgrade: LILO is not already installed on the "
620     "system, selecting LILO")
621     id.upgradeDeps ="%s%s\n" % (id.upgradeDeps, text)
622     log(text)
623     id.grpset.hdrlist["lilo"].select()
624    
625    
626     h = None
627     try:
628     h = ts.dbMatch('name', 'gnome-core').next()
629     except StopIteration:
630     pass
631     if h is not None:
632     log("Upgrade: gnome-core was on the system. Upgrading to GNOME 2")
633     upgraded = []
634     for pkg in ("gnome-terminal", "gnome-desktop", "gnome-session",
635     "gnome-panel", "metacity", "file-roller", "yelp",
636     "nautilus"):
637     if id.grpset.hdrlist.has_key(pkg) and not id.grpset.hdrlist[pkg].isSelected():
638     id.grpset.hdrlist[pkg].select()
639     upgraded.append(pkg)
640    
641     text = ("Upgrade: gnome-core is on the system. Selecting packages "
642     "to upgrade to GNOME2: %s" %(str(upgraded),))
643     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
644    
645     # if they have up2date-gnome, they probably want the applet now too
646     # since it works in both gnome and kde
647     if (id.grpset.hdrlist.has_key("rhn-applet")
648     and not id.grpset.hdrlist["rhn-applet"].isSelected()):
649     log("Upgrade: rhn-applet is not currently selected to be upgraded")
650     h = None
651     try:
652     h = ts.dbMatch('name', 'up2date-gnome').next()
653     except StopIteration:
654     pass
655    
656     if h is not None:
657     hdr = None
658     try:
659     hdr = ts.dbMatch('name', 'rhn-applet').next()
660     except StopIteration:
661     pass
662     if hdr is None:
663     text = ("Upgrade: up2date-gnome is on the "
664     "system, but rhn-applet isn't. Selecting "
665     "rhn-applet to be installed")
666     id.upgradeDeps = "%s%s\n" % (id.upgradeDeps, text)
667     log(text)
668     id.grpset.hdrlist["rhn-applet"].select()
669    
670     # and since xterm is now split out from XFree86 (#98254)
671     if (id.grpset.hdrlist.has_key("xterm") and
672     not id.grpset.hdrlist["xterm"].isSelected()):
673     h = None
674     try:
675     h = ts.dbMatch('name', 'XFree86').next()
676     except StopIteration:
677     pass
678     if h is not None:
679     text = ("Upgrade: XFree86 was on the system. Pulling in xterm "
680     "for upgrade.")
681     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
682     log(text)
683     id.grpset.hdrlist["xterm"].select()
684    
685     # input methods all changed. hooray!
686     imupg = ( ("ami", "iiimf-le-hangul"),
687     ("kinput2-canna-wnn6", "iiimf-le-canna"),
688     ("miniChinput", "iiimf-le-chinput"),
689     ("xcin", "iiimf-le-xcin") )
690     iiimf = 0
691     for (old, new) in imupg:
692     mi = ts.dbMatch("name", old)
693     if (mi.count() > 0 and id.grpset.hdrlist.has_key(new) and
694     not id.grpset.hdrlist[new].isSelected()):
695     text = "Upgrade: %s was on the system. Pulling in %s" %(old, new)
696     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
697     log(text)
698     id.grpset.hdrlist[new].select()
699     iiimf = 1
700     if iiimf:
701     imupg = ( ("iiimf-gnome-im-switcher", "control-center"),
702     ("iiimf-gnome-im-switcher", "gnome-panel"),
703     ("iiimf-gtk", "gtk2"),
704     ("system-switch-im", "gtk2"),
705     ("iiimf-x", "xorg-x11"),
706     ("iiimf-x", "XFree86"))
707     for (new, old) in imupg:
708     mi = ts.dbMatch("name", old)
709     if (not id.grpset.hdrlist.has_key(new) or
710     id.grpset.hdrlist[new].isSelected()):
711     continue
712     if (mi.count() > 0 or
713     id.grpset.hdrlist.has_key(old) and
714     id.grpset.hdrlist[old].isSelected()):
715     text = "Upgrade: Need iiimf base package %s" %(new,)
716     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
717     log(text)
718     id.grpset.hdrlist[new].select()
719    
720     # firefox replaces mozilla/netscape (#137244)
721     if (id.grpset.hdrlist.has_key("firefox") and
722     not id.grpset.hdrlist["firefox"].isSelected()):
723     found = 0
724     for p in ("mozilla", "netscape-navigator", "netscape-communicator"):
725     mi = ts.dbMatch("name", p)
726     found += mi.count()
727     if found > 0:
728     text = "Upgrade: Found a graphical browser. Pulling in firefox"
729     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
730     log(text)
731     id.grpset.hdrlist["firefox"].select()
732    
733     # now some upgrade removal black list checking... there are things that
734     # if they were installed in the past, we want to remove them because
735     # they'll screw up the upgrade otherwise
736     for pkg in upgrade_remove_blacklist:
737     h = None
738     try:
739     h = ts.dbMatch('name', pkg).next()
740     except StopIteration:
741     pass
742     if h is not None:
743     text = ("Upgrade: %s is on the system but will cause problems "
744     "with the upgrade transaction. Removing." %(pkg,))
745     log(text)
746     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
747     id.upgradeRemove.append(pkg)
748    
749     # new package dependency fixup
750     depcheck = hdrlist.DependencyChecker(id.grpset, how = "u")
751     for p in id.grpset.hdrlist.pkgs.values():
752     if p.isSelected():
753     ts.addInstall(p.hdr, p.hdr, "u")
754     deps = ts.check(depcheck.callback)
755     for pkgnevra in deps:
756     text = ("Upgrade Dependency: Needs %s, "
757     "automatically added." % (pkgnevra,))
758     # log(text)
759     id.upgradeDeps = "%s%s\n" % (id.upgradeDeps, text)
760    
761     win.pop()
762    
763    

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