zengxyz / rpms / anaconda

Forked from rpms/anaconda 3 months ago
Clone
cebaad
From 5d5d1a7099537a0da7c5a54520d7474b4696d940 Mon Sep 17 00:00:00 2001
cebaad
From: Vendula Poncova <vponcova@redhat.com>
cebaad
Date: Fri, 27 Nov 2020 13:30:53 +0100
cebaad
Subject: [PATCH 20002/20005] Define the updates repositories in the Anaconda
cebaad
 configuration files (#1642513)
cebaad
cebaad
Replace the enable_updates configuration option with the updates_repositories
cebaad
configuration option. Installation of latest updates will be enabled if there
cebaad
are some updates repositories defined in the configuration files.
cebaad
cebaad
Resolves: rhbz#1642513
cebaad
cebaad
(cherry picked from commit 95dfc2e91e3de3721624ded7cf33ec947c19a3a7)
cebaad
---
cebaad
 data/anaconda.conf                              |  4 ++--
cebaad
 data/product.d/fedora.conf                      |  4 ++++
cebaad
 data/product.d/rhel.conf                        |  1 -
cebaad
 data/product.d/scientific-linux.conf            |  5 ++++-
cebaad
 pyanaconda/core/configuration/payload.py        | 15 ++++++++-------
cebaad
 pyanaconda/core/constants.py                    |  4 ----
cebaad
 pyanaconda/payload/dnf/payload.py               |  4 ++--
cebaad
 pyanaconda/ui/gui/spokes/installation_source.py |  2 +-
cebaad
 8 files changed, 21 insertions(+), 18 deletions(-)
cebaad
cebaad
diff --git a/data/anaconda.conf b/data/anaconda.conf
cebaad
index ab6c15bb6..1508a7a8a 100644
cebaad
--- a/data/anaconda.conf
cebaad
+++ b/data/anaconda.conf
cebaad
@@ -68,8 +68,8 @@ default_environment =
cebaad
 # List of ignored packages.
cebaad
 ignored_packages =
cebaad
 
cebaad
-# Enable installation of latest updates.
cebaad
-enable_updates = True
cebaad
+# Names of repositories that provide latest updates.
cebaad
+updates_repositories =
cebaad
 
cebaad
 # List of .treeinfo variant types to enable.
cebaad
 # Valid items:
cebaad
diff --git a/data/product.d/fedora.conf b/data/product.d/fedora.conf
cebaad
index 31a9245c0..f0a307113 100644
cebaad
--- a/data/product.d/fedora.conf
cebaad
+++ b/data/product.d/fedora.conf
cebaad
@@ -19,3 +19,7 @@ default_help_pages =
cebaad
 [Payload]
cebaad
 default_rpm_gpg_keys =
cebaad
     /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
cebaad
+
cebaad
+updates_repositories =
cebaad
+    updates
cebaad
+    updates-modular
cebaad
diff --git a/data/product.d/rhel.conf b/data/product.d/rhel.conf
cebaad
index c4de9b6a8..629ba172b 100644
cebaad
--- a/data/product.d/rhel.conf
cebaad
+++ b/data/product.d/rhel.conf
cebaad
@@ -33,7 +33,6 @@ ignored_packages =
cebaad
     btrfs-progs
cebaad
     dmraid
cebaad
 
cebaad
-enable_updates = False
cebaad
 enable_closest_mirror = False
cebaad
 default_source = CDN
cebaad
 
cebaad
diff --git a/data/product.d/scientific-linux.conf b/data/product.d/scientific-linux.conf
cebaad
index e8393e633..c5bd8121a 100644
cebaad
--- a/data/product.d/scientific-linux.conf
cebaad
+++ b/data/product.d/scientific-linux.conf
cebaad
@@ -20,9 +20,12 @@ kickstart_modules =
cebaad
      org.fedoraproject.Anaconda.Modules.Services
cebaad
 
cebaad
 [Payload]
cebaad
-enable_updates = True
cebaad
 default_source = CLOSEST_MIRROR
cebaad
 
cebaad
+updates_repositories =
cebaad
+    updates
cebaad
+    updates-modular
cebaad
+
cebaad
 [User Interface]
cebaad
 help_directory = /usr/share/anaconda/help/sl
cebaad
 default_help_pages =
cebaad
diff --git a/pyanaconda/core/configuration/payload.py b/pyanaconda/core/configuration/payload.py
cebaad
index 4cc2c0244..de521e009 100644
cebaad
--- a/pyanaconda/core/configuration/payload.py
cebaad
+++ b/pyanaconda/core/configuration/payload.py
cebaad
@@ -41,16 +41,17 @@ class PayloadSection(Section):
cebaad
         return self._get_option("ignored_packages", str).split()
cebaad
 
cebaad
     @property
cebaad
-    def enable_updates(self):
cebaad
-        """Enable installation of latest updates.
cebaad
+    def updates_repositories(self):
cebaad
+        """List of names of repositories that provide latest updates.
cebaad
 
cebaad
-        This flag controls whether or not Anaconda should provide an option to
cebaad
-        install the latest updates during installation source selection.
cebaad
+        This option also controls whether or not Anaconda should provide
cebaad
+        an option to install the latest updates during installation source
cebaad
+        selection.
cebaad
 
cebaad
-        The installation of latest updates is selected by default, if the closest
cebaad
-        mirror is selected, and the "updates" repo is enabled.
cebaad
+        The installation of latest updates is selected by default, if
cebaad
+        the closest mirror is selected, and the "updates" repo is enabled.
cebaad
         """
cebaad
-        return self._get_option("enable_updates", bool)
cebaad
+        return self._get_option("updates_repositories", str).split()
cebaad
 
cebaad
     @property
cebaad
     def enabled_repositories_from_treeinfo(self):
cebaad
diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py
cebaad
index 9c56068e9..3f0abea3f 100644
cebaad
--- a/pyanaconda/core/constants.py
cebaad
+++ b/pyanaconda/core/constants.py
cebaad
@@ -63,10 +63,6 @@ DEFAULT_REPOS = [productName.split('-')[0].lower(),
cebaad
                  "BaseOS",  # Used by RHEL
cebaad
                  "baseos"]  # Used by CentOS Stream
cebaad
 
cebaad
-# Get list of repo names which should be used as updates repos
cebaad
-DEFAULT_UPDATE_REPOS = ["updates",
cebaad
-                        "updates-modular"]
cebaad
-
cebaad
 DBUS_ANACONDA_SESSION_ADDRESS = "DBUS_ANACONDA_SESSION_BUS_ADDRESS"
cebaad
 
cebaad
 ANACONDA_BUS_CONF_FILE = "/usr/share/anaconda/dbus/anaconda-bus.conf"
cebaad
diff --git a/pyanaconda/payload/dnf/payload.py b/pyanaconda/payload/dnf/payload.py
cebaad
index ac717e793..f091cfe53 100644
cebaad
--- a/pyanaconda/payload/dnf/payload.py
cebaad
+++ b/pyanaconda/payload/dnf/payload.py
cebaad
@@ -1135,10 +1135,10 @@ class DNFPayload(Payload):
cebaad
 
cebaad
         # Enable or disable updates.
cebaad
         if self._updates_enabled:
cebaad
-            for repo in constants.DEFAULT_UPDATE_REPOS:
cebaad
+            for repo in conf.payload.updates_repositories:
cebaad
                 self.enable_repo(repo)
cebaad
         else:
cebaad
-            for repo in constants.DEFAULT_UPDATE_REPOS:
cebaad
+            for repo in conf.payload.updates_repositories:
cebaad
                 self.disable_repo(repo)
cebaad
 
cebaad
         # Disable updates-testing.
cebaad
diff --git a/pyanaconda/ui/gui/spokes/installation_source.py b/pyanaconda/ui/gui/spokes/installation_source.py
cebaad
index d0d4da72b..a5d89e1c2 100644
cebaad
--- a/pyanaconda/ui/gui/spokes/installation_source.py
cebaad
+++ b/pyanaconda/ui/gui/spokes/installation_source.py
cebaad
@@ -776,7 +776,7 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler, SourceSwitchHandler):
cebaad
         self._network_button.connect("toggled", self._update_url_entry_check)
cebaad
 
cebaad
         # Show or hide the updates option based on the configuration
cebaad
-        if conf.payload.enable_updates:
cebaad
+        if conf.payload.updates_repositories:
cebaad
             really_show(self._updates_box)
cebaad
         else:
cebaad
             really_hide(self._updates_box)
cebaad
-- 
cebaad
2.31.1
cebaad