Just try once to resolve dependencies. Callers can catch the
DependencyError and present UI as needed to amend the software
set or repos and then try again.
This also changes spaceRequired. After successfully resolving
dependencies we explicitly trigger calculation of the required
space. Less magic to run amuck, more reliable results.
---
pyanaconda/packaging/yumpayload.py | 85 ++++++++++++++----------------------
1 files changed, 33 insertions(+), 52 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 0d02c2a..0c7d028 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -68,8 +68,6 @@ from pyanaconda.image import opticalInstallMedia
from pyanaconda.image import mountImage
from pyanaconda.image import findFirstIsoImage
@@ -111,6 +109,8 @@ class YumPayload(PackagePayload):
def reset(self, root=None):
""" Reset this instance to its initial (unconfigured) state. """
+ from pyanaconda.storage.size import Size
+
if os.path.ismount(INSTALL_TREE) and not flags.testing:
isys.umount(INSTALL_TREE)
@@ -125,7 +125,7 @@ class YumPayload(PackagePayload):
self._groups = []
self._packages = []
@@ -645,6 +645,7 @@ reposdir=%s
try:
self._groups = self._yum.comps
except (RepoError, GroupsError) as e:
+ log.error("failed to get group info: %s" % e)
raise MetadataError(e.value)
return [g.groupid for g in self._groups.get_groups()]
@@ -675,8 +676,6 @@ reposdir=%s
except yum.Errors.GroupsError:
raise NoSuchGroup(groupid)
- self._space_required = None
-
def _deselectYumGroup(self, groupid):
# deselect the group in comps
log.debug("deselect group %s" % groupid)
@@ -686,8 +685,6 @@ reposdir=%s
except yum.Errors.GroupsError:
raise NoSuchGroup(groupid)
- self._space_required = None
-
###
### METHODS FOR WORKING WITH PACKAGES
###
@@ -720,8 +717,6 @@ reposdir=%s
except yum.Errors.InstallError:
raise NoSuchPackage(pkgid)
- self._space_required = None
-
def _deselectYumPackage(self, pkgid):
"""Mark a package to be excluded from installation.
@@ -732,23 +727,25 @@ reposdir=%s
with _yum_lock:
self._yum.tsInfo.deselect(pkgid)
- self._space_required = None
-
###
### METHODS FOR QUERYING STATE
###
@property
def spaceRequired(self):
""" The total disk space (Size) required for the current selection. """
+ return self._space_required
+
+ def calculateSpaceNeeds(self):
+ from pyanaconda.storage.size import Size
+
# XXX this will only be useful if you've run checkSoftwareSelection
- if not self._space_required:
- total = 0
- with _yum_lock:
- for txmbr in self._yum.tsInfo.getMembers():
- total += getattr(txmbr.po, "installedsize", 0)
+ total = 0
+ with _yum_lock:
+ for txmbr in self._yum.tsInfo.getMembers():
+ total += getattr(txmbr.po, "installedsize", 0)
- total += total * 0.10 # add 10% to account for metadata, &c
- self._space_required = Size(bytes=total)
+ total += total * 0.10 # add 10% to account for metadata, &c
+ self._space_required = Size(bytes=total)