[rhel6-branch][PATCH] Check if selected repos have the core package group (#901515)

Martin Kolman mkolman at redhat.com
Tue Jul 16 09:44:25 UTC 2013


Check if the selected repositories contain the "core" package group,
which is a requirement for successful installation.
In GUI:
If the core group is not available, show warning dialog if next is clicked.
If core is available, let the installation proceed as usual.
In TUI:
If the core group is not available, show warning dialog and
exit once OK is clicked.

Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 iw/task_gui.py     |  8 ++++++++
 textw/task_text.py | 17 ++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/iw/task_gui.py b/iw/task_gui.py
index dc574d7..52cef22 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -523,6 +523,14 @@ class TaskWindow(InstallWindow):
         # through the UI.
         self.backend.ayum.comps = None
 
+        # check if the selected repositories contain the core package group,
+        # which is required for installation
+        if not self.backend.ayum.comps.has_group("core"):
+            self.anaconda.intf.messageWindow(_("Core group missing in selected repos"),
+                _("You must select at least one software repository "
+                  "containing the core package group."))
+            raise gui.StayOnScreen
+
         tasks = self.xml.get_widget("taskList").get_model()
         for (cb, task, grps) in filter(lambda x: not x[0], tasks):
             map(lambda g: setattr(self.backend.ayum.comps.return_group(g),
diff --git a/textw/task_text.py b/textw/task_text.py
index 17d312b..a6fc4d4 100644
--- a/textw/task_text.py
+++ b/textw/task_text.py
@@ -19,10 +19,25 @@
 
 from constants_text import *
 from constants import *
+from yuminstall import NoSuchGroup
+#import sys
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+
 
 class TaskWindow:
     def __call__(self, screen, anaconda):
         anaconda.backend.resetPackageSelections()
-        anaconda.backend.selectGroup("Core")
+        try:
+            anaconda.backend.selectGroup("Core")
+        except NoSuchGroup:
+            anaconda.intf.messageWindow(_("Core group missing in selected repos"),
+                                        _("At least one of the software "
+                                          "repositories used for the "
+                                          "installation needs to contain "
+                                          "the core package group. If the "
+                                          "core group is not present, "
+                                          "installation can't continue."))
+            sys.exit(1)
 
         return INSTALL_OK
-- 
1.8.3.1



More information about the anaconda-patches mailing list