File Add-support-for-Zstandard-compressed-kernel-modules.patch of Package virt-v2v.32335

Subject: convert: linux: Add support for Zstandard compressed kernel modules
From: Richard W.M. Jones rjones@redhat.com Tue Aug 9 19:09:08 2022 +0100
Date: Tue Aug 9 19:09:08 2022 +0100:
Git: 315c016dbea899587649a4bbf1865390cb4e1d3c

OpenSUSE uses *.ko.zst for kernel modules.  This commit adds support
in the same way as the existing support for *.ko.xz.  Note this
requires a corresponding change to libguestfs to support Zstandard
compression in the guestfs_file_architecture API:

https://github.com/libguestfs/libguestfs/commit/0e784824e82a88e522873fec5db1a11943d637ed

Reported-by: Xiaodai Wang
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2116811

--- a/v2v/linux_kernels.ml
+++ b/v2v/linux_kernels.ml
@@ -64,8 +64,8 @@ let print_kernel_info chan prefix ki =
   fpf "pvpanic=%b xen=%b debug=%b\n"
       ki.ki_supports_isa_pvpanic ki.ki_is_xen_pv_only_kernel ki.ki_is_debug
 
-let rex_ko = PCRE.compile "\\.k?o(?:\\.xz)?$"
-let rex_ko_extract = PCRE.compile "/([^/]+)\\.k?o(?:\\.xz)?$"
+let rex_ko = PCRE.compile "\\.k?o(?:\\.(?:xz|zst))?$"
+let rex_ko_extract = PCRE.compile "/([^/]+)\\.k?o(?:\\.(?:xz|zst))?$"
 
 let detect_kernels (g : G.guestfs) inspect family bootloader =
   (* What kernel/kernel-like packages are installed on the current guest? *)
@@ -202,7 +202,11 @@ let detect_kernels (g : G.guestfs) inspe
              let all_candidates = List.flatten (
                List.map (
                  fun f ->
-                   [ "/" ^ f ^ ".o"; "/" ^ f ^ ".ko"; "/" ^ f ^ ".ko.xz" ]
+                   [ "/" ^ f ^ ".o";
+                     "/" ^ f ^ ".ko";
+                     "/" ^ f ^ ".ko.xz";
+                     "/" ^ f ^ ".ko.zst";
+                   ]
                ) candidates
              ) in
              let candidate =
openSUSE Build Service is sponsored by