diff options
-rw-r--r-- | dispatch.py | 3 | ||||
-rw-r--r-- | installclasses/upgradeclass.py | 6 | ||||
-rw-r--r-- | instdata.py | 2 | ||||
-rw-r--r-- | iw/lilo_gui.py | 22 | ||||
-rw-r--r-- | iw/upgrade_swap_gui.py | 19 | ||||
-rw-r--r-- | packages.py | 2 | ||||
-rw-r--r-- | upgrade.py | 101 | ||||
-rw-r--r-- | upgradeclass.py | 6 |
8 files changed, 92 insertions, 69 deletions
diff --git a/dispatch.py b/dispatch.py index c1e451bf1..af3b5f5d9 100644 --- a/dispatch.py +++ b/dispatch.py @@ -22,6 +22,7 @@ from packages import queryUpgradeContinue from floppy import makeBootdisk from bootloader import partitioningComplete, writeBootloader from flags import flags +from upgrade import upgradeFindPackages DISPATCH_BACK = -1 DISPATCH_FORWARD = 1 @@ -61,6 +62,8 @@ installSteps = [ ( "accounts", ("id.rootPassword", "id.accounts", ) ), ( "authentication", ("id.auth", ) ), ( "readcomps", readPackages, ("intf", "method", "id" )), + ( "findpackages", upgradeFindPackages, ("intf", "method", "id", + "instPath")), ( "package-selection", ("id.comps", "dispatch") ), ( "indivpackage", ("id.comps", "id.hdList", ) ), ( "handleX11pkgs", handleX11Packages, ("dir", "intf", "dispatch", diff --git a/installclasses/upgradeclass.py b/installclasses/upgradeclass.py index f8d8d4edd..8dff1d6aa 100644 --- a/installclasses/upgradeclass.py +++ b/installclasses/upgradeclass.py @@ -24,12 +24,16 @@ class InstallClass(BaseInstallClass): "findinstall", "addswap", "upgradecontinue", - "indivpackage", + "readcomps", +# "indivpackage", + "findpackages", "bootloader", + "checkdeps", "dependencies", "monitor", "confirminstall", "install", + "instbootloader", "bootdisk", "complete" ) diff --git a/instdata.py b/instdata.py index c8c092f94..4ab91c451 100644 --- a/instdata.py +++ b/instdata.py @@ -48,6 +48,8 @@ class InstallData: self.diskset = partitioning.DiskSet() self.partrequests = partitioning.PartitionRequests(self.diskset) self.bootloader = bootloader.x86BootloaderInfo() + self.dependencies = [] + self.dbpath = None def setInstallProgressClass(self, c): self.instProgress = c diff --git a/iw/lilo_gui.py b/iw/lilo_gui.py index 306dc059d..c9cd0ac08 100644 --- a/iw/lilo_gui.py +++ b/iw/lilo_gui.py @@ -133,13 +133,18 @@ class LiloWindow (InstallWindow): return 1 def toggled (self, widget, *args): + if self.ignoreSignals: + return + if widget.get_active (): state = TRUE else: state = FALSE - for n in self.bootDevice.keys() + [self.appendEntry, self.editBox, - self.imageList, self.liloLocationBox, self.radioBox, self.sw ]: + list = self.bootDevice.keys() + list.extend ([self.appendEntry, self.editBox, self.imageList, + self.liloLocationBox, self.radioBox, self.sw]) + for n in list: n.set_sensitive (state) if state and not len(self.bootDevice.keys()) < 2: @@ -242,7 +247,7 @@ class LiloWindow (InstallWindow): imageList = bl.images.getImages() defaultDevice = bl.images.getDefault() - self.ignoreSignals = 0 + self.ignoreSignals = 1 format = "/dev/%s" @@ -312,8 +317,8 @@ class LiloWindow (InstallWindow): self.bootloader.set_active (FALSE) self.toggled (self.bootloader) - for n in [self.mbr, self.part, self.appendEntry, self.editBox, - self.imageList, self.liloLocationBox, self.radioBox ]: + for n in (self.mbr, self.part, self.appendEntry, self.editBox, + self.imageList, self.liloLocationBox, self.radioBox ): n.set_sensitive (FALSE) self.bootloader.connect ("toggled", self.toggled) @@ -324,8 +329,8 @@ class LiloWindow (InstallWindow): box.pack_start (GtkHSeparator (), FALSE) box.pack_start (self.radioBox, FALSE) - self.imageList = GtkCList (4, - ( _("Default"), _("Device"), _("Partition type"), _("Boot label"))) + self.imageList = GtkCList (4, ( _("Default"), _("Device"), + _("Partition type"), _("Boot label"))) sortedKeys = imageList.keys() sortedKeys.sort() @@ -403,7 +408,8 @@ class LiloWindow (InstallWindow): self.editBox.set_sensitive(FALSE) self.radioBox.set_sensitive(FALSE) self.sw.set_sensitive(FALSE) - + + self.ignoreSignals = 0 return box diff --git a/iw/upgrade_swap_gui.py b/iw/upgrade_swap_gui.py index 95001e062..d053fa588 100644 --- a/iw/upgrade_swap_gui.py +++ b/iw/upgrade_swap_gui.py @@ -47,11 +47,6 @@ class UpgradeSwapWindow (InstallWindow): #-If the user doesn't need to add swap, we don't do anything if not self.neededSwap: return None - - mnt, part, size = self.clist.get_row_data(self.row) - val = int(self.entry.get_text()) - size = int(size) - val = int(val) if self.option2.get_active(): rc = self.warning() @@ -59,10 +54,18 @@ class UpgradeSwapWindow (InstallWindow): if rc == 1: raise gui.StayOnScreen else: - # proceed because they decided not to have swapfile created - self.todo.upgradeFindPackages() return None - elif val > 2000 or val < 1: + + data = self.clist.get_row_data(self.row) + if data: + mnt, part, size = data + val = int(self.entry.get_text()) + size = int(size) + val = int(val) + else: + val = 0 + + if val > 2000 or val < 1: rc = self.swapWrongSize() raise gui.StayOnScreen diff --git a/packages.py b/packages.py index 7cc015284..15efeccb1 100644 --- a/packages.py +++ b/packages.py @@ -654,7 +654,7 @@ def doInstall(method, id, intf, instPath): pass os.rename (instPath + "/var/lib/rpm", instPath + "/var/lib/rpm.rpmsave") - os.rename (instPath + self.dbpath, + os.rename (instPath + id.dbpath, instPath + "/var/lib/rpm") # XXX - rpm 4.0.2 %post braindeadness support diff --git a/upgrade.py b/upgrade.py index 894b856ce..855ac90aa 100644 --- a/upgrade.py +++ b/upgrade.py @@ -9,6 +9,8 @@ import os.path from flags import flags from partitioning import * import fsset +import time +import rpm def findExistingRoots (intf, id, chroot): if not flags.setupFilesystems: return [ (chroot, 'ext2') ] @@ -160,7 +162,7 @@ def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath): mountRootPartition(intf, rootInfo, oldfsset, instPath, allowDirty = 0) except SystemError, msg: - self.intf.messageWindow(_("Dirty Filesystems"), + intf.messageWindow(_("Dirty Filesystems"), _("One or more of the filesystems listed in the " "/etc/fstab on your Linux system cannot be mounted. " "Please fix this problem and try to upgrade again.")) @@ -170,7 +172,7 @@ def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath): '/boot', '/tmp', '/var/tmp' ] badLinks = [] for n in checkLinks: - if not os.path.islink(self.instPath + n): continue + if not os.path.islink(instPath + n): continue l = os.readlink(self.instPath + n) if l[0] == '/': badLinks.append(n) @@ -182,7 +184,7 @@ def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath): "symbolic links and restart the upgrade.\n\n") for n in badLinks: message = message + '\t' + n + '\n' - self.intf.messageWindow(("Absolute Symlinks"), message) + intf.messageWindow(("Absolute Symlinks"), message) sys.exit(0) else: newfsset = fsset.readFstab(instPath + '/etc/fstab') @@ -190,71 +192,74 @@ def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath): oldfsset.add(entry) if flags.setupFilesystems: - oldfsset.turnOnSwap(self.instPath) - -def upgradeFindPackages (self): - if not self.rebuildTime: - self.rebuildTime = str(int(time.time())) - self.getCompsList () - self.getHeaderList () - self.method.mergeFullHeaders(self.hdList) - - win = self.intf.waitWindow (_("Finding"), - _("Finding packages to upgrade...")) - - self.dbpath = "/var/lib/anaconda-rebuilddb" + self.rebuildTime - rpm.addMacro("_dbpath_rebuild", self.dbpath) + oldfsset.turnOnSwap(instPath) + +rebuildTime = None + +def upgradeFindPackages (intf, method, id, instPath): + global rebuildTime + if not rebuildTime: + rebuildTime = str(int(time.time())) + method.mergeFullHeaders(id.hdlist) + + win = intf.waitWindow (_("Finding"), + _("Finding packages to upgrade...")) + + id.dbpath = "/var/lib/anaconda-rebuilddb" + rebuildTime + rpm.addMacro("_dbpath_rebuild", id.dbpath) rpm.addMacro("_dbapi", "-1") # now, set the system clock so the timestamps will be right: - iutil.setClock (self.instPath) + if flags.setupFilesystems: + iutil.setClock (instPath) # and rebuild the database so we can run the dependency problem # sets against the on disk db - rc = rpm.rebuilddb (self.instPath) + + rebuildpath = "%s%s%s" % (instPath, "/var/lib/anaconda-rebuilddb", + rebuildTime) + rc = rpm.rebuilddb (instPath) if rc: try: - iutil.rmrf (self.instPath + "/var/lib/anaconda-rebuilddb" - + self.rebuildTime) + iutil.rmrf (rebuildpath) except: pass win.pop() - self.intf.messageWindow(_("Error"), - _("Rebuild of RPM database failed. " - "You may be out of disk space?")) - if self.setupFilesystems: - self.fstab.umountFilesystems (self.instPath) + intf.messageWindow(_("Error"), + _("Rebuild of RPM database failed. " + "You may be out of disk space?")) + if files.setupFilesystems: + fsset.umountFilesystems (instPath) sys.exit(0) - rpm.addMacro("_dbpath", self.dbpath) + rpm.addMacro("_dbpath", id.dbpath) rpm.addMacro("_dbapi", "3") try: - packages = rpm.findUpgradeSet (self.hdList.hdlist, self.instPath) + packages = rpm.findUpgradeSet (id.hdlist.hdlist, instPath) except rpm.error: - iutil.rmrf (self.instPath + "/var/lib/anaconda-rebuilddb" - + self.rebuildTime) + iutil.rmrf (rebuildpath) win.pop() - self.intf.messageWindow(_("Error"), - _("An error occured when finding the packages to " - "upgrade.")) - if self.setupFilesystems: - self.fstab.umountFilesystems (self.instPath) + intf.messageWindow(_("Error"), + _("An error occured when finding the packages to " + "upgrade.")) + if flags.setupFilesystems: + fsset.umountFilesystems (instPath) sys.exit(0) # Turn off all comps - for comp in self.comps: + for comp in id.comps: comp.unselect() # unselect all packages - for package in self.hdList.packages.values (): + for package in id.hdlist.packages.values (): package.selected = 0 hasX = 0 hasFileManager = 0 # turn on the packages in the upgrade set for package in packages: - self.hdList[package[rpm.RPMTAG_NAME]].select() + id.hdlist[package[rpm.RPMTAG_NAME]].select() if package[rpm.RPMTAG_NAME] == "XFree86": hasX = 1 if package[rpm.RPMTAG_NAME] == "gmc": @@ -263,13 +268,13 @@ def upgradeFindPackages (self): hasFileManager = 1 # open up the database to check dependencies - db = rpm.opendb (0, self.instPath) + db = rpm.opendb (0, instPath) # if we have X but not gmc, we need to turn on GNOME. We only # want to turn on packages we don't have installed already, though. if hasX and not hasFileManager: log ("Has X but no desktop -- Installing GNOME") - for package in self.comps['GNOME'].pkgs: + for package in id.comps['GNOME'].pkgs: try: rec = db.findbyname (package.name) except rpm.error: @@ -281,16 +286,12 @@ def upgradeFindPackages (self): del db # new package dependency fixup - deps = self.verifyDeps () - loops = 0 - while deps and self.canResolveDeps (deps) and loops < 10: - for (name, suggest) in deps: - if name != _("no suggestion"): - log ("Upgrade Dependency: %s needs %s, " - "automatically added.", name, suggest) - self.selectDeps (deps) - deps = self.verifyDeps () - loops = loops + 1 + deps = id.comps.verifyDeps(instPath, 1) + for (name, suggest) in deps: + if name != _("no suggestion"): + log ("Upgrade Dependency: %s needs %s, " + "automatically added.", name, suggest) + id.comps.selectDeps (deps) win.pop () diff --git a/upgradeclass.py b/upgradeclass.py index f8d8d4edd..8dff1d6aa 100644 --- a/upgradeclass.py +++ b/upgradeclass.py @@ -24,12 +24,16 @@ class InstallClass(BaseInstallClass): "findinstall", "addswap", "upgradecontinue", - "indivpackage", + "readcomps", +# "indivpackage", + "findpackages", "bootloader", + "checkdeps", "dependencies", "monitor", "confirminstall", "install", + "instbootloader", "bootdisk", "complete" ) |