From 11c21de1b14c509563c7f09f119c876b809dd168 Mon Sep 17 00:00:00 2001 From: Paul Nasrat Date: Tue, 30 Aug 2005 18:35:36 +0000 Subject: Dispatch/yuminstall fixups --- anaconda | 2 +- backend.py | 24 ++++++++++++++++-------- dispatch.py | 20 ++++++++++---------- yuminstall.py | 8 +++++--- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/anaconda b/anaconda index 6d622ce61..50e257523 100755 --- a/anaconda +++ b/anaconda @@ -1093,7 +1093,7 @@ if method: from yuminstall import YumBackend -backend = YumBackend(method) +backend = YumBackend(methodobj) floppyDevice = floppy.probeFloppyDevice() diff --git a/backend.py b/backend.py index 7339e264e..91044ab07 100644 --- a/backend.py +++ b/backend.py @@ -15,14 +15,6 @@ import logging log = logging.getLogger("anaconda") -class ProxyBackend: - def __init__(self, object=None): - self.object = object - - def __getattr__(self, attr): - if self.object: - return getattr(self.object, attr) - class AnacondaBackend: def __init__(self, method): self.method = method @@ -88,3 +80,19 @@ class AnacondaBackend: else: self.modeText = _("Installing %s-%s-%s.%s.\n") + +def doPreSelection(backend, intf, id, instPath): + backend.doPreSelection(intf, id, instPath) + +def doPostSelection(backend, intf, id, instPath): + backend.doPostSelection(intf, id, instPath) + +def doPreInstall(backend, intf, id, instPath, dir): + backend.doPreInstall(intf, id, instPath, dir) + +def doPostInstall(backend, intf, id, instPath): + backend.doPostInstall(intf, id, instPath) + +def doInstall(backend, intf, id, instPath): + backend.doInstall(intf, id, instPath) + diff --git a/dispatch.py b/dispatch.py index ecb71d6bb..14cca8694 100644 --- a/dispatch.py +++ b/dispatch.py @@ -44,8 +44,9 @@ from installmethod import doMethodComplete import logging log = logging.getLogger("anaconda") -from backend import ProxyBackend -backend = ProxyBackend() +from backend import doPreSelection, doPostSelection +from backend import doPreInstall, doPostInstall, doInstall + # These are all of the install steps, in order. Note that upgrade and # install steps are the same thing! Upgrades skip install steps, while # installs skip upgrade steps. @@ -102,7 +103,7 @@ installSteps = [ ("timezone", ("id.instLanguage", "id.timezone")), ("accounts", ("intf", "id.rootPassword")), #XXX: factor to backend - ("preselection", backend.doPreSelection, ("intf", "id", "instPath")), + ("preselection", doPreSelection, ("backend","intf", "id", "instPath")), #("desktopchoice", ("intf", "id.instClass", "dispatch", "id.grpset")), #("findpackages", upgradeFindPackages, ("intf", "method", "id", "instPath", "dir")), #("selectlangpackages", selectLanguageSupportGroups, ("id.grpset","id.instLanguage")), @@ -112,7 +113,7 @@ installSteps = [ # "id", "instPath")), #("handlemiscpkgs", handleMiscPackages, ("intf", "id", "dir")), #("fixupconditionals", fixupConditionals, ("id.grpset",)), - ("postselection", backend.doPostSelection, ("intf", "id", "instPath")), + ("postselection", doPostSelection, ("backend", "intf", "id", "instPath")), #XXX: factor to backend #("checkdeps", checkDependencies, ("dir", "intf", "dispatch", "id", "instPath")), #("dependencies", ("id.grpset", "id.dependencies")), @@ -127,8 +128,8 @@ installSteps = [ "instPath")), ("setuptime", setupTimezone, ("id.timezone", "id.upgrade", "instPath", "dir")), - ("preinstallconfig", backend.doPreInstall, ("intf", "id", "instPath", "dir")), - ("installpackages", backend.doInstall, ("method", "id", "intf", "instPath")), + ("preinstallconfig", doPreInstall, ("backend", "intf", "id", "instPath", "dir")), + ("installpackages", doInstall, ("backend", "intf", "id", "instPath")), #("postinstallconfig", backend.doPostInstall, ("method", "id", "intf", "instPath")), ("writeconfig", writeConfiguration, ("id", "instPath")), ("firstboot", firstbootConfiguration, ("id", "instPath")), @@ -153,7 +154,7 @@ installSteps = [ ("writeksconfig", writeKSConfiguration, ("id", "instPath")), ("setfilecon", setFileCons, ("instPath","id.partitions")), ("copylogs", copyAnacondaLogs, ("instPath",)), - ("dopostaction", doPostAction, ("id", "instPath", "intf")), + ("dopostaction", doPostInstall, ("backend", "intf", "id", "instPath")), ("methodcomplete", doMethodComplete, ("method", "id.fsset")), ("complete", ()), ] @@ -284,9 +285,7 @@ class Dispatcher: return (step, args) - def __init__(self, intf, id, method, instPath, mybackend): - global backend - backend.object = mybackend + def __init__(self, intf, id, method, instPath, backend): self.dir = DISPATCH_FORWARD self.step = None self.skipSteps = {} @@ -297,4 +296,5 @@ class Dispatcher: self.method = method self.dispatch = self self.instPath = instPath + self.backend = backend self.firstStep = 0 diff --git a/yuminstall.py b/yuminstall.py index a9abc9c4e..0e95c9def 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -23,12 +23,14 @@ import yum.repos import yum.packages from syslogd import syslog from backend import AnacondaBackend +from constants import * from rhpl.translate import _ import logging log = logging.getLogger("anaconda") import iutil +import isys class simpleCallback: @@ -245,7 +247,7 @@ class YumBackend(AnacondaBackend): _("Checking dependencies in packages selected for installation...")) (code, msgs) = self.ayum.buildTransaction() - (dlpkgs, totalSize, totalFiles) = self.ayum.getDownloadPkgs() + (self.dlpkgs, self.totalSize, self.totalFiles) = self.ayum.getDownloadPkgs() win.pop() def doPreInstall(self, intf, id, instPath, dir): @@ -281,7 +283,7 @@ class YumBackend(AnacondaBackend): instPath + "/etc/modprobe.conf.anacbak") - if method.systemMounted (id.fsset, instPath): + if self.method.systemMounted (id.fsset, instPath): id.fsset.umountFilesystems(instPath) return DISPATCH_BACK @@ -355,7 +357,7 @@ class YumBackend(AnacondaBackend): pkgTimer = timer.Timer(start = 0) - id.instProgress.setSizes(len(dlpkgs), totalSize, totalFiles) + id.instProgress.setSizes(len(self.dlpkgs), self.totalSize, self.totalFiles) id.instProgress.processEvents() cb = simpleCallback(intf.messageWindow, id.instProgress, pkgTimer, self.method, intf.progressWindow, self.instLog, self.modeText, self.ayum.ts) -- cgit