[f18-branch/master] recheck software when source changes (#875599)

Brian C. Lane bcl at redhat.com
Wed Dec 12 20:01:34 UTC 2012


From: "Brian C. Lane" <bcl at redhat.com>

Refresh the environments and groups when the source changes, and allow
the software spoke's apply() method to run when the source is different
than the last time the spoke was visited.
---
 pyanaconda/ui/gui/spokes/software.py | 12 +++++++++---
 pyanaconda/ui/gui/spokes/source.py   | 16 ++++++++++++++--
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 8fd4c59..a50cf60 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -81,7 +81,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
 
         # Don't redo dep solving if nothing's changed.
         if row[2] == self._origEnvironment and set(addons) == set(self._origAddons) and \
-           not self._clickedRemove:
+           not self._clickedRemove and self.txid_valid:
             return
 
         self._selectFlag = False
@@ -122,8 +122,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
     @property
     def completed(self):
         processingDone = not threadMgr.get("AnaCheckSoftwareThread") and \
-                         not self._errorMsgs and \
-                         self._tx_id == self.payload.txID
+                         not self._errorMsgs and self.txid_valid
 
         if flags.automatedInstall and packagesSeen:
             return processingDone
@@ -153,6 +152,9 @@ class SoftwareSelectionSpoke(NormalSpoke):
         if not self.ready:
             return _("Installation source not set up")
 
+        if not self.txid_valid:
+            return _("Source changed - please verify")
+
         row = self._get_selected_environment()
         if not row:
             # Kickstart installs with %packages will have a row selected, unless
@@ -277,6 +279,10 @@ class SoftwareSelectionSpoke(NormalSpoke):
 
         return self._environmentStore[itr]
 
+    @property
+    def txid_valid(self):
+        return self._tx_id == self.payload.txID
+
     # Signal handlers
     def on_environment_toggled(self, renderer, path):
         if not self._selectFlag:
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 9892fff..c60d965 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -41,7 +41,7 @@ from pyanaconda.ui.gui.utils import enlightbox, gtk_thread_wait
 from pyanaconda.iutil import ProxyString, ProxyStringError
 from pyanaconda.ui.gui.utils import gtk_call_once
 from pyanaconda.threads import threadMgr, AnacondaThread
-from pyanaconda.packaging import PayloadError, get_mount_paths
+from pyanaconda.packaging import PayloadError, get_mount_paths, MetadataError
 from pyanaconda.constants import DRACUT_ISODIR, ISO_DIR
 
 __all__ = ["SourceSpoke"]
@@ -576,7 +576,19 @@ class SourceSpoke(NormalSpoke):
                 self._error = True
                 gtk_call_once(self.set_warning, _("Failed to set up install source, check the repo url"))
             else:
-                communication.send_ready("SoftwareSelectionSpoke")
+                try:
+                    # Grabbing the list of groups could potentially take a long time the
+                    # first time (yum does a lot of magic property stuff, some of which
+                    # involves side effects like network access) so go ahead and grab
+                    # them now. These are properties with side-effects, just accessing
+                    # them will trigger yum.
+                    e = self.payload.environments
+                    g = self.payload.groups
+                except MetadataError:
+                    communication.send_message("SoftwareSelectionSpoke",
+                                               _("No installation source available"))
+                else:
+                    communication.send_ready("SoftwareSelectionSpoke")
         finally:
             communication.send_ready(self.__class__.__name__)
 
-- 
1.8.0



More information about the anaconda-patches mailing list