From fc9e810d1be5c6226a75cdbd66e5c0d0561389e7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 3 May 2022 14:04:20 +0000 Subject: [PATCH] import supermin-5.2.1-2.module+el8.7.0+14396+56bc2570 --- ...ile-to-avoid-lstat-Value-too-large-f.patch | 6 +- ...0002-Ignore-zfcpdump-kernel-on-s390x.patch | 29 +++++ ...re-unbootable-kernels-in-lib-modules.patch | 109 ++++++++++++++++++ SOURCES/0004-Ignore-debug-kernels.patch | 33 ++++++ SOURCES/copy-patches.sh | 55 +++++++++ SPECS/supermin.spec | 22 +++- 6 files changed, 249 insertions(+), 5 deletions(-) create mode 100644 SOURCES/0002-Ignore-zfcpdump-kernel-on-s390x.patch create mode 100644 SOURCES/0003-Ignore-unbootable-kernels-in-lib-modules.patch create mode 100644 SOURCES/0004-Ignore-debug-kernels.patch create mode 100755 SOURCES/copy-patches.sh diff --git a/SOURCES/0001-Open-Unix.LargeFile-to-avoid-lstat-Value-too-large-f.patch b/SOURCES/0001-Open-Unix.LargeFile-to-avoid-lstat-Value-too-large-f.patch index c5d4ea3..c9d6d28 100644 --- a/SOURCES/0001-Open-Unix.LargeFile-to-avoid-lstat-Value-too-large-f.patch +++ b/SOURCES/0001-Open-Unix.LargeFile-to-avoid-lstat-Value-too-large-f.patch @@ -1,4 +1,4 @@ -From fd9f17c7eb63979af882533a0d234bfc8ca42de3 Mon Sep 17 00:00:00 2001 +From b1672fa8a1fdb9c00a0fa1c04547d69abc6afb0a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 1 Feb 2021 10:07:02 +0000 Subject: [PATCH] Open Unix.LargeFile to avoid "lstat: Value too large for @@ -18,6 +18,8 @@ using int64 for some (unfortunately not all) fields. For more information see the OCaml sources, file otherlibs/unix/stat.c, all instances of "EOVERFLOW". + +(cherry picked from commit fd9f17c7eb63979af882533a0d234bfc8ca42de3) --- src/format_chroot.ml | 1 + src/format_ext2.ml | 1 + @@ -176,5 +178,5 @@ index b25df88..f5990ef 100644 let (+^) = Int64.add -- -2.29.0.rc2 +2.31.1 diff --git a/SOURCES/0002-Ignore-zfcpdump-kernel-on-s390x.patch b/SOURCES/0002-Ignore-zfcpdump-kernel-on-s390x.patch new file mode 100644 index 0000000..88f4aba --- /dev/null +++ b/SOURCES/0002-Ignore-zfcpdump-kernel-on-s390x.patch @@ -0,0 +1,29 @@ +From d5e5a787b53490c5503a598721d7b34b7d30badd Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 29 Nov 2021 14:40:15 +0000 +Subject: [PATCH] Ignore zfcpdump kernel on s390x + +Reported-by: Sebastian Mitterle +Thanks: Cornelia Huck +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2027375 +(cherry picked from commit 9fbe476d4df0b01568d3668e6121cae7c779c8c7) +--- + src/format_ext2_kernel.ml | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml +index 3be4413..ea69ade 100644 +--- a/src/format_ext2_kernel.ml ++++ b/src/format_ext2_kernel.ml +@@ -157,6 +157,8 @@ and kernel_filter patterns is_arm all_files = + ) all_files in + let files = + List.filter (fun filename -> find filename "xen" = -1) files in ++ let files = ++ List.filter (fun filename -> find filename "zfcpdump" = -1) files in + let files = + if not is_arm then files + else ( +-- +2.31.1 + diff --git a/SOURCES/0003-Ignore-unbootable-kernels-in-lib-modules.patch b/SOURCES/0003-Ignore-unbootable-kernels-in-lib-modules.patch new file mode 100644 index 0000000..88003e4 --- /dev/null +++ b/SOURCES/0003-Ignore-unbootable-kernels-in-lib-modules.patch @@ -0,0 +1,109 @@ +From b843c724ee6e3f66991b8bd81a602e2bea0c1625 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 1 Dec 2021 10:28:36 +0000 +Subject: [PATCH] Ignore unbootable kernels in /lib/modules + +The previous commit didn't ignore zfcpdump kernels if found in +/lib/modules because we didn't apply the kernel filter to those paths. + +Also this commit cleans up the code in general, splitting up the +multi-purpose "kernel_filter" function into two parts with clearer +roles. + +Fixes: commit 9fbe476d4df0b01568d3668e6121cae7c779c8c7 +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2027375 +Reported-by: Yongkui Guo +(cherry picked from commit f53868ce875fc17527696a85b48c67fefa3176e7) +--- + src/format_ext2_kernel.ml | 44 +++++++++++++++++++++++---------------- + 1 file changed, 26 insertions(+), 18 deletions(-) + +diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml +index ea69ade..79d636b 100644 +--- a/src/format_ext2_kernel.ml ++++ b/src/format_ext2_kernel.ml +@@ -38,7 +38,7 @@ let rec build_kernel debug host_cpu copy_kernel kernel = + | None -> + if debug >= 1 then + printf "supermin: kernel: looking for kernels in /lib/modules/*/vmlinuz ...\n%!"; +- match find_kernel_from_lib_modules debug with ++ match find_kernel_from_lib_modules debug host_cpu with + | Some k -> k + | None -> + if debug >= 1 then +@@ -89,10 +89,13 @@ and find_kernel_from_env_vars debug = + Some (kernel_env, kernel_name, kernel_version, modpath) + with Not_found -> None + +-and find_kernel_from_lib_modules debug = ++and find_kernel_from_lib_modules debug host_cpu = ++ let files = glob "/lib/modules/*/vmlinuz" [GLOB_NOSORT; GLOB_NOESCAPE] in ++ let files = Array.to_list files in ++ ++ let files = ignore_unbootable_kernels host_cpu files in ++ + let kernels = +- let files = glob "/lib/modules/*/vmlinuz" [GLOB_NOSORT; GLOB_NOESCAPE] in +- let files = Array.to_list files in + let kernels = + filter_map ( + fun kernel_file -> +@@ -114,22 +117,22 @@ and find_kernel_from_lib_modules debug = + | [] -> None + + and find_kernel_from_boot debug host_cpu = +- let is_arm = +- String.length host_cpu >= 3 && +- host_cpu.[0] = 'a' && host_cpu.[1] = 'r' && host_cpu.[2] = 'm' in +- + let all_files = Sys.readdir "/boot" in + let all_files = Array.to_list all_files in + + (* In original: ls -1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen *) + let patterns = patt_of_cpu host_cpu in +- let files = kernel_filter patterns is_arm all_files in ++ let files = files_matching_globs patterns all_files in ++ let files = ignore_unbootable_kernels host_cpu files in + + let files = + if files <> [] then files +- else ++ else ( + (* In original: ls -1dvr /boot/vmlinuz-* 2>/dev/null | grep -v xen *) +- kernel_filter ["vmlinu?-*"] is_arm all_files in ++ let files = files_matching_globs ["vmlinu?-*"] all_files in ++ let files = ignore_unbootable_kernels host_cpu files in ++ files ++ ) in + + let files = List.sort (fun a b -> compare_version b a) files in + let kernels = +@@ -148,13 +151,18 @@ and find_kernel_from_boot debug host_cpu = + | kernel :: _ -> Some kernel + | [] -> None + +-and kernel_filter patterns is_arm all_files = +- let files = +- List.filter +- (fun filename -> +- List.exists +- (fun patt -> fnmatch patt filename [FNM_NOESCAPE]) patterns +- ) all_files in ++and files_matching_globs patterns files = ++ List.filter ++ (fun filename -> ++ List.exists ++ (fun patt -> fnmatch patt filename [FNM_NOESCAPE]) patterns ++ ) files ++ ++and ignore_unbootable_kernels host_cpu files = ++ let is_arm = ++ String.length host_cpu >= 3 && ++ host_cpu.[0] = 'a' && host_cpu.[1] = 'r' && host_cpu.[2] = 'm' in ++ + let files = + List.filter (fun filename -> find filename "xen" = -1) files in + let files = +-- +2.31.1 + diff --git a/SOURCES/0004-Ignore-debug-kernels.patch b/SOURCES/0004-Ignore-debug-kernels.patch new file mode 100644 index 0000000..d278725 --- /dev/null +++ b/SOURCES/0004-Ignore-debug-kernels.patch @@ -0,0 +1,33 @@ +From b2565eb1ddc43d8ff6e3406f11004ff42ab108aa Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 28 Feb 2022 16:54:33 -0500 +Subject: [PATCH] Ignore debug kernels + +On RHEL 8.2 with RT, these kernels are not bootable. The kernel in +that instance was called +/lib/modules/4.18.0-193.70.1.rt13.120.el8_2.x86_64+debug/vmlinuz +installed from the package +kernel-rt-debug-core-4.18.0-193.70.1.rt13.120.el8_2.x86_64 + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2051332 +(cherry picked from commit c44d685e662e001f5fe70f0a98d0964cb561e1ec) +--- + src/format_ext2_kernel.ml | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml +index 79d636b..c592703 100644 +--- a/src/format_ext2_kernel.ml ++++ b/src/format_ext2_kernel.ml +@@ -167,6 +167,8 @@ and ignore_unbootable_kernels host_cpu files = + List.filter (fun filename -> find filename "xen" = -1) files in + let files = + List.filter (fun filename -> find filename "zfcpdump" = -1) files in ++ let files = ++ List.filter (fun filename -> find filename "+debug" = -1) files in + let files = + if not is_arm then files + else ( +-- +2.31.1 + diff --git a/SOURCES/copy-patches.sh b/SOURCES/copy-patches.sh new file mode 100755 index 0000000..016d0d8 --- /dev/null +++ b/SOURCES/copy-patches.sh @@ -0,0 +1,55 @@ +#!/bin/bash - + +set -e + +# Maintainer script to copy patches from the git repo to the current +# directory. Use it like this: +# ./copy-patches.sh + +rhel_version=8.7.0 + +# Check we're in the right directory. +if [ ! -f supermin.spec ]; then + echo "$0: run this from the directory containing 'supermin.spec'" + exit 1 +fi + +git_checkout=$HOME/d/supermin-rhel-$rhel_version +if [ ! -d $git_checkout ]; then + echo "$0: $git_checkout does not exist" + echo "This script is only for use by the maintainer when preparing a" + echo "supermin release on RHEL." + exit 1 +fi + +# Get the base version of supermin. +version=`grep '^Version:' supermin.spec | awk '{print $2}'` +tag="v$version" + +# Remove any existing patches. +git rm -f [0-9]*.patch ||: +rm -f [0-9]*.patch + +# Get the patches. +(cd $git_checkout; rm -f [0-9]*.patch; git format-patch -N --submodule=diff $tag) +mv $git_checkout/[0-9]*.patch . + +# Remove any not to be applied. +rm -f *NOT-FOR-RPM*.patch + +# Add the patches. +git add [0-9]*.patch + +# Print out the patch lines. +echo +echo "--- Copy the following text into supermin.spec file" +echo + +echo "# Patches." +for f in [0-9]*.patch; do + n=`echo $f | awk -F- '{print $1}'` + echo "Patch$n: $f" +done + +echo +echo "--- End of text" diff --git a/SPECS/supermin.spec b/SPECS/supermin.spec index 1ac0b68..1de7548 100644 --- a/SPECS/supermin.spec +++ b/SPECS/supermin.spec @@ -29,7 +29,7 @@ Summary: Tool for creating supermin appliances Name: supermin Version: 5.2.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ ExcludeArch: %{ix86} @@ -40,8 +40,16 @@ Source1: http://download.libguestfs.org/supermin/%{source_directory}/%{nam # Keyring used to verify tarball signature. Source2: libguestfs.keyring -# Upstream fix for stat field overflow on armv7. -Patch1: 0001-Open-Unix.LargeFile-to-avoid-lstat-Value-too-large-f.patch +# RHEL 8 git repository is: +# https://github.com/libguestfs/supermin/tree/rhel-8.7.0 +# Use 'copy-patches.sh' to copy the patches from the git repo +# to the current directory. + +# Patches. +Patch0001: 0001-Open-Unix.LargeFile-to-avoid-lstat-Value-too-large-f.patch +Patch0002: 0002-Ignore-zfcpdump-kernel-on-s390x.patch +Patch0003: 0003-Ignore-unbootable-kernels-in-lib-modules.patch +Patch0004: 0004-Ignore-debug-kernels.patch BuildRequires: /usr/bin/pod2man BuildRequires: /usr/bin/pod2html @@ -90,6 +98,9 @@ Requires: findutils Source3: supermin.attr Source4: supermin-find-requires +# Maintainer script which helps with handling patches. +Source5: copy-patches.sh + %description Supermin is a tool for building supermin appliances. These are tiny @@ -164,6 +175,11 @@ make check || { %changelog +* Fri Mar 04 2022 Richard W.M. Jones - 5.2.1-2.el8 +- Supermin should ignore +debug kernels + resolves: rhbz#2051332 +- Add copy-patches script. + * Thu Sep 2 2021 Danilo C. L. de Paula - 5.2.1-1.el8 - Resolves: bz#2000225 (Rebase virt:rhel module:stream based on AV-8.6)