Blame SOURCES/0013-builder-dib-Replace-On_exit.rmdir-with-On_exit.rm_rf.patch

7b180b
From 3576da023fb42ceaea80b81aebad345de606a332 Mon Sep 17 00:00:00 2001
7b180b
From: "Richard W.M. Jones" <rjones@redhat.com>
7b180b
Date: Fri, 15 Jul 2022 08:55:53 +0100
7b180b
Subject: [PATCH] builder, dib: Replace On_exit.rmdir with On_exit.rm_rf
7b180b
7b180b
Update common submodule.
7b180b
7b180b
(cherry picked from commit f5baf83e464c276d3dae6f8e878b8f47fe0d43d9)
7b180b
---
7b180b
 builder/builder.ml            | 2 +-
7b180b
 builder/index_parser_tests.ml | 2 +-
7b180b
 builder/repository_main.ml    | 2 +-
7b180b
 common                        | 2 +-
7b180b
 dib/dib.ml                    | 2 +-
7b180b
 5 files changed, 5 insertions(+), 5 deletions(-)
7b180b
7b180b
diff --git a/builder/builder.ml b/builder/builder.ml
7b180b
index 2c9c83085..e34aae6c7 100644
7b180b
--- a/builder/builder.ml
7b180b
+++ b/builder/builder.ml
7b180b
@@ -182,7 +182,7 @@ let main () =
7b180b
    * create.
7b180b
    *)
7b180b
   let tmpdir = Mkdtemp.temp_dir "virt-builder." in
7b180b
-  On_exit.rmdir tmpdir;
7b180b
+  On_exit.rm_rf tmpdir;
7b180b
 
7b180b
   (* Download the sources. *)
7b180b
   let downloader = Downloader.create ~curl:cmdline.curl ~cache ~tmpdir in
7b180b
diff --git a/builder/index_parser_tests.ml b/builder/index_parser_tests.ml
7b180b
index 39983faba..5262a1607 100644
7b180b
--- a/builder/index_parser_tests.ml
7b180b
+++ b/builder/index_parser_tests.ml
7b180b
@@ -28,7 +28,7 @@ open Tools_utils
7b180b
 
7b180b
 let tmpdir =
7b180b
   let tmpdir = Mkdtemp.temp_dir "guestfs-tests." in
7b180b
-  On_exit.rmdir tmpdir;
7b180b
+  On_exit.rm_rf tmpdir;
7b180b
   tmpdir
7b180b
 
7b180b
 let dummy_sigchecker = Sigchecker.create ~gpg:"gpg"
7b180b
diff --git a/builder/repository_main.ml b/builder/repository_main.ml
7b180b
index c5b656310..c24729c4c 100644
7b180b
--- a/builder/repository_main.ml
7b180b
+++ b/builder/repository_main.ml
7b180b
@@ -420,7 +420,7 @@ let main () =
7b180b
   (* Create a temporary folder to work in *)
7b180b
   let tmpdir = Mkdtemp.temp_dir ~base_dir:cmdline.repo
7b180b
                                 "virt-builder-repository." in
7b180b
-  On_exit.rmdir tmpdir;
7b180b
+  On_exit.rm_rf tmpdir;
7b180b
 
7b180b
   let tmprepo = tmpdir // "repo" in
7b180b
   mkdir_p tmprepo 0o700;
7b180b
Submodule common af6cb55bc..fd964c1ba:
7b180b
diff --git a/common/mlcustomize/guest_packages.ml b/common/mlcustomize/guest_packages.ml
7b180b
index 4c3c34e..7c29a2a 100644
7b180b
--- a/common/mlcustomize/guest_packages.ml
7b180b
+++ b/common/mlcustomize/guest_packages.ml
7b180b
@@ -73,9 +73,9 @@ let install_command packages package_management =
7b180b
   | "zypper" -> sprintf "zypper -n in -l %s" quoted_args
7b180b
 
7b180b
   | "unknown" ->
7b180b
-    error_unknown_package_manager (s_"--install")
7b180b
+    error_unknown_package_manager "--install"
7b180b
   | pm ->
7b180b
-    error_unimplemented_package_manager (s_"--install") pm
7b180b
+    error_unimplemented_package_manager "--install" pm
7b180b
 
7b180b
 let update_command package_management =
7b180b
   match package_management with
7b180b
@@ -103,9 +103,9 @@ let update_command package_management =
7b180b
   | "zypper" -> "zypper -n update -l"
7b180b
 
7b180b
   | "unknown" ->
7b180b
-    error_unknown_package_manager (s_"--update")
7b180b
+    error_unknown_package_manager "--update"
7b180b
   | pm ->
7b180b
-    error_unimplemented_package_manager (s_"--update") pm
7b180b
+    error_unimplemented_package_manager "--update" pm
7b180b
 
7b180b
 let uninstall_command packages package_management =
7b180b
   let quoted_args = String.concat " " (List.map quote packages) in
7b180b
@@ -127,6 +127,6 @@ let uninstall_command packages package_management =
7b180b
   | "zypper" -> sprintf "zypper -n rm %s" quoted_args
7b180b
 
7b180b
   | "unknown" ->
7b180b
-    error_unknown_package_manager (s_"--uninstall")
7b180b
+    error_unknown_package_manager "--uninstall"
7b180b
   | pm ->
7b180b
-    error_unimplemented_package_manager (s_"--uninstall") pm
7b180b
+    error_unimplemented_package_manager "--uninstall" pm
7b180b
diff --git a/common/mltools/on_exit.ml b/common/mltools/on_exit.ml
7b180b
index 53ccb68..cae12e7 100644
7b180b
--- a/common/mltools/on_exit.ml
7b180b
+++ b/common/mltools/on_exit.ml
7b180b
@@ -52,7 +52,7 @@ let do_actions () =
7b180b
     List.iter (do_action (fun file -> Unix.unlink file)) !files;
7b180b
     List.iter (do_action (
7b180b
       fun dir ->
7b180b
-        let cmd = sprintf "rm -rf %s" (Filename.quote dir) in
7b180b
+        let cmd = sprintf "rm -rf -- %s" (Filename.quote dir) in
7b180b
         ignore (Tools_utils.shell_command cmd)
7b180b
       )
7b180b
     ) !rmdirs;
7b180b
@@ -102,7 +102,7 @@ let unlink filename =
7b180b
   register ();
7b180b
   List.push_front filename files
7b180b
 
7b180b
-let rmdir dir =
7b180b
+let rm_rf dir =
7b180b
   register ();
7b180b
   List.push_front dir rmdirs
7b180b
 
7b180b
diff --git a/common/mltools/on_exit.mli b/common/mltools/on_exit.mli
7b180b
index a02e3db..9bcf104 100644
7b180b
--- a/common/mltools/on_exit.mli
7b180b
+++ b/common/mltools/on_exit.mli
7b180b
@@ -47,7 +47,7 @@ val f : (unit -> unit) -> unit
7b180b
 val unlink : string -> unit
7b180b
 (** Unlink a single temporary file on exit. *)
7b180b
 
7b180b
-val rmdir : string -> unit
7b180b
+val rm_rf : string -> unit
7b180b
 (** Recursively remove a temporary directory on exit (using [rm -rf]). *)
7b180b
 
7b180b
 val kill : ?signal:int -> int -> unit
7b180b
diff --git a/dib/dib.ml b/dib/dib.ml
7b180b
index f5ce604c8..a4ba36040 100644
7b180b
--- a/dib/dib.ml
7b180b
+++ b/dib/dib.ml
7b180b
@@ -550,7 +550,7 @@ let main () =
7b180b
   let image_basename_d = image_basename ^ ".d" in
7b180b
 
7b180b
   let tmpdir = Mkdtemp.temp_dir "dib." in
7b180b
-  On_exit.rmdir tmpdir;
7b180b
+  On_exit.rm_rf tmpdir;
7b180b
   let auxtmpdir = tmpdir // "in_target.aux" in
7b180b
   do_mkdir auxtmpdir;
7b180b
   let hookstmpdir = auxtmpdir // "hooks" in
7b180b
-- 
7b180b
2.31.1
7b180b