[PATCH 7/9] Tighten up interaction between source and software spokes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The software spoke should only be ready when a valid source is
configured. Downloading of repo metadata happens in the background, as
does dependency checking.
---
 pyanaconda/ui/gui/spokes/software.py |   33 ++++++++++++++++++++++++-
 pyanaconda/ui/gui/spokes/source.py   |   43 +++++++++++++++++++++++++++++----
 2 files changed, 68 insertions(+), 8 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 16207fe..beb0a53 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -43,6 +43,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
     def __init__(self, *args, **kwargs):
         NormalSpoke.__init__(self, *args, **kwargs)
         self._ready = False
+        self._error = False
 
         self.selectedGroups = []
         self.excludedGroups = []
@@ -52,6 +53,8 @@ class SoftwareSelectionSpoke(NormalSpoke):
         # NOTE:  Other apply methods work directly with the ksdata, but this
         # one does not.  However, selectGroup/deselectGroup modifies ksdata as
         # part of its operation.  So this is fine.
+        from pyanaconda.threads import threadMgr, AnacondaThread
+
         row = self._get_selected_desktop()
         if not row:
             return
@@ -69,9 +72,30 @@ class SoftwareSelectionSpoke(NormalSpoke):
             for group in [g for g in groups if g not in self.excludedGroups]:
                 self.payload.selectGroup(group)
 
+        communication.send_not_ready(self.__class__.__name__)
+        threadMgr.add(AnacondaThread(name="AnaCheckSoftwareThread",
+                                     target=self.checkSoftwareSelection))
+
+    def checkSoftwareSelection(self):
+        from pyanaconda.packaging import DependencyError
+        communication.send_message(self.__class__.__name__,
+                                   _("Checking software dependencies..."))
+        try:
+            self.payload.checkSoftwareSelection()
+        except DependencyError as e:
+            self._error = True
+            communication.send_message(self.__class__.__name__,
+                                       _("Error checking software dependencies"))
+        else:
+            communication.send_ready(self.__class__.__name__)
+            self._error = False
+
     @property
     def completed(self):
-        return self._get_selected_desktop() is not None
+        from pyanaconda.threads import threadMgr
+        return self._get_selected_desktop() is not None and \
+               not threadMgr.get("AnaCheckSoftwareThread") and \
+               not self._error
 
     @property
     def ready(self):
@@ -80,10 +104,15 @@ class SoftwareSelectionSpoke(NormalSpoke):
         # becasue the user filled something out, or because we're done fetching
         # repo metadata from the mirror list, or we detected a DVD/CD.
         from pyanaconda.threads import threadMgr
-        return self._ready and not threadMgr.get("AnaPayloadMDThread")
+        return (self._ready and not threadMgr.get("AnaPayloadMDThread") and
+                not threadMgr.get("AnaCheckSoftwareThread") and
+                self.payload.baseRepo is not None)
 
     @property
     def status(self):
+        if self._error:
+            return _("Error checking software selection")
+
         row = self._get_selected_desktop()
         if not row:
             return _("Nothing selected")
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 8d59abe..2dd9cc1 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -37,6 +37,9 @@ __all__ = ["SourceSpoke"]
 
 MOUNTPOINT = "/mnt/install/isodir"
 
+METADATA_DOWNLOAD_MESSAGE = _("Downloading package metadata...")
+METADATA_ERROR_MESSAGE = _("Error downloading package metadata...")
+
 class ProxyDialog(UIObject):
     builderObjects = ["proxyDialog"]
     mainWidgetName = "proxyDialog"
@@ -240,9 +243,11 @@ class SourceSpoke(NormalSpoke):
         NormalSpoke.__init__(self, *args, **kwargs)
         self._currentIsoFile = None
         self._ready = False
+        self._error = False
 
     def apply(self):
         from pyanaconda.threads import threadMgr, AnacondaThread
+        from pyanaconda.packaging import PayloadError
 
         if self._autodetectButton.get_active():
             dev = self._get_selected_media()
@@ -297,20 +302,44 @@ class SourceSpoke(NormalSpoke):
             (self.data.method.server, self.data.method.dir) = url.split(":", 2)
             self.data.method.opts = self.builder.get_object("nfsOptsEntry").get_text() or ""
 
-        self.payload.updateBaseRepo(self.storage)
-        threadMgr.add(AnacondaThread(name="AnaPayloadMDThread",
-                                      target=self.payload.gatherRepoMetadata))
+        communication.send_not_ready("SoftwareSelectionSpoke")
+        try:
+            self.payload.updateBaseRepo(self.storage, fallback=False)
+        except PayloadError as e:
+            self._error = True
+            communication.send_message(self.__class__.__name__,
+                                       _("Failed to set up install source"))
+        else:
+            self._error = False
+            threadMgr.add(AnacondaThread(name="AnaPayloadMDThread",
+                                         target=self.getRepoMetadata))
+
+    def getRepoMetadata(self):
+        communication.send_not_ready(self.__class__.__name__)
+        communication.send_message(self.__class__.__name__,
+                                   METADATA_DOWNLOAD_MESSAGE)
+        self.payload.gatherRepoMetadata()
+        self.payload.release()
+        if not self.payload.baseRepo:
+            communication.send_message(self.__class__.__name__,
+                                       METADATA_ERROR_MESSAGE)
+            communication.send_ready(self.__class__.__name__)
+            self._error = True
+        else:
+            communication.send_ready(self.__class__.__name__)
+            communication.send_ready("SoftwareSelectionSpoke")
 
     @property
     def completed(self):
-        return self.status and self.status != _("Nothing selected")
+        return not self._error and self.status and self.status != _("Nothing selected")
 
     @property
     def ready(self):
+        from pyanaconda.threads import threadMgr
         # By default, the source spoke is not ready.  We have to wait until
         # storageInitialize is done to know whether or not there's local
         # devices potentially holding install media.
-        return self._ready
+        return (self._ready and not threadMgr.get("AnaPayloadMDThread"))
 
     @property
     def status(self):
@@ -328,6 +357,8 @@ class SourceSpoke(NormalSpoke):
         else:
             if self.payload.baseRepo:
                 return _("Closest mirror")
+            elif self._error:
+                return _("Error setting up software source")
             else:
                 return _("Nothing selected")
 
@@ -374,7 +405,7 @@ class SourceSpoke(NormalSpoke):
         if storageThread:
             storageThread.join()
 
-        communication.send_message(self.__class__.__name__, _("Downloading package metadata..."))
+        communication.send_message(self.__class__.__name__, METADATA_DOWNLOAD_MESSAGE)
 
         payloadThread = threadMgr.get("AnaPayloadThread")
         if payloadThread:
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux