From 1e9af2fc2a86c6201fab8c0214c658649ce30285 Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Wed, 21 Dec 2022 22:54:08 +0800 Subject: [PATCH] kernel: install extra groups for kernel --- ...rnel-install-extra-groups-for-kernel.patch | 188 ++++++++++++++++++ anaconda.spec | 6 +- 2 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 0011-kernel-install-extra-groups-for-kernel.patch diff --git a/0011-kernel-install-extra-groups-for-kernel.patch b/0011-kernel-install-extra-groups-for-kernel.patch new file mode 100644 index 0000000..21e6294 --- /dev/null +++ b/0011-kernel-install-extra-groups-for-kernel.patch @@ -0,0 +1,188 @@ +From f0671cf14b4a508c45117cebc28a5f74829ad4ed Mon Sep 17 00:00:00 2001 +From: Liwei Ge +Date: Wed, 21 Dec 2022 22:49:28 +0800 +Subject: [PATCH] kernel: install extra groups for kernel + +--- + pyanaconda/payload/dnf/payload.py | 21 ++++++++++++++++++- + pyanaconda/ui/gui/spokes/kernel_selection.py | 18 +++++++++++++--- + .../ui/gui/spokes/software_selection.py | 2 +- + pyanaconda/ui/tui/spokes/kernel_selection.py | 16 ++++++++++++-- + .../ui/tui/spokes/software_selection.py | 2 +- + 5 files changed, 51 insertions(+), 8 deletions(-) + +diff --git a/pyanaconda/payload/dnf/payload.py b/pyanaconda/payload/dnf/payload.py +index aca7c07..4a62561 100644 +--- a/pyanaconda/payload/dnf/payload.py ++++ b/pyanaconda/payload/dnf/payload.py +@@ -133,6 +133,7 @@ class DNFPayload(Payload): + self._repoMD_list = [] + + self._available_kernels = OrderedDict() ++ self._available_groups = OrderedDict() + self._current_kernel = None + + self._req_groups = set() +@@ -795,7 +796,8 @@ class DNFPayload(Payload): + + def detectMultiKernel(self): + kernel_patterns=["kernel", "kernel-tools", "python3-perf", "kernel-headers", "kernel-devel", "bpftool", "perf"] +- self._available_kernels = {} ++ self._available_kernels.clear() ++ self._available_groups.clear() + + if not self._base.sack: + ret_msg = "Query is not ready yet" +@@ -814,6 +816,19 @@ class DNFPayload(Payload): + continue + kernel_key = "%s" % (pkg.version) + kernel_sub_key = "%s" % (pkg.release) ++ ++ if pkg.name == 'kernel': ++ for kernel_group in self.groups: ++ if re.search("-%s-%s$" % (kernel_key, kernel_sub_key), kernel_group): ++ if kernel_key in self._available_groups: ++ if kernel_sub_key in self._available_groups[kernel_key]: ++ self._available_groups[kernel_key][kernel_sub_key].append(kernel_group) ++ else: ++ self._available_groups[kernel_key][kernel_sub_key] = [ kernel_group ] ++ else: ++ self._available_groups[kernel_key] = OrderedDict() ++ self._available_groups[kernel_key][kernel_sub_key] = [ kernel_group ] ++ + if kernel_key in self._available_kernels: + if kernel_sub_key in self._available_kernels[kernel_key]: + self._available_kernels[kernel_key][kernel_sub_key].append("%s-%s" % (pkg.name, pkg.version)) +@@ -828,6 +843,10 @@ class DNFPayload(Payload): + def available_kernels(self): + return self._available_kernels + ++ @property ++ def available_groups(self): ++ return self._available_groups ++ + @property + def current_kernel(self): + return self._current_kernel +diff --git a/pyanaconda/ui/gui/spokes/kernel_selection.py b/pyanaconda/ui/gui/spokes/kernel_selection.py +index 3bd16e4..6ebaf4a 100644 +--- a/pyanaconda/ui/gui/spokes/kernel_selection.py ++++ b/pyanaconda/ui/gui/spokes/kernel_selection.py +@@ -87,6 +87,10 @@ class KernelSelectionSpoke(NormalSpoke): + def available_kernels(self): + return self.payload.available_kernels + ++ @property ++ def available_groups(self): ++ return self.payload.available_groups ++ + @property + def current_kernel(self): + return self.payload.current_kernel +@@ -117,16 +121,24 @@ class KernelSelectionSpoke(NormalSpoke): + kernel_sub_keys = list(self.available_kernels[kernel].keys()) + if kernel == self.current_kernel: + include_kernel = self.available_kernels[kernel][kernel_sub_keys[-1]] +- self.payload.data.packages.packageList.extend(include_kernel) + for package in include_kernel: ++ if package not in self.payload.data.packages.packageList: ++ self.payload.data.packages.packageList.append(package) + if package in self.payload.data.packages.excludedList: + self.payload.data.packages.excludedList.remove(package) ++ if kernel in self.available_groups.keys(): ++ for group in self.available_groups[kernel][kernel_sub_keys[-1]]: ++ self.payload.select_group(group) + else: + exclude_kernel = self.available_kernels[kernel][kernel_sub_keys[-1]] +- self.payload.data.packages.excludedList.extend(exclude_kernel) + for package in exclude_kernel: ++ if package not in self.payload.data.packages.excludedList: ++ self.payload.data.packages.excludedList.append(package) + if package in self.payload.data.packages.packageList: + self.payload.data.packages.packageList.remove(package) ++ if kernel in self.available_groups.keys(): ++ for group in self.available_groups[kernel][kernel_sub_keys[-1]]: ++ self.payload.deselect_group(group) + + # store kernel selection + self._orig_kernel = self.current_kernel +@@ -225,7 +237,7 @@ class KernelSelectionSpoke(NormalSpoke): + threadMgr.wait(constants.THREAD_PAYLOAD) + + self._error_msgs = self.payload.detectMultiKernel() +- if not self._error_msgs: ++ if not self._error_msgs and not self.current_kernel: + # use latest kernel as default, normally it's anck + self.current_kernel = list(self.available_kernels.keys())[-1] + +diff --git a/pyanaconda/ui/gui/spokes/software_selection.py b/pyanaconda/ui/gui/spokes/software_selection.py +index afcb462..d694641 100644 +--- a/pyanaconda/ui/gui/spokes/software_selection.py ++++ b/pyanaconda/ui/gui/spokes/software_selection.py +@@ -202,7 +202,7 @@ class SoftwareSelectionSpoke(NormalSpoke): + if not self._kickstarted and set(addons) != set(self._orig_addons): + self._select_flag = False + #self.payload.data.packages.packageList = [] +- self.payload.data.packages.groupList = [] ++ #self.payload.data.packages.groupList = [] + self.payload.select_environment(self.environment) + log.debug("Environment selected for installation: %s", self.environment) + log.debug("Groups selected for installation: %s", addons) +diff --git a/pyanaconda/ui/tui/spokes/kernel_selection.py b/pyanaconda/ui/tui/spokes/kernel_selection.py +index cd144c1..a261fac 100644 +--- a/pyanaconda/ui/tui/spokes/kernel_selection.py ++++ b/pyanaconda/ui/tui/spokes/kernel_selection.py +@@ -176,6 +176,10 @@ class KernelSpoke(NormalTUISpoke): + def available_kernels(self): + return self.payload.available_kernels + ++ @property ++ def available_groups(self): ++ return self.payload.available_groups ++ + @property + def current_kernel(self): + return self.payload.current_kernel +@@ -204,16 +208,24 @@ class KernelSpoke(NormalTUISpoke): + kernel_sub_keys = list(self.available_kernels[kernel].keys()) + if kernel == self.current_kernel: + include_kernel = self.available_kernels[kernel][kernel_sub_keys[-1]] +- self.payload.data.packages.packageList.extend(include_kernel) + for package in include_kernel: ++ if package not in self.payload.data.packages.packageList: ++ self.payload.data.packages.packageList.append(package) + if package in self.payload.data.packages.excludedList: + self.payload.data.packages.excludedList.remove(package) ++ if kernel in self.available_groups.keys(): ++ for group in self.available_groups[kernel][kernel_sub_keys[-1]]: ++ self.payload.select_group(group) + else: + exclude_kernel = self.available_kernels[kernel][kernel_sub_keys[-1]] +- self.payload.data.packages.excludedList.extend(exclude_kernel) + for package in exclude_kernel: ++ if package not in self.payload.data.packages.excludedList: ++ self.payload.data.packages.excludedList.append(package) + if package in self.payload.data.packages.packageList: + self.payload.data.packages.packageList.remove(package) ++ if kernel in self.available_groups.keys(): ++ for group in self.available_groups[kernel][kernel_sub_keys[-1]]: ++ self.payload.deselect_group(group) + + # store kernel selection + self._orig_kernel = self.current_kernel +diff --git a/pyanaconda/ui/tui/spokes/software_selection.py b/pyanaconda/ui/tui/spokes/software_selection.py +index 19a9513..abf499a 100644 +--- a/pyanaconda/ui/tui/spokes/software_selection.py ++++ b/pyanaconda/ui/tui/spokes/software_selection.py +@@ -313,7 +313,7 @@ class SoftwareSpoke(NormalTUISpoke): + self._orig_env, self.environment, self.addons) + + #self.payload.data.packages.packageList = [] +- self.data.packages.groupList = [] ++ #self.data.packages.groupList = [] + self.payload.select_environment(self.environment) + + environment_id = self._translate_env_name_to_id(self.environment) +-- +2.27.0 + diff --git a/anaconda.spec b/anaconda.spec index d13dbaf..b2fabec 100644 --- a/anaconda.spec +++ b/anaconda.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.6 +%define anolis_release .0.7 Summary: Graphical system installer Name: anaconda Version: 33.16.6.7 @@ -24,6 +24,7 @@ Patch0007: 0007-install-fix-anolis-bootloader.patch Patch0008: 0008-install-fix-kernel-spoke-notify.patch Patch0009: 0001-add-BOOTLOONGARCH64.EFI-for-anaconda-to-support-new-firmware.patch Patch0010: 0009-Fix-smt-description.patch +Patch0011: 0011-kernel-install-extra-groups-for-kernel.patch # End of Anolis patches # Versions of required components (done so we make sure the buildrequires @@ -377,6 +378,9 @@ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{buildroot}%{_d %{_prefix}/libexec/anaconda/dd_* %changelog +* Wed Dec 21 2022 Liwei Ge - 33.16.6.7-1.0.7 +- Install extra groups for kernel + * Wed Nov 09 2022 Chang Gao - 33.16.6.7-1.0.6 - Rebrand the smt warning description -- Gitee