summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backend.py13
-rw-r--r--dispatch.py4
-rw-r--r--iw/task_gui.py3
-rw-r--r--livecd.py4
-rw-r--r--yuminstall.py145
5 files changed, 86 insertions, 83 deletions
diff --git a/backend.py b/backend.py
index e515bba00..ee4dad17b 100644
--- a/backend.py
+++ b/backend.py
@@ -187,11 +187,8 @@ class AnacondaBackend:
def kernelVersionList(self, rootPath="/"):
return []
- def doInitialSetup(self, anaconda):
- raise NotImplementedError
-
- def doRepoSetup(self, anaconda):
- log.warning("doRepoSetup not implemented for backend!")
+ def doBackendSetup(self, anaconda):
+ log.warning("doBackendSetup not implemented for backend!")
raise NotImplementedError
def groupExists(self, group):
@@ -245,10 +242,10 @@ class AnacondaBackend:
def complete(self, anaconda):
pass
-def doRepoSetup(anaconda):
- if anaconda.backend.doInitialSetup(anaconda) == DISPATCH_BACK:
+def doBackendSetup(anaconda):
+ if anaconda.backend.doBackendSetup(anaconda) == DISPATCH_BACK:
return DISPATCH_BACK
- anaconda.backend.doRepoSetup(anaconda)
+
if anaconda.id.upgrade:
anaconda.backend.checkSupportedUpgrade(anaconda)
iutil.writeRpmPlatform(anaconda.rootPath)
diff --git a/dispatch.py b/dispatch.py
index 2fe7b85d2..77eb90ada 100644
--- a/dispatch.py
+++ b/dispatch.py
@@ -44,7 +44,7 @@ from upgrade import findRootParts, queryUpgradeContinue
from installmethod import doMethodComplete
from kickstart import runPostScripts
-from backend import doPostSelection, doRepoSetup, doBasePackageSelect
+from backend import doPostSelection, doBackendSetup, doBasePackageSelect
from backend import doPreInstall, doPostInstall, doInstall
from backend import writeConfiguration
@@ -93,7 +93,7 @@ installSteps = [
("upgbootloader", ),
("bootloadersetup", bootloaderSetupChoices, ),
("bootloader", ),
- ("reposetup", doRepoSetup, ),
+ ("reposetup", doBackendSetup, ),
("basepkgsel", doBasePackageSelect, ),
("tasksel", ),
("group-selection", ),
diff --git a/iw/task_gui.py b/iw/task_gui.py
index 4027a603f..6b982f306 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -39,7 +39,8 @@ log = logging.getLogger("anaconda")
def setupRepo(anaconda, repo):
try:
- anaconda.backend.doRepoSetup(anaconda, thisrepo = repo.id, fatalerrors = False)
+ anaconda.backend.doRepoSetup(anaconda, thisrepo=repo.id, fatalerrors=False)
+ anaconda.backend.doSackSetup(anaconda, thisrepo=repo.id, fatalerrors=False)
log.info("added repository %s with with source URL %s" % (repo.name, repo.baseurl[0]))
except yum.Errors.RepoError, e:
anaconda.intf.messageWindow(_("Error"),
diff --git a/livecd.py b/livecd.py
index 5da7311a1..f3afc2088 100644
--- a/livecd.py
+++ b/livecd.py
@@ -366,9 +366,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend):
def kernelVersionList(self, rootPath = "/"):
return packages.rpmKernelVersionList(rootPath)
- def doInitialSetup(self, anaconda):
- pass
- def doRepoSetup(self, anaconda):
+ def doBackendSetup(self, anaconda):
# ensure there's enough space on the rootfs
# FIXME: really, this should be in the general sanity checking, but
# trying to weave that in is a little tricky at present.
diff --git a/yuminstall.py b/yuminstall.py
index decdcbc90..d2d745f40 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -267,12 +267,16 @@ class AnacondaYumRepo(YumRepository):
return False
def dirCleanup(self):
- if os.path.isdir(self.getAttribute('cachedir')):
+ cachedir = self.getAttribute('cachedir')
+
+ if os.path.isdir(cachedir):
if self.needsNetwork():
- shutil.rmtree("%s/headers" % self.getAttribute('cachedir'))
- shutil.rmtree("%s/packages" % self.getAttribute('cachedir'))
+ if os.path.exists("%s/headers" % cachedir):
+ shutil.rmtree("%s/headers" % cachedir)
+ if os.path.exists("%s/packages" % cachedir):
+ shutil.rmtree("%s/packages" % cachedir)
else:
- shutil.rmtree(self.getAttribute('cachedir'))
+ shutil.rmtree(cachedir)
class YumSorter(yum.YumBase):
def _transactionDataFactory(self):
@@ -967,7 +971,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
anaconda.backend.removeInstallImage()
- def doInitialSetup(self, anaconda):
+ def doBackendSetup(self, anaconda):
if anaconda.dir == DISPATCH_BACK:
return DISPATCH_BACK
@@ -978,62 +982,86 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
iutil.writeRpmPlatform()
self.ayum = AnacondaYum(anaconda)
+ self.ayum.doMacros()
+
+ self.doRepoSetup(anaconda)
+ self.doSackSetup(anaconda)
+
def doGroupSetup(self):
- # FIXME: this is a pretty ugly hack to make it so that we don't lose
- # groups being selected (#237708)
- sel = filter(lambda g: g.selected, self.ayum.comps.get_groups())
- self.ayum.doGroupSetup()
- # now we'll actually reselect groups..
- map(lambda g: self.selectGroup(g.groupid), sel)
-
- # and now, to add to the hacks, we'll make sure that packages don't
- # have groups double-listed. this avoids problems with deselecting
- # groups later
- for txmbr in self.ayum.tsInfo.getMembers():
- txmbr.groups = yum.misc.unique(txmbr.groups)
+ while True:
+ try:
+ # FIXME: this is a pretty ugly hack to make it so that we don't lose
+ # groups being selected (#237708)
+ sel = filter(lambda g: g.selected, self.ayum.comps.get_groups())
+ self.ayum.doGroupSetup()
+ # now we'll actually reselect groups..
+ map(lambda g: self.selectGroup(g.groupid), sel)
+
+ # and now, to add to the hacks, we'll make sure that packages don't
+ # have groups double-listed. this avoids problems with deselecting
+ # groups later
+ for txmbr in self.ayum.tsInfo.getMembers():
+ txmbr.groups = yum.misc.unique(txmbr.groups)
+ except (GroupsError, NoSuchGroup, RepoError), e:
+ buttons = [_("_Exit installer"), _("_Retry")]
+ else:
+ break # success
+
+ rc = anaconda.intf.messageWindow(_("Error"),
+ _("Unable to read group information "
+ "from repositories. This is "
+ "a problem with the generation "
+ "of your install tree."),
+ type="custom", custom_icon="error",
+ custom_buttons = buttons)
+ if rc == 0:
+ sys.exit(0)
+ else:
+ self.ayum._setGroups(None)
+ continue
+
+ self._catchallCategory()
def doRepoSetup(self, anaconda, thisrepo = None, fatalerrors = True):
- # We want to call ayum.doRepoSetup one repo at a time so we have
- # some concept of which repo didn't set up correctly.
- repos = []
+ self.__withFuncDo(anaconda, lambda r: self.ayum.doRepoSetup(thisrepo=r.id),
+ thisrepo=thisrepo, fatalerrors=fatalerrors, progress=False)
+
+ def doSackSetup(self, anaconda, thisrepo = None, fatalerrors = True):
+ self.__withFuncDo(anaconda, lambda r: self.ayum.doSackSetup(thisrepo=r.id),
+ thisrepo=thisrepo, fatalerrors=fatalerrors, progress=True)
+ def __withFuncDo(self, anaconda, fn, thisrepo=None, fatalerrors=True, progress=True):
# Don't do this if we're being called as a dispatcher step (instead
# of being called when a repo is added via the UI) and we're going
# back.
if thisrepo is None and anaconda.dir == DISPATCH_BACK:
return
+ # We want to call the function one repo at a time so we have some
+ # concept of which repo didn't set up correctly.
if thisrepo is not None:
- repos.append(self.ayum.repos.getRepo(thisrepo))
+ repos = [self.ayum.repos.getRepo(thisrepo)]
else:
- repos.extend(self.ayum.repos.listEnabled())
-
- self.ayum.doMacros()
-
- longtasks = ( (self.ayum.doRepoSetup, 4),
- (self.ayum.doSackSetup, 6) )
-
- tot = 0
- for t in longtasks:
- tot += t[1]
+ repos = self.ayum.repos.listEnabled()
for repo in repos:
- if repo.name is None:
- txt = _("Retrieving installation information...")
- else:
- txt = _("Retrieving installation information for %s...")%(repo.name)
- while 1:
- waitwin = YumProgress(anaconda.intf, txt, tot)
- self.ayum.repos.callback = waitwin
+ if progress:
+ if repo.name is None:
+ txt = _("Retrieving installation information...")
+ else:
+ txt = _("Retrieving installation information for %s...")%(repo.name)
+ waitwin = YumProgress(anaconda.intf, txt, 1)
+ self.ayum.repos.callback = waitwin
+
+ while True:
try:
- for (task, incr) in longtasks:
- waitwin.set_incr(incr)
- task(thisrepo = repo.id)
- waitwin.next_task()
- waitwin.pop()
+ fn(repo)
+ if progress:
+ waitwin.pop()
except RepoError, e:
- waitwin.pop()
+ if progress:
+ waitwin.pop()
if repo.needsNetwork() and not network.hasActiveNetDev():
if anaconda.intf.enableNetwork(anaconda):
repo.mirrorlistparsed = False
@@ -1046,7 +1074,9 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
if anaconda.isKickstart:
buttons.append(_("_Continue"))
- waitwin.pop()
+ if progress:
+ waitwin.pop()
+
if not fatalerrors:
raise RepoError, e
@@ -1080,31 +1110,8 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
repo.setFailureObj(self.ayum.urlgrabberFailureCB)
repo.setMirrorFailureObj((self.ayum.mirrorFailureCB, (),
- {"tsInfo":self.ayum.tsInfo,
- "repo": repo.id}))
-
- while 1:
- try:
- self.doGroupSetup()
- except (GroupsError, NoSuchGroup, RepoError), e:
- buttons = [_("_Exit installer"), _("_Retry")]
- else:
- break # success
+ {"repo": repo.id}))
- rc = anaconda.intf.messageWindow(_("Error"),
- _("Unable to read group information "
- "from repositories. This is "
- "a problem with the generation "
- "of your install tree."),
- type="custom", custom_icon="error",
- custom_buttons = buttons)
- if rc == 0:
- sys.exit(0)
- else:
- self.ayum._setGroups(None)
- continue
-
- self._catchallCategory()
self.ayum.repos.callback = None
def _catchallCategory(self):