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

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