virt-v2v/0003-convert-linux-Move-uninstall_packages-function-below.patch
Richard W.M. Jones 9593fa2f52 convert: linux: Ignore /etc/lvm/archive/*.vg files
resolves: RHEL-113820
mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor
resolves: RHEL-112517
Fix for setting boot order for Linux guests based on grub location
resolves: RHEL-115989, RHEL-115990
2025-09-18 14:47:36 +01:00

74 lines
2.4 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 1f6d4e079dd5fdc9ed4c84ada57835b733bbbe78 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 18 Sep 2025 12:21:58 +0100
Subject: [PATCH] convert: linux: Move uninstall_packages function below
do_convert
The structure of conversion is the do_convert () function, followed by
the subfunctions that are used for conversion. Move
uninstall_packages below do_convert so it's like all the other
functions.
This is just code motion, there is no functional change.
Updates: commit b3268a13beca4da218e7ffe4648a18420296103a
---
convert/convert_linux.ml | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index 872fa663..f339361a 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -131,25 +131,6 @@ let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ =
(*----------------------------------------------------------------------*)
(* Conversion step. *)
- let uninstall_packages pkgs =
- if pkgs <> [] then (
- let cmd =
- try Guest_packages.uninstall_command pkgs inspect.i_package_management
- with
- | Guest_packages.Unknown_package_manager msg
- | Guest_packages.Unimplemented_package_manager msg ->
- error "%s" msg
- in
- (try ignore (g#sh cmd)
- with G.Error msg ->
- warning (f_"could not uninstall packages %s: %s (ignored)")
- (String.concat " " pkgs) msg
- );
- (* Reload Augeas in case anything changed. *)
- Linux.augeas_reload g
- )
- in
-
let rec do_convert () =
augeas_grub_configuration ();
@@ -1378,6 +1359,24 @@ fi
"/etc/blkid/blkid.tab"; "/etc/blkid.tab";
"/etc/lvm/cache/.cache"; "/etc/lvm/devices/system.devices"
];
+
+ and uninstall_packages pkgs =
+ if pkgs <> [] then (
+ let cmd =
+ try Guest_packages.uninstall_command pkgs inspect.i_package_management
+ with
+ | Guest_packages.Unknown_package_manager msg
+ | Guest_packages.Unimplemented_package_manager msg ->
+ error "%s" msg
+ in
+ (try ignore (g#sh cmd)
+ with G.Error msg ->
+ warning (f_"could not uninstall packages %s: %s (ignored)")
+ (String.concat " " pkgs) msg
+ );
+ (* Reload Augeas in case anything changed. *)
+ Linux.augeas_reload g
+ )
in
do_convert ()