[PATCH 2/4] When changing environments, don't explicitly exclude groups (#863886).

Chris Lumens clumens at redhat.com
Mon Oct 8 20:18:42 UTC 2012


Otherwise, you'll end up in a situation where packages the previous and
current environment share will not get installed.
---
 pyanaconda/packaging/__init__.py     |  3 +++
 pyanaconda/packaging/yumpayload.py   | 12 ++++++++++++
 pyanaconda/ui/gui/spokes/software.py | 10 ++++++++--
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 65e3776..6462a28 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -277,6 +277,9 @@ class Payload(object):
     def deselectEnvironment(self, environmentid):
         raise NotImplementedError()
 
+    def environmentGroups(self, environmentid):
+        raise NotImplementedError()
+
     ###
     ### METHODS FOR WORKING WITH GROUPS
     ###
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 6f3160d..cd2e22e 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -837,6 +837,18 @@ reposdir=%s
             for group in environment.options:
                 self.deselectGroup(group)
 
+    def environmentGroups(self, environmentid):
+        groups = self._yumGroups
+        if not groups:
+            return []
+
+        with _yum_lock:
+            if not groups.has_environment(environmentid):
+                raise NoSuchGroup(environmentid)
+
+            environment = groups.return_environment(environmentid)
+            return environment.groups + environment.options
+
     ###
     ### METHODS FOR WORKING WITH GROUPS
     ###
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 10b4d48..1d795a9 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -32,6 +32,8 @@ from pyanaconda.ui.gui.utils import enlightbox, gdk_threaded
 from pyanaconda.ui.gui.categories.software import SoftwareCategory
 from .source import AdditionalReposDialog
 
+from pykickstart.parser import Group
+
 import sys
 
 __all__ = ["SoftwareSelectionSpoke"]
@@ -260,8 +262,12 @@ class SoftwareSelectionSpoke(NormalSpoke):
         for row in self._environmentStore:
             row[0] = False
 
-        if self.environment:
-            self.payload.deselectEnvironment(self.environment)
+        # Remove all groups from the previous environment from the selected
+        # list, but don't explicitly exclude them.
+        for groupid in self.payload.environmentGroups(self.environment):
+            grp = Group(groupid)
+            if grp in self.data.packages.groupList:
+                self.data.packages.groupList.remove(grp)
 
         # Then mark the clicked environment as selected and update the screen.
         self._environmentStore[path][0] = True
-- 
1.7.11.2



More information about the anaconda-patches mailing list