|
|
c1a9fa |
From ea881513e9c15b0a816d3ba4afe471ff2f591a03 Mon Sep 17 00:00:00 2001
|
|
|
c1a9fa |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
c1a9fa |
Date: Thu, 14 Jul 2022 12:44:27 +0100
|
|
|
c1a9fa |
Subject: [PATCH] common: Adapt to renamed function On_exit.rmdir ->
|
|
|
c1a9fa |
On_exit.rm_rf
|
|
|
c1a9fa |
|
|
|
c1a9fa |
This function was renamed to make it clearer what it does (and that
|
|
|
c1a9fa |
it's potentially dangerous). The functionality is unchanged.
|
|
|
c1a9fa |
|
|
|
c1a9fa |
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
c1a9fa |
(cherry picked from commit 2eb6441264deb0411d36dabaf8fb2da9f07c8439)
|
|
|
c1a9fa |
---
|
|
|
c1a9fa |
common | 2 +-
|
|
|
c1a9fa |
input/OVA.ml | 2 +-
|
|
|
c1a9fa |
input/parse_domain_from_vmx.ml | 2 +-
|
|
|
c1a9fa |
lib/nbdkit.ml | 2 +-
|
|
|
c1a9fa |
lib/qemuNBD.ml | 2 +-
|
|
|
c1a9fa |
lib/utils.ml | 2 +-
|
|
|
c1a9fa |
output/python_script.ml | 2 +-
|
|
|
c1a9fa |
7 files changed, 7 insertions(+), 7 deletions(-)
|
|
|
c1a9fa |
|
|
|
c1a9fa |
Submodule common af6cb55b..fd964c1b:
|
|
|
c1a9fa |
diff --git a/common/mlcustomize/guest_packages.ml b/common/mlcustomize/guest_packages.ml
|
|
|
c1a9fa |
index 4c3c34ed..7c29a2ab 100644
|
|
|
c1a9fa |
--- a/common/mlcustomize/guest_packages.ml
|
|
|
c1a9fa |
+++ b/common/mlcustomize/guest_packages.ml
|
|
|
c1a9fa |
@@ -73,9 +73,9 @@ let install_command packages package_management =
|
|
|
c1a9fa |
| "zypper" -> sprintf "zypper -n in -l %s" quoted_args
|
|
|
c1a9fa |
|
|
|
c1a9fa |
| "unknown" ->
|
|
|
c1a9fa |
- error_unknown_package_manager (s_"--install")
|
|
|
c1a9fa |
+ error_unknown_package_manager "--install"
|
|
|
c1a9fa |
| pm ->
|
|
|
c1a9fa |
- error_unimplemented_package_manager (s_"--install") pm
|
|
|
c1a9fa |
+ error_unimplemented_package_manager "--install" pm
|
|
|
c1a9fa |
|
|
|
c1a9fa |
let update_command package_management =
|
|
|
c1a9fa |
match package_management with
|
|
|
c1a9fa |
@@ -103,9 +103,9 @@ let update_command package_management =
|
|
|
c1a9fa |
| "zypper" -> "zypper -n update -l"
|
|
|
c1a9fa |
|
|
|
c1a9fa |
| "unknown" ->
|
|
|
c1a9fa |
- error_unknown_package_manager (s_"--update")
|
|
|
c1a9fa |
+ error_unknown_package_manager "--update"
|
|
|
c1a9fa |
| pm ->
|
|
|
c1a9fa |
- error_unimplemented_package_manager (s_"--update") pm
|
|
|
c1a9fa |
+ error_unimplemented_package_manager "--update" pm
|
|
|
c1a9fa |
|
|
|
c1a9fa |
let uninstall_command packages package_management =
|
|
|
c1a9fa |
let quoted_args = String.concat " " (List.map quote packages) in
|
|
|
c1a9fa |
@@ -127,6 +127,6 @@ let uninstall_command packages package_management =
|
|
|
c1a9fa |
| "zypper" -> sprintf "zypper -n rm %s" quoted_args
|
|
|
c1a9fa |
|
|
|
c1a9fa |
| "unknown" ->
|
|
|
c1a9fa |
- error_unknown_package_manager (s_"--uninstall")
|
|
|
c1a9fa |
+ error_unknown_package_manager "--uninstall"
|
|
|
c1a9fa |
| pm ->
|
|
|
c1a9fa |
- error_unimplemented_package_manager (s_"--uninstall") pm
|
|
|
c1a9fa |
+ error_unimplemented_package_manager "--uninstall" pm
|
|
|
c1a9fa |
diff --git a/common/mltools/on_exit.ml b/common/mltools/on_exit.ml
|
|
|
c1a9fa |
index 53ccb68a..cae12e73 100644
|
|
|
c1a9fa |
--- a/common/mltools/on_exit.ml
|
|
|
c1a9fa |
+++ b/common/mltools/on_exit.ml
|
|
|
c1a9fa |
@@ -52,7 +52,7 @@ let do_actions () =
|
|
|
c1a9fa |
List.iter (do_action (fun file -> Unix.unlink file)) !files;
|
|
|
c1a9fa |
List.iter (do_action (
|
|
|
c1a9fa |
fun dir ->
|
|
|
c1a9fa |
- let cmd = sprintf "rm -rf %s" (Filename.quote dir) in
|
|
|
c1a9fa |
+ let cmd = sprintf "rm -rf -- %s" (Filename.quote dir) in
|
|
|
c1a9fa |
ignore (Tools_utils.shell_command cmd)
|
|
|
c1a9fa |
)
|
|
|
c1a9fa |
) !rmdirs;
|
|
|
c1a9fa |
@@ -102,7 +102,7 @@ let unlink filename =
|
|
|
c1a9fa |
register ();
|
|
|
c1a9fa |
List.push_front filename files
|
|
|
c1a9fa |
|
|
|
c1a9fa |
-let rmdir dir =
|
|
|
c1a9fa |
+let rm_rf dir =
|
|
|
c1a9fa |
register ();
|
|
|
c1a9fa |
List.push_front dir rmdirs
|
|
|
c1a9fa |
|
|
|
c1a9fa |
diff --git a/common/mltools/on_exit.mli b/common/mltools/on_exit.mli
|
|
|
c1a9fa |
index a02e3db3..9bcf104f 100644
|
|
|
c1a9fa |
--- a/common/mltools/on_exit.mli
|
|
|
c1a9fa |
+++ b/common/mltools/on_exit.mli
|
|
|
c1a9fa |
@@ -47,7 +47,7 @@ val f : (unit -> unit) -> unit
|
|
|
c1a9fa |
val unlink : string -> unit
|
|
|
c1a9fa |
(** Unlink a single temporary file on exit. *)
|
|
|
c1a9fa |
|
|
|
c1a9fa |
-val rmdir : string -> unit
|
|
|
c1a9fa |
+val rm_rf : string -> unit
|
|
|
c1a9fa |
(** Recursively remove a temporary directory on exit (using [rm -rf]). *)
|
|
|
c1a9fa |
|
|
|
c1a9fa |
val kill : ?signal:int -> int -> unit
|
|
|
c1a9fa |
diff --git a/input/OVA.ml b/input/OVA.ml
|
|
|
c1a9fa |
index 9e9c3712..09ceee98 100644
|
|
|
c1a9fa |
--- a/input/OVA.ml
|
|
|
c1a9fa |
+++ b/input/OVA.ml
|
|
|
c1a9fa |
@@ -78,7 +78,7 @@ let rec parse_ova ova =
|
|
|
c1a9fa |
else (
|
|
|
c1a9fa |
let tmpdir =
|
|
|
c1a9fa |
let t = Mkdtemp.temp_dir ~base_dir:large_tmpdir "ova." in
|
|
|
c1a9fa |
- On_exit.rmdir t;
|
|
|
c1a9fa |
+ On_exit.rm_rf t;
|
|
|
c1a9fa |
t in
|
|
|
c1a9fa |
|
|
|
c1a9fa |
match detect_file_type ova with
|
|
|
c1a9fa |
diff --git a/input/parse_domain_from_vmx.ml b/input/parse_domain_from_vmx.ml
|
|
|
c1a9fa |
index 947ca414..7aca2c24 100644
|
|
|
c1a9fa |
--- a/input/parse_domain_from_vmx.ml
|
|
|
c1a9fa |
+++ b/input/parse_domain_from_vmx.ml
|
|
|
c1a9fa |
@@ -375,7 +375,7 @@ and find_nics vmx =
|
|
|
c1a9fa |
let parse_domain_from_vmx vmx_source =
|
|
|
c1a9fa |
let tmpdir =
|
|
|
c1a9fa |
let t = Mkdtemp.temp_dir "vmx." in
|
|
|
c1a9fa |
- On_exit.rmdir t;
|
|
|
c1a9fa |
+ On_exit.rm_rf t;
|
|
|
c1a9fa |
t in
|
|
|
c1a9fa |
|
|
|
c1a9fa |
(* If the transport is SSH, fetch the file from remote, else
|
|
|
c1a9fa |
diff --git a/lib/nbdkit.ml b/lib/nbdkit.ml
|
|
|
c1a9fa |
index 07896684..1137b6bb 100644
|
|
|
c1a9fa |
--- a/lib/nbdkit.ml
|
|
|
c1a9fa |
+++ b/lib/nbdkit.ml
|
|
|
c1a9fa |
@@ -105,7 +105,7 @@ let add_filter_if_available cmd filter =
|
|
|
c1a9fa |
let run_unix socket cmd =
|
|
|
c1a9fa |
(* Create a temporary directory where we place the PID file. *)
|
|
|
c1a9fa |
let piddir = Mkdtemp.temp_dir "v2vnbdkit." in
|
|
|
c1a9fa |
- On_exit.rmdir piddir;
|
|
|
c1a9fa |
+ On_exit.rm_rf piddir;
|
|
|
c1a9fa |
|
|
|
c1a9fa |
let id = unique () in
|
|
|
c1a9fa |
let pidfile = piddir // sprintf "nbdkit%d.pid" id in
|
|
|
c1a9fa |
diff --git a/lib/qemuNBD.ml b/lib/qemuNBD.ml
|
|
|
c1a9fa |
index bbb65f41..c3dd1666 100644
|
|
|
c1a9fa |
--- a/lib/qemuNBD.ml
|
|
|
c1a9fa |
+++ b/lib/qemuNBD.ml
|
|
|
c1a9fa |
@@ -69,7 +69,7 @@ let run_unix socket { disk; snapshot; format; imgopts } =
|
|
|
c1a9fa |
|
|
|
c1a9fa |
(* Create a temporary directory where we place the PID file. *)
|
|
|
c1a9fa |
let piddir = Mkdtemp.temp_dir "v2vqemunbd." in
|
|
|
c1a9fa |
- On_exit.rmdir piddir;
|
|
|
c1a9fa |
+ On_exit.rm_rf piddir;
|
|
|
c1a9fa |
|
|
|
c1a9fa |
let id = unique () in
|
|
|
c1a9fa |
let pidfile = piddir // sprintf "qemunbd%d.pid" id in
|
|
|
c1a9fa |
diff --git a/lib/utils.ml b/lib/utils.ml
|
|
|
c1a9fa |
index 7116a4f9..84b9a93f 100644
|
|
|
c1a9fa |
--- a/lib/utils.ml
|
|
|
c1a9fa |
+++ b/lib/utils.ml
|
|
|
c1a9fa |
@@ -204,7 +204,7 @@ let error_if_no_ssh_agent () =
|
|
|
c1a9fa |
let create_v2v_directory () =
|
|
|
c1a9fa |
let d = Mkdtemp.temp_dir "v2v." in
|
|
|
c1a9fa |
chown_for_libvirt_rhbz_1045069 d;
|
|
|
c1a9fa |
- On_exit.rmdir d;
|
|
|
c1a9fa |
+ On_exit.rm_rf d;
|
|
|
c1a9fa |
d
|
|
|
c1a9fa |
|
|
|
c1a9fa |
(* Wait for a file to appear until a timeout. *)
|
|
|
c1a9fa |
diff --git a/output/python_script.ml b/output/python_script.ml
|
|
|
c1a9fa |
index 54ccd1b5..ecf46c2d 100644
|
|
|
c1a9fa |
--- a/output/python_script.ml
|
|
|
c1a9fa |
+++ b/output/python_script.ml
|
|
|
c1a9fa |
@@ -33,7 +33,7 @@ type script = {
|
|
|
c1a9fa |
|
|
|
c1a9fa |
let create ?(name = "script.py") code =
|
|
|
c1a9fa |
let tmpdir = Mkdtemp.temp_dir "v2v." in
|
|
|
c1a9fa |
- On_exit.rmdir tmpdir;
|
|
|
c1a9fa |
+ On_exit.rm_rf tmpdir;
|
|
|
c1a9fa |
let path = tmpdir // name in
|
|
|
c1a9fa |
with_open_out path (fun chan -> output_string chan code);
|
|
|
c1a9fa |
{ tmpdir; path }
|