From 3962cd5f7e6fc64306d6c4e173b5542d215d234a Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 26 Jul 2023 10:19:25 -0700 Subject: [PATCH] Revert "Add GUI option for installing 64k ARM kernel" This reverts commit 0c7c9e9586d962c9babf0d718e38768c8bb34b85. It's broken - it tries to use the `match_available_packages` method of a `DNFPayload` instance, but that method is part of `DNFManager`, not `DNFPayload`. See https://github.com/rhinstaller/anaconda/pull/4858#issuecomment-1652180161 . We are reverting this downstream (in Fedora) to fix composes while upstream comes up with a proper fix. --- data/anaconda.conf | 3 - data/profile.d/rhel.conf | 1 - pyanaconda/core/configuration/ui.py | 4 - .../ui/gui/spokes/software_selection.glade | 224 +++++------------- .../ui/gui/spokes/software_selection.py | 62 ----- pyanaconda/ui/lib/software.py | 43 +--- .../pyanaconda_tests/ui/test_software.py | 34 +-- 7 files changed, 64 insertions(+), 307 deletions(-) diff --git a/data/anaconda.conf b/data/anaconda.conf index 73e6e21e55..34d2d26802 100644 --- a/data/anaconda.conf +++ b/data/anaconda.conf @@ -302,9 +302,6 @@ password_policies = user (quality 1, length 6, empty) luks (quality 1, length 6) -# Should kernel options be shown in the software selection spoke? -show_kernel_options = True - [License] # A path to EULA (if any) # diff --git a/data/profile.d/rhel.conf b/data/profile.d/rhel.conf index 468a05f78c..0a645fd0ca 100644 --- a/data/profile.d/rhel.conf +++ b/data/profile.d/rhel.conf @@ -39,7 +39,6 @@ swap_is_recommended = True [User Interface] help_directory = /usr/share/anaconda/help/rhel custom_stylesheet = /usr/share/anaconda/pixmaps/redhat.css -show_kernel_options = True [License] eula = /usr/share/redhat-release/EULA diff --git a/pyanaconda/core/configuration/ui.py b/pyanaconda/core/configuration/ui.py index 57cb232c7c..e4432f68f8 100644 --- a/pyanaconda/core/configuration/ui.py +++ b/pyanaconda/core/configuration/ui.py @@ -90,10 +90,6 @@ class UserInterfaceSection(Section): """Convert a policies string into a list of dictionaries.""" return list(map(self._convert_policy_line, value.strip().split("\n"))) - @property - def show_kernel_options(self): - return self._get_option("show_kernel_options", bool) - @classmethod def _convert_policy_line(cls, line): """Convert a policy line into a dictionary.""" diff --git a/pyanaconda/ui/gui/spokes/software_selection.glade b/pyanaconda/ui/gui/spokes/software_selection.glade index 4cb67f2769..87804c72ea 100644 --- a/pyanaconda/ui/gui/spokes/software_selection.glade +++ b/pyanaconda/ui/gui/spokes/software_selection.glade @@ -1,28 +1,27 @@ - + - False + False True True - SOFTWARE SELECTION + SOFTWARE SELECTION - False + False True True vertical - False + False - - False + False @@ -34,36 +33,55 @@ - False + False True True 0 0 - 12 - 48 - 24 - 24 + 12 + 48 + 24 + 24 - False + False True True vertical - True - False + False True True - 24 - True + 24 + True + + + True + False + end + 6 + True + Base Environment + True + 0 + + + + + + + 0 + 0 + + True - False + False end - 6 + 6 True Additional software for Selected Environment True @@ -74,27 +92,27 @@ - 1 - 0 + 1 + 0 True - True + True True True - never - in + never + in - 250 + 250 True - False + False True - False + False True @@ -103,160 +121,40 @@ - 1 - 1 + 1 + 1 - + True - False - end - 6 + True + GDK_STRUCTURE_MASK | GDK_SCROLL_MASK True - Base Environment - True - 0 - - - - - - - 0 - 0 - - - - - True - False - vertical - - - True - True - GDK_STRUCTURE_MASK | GDK_SCROLL_MASK - True - True - never - in - - - 250 - True - False - - - True - False - True - - - - - - - - False - True - 0 - - + True + never + in - + + 250 True - False - vertical - 12 + False - + True - False - end - 12 + False True - Kernel Options - True - 0 - - - - - - - False - True - 0 - - - - - - True - False - 12 - - - True - False - start - 12 - True - Page size: - - - 0 - 0 - - - - - True - False - True - 0 - 0 - - - - 1 - 1 - 1 - - - - - 1 - 0 - - + - - False - False - 3 - - - False - False - 1 - - 0 - 1 + 0 + 1 - - - - - - True diff --git a/pyanaconda/ui/gui/spokes/software_selection.py b/pyanaconda/ui/gui/spokes/software_selection.py index 1736b0b4b0..151e0e0b9f 100644 --- a/pyanaconda/ui/gui/spokes/software_selection.py +++ b/pyanaconda/ui/gui/spokes/software_selection.py @@ -32,13 +32,9 @@ from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.gui.spokes.lib.detailederror import DetailedErrorDialog from pyanaconda.ui.gui.spokes.lib.software_selection import GroupListBoxRow, SeparatorRow, \ EnvironmentListBoxRow -from pyanaconda.ui.gui.utils import escape_markup from pyanaconda.ui.lib.software import SoftwareSelectionCache, get_software_selection_status, \ is_software_selection_complete, get_group_data, get_environment_data from pyanaconda.ui.lib.subscription import is_cdn_registration_required -from pyanaconda.ui.lib.software import FEATURE_64K, KernelFeatures, get_kernel_from_properties, \ - get_available_kernel_features, get_kernel_titles_and_descriptions -from pyanaconda.core.configuration.anaconda import conf import gi gi.require_version("Gtk", "3.0") @@ -98,23 +94,6 @@ class SoftwareSelectionSpoke(NormalSpoke): Gtk.Scrollable.get_vadjustment(addon_viewport) ) - # Display a group of options for selecting desired properties of a kernel - self._kernel_box = self.builder.get_object("kernelBox") - self._combo_kernel_page_size = self.builder.get_object("kernelPageSizeCombo") - self._label_kernel_page_size = self.builder.get_object("kernelPageSizeLabel") - - # Normally I would create these in the .glade file but due to a bug they weren't - # created properly - self._model_kernel_page_size = Gtk.ListStore(str, str) - - kernel_labels = get_kernel_titles_and_descriptions() - for i in ["4k", "64k"]: - self._model_kernel_page_size.append([i, "%s\n%s" % \ - (escape_markup(kernel_labels[i][0]), - escape_markup(kernel_labels[i][1]))]) - self._combo_kernel_page_size.set_model(self._model_kernel_page_size) - self._available_kernels = get_available_kernel_features(self.payload) - @property def _selection(self): """The packages selection.""" @@ -235,12 +214,10 @@ class SoftwareSelectionSpoke(NormalSpoke): # Create a new software selection cache. self._selection_cache = SoftwareSelectionCache(self.payload.proxy) self._selection_cache.apply_selection_data(self._selection) - self._available_kernels = get_available_kernel_features(self.payload) # Refresh up the UI. self._refresh_environments() self._refresh_groups() - self._refresh_kernel_features() # Set up the info bar. self.clear_info() @@ -314,35 +291,6 @@ class SoftwareSelectionSpoke(NormalSpoke): listbox.remove(child) del child - def _refresh_kernel_features(self): - """Display options for selecting kernel features.""" - - # Only showing parts of kernel box relevant for current system. - self._available_kernels = get_available_kernel_features(self.payload) - - if not conf.ui.show_kernel_options: - show_kernels = False - else: - show_kernels = False - for (_key, val) in self._available_kernels.items(): - if val: - show_kernels = True - break - - if show_kernels: - self._kernel_box.set_visible(True) - self._kernel_box.set_no_show_all(False) - - # Arm 64k page size kernel combo - self._combo_kernel_page_size.set_visible(self._available_kernels[FEATURE_64K]) - self._combo_kernel_page_size.set_no_show_all(not self._available_kernels[FEATURE_64K]) - self._label_kernel_page_size.set_visible(self._available_kernels[FEATURE_64K]) - self._label_kernel_page_size.set_no_show_all(not self._available_kernels[FEATURE_64K]) - else: - # Hide the entire box. - self._kernel_box.set_visible(False) - self._kernel_box.set_no_show_all(True) - def apply(self): """Apply the changes.""" self._kickstarted = False @@ -350,16 +298,6 @@ class SoftwareSelectionSpoke(NormalSpoke): selection = self._selection_cache.get_selection_data() log.debug("Setting new software selection: %s", selection) - # Select kernel - property_64k = self._available_kernels[FEATURE_64K] and \ - self._combo_kernel_page_size.get_active_id() == FEATURE_64K - kernel_properties = KernelFeatures(property_64k) - kernel = get_kernel_from_properties(kernel_properties) - if kernel is not None and conf.ui.show_kernel_options: - log.debug("Selected kernel package: %s", kernel) - selection.packages.append(kernel) - selection.excluded_packages.append("kernel") - self.payload.set_packages_selection(selection) hubQ.send_not_ready(self.__class__.__name__) diff --git a/pyanaconda/ui/lib/software.py b/pyanaconda/ui/lib/software.py index 3eebc024df..747ac8367b 100644 --- a/pyanaconda/ui/lib/software.py +++ b/pyanaconda/ui/lib/software.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2023 Red Hat, Inc. +# Copyright (C) 2021 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of @@ -15,9 +15,6 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from collections import namedtuple -from blivet.arch import is_aarch64 - from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ from pyanaconda.modules.common.structures.comps import CompsEnvironmentData, CompsGroupData @@ -25,9 +22,6 @@ from pyanaconda.modules.common.structures.packages import PackagesSelectionData log = get_module_logger(__name__) -FEATURE_64K = "64k" -KernelFeatures = namedtuple("KernelFeatures", ["page_size_64k"]) - def get_environment_data(dnf_proxy, environment_name): """Get the environment data. @@ -102,41 +96,6 @@ def get_software_selection_status(dnf_proxy, selection, kickstarted=False): return environment_data.name -def get_available_kernel_features(payload): - """Returns a dictionary with that shows which kernels should be shown in the UI. - """ - features = { - FEATURE_64K: is_aarch64() and any(payload.match_available_packages("kernel-64k")) - } - - return features - - -def get_kernel_titles_and_descriptions(): - """Returns a dictionary with descriptions and titles for different kernel options. - """ - kernel_features = { - "4k": (_("4k"), _("More efficient memory usage in smaller environments")), - "64k": (_("64k"), _("System performance gains for memory-intensive workloads")), - } - - return kernel_features - - -def get_kernel_from_properties(features): - """Translates the selection of required properties into a kernel package name and returns it - or returns None if no properties were selected. - """ - kernels = { - # ARM 64k Package Name - ( False ): None, - ( True ): "kernel-64k", - } - - kernel_package = kernels[features[0]] - return kernel_package - - class SoftwareSelectionCache(object): """The cache of the user software selection. diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_software.py b/tests/unit_tests/pyanaconda_tests/ui/test_software.py index c9397e15fb..f5ced5d9c1 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_software.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_software.py @@ -16,7 +16,6 @@ # Red Hat, Inc. # import unittest -from unittest.mock import patch from unittest.mock import Mock from dasbus.structure import compare_data @@ -26,8 +25,8 @@ from pyanaconda.modules.common.structures.packages import PackagesSelectionData from pyanaconda.modules.payloads.payload.dnf.dnf import DNFModule from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager from pyanaconda.ui.lib.software import is_software_selection_complete, \ - get_software_selection_status, SoftwareSelectionCache, get_kernel_from_properties, \ - get_available_kernel_features, KernelFeatures + get_software_selection_status, SoftwareSelectionCache + def get_dnf_proxy(dnf_manager): """Create a DNF payload proxy using the specified DNF manager.""" @@ -96,35 +95,6 @@ class SoftwareSelectionUITestCase(unittest.TestCase): status = get_software_selection_status(self.dnf_proxy, selection, kickstarted=True) assert status == "Custom software selected" - def test_get_kernel_from_properties(self): - """Test if kernel features are translated to corrent package names.""" - assert get_kernel_from_properties( - KernelFeatures(page_size_64k=False)) is None - assert get_kernel_from_properties( - KernelFeatures(page_size_64k=True)) == "kernel-64k" - - @patch("pyanaconda.ui.lib.software.is_aarch64") - def test_get_available_kernel_features(self, is_aarch64): - """test availability of kernel packages""" - payload = Mock() - payload.match_available_packages.return_value = ["ntoskrnl"] - is_aarch64.return_value = False - - res = get_available_kernel_features(payload) - assert isinstance(res, dict) - assert len(res) > 0 - assert not res["64k"] - is_aarch64.assert_called_once() - - is_aarch64.return_value = True - assert is_aarch64() - res = get_available_kernel_features(payload) - assert res["64k"] - - payload.match_available_packages.return_value = [] - res = get_available_kernel_features(payload) - assert not res["64k"] - class SoftwareSelectionCacheTestCase(unittest.TestCase): """Test the cache for the Software Selection spoke.""" -- 2.41.0