[master 1/1] Depsolve kickstarted packages on the summary hub (#961280)

dashea installerbot-noreply at redhat.com
Fri Jun 19 20:35:56 UTC 2015


From: David Shea <dshea at redhat.com>

Pacakage selections with no environments, which kickstarts often are,
were not skipping the depsolve steps, so stop doing that. This way
package errors are displayed before disk formatting takes place.

Change the software spoke slightly to improve its behavior when
interactive modifications are made to a kickstart install. Add a hidden
radio button to allow the environment selection to appear unselected if
there is no environment selected in a kickstart, and switch everything
to the interactive logic if any modifications are made to a kickstart's
environment and group selections.
---
 pyanaconda/ui/gui/spokes/software.py | 46 +++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index ca33a15..1cf3632 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -83,10 +83,18 @@ def __init__(self, *args, **kwargs):
         # state constants. See refreshAddons for how the values are used.
         self._addonStates = {}
 
+        # Create a RadioButton that will never be displayed to use as the group for the
+        # environment radio buttons. This way the environment radio buttons can all appear
+        # unselected in the case of modifying data from kickstart.
+        self._firstRadio = Gtk.RadioButton(group=None)
+
         # Used for detecting whether anything's changed in the spoke.
         self._origAddons = []
         self._origEnvironment = None
 
+        # Whether we are using package selections from a kickstart
+        self._kickstarted = flags.automatedInstall and self.data.packages.seen
+
         # Register event listeners to update our status on payload events
         payloadMgr.addListener(payloadMgr.STATE_PACKAGE_MD, self._downloading_package_md)
         payloadMgr.addListener(payloadMgr.STATE_GROUP_MD, self._downloading_group_md)
@@ -108,17 +116,25 @@ def _payload_error(self):
 
     def _apply(self):
         env = self._get_selected_environment()
-        if not env:
-            return
+
+        # Check if a kickstart install still looks like a kickstart install
+        # If an environment is selected and either the environment or the
+        # addon list does not match the ksdata, the packages were
+        # selected interactively.
+        if env and self._kickstarted:
+            if env != self.data.packages.environment or \
+                    set(self.selectedGroups) != set(self.data.packages.groupList):
+                self._kickstarted = False
 
         # Not a kickstart with packages, setup the environment and groups
-        if not (flags.automatedInstall and self.data.packages.seen):
+        if env and not self._kickstarted:
             addons = self._get_selected_addons()
             for group in addons:
                 if group not in self.selectedGroups:
                     self.selectedGroups.append(group)
 
             self._selectFlag = False
+            self.payload.data.packages.packageList = []
             self.payload.data.packages.groupList = []
             self.payload.selectEnvironment(env)
             self.environment = env
@@ -162,7 +178,7 @@ def completed(self):
 
         # we should always check processingDone before checking the other variables,
         # as they might be inconsistent until processing is finished
-        if flags.automatedInstall:
+        if self._kickstarted:
             return processingDone and self.data.packages.seen
         else:
             return processingDone and self._get_selected_environment() is not None
@@ -218,7 +234,7 @@ def status(self):
             # Kickstart installs with %packages will have a row selected, unless
             # they did an install without a desktop environment.  This should
             # catch that one case.
-            if flags.automatedInstall and self.data.packages.seen:
+            if self._kickstarted:
                 return _("Custom software selected")
 
             return _("Nothing selected")
@@ -233,7 +249,7 @@ def initialize(self):
     def _initialize(self):
         threadMgr.wait(constants.THREAD_PAYLOAD)
 
-        if not flags.automatedInstall or not self.data.packages.seen:
+        if not self._kickstarted:
             # having done all the slow downloading, we need to do the first refresh
             # of the UI here so there's an environment selected by default.  This
             # happens inside the main thread by necessity.  We can't do anything
@@ -291,25 +307,23 @@ def refresh(self):
             self.environment = self.payload.instclass.defaultPackageEnvironment
 
         firstEnvironment = True
-        firstRadio = None
 
         self._clear_listbox(self._environmentListBox)
 
         for environment in self.payload.environments:
             (name, desc) = self.payload.environmentDescription(environment)
 
-            radio = Gtk.RadioButton(group=firstRadio)
+            radio = Gtk.RadioButton(group=self._firstRadio)
 
             # automatically select an environment if this is an interactive install
             active = environment == self.environment or \
-                     not flags.automatedInstall and not self.environment and firstEnvironment
+                     not self._kickstarted and not self.environment and firstEnvironment
             radio.set_active(active)
             if active:
                 self.environment = environment
 
             self._add_row(self._environmentListBox, name, desc, radio,
                     self.on_radio_button_toggled)
-            firstRadio = firstRadio or radio
 
             firstEnvironment = False
 
@@ -376,10 +390,14 @@ def refreshAddons(self):
             self.clear_info()
 
     def _allAddons(self):
-        addons = copy.copy(self.payload.environmentAddons[self.environment][0])
-        if self._addSep:
-            addons.append('')
-        addons += self.payload.environmentAddons[self.environment][1]
+        if self.environment in self.payload.environmentAddons:
+            addons = copy.copy(self.payload.environmentAddons[self.environment][0])
+            if self._addSep:
+                addons.append('')
+            addons += self.payload.environmentAddons[self.environment][1]
+        else:
+            addons = []
+
         return addons
 
     def _get_selected_addons(self):


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/fc345adf4664c2756670ea3c30f5ab16b559f97c


More information about the anaconda-patches mailing list