/[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.4 - (hide annotations) (download) (as text)
Sun Jul 31 16:38:19 2005 UTC (19 years, 4 months ago) by slords
Branch: MAIN
Changes since 1.3: +0 -1 lines
Content type: text/x-python
Cleanup and descriptions

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     if val > 0:
537     supportedUpgradeVersion = 0
538     else:
539     supportedUpgradeVersion = 1
540     break
541    
542     if supportedUpgradeVersion == 0:
543     rc = intf.messageWindow(_("Warning"),
544     _("You appear to be upgrading from a system "
545     "which is too old to upgrade to this "
546     "version of %s. Are you sure you wish to "
547     "continue the upgrade "
548     "process?") %(productName,),
549     type = "yesno")
550     if rc == 0:
551     try:
552     resetRpmdb(id.dbpath, instPath)
553     except Exception, e:
554     log("error returning rpmdb to old state: %s" %(e,))
555     pass
556     sys.exit(0)
557    
558 gordonr 1.1
559     # during upgrade, make sure that we only install %lang colored files
560     # for the languages selected to be supported.
561     langs = ''
562     if os.access(instPath + "/etc/sysconfig/i18n", os.R_OK):
563     f = open(instPath + "/etc/sysconfig/i18n", 'r')
564     for line in f.readlines():
565     line = string.strip(line)
566     parts = string.split(line, '=')
567     if len(parts) < 2:
568     continue
569     if string.strip(parts[0]) == 'SUPPORTED':
570     langs = parts[1]
571     if len(langs) > 0:
572     if langs[0] == '"' and langs[-1:] == '"':
573     langs = langs[1:-1]
574     break
575     del f
576     ## if langs:
577     ## rpm.addMacro("_install_langs", langs)
578    
579     # check the installed system to see if the packages just
580     # are not newer in this release.
581     if hasX and not hasFileManager:
582     for name in ("nautilus", "kdebase", "gmc"):
583     try:
584     h = ts.dbMatch('name', name).next()
585     except StopIteration:
586     continue
587     if h is not None:
588     hasFileManager = 1
589     break
590    
591     # make sure the boot loader being used is being installed.
592     # FIXME: generalize so that specific bits aren't needed
593     if iutil.getArch() == "i386" and id.bootloader.useGrub():
594     log("Upgrade: User selected to use GRUB for bootloader")
595     if id.grpset.hdrlist.has_key("grub") and not id.grpset.hdrlist["grub"].isSelected():
596     log("Upgrade: grub is not currently selected to be upgraded")
597     h = None
598     try:
599     h = ts.dbMatch('name', 'grub').next()
600     except StopIteration:
601     pass
602     if h is None:
603     text = ("Upgrade: GRUB is not already installed on the "
604     "system, selecting GRUB")
605     id.upgradeDeps ="%s%s\n" % (id.upgradeDeps, text)
606     log(text)
607     id.grpset.hdrlist["grub"].select()
608     if iutil.getArch() == "i386" and not id.bootloader.useGrub():
609     log("Upgrade: User selected to use LILO for bootloader")
610     if id.grpset.hdrlist.has_key("lilo") and not id.grpset.hdrlist["lilo"].isSelected():
611     log("Upgrade: lilo is not currently selected to be upgraded")
612     h = None
613     try:
614     h = ts.dbMatch('name', 'lilo').next()
615     except StopIteration:
616     pass
617     if h is None:
618     text = ("Upgrade: LILO is not already installed on the "
619     "system, selecting LILO")
620     id.upgradeDeps ="%s%s\n" % (id.upgradeDeps, text)
621     log(text)
622     id.grpset.hdrlist["lilo"].select()
623    
624    
625     h = None
626     try:
627     h = ts.dbMatch('name', 'gnome-core').next()
628     except StopIteration:
629     pass
630     if h is not None:
631     log("Upgrade: gnome-core was on the system. Upgrading to GNOME 2")
632     upgraded = []
633     for pkg in ("gnome-terminal", "gnome-desktop", "gnome-session",
634     "gnome-panel", "metacity", "file-roller", "yelp",
635     "nautilus"):
636     if id.grpset.hdrlist.has_key(pkg) and not id.grpset.hdrlist[pkg].isSelected():
637     id.grpset.hdrlist[pkg].select()
638     upgraded.append(pkg)
639    
640     text = ("Upgrade: gnome-core is on the system. Selecting packages "
641     "to upgrade to GNOME2: %s" %(str(upgraded),))
642     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
643    
644     # if they have up2date-gnome, they probably want the applet now too
645     # since it works in both gnome and kde
646     if (id.grpset.hdrlist.has_key("rhn-applet")
647     and not id.grpset.hdrlist["rhn-applet"].isSelected()):
648     log("Upgrade: rhn-applet is not currently selected to be upgraded")
649     h = None
650     try:
651     h = ts.dbMatch('name', 'up2date-gnome').next()
652     except StopIteration:
653     pass
654    
655     if h is not None:
656     hdr = None
657     try:
658     hdr = ts.dbMatch('name', 'rhn-applet').next()
659     except StopIteration:
660     pass
661     if hdr is None:
662     text = ("Upgrade: up2date-gnome is on the "
663     "system, but rhn-applet isn't. Selecting "
664     "rhn-applet to be installed")
665     id.upgradeDeps = "%s%s\n" % (id.upgradeDeps, text)
666     log(text)
667     id.grpset.hdrlist["rhn-applet"].select()
668    
669     # and since xterm is now split out from XFree86 (#98254)
670     if (id.grpset.hdrlist.has_key("xterm") and
671     not id.grpset.hdrlist["xterm"].isSelected()):
672     h = None
673     try:
674     h = ts.dbMatch('name', 'XFree86').next()
675     except StopIteration:
676     pass
677     if h is not None:
678     text = ("Upgrade: XFree86 was on the system. Pulling in xterm "
679     "for upgrade.")
680     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
681     log(text)
682     id.grpset.hdrlist["xterm"].select()
683    
684     # input methods all changed. hooray!
685     imupg = ( ("ami", "iiimf-le-hangul"),
686     ("kinput2-canna-wnn6", "iiimf-le-canna"),
687     ("miniChinput", "iiimf-le-chinput"),
688     ("xcin", "iiimf-le-xcin") )
689     iiimf = 0
690     for (old, new) in imupg:
691     mi = ts.dbMatch("name", old)
692     if (mi.count() > 0 and id.grpset.hdrlist.has_key(new) and
693     not id.grpset.hdrlist[new].isSelected()):
694     text = "Upgrade: %s was on the system. Pulling in %s" %(old, new)
695     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
696     log(text)
697     id.grpset.hdrlist[new].select()
698     iiimf = 1
699     if iiimf:
700     imupg = ( ("iiimf-gnome-im-switcher", "control-center"),
701     ("iiimf-gnome-im-switcher", "gnome-panel"),
702     ("iiimf-gtk", "gtk2"),
703     ("system-switch-im", "gtk2"),
704     ("iiimf-x", "xorg-x11"),
705     ("iiimf-x", "XFree86"))
706     for (new, old) in imupg:
707     mi = ts.dbMatch("name", old)
708     if (not id.grpset.hdrlist.has_key(new) or
709     id.grpset.hdrlist[new].isSelected()):
710     continue
711     if (mi.count() > 0 or
712     id.grpset.hdrlist.has_key(old) and
713     id.grpset.hdrlist[old].isSelected()):
714     text = "Upgrade: Need iiimf base package %s" %(new,)
715     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
716     log(text)
717     id.grpset.hdrlist[new].select()
718    
719     # firefox replaces mozilla/netscape (#137244)
720     if (id.grpset.hdrlist.has_key("firefox") and
721     not id.grpset.hdrlist["firefox"].isSelected()):
722     found = 0
723     for p in ("mozilla", "netscape-navigator", "netscape-communicator"):
724     mi = ts.dbMatch("name", p)
725     found += mi.count()
726     if found > 0:
727     text = "Upgrade: Found a graphical browser. Pulling in firefox"
728     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
729     log(text)
730     id.grpset.hdrlist["firefox"].select()
731    
732     # now some upgrade removal black list checking... there are things that
733     # if they were installed in the past, we want to remove them because
734     # they'll screw up the upgrade otherwise
735     for pkg in upgrade_remove_blacklist:
736     h = None
737     try:
738     h = ts.dbMatch('name', pkg).next()
739     except StopIteration:
740     pass
741     if h is not None:
742     text = ("Upgrade: %s is on the system but will cause problems "
743     "with the upgrade transaction. Removing." %(pkg,))
744     log(text)
745     id.upgradeDeps = "%s%s\n" %(id.upgradeDeps, text)
746     id.upgradeRemove.append(pkg)
747    
748     # new package dependency fixup
749     depcheck = hdrlist.DependencyChecker(id.grpset, how = "u")
750     for p in id.grpset.hdrlist.pkgs.values():
751     if p.isSelected():
752     ts.addInstall(p.hdr, p.hdr, "u")
753     deps = ts.check(depcheck.callback)
754     for pkgnevra in deps:
755     text = ("Upgrade Dependency: Needs %s, "
756     "automatically added." % (pkgnevra,))
757     # log(text)
758     id.upgradeDeps = "%s%s\n" % (id.upgradeDeps, text)
759    
760     win.pop()
761    
762    

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