[Libguestfs] [supermin PATCH 1/2] prepare: keep config_files available for longer

Pino Toscano ptoscano at redhat.com
Mon Dec 3 16:17:32 UTC 2018


This is just refactoring, with no behaviour changes.
---
 src/mode_prepare.ml | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/mode_prepare.ml b/src/mode_prepare.ml
index 7c8221e..7759c58 100644
--- a/src/mode_prepare.ml
+++ b/src/mode_prepare.ml
@@ -128,28 +128,28 @@ let prepare debug (copy_kernel, format, host_cpu,
    * be missing either from the package or from the filesystem (the
    * latter case with --use-installed).
    *)
-  let files_from =
-    let config_files =
-      List.map (
-        fun (_, files) ->
-          filter_map (
-            function
-            | { ft_config = true; ft_path = path } -> Some path
-            | { ft_config = false } -> None
-          ) files
-      ) packages in
-    let config_files = List.flatten config_files in
-
-    let config_files = List.filter (
-      fun path ->
-        try close_in (open_in (dir // path)); true
-        with Sys_error _ -> false
-    ) config_files in
+  let config_files =
+    List.map (
+      fun (_, files) ->
+        filter_map (
+          function
+          | { ft_config = true; ft_path = path } -> Some path
+          | { ft_config = false } -> None
+        ) files
+    ) packages in
+  let config_files = List.flatten config_files in
+
+  let config_files = List.filter (
+    fun path ->
+      try close_in (open_in (dir // path)); true
+      with Sys_error _ -> false
+  ) config_files in
 
-    if debug >= 1 then
-      printf "supermin: there are %d config files\n"
-             (List.length config_files);
+  if debug >= 1 then
+    printf "supermin: there are %d config files\n"
+           (List.length config_files);
 
+  let files_from =
     (* Put the list of config files into a file, for tar to read. *)
     let files_from = tmpdir // "files-from.txt" in
     let chan = open_out files_from in
-- 
2.17.2




More information about the Libguestfs mailing list