summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--harddrive.py8
-rw-r--r--image.py23
-rw-r--r--installmethod.py3
-rw-r--r--urlinstall.py8
-rw-r--r--yuminstall.py102
6 files changed, 98 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 781063507..914d44efd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-05-25 Chris Lumens <clumens@redhat.com>
+
+ * harddrive.py (HardDriveInstallMethod.badPackageError): Add a
+ method-specific function to explain why the package may not be found.
+ * image.py (CdromInstallMethod.badPackageError): Likewise.
+ (NfsInstallMethod.badPackageError): Likewise.
+ (NfsIsoInstallMethod.badPackageError): Likewise.
+ * installmethod.py (badPackageError): Likewise.
+ * urlinstall.py (UrlInstallMethod.badPackageError): Likewise.
+
+ * yuminstall.py: Consolidate file fetching error handling into one
+ set of urlgrabber error callbacks. Allow retrying when the error
+ dialog is displayed (#183974).
+
2006-05-24 David Cantrell <dcantrell@redhat.com>
* isys/nl.c: Skip Netlink messages with void ARP headers or zero-length
diff --git a/harddrive.py b/harddrive.py
index 56995f969..fce31f3ff 100644
--- a/harddrive.py
+++ b/harddrive.py
@@ -37,6 +37,14 @@ class HardDriveInstallMethod(ImageInstallMethod):
self.switchMedia(wasmounted)
return path
+ def badPackageError(self, pkgname):
+ return _("The file %s cannot be opened. This is due to a missing "
+ "file or perhaps a corrupt package. Please verify your "
+ "installation images and that you have all the required "
+ "media.\n\n"
+ "If you reboot, your system will be left in an inconsistent "
+ "state that will likely require reinstallation.\n\n") % pkgname
+
# mounts disc image cdNum under self.tree
def mountMedia(self, cdNum):
if self.mediaIsMounted:
diff --git a/image.py b/image.py
index 0caa79009..e2f9f560e 100644
--- a/image.py
+++ b/image.py
@@ -141,6 +141,14 @@ class CdromInstallMethod(ImageInstallMethod):
def ejectCD(self):
isys.ejectCdrom(self.device, makeDevice=1)
+ def badPackageError(self, pkgname):
+ return _("The file %s cannot be opened. This is due to a missing "
+ "file or perhaps a corrupt package. Please verify your "
+ "installation images and that you have all the required "
+ "media.\n\n"
+ "If you reboot, your system will be left in an inconsistent "
+ "state that will likely require reinstallation.\n\n") % pkgname
+
def systemUnmounted(self):
if self.loopbackFile:
isys.makeDevInode("loop0", "/tmp/loop")
@@ -346,6 +354,13 @@ class CdromInstallMethod(ImageInstallMethod):
class NfsInstallMethod(ImageInstallMethod):
+ def badPackageError(self, pkgname):
+ return _("The file %s cannot be opened. This is due to a missing "
+ "file or perhaps a corrupt package. Please verify your "
+ "installation tree contains all required packages.\n\n"
+ "If you reboot, your system will be left in an inconsistent "
+ "state that will likely require reinstallation.\n\n") % pkgname
+
def __init__(self, method, rootPath, intf):
"""@param method: nfs:/mnt/source"""
tree = method[5:]
@@ -451,6 +466,14 @@ class NfsIsoInstallMethod(NfsInstallMethod):
self.umountImage()
self.mountImage(mediano)
+ def badPackageError(self, pkgname):
+ return _("The file %s cannot be opened. This is due to a missing "
+ "file or perhaps a corrupt package. Please verify your "
+ "installation images and that you have all the required "
+ "media.\n\n"
+ "If you reboot, your system will be left in an inconsistent "
+ "state that will likely require reinstallation.\n\n") % pkgname
+
def umountImage(self):
if self.currentMedia:
isys.umount(self.mntPoint)
diff --git a/installmethod.py b/installmethod.py
index eb613401e..a1fd095e3 100644
--- a/installmethod.py
+++ b/installmethod.py
@@ -76,6 +76,9 @@ class InstallMethod:
def ejectCD(self):
pass
+ def badPackageError(self, pkgname):
+ pass
+
# this handles any cleanup needed for the method. it occurs *very* late
# (ie immediately before the congratulations screen). main use right now
diff --git a/urlinstall.py b/urlinstall.py
index 528d6544d..a6be87a15 100644
--- a/urlinstall.py
+++ b/urlinstall.py
@@ -70,6 +70,14 @@ def urlretrieve(location, file, callback=None):
class UrlInstallMethod(InstallMethod):
+ def badPackageError(self, pkgname):
+ return _("The file %s cannot be opened. This is due to a missing "
+ "file or perhaps a corrupt package. Please verify your "
+ "mirror contains all required packages, and try using a "
+ "different one.\n\n"
+ "If you reboot, your system will be left in an inconsistent "
+ "state that will likely require reinstallation.\n\n") % pkgname
+
def getFilename(self, filename, callback=None, destdir=None, retry=1,
disc = 1):
diff --git a/yuminstall.py b/yuminstall.py
index 510cbd0f8..4b45e64fd 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -138,47 +138,12 @@ class simpleCallback:
while self.files[nvra] == None:
try:
- fn = repo.get(relative=path, local=po.localPkg())
+ fn = repo.get(relative=path, local=po.localPkg())
+
+ f = open(fn, 'r')
+ self.files[nvra] = f
except yum.Errors.RepoError, e:
- log.info("Failed %s in %s" %(path, po.returnSimple('name')))
- self.method.unmountCD()
- rc = self.messageWindow(_("Error"),
- _("The package %s-%s-%s.%s cannot be opened. This is due "
- "to a missing file or perhaps a corrupt package. "
- "If you are installing from CD media this usually "
- "means the CD media is corrupt, or the CD drive is "
- "unable to read the media.\n\n"
- "Press 'Retry' to try again.") %
- (po.returnSimple('name'),
- po.returnSimple('version'),
- po.returnSimple('release'),
- po.returnSimple('arch')),
- type="custom",
- custom_icon="error",
- custom_buttons = [ _("Re_boot"),
- _("_Retry") ])
- if rc == 0:
- rc = self.messageWindow(_("Warning"),
- _("If you reboot, your system "
- "will be left in an "
- "inconsistent state that "
- "will likely require "
- "reinstallation. Are you "
- "sure you wish to "
- "continue?"),
- type = "custom",
- custom_icon="warning",
- custom_buttons = [_("_Cancel"),
- _("_Reboot")])
- if rc == 1:
- sys.exit(0)
- else:
- continue
- else:
- continue
-
- f = open(fn, 'r')
- self.files[nvra] = f
+ continue
return self.files[nvra].fileno()
@@ -551,7 +516,16 @@ class AnacondaYum(YumSorter):
if ts_elem.has_key((txmbr.pkgtup, 'i')):
continue
- self.downloadHeader(txmbr.po)
+ # If we get a URLGrabError, that means we had trouble getting
+ # the package. However, the user clicked retry in the
+ # urlgrabberFailureCB (since if they clicked Reboot, we exited)
+ # so use this as the indication to try again.
+ while True:
+ try:
+ self.downloadHeader(txmbr.po)
+ break
+ except RepoError:
+ pass
hdr = txmbr.po.returnLocalHeader()
rpmfile = txmbr.po.localPkg()
@@ -595,30 +569,33 @@ class AnacondaYum(YumSorter):
return False
class YumBackend(AnacondaBackend):
- def __init__(self, method, instPath):
- AnacondaBackend.__init__(self, method, instPath)
+ def _handleFailure(self, url, intf):
+ (scheme, netloc, path, query, fragment) = urlparse.urlsplit(url)
+
+ rc = intf.messageWindow(_("Error"),
+ self.method.badPackageError(os.path.basename(path)),
+ type="custom", custom_icon="error",
+ custom_buttons=[_("Re_boot"), _("_Retry")])
+
+ if rc == 0:
+ sys.exit(0)
+
+ def mirrorFailureCB (self, obj, *args, **kwargs):
+ log.warning("Failed to get %s from mirror" % obj.url)
+
+ self.method.unmountCD()
+
+ if kwargs.has_key("intf") and kwargs["intf"]:
+ self._handleFailure(obj.url, kwargs["intf"])
def urlgrabberFailureCB (self, obj, *args, **kwargs):
log.warning("Try %s/%s for %s failed" % (obj.tries, obj.retry, obj.url))
if obj.tries >= obj.retry:
- if kwargs.has_key("method") and kwargs["method"]:
- kwargs["method"].unmountCD()
-
- # We've already tried self.retries times to download this file.
- # Nothing left to do but give up.
+ self.method.unmountCD()
+
if kwargs.has_key("intf") and kwargs["intf"]:
- (scheme, netloc, path, query, fragment) = urlparse.urlsplit(obj.url)
- rc = kwargs["intf"].messageWindow(_("Error"),
- _("The file %s cannot be opened. This is due "
- "to a missing file or perhaps a corrupt package. "
- "If you are installing from CD media this usually "
- "means the CD media is corrupt, or the CD drive is "
- "unable to read the media.\n\n") % os.path.basename(path),
- type="custom", custom_icon="error", custom_buttons=[_("Re_boot")])
-
- if rc == 0:
- sys.exit(0)
+ self._handleFailure(obj.url, kwargs["intf"])
def doInitialSetup(self, anaconda):
if anaconda.id.getUpgrade():
@@ -680,7 +657,9 @@ class YumBackend(AnacondaBackend):
self.ayum.repos.callback = None
self.ayum.repos.setFailureCallback((self.urlgrabberFailureCB, (),
- {"intf":anaconda.intf, "method":self.method}))
+ {"intf":anaconda.intf}))
+ self.ayum.repos.setMirrorFailureCallback((self.mirrorFailureCB, (),
+ {"intf":anaconda.intf}))
def _catchallCategory(self):
# FIXME: this is a bad hack, but catch groups which aren't in
@@ -1231,6 +1210,9 @@ class YumBackend(AnacondaBackend):
if not txmbr.groups:
packages.append(txmbr.name)
+ if len(self.ayum.tsInfo.instgroups) == 0 and len(packages) == 0:
+ return
+
f.write("\n%packages\n")
map(lambda grp: f.write("@%s\n" % grp), self.ayum.tsInfo.instgroups)
map(lambda pkg: f.write("%s\n" % pkg), packages)