summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2012-08-30 15:15:36 -0400
committerChris Lumens <clumens@redhat.com>2012-08-30 17:14:04 -0400
commit56405f445a528aad3c2d4a499dcb7f328083c39d (patch)
tree5ea717e923493e196525c61a2d1ee61da59bb761
parent10838171fe3001cbaac5fbdf4031501bf871a321 (diff)
downloadanaconda-56405f445a528aad3c2d4a499dcb7f328083c39d.tar.gz
anaconda-56405f445a528aad3c2d4a499dcb7f328083c39d.tar.xz
anaconda-56405f445a528aad3c2d4a499dcb7f328083c39d.zip
Fix problems in the packaging module that pylint detected.
-rw-r--r--pyanaconda/packaging/__init__.py14
-rw-r--r--pyanaconda/packaging/yumpayload.py54
2 files changed, 33 insertions, 35 deletions
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 72eed821c..e916b1f99 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -43,6 +43,7 @@ from pyanaconda.constants import *
from pyanaconda.flags import flags
from pyanaconda import iutil
+from pyanaconda import isys
from pyanaconda.iutil import ProxyString, ProxyStringError
from pykickstart.parser import Group
@@ -51,6 +52,7 @@ import logging
log = logging.getLogger("packaging")
from pyanaconda.errors import *
+from pyanaconda.storage.errors import StorageError
#from pyanaconda.progress import progress
from pyanaconda.product import productName, productVersion
@@ -143,6 +145,7 @@ class Payload(object):
def setup(self, storage):
""" Do any payload-specific setup. """
+ self.storage = storage
raise NotImplementedError()
def preStorage(self):
@@ -373,11 +376,11 @@ class Payload(object):
if not self._kernelVersionList:
import glob
try:
- from yum.rpmUtils.miscutils import compareVerOnly
+ import yum
except ImportError:
cmpfunc = cmp
else:
- cmpfunc = compareVerOnly
+ cmpfunc = yum.rpmUtils.miscutils.compareVerOnly
files = glob.glob(ROOT_PATH + "/boot/vmlinuz-*")
files.extend(glob.glob(ROOT_PATH + "/boot/efi/EFI/redhat/vmlinuz-*"))
@@ -634,16 +637,15 @@ class PackagePayload(Payload):
""" A PackagePayload installs a set of packages onto the target system. """
@property
def kernelPackages(self):
- from pyanaconda.isys import isPaeAvailable
kernels = ["kernel"]
- if isPaeAvailable():
+ if isys.isPaeAvailable():
kernels.insert(0, "kernel-PAE")
# most ARM systems use platform-specific kernels
if iutil.isARM():
- if anaconda.platform.armMachine is not None:
- kernels = ["kernel-%s" % anaconda.platform.armMachine]
+ if self.storage.platform.armMachine is not None:
+ kernels = ["kernel-%s" % self.storage.platform.armMachine]
return kernels
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 0d8e5cff8..97cc1aa41 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -112,12 +112,10 @@ class YumPayload(PackagePayload):
""" Reset this instance to its initial (unconfigured) state. """
from pyanaconda.storage.size import Size
- """
- cdrom: install_device.teardown (INSTALL_TREE)
- hd: umount INSTALL_TREE, install_device.teardown (ISO_DIR)
- nfs: umount INSTALL_TREE
- nfsiso: umount INSTALL_TREE, umount ISO_DIR
- """
+ # cdrom: install_device.teardown (INSTALL_TREE)
+ # hd: umount INSTALL_TREE, install_device.teardown (ISO_DIR)
+ # nfs: umount INSTALL_TREE
+ # nfsiso: umount INSTALL_TREE, umount ISO_DIR
if os.path.ismount(INSTALL_TREE) and not flags.testing:
if self.install_device and \
get_mount_device(INSTALL_TREE) == self.install_device.path:
@@ -272,7 +270,7 @@ reposdir=%s
f.write("proxy=%s\n" % (proxy.noauth_url,))
if proxy.username:
f.write("proxy_username=%s\n" % (proxy.username,))
- if proxy_password:
+ if proxy.password:
f.write("proxy_password=%s\n" % (proxy.password,))
except ProxyStringError as e:
log.error("Failed to parse proxy for _writeInstallConfig %s: %s" \
@@ -405,20 +403,18 @@ reposdir=%s
# now disable and/or remove any repos that don't make sense
for repo in self._yum.repos.repos.values():
- """ Rules for which repos to enable/disable/remove
-
- - always remove
- - source, debuginfo
- - disable if isFinal
- - rawhide, development
- - disable all other built-in repos if rawhide is enabled
- - remove any repo when not isFinal and repo not enabled
- - if a base repo is defined, disable any repo not defined by
- the user that is not the base repo
-
- FIXME: updates needs special handling
-
- """
+ # Rules for which repos to enable/disable/remove
+ #
+ # - always remove
+ # - source, debuginfo
+ # - disable if isFinal
+ # - rawhide, development
+ # - disable all other built-in repos if rawhide is enabled
+ # - remove any repo when not isFinal and repo not enabled
+ # - if a base repo is defined, disable any repo not defined by
+ # the user that is not the base repo
+ #
+ # FIXME: updates needs special handling
if repo.id in self.addOns:
continue
@@ -685,8 +681,8 @@ reposdir=%s
def addRepo(self, newrepo):
""" Add a ksdata repo. """
log.debug("adding new repo %s" % newrepo.name)
- self._addYumRepo(newrepo) # FIXME: handle MetadataError
- super(YumRepo, self).addRepo(newrepo)
+ self._addYumRepo(newrepo.name, newrepo.baseurl, newrepo.mirrorlist, newrepo.proxy) # FIXME: handle MetadataError
+ super(YumPayload, self).addRepo(newrepo)
def _removeYumRepo(self, repo_id):
if repo_id in self.repos:
@@ -1137,7 +1133,7 @@ reposdir=%s
rpm.addMacro("__file_context_path", f)
break
else:
- rpm.addMacros("__file_context_path", "%{nil}")
+ rpm.addMacro("__file_context_path", "%{nil}")
def install(self):
""" Install the payload. """
@@ -1329,6 +1325,11 @@ class RPMCallback(object):
# obj.url = 'http://foo.com/stuff'
checkfunc = (self._yum.verifyPkg, (txmbr.po, 1), {})
package_path = repo.getPackage(txmbr.po, checkfunc=checkfunc)
+ except URLGrabError as e:
+ log.error("URLGrabError: %s" % (e,))
+ exn = PayloadInstallError("failed to get package")
+ if errorHandler.cb(exn, txmbr.po) == ERROR_RAISE:
+ raise exn
except (yum.Errors.NoMoreMirrorsRepoError, IOError):
if os.path.exists(txmbr.po.localPkg()):
os.unlink(txmbr.po.localPkg())
@@ -1339,11 +1340,6 @@ class RPMCallback(object):
raise exn
except yum.Errors.RepoError:
continue
- except URLGrabError as e:
- log.error("URLGrabError: %s" % (e,))
- exn = PayloadInstallError("failed to get package")
- if errorHandler.cb(exn, txmbr.po) == ERROR_RAISE:
- raise exn
self.package_file = open(package_path)