From 8e5ba8d20f08ab1ce1ac42d988bc9b91ce61b09337044b5964f61b16aef99f16 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Mon, 14 Sep 2015 12:43:07 +0000 Subject: [PATCH] Accepting request 330886 from home:cbosdonnat:branches:Virtualization - Create the .cache folder if it doesn't exist already. bsc#939097. OBS-URL: https://build.opensuse.org/request/show/330886 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=347 --- 0000-hotfix.patch | 43 +++++++++++++++++++++++++++++++++++++++++++ libguestfs.changes | 6 ++++++ 2 files changed, 49 insertions(+) diff --git a/0000-hotfix.patch b/0000-hotfix.patch index 0c62559..c41441c 100644 --- a/0000-hotfix.patch +++ b/0000-hotfix.patch @@ -154,3 +154,46 @@ Index: libguestfs-1.26.10/customize/password.ml | _, _ -> warning ~prog (f_"password: using insecure md5 password encryption for guest of type %s version %d.\nIf this is incorrect, use --password-crypto option and file a bug.") distro major; +Index: libguestfs-1.26.10/builder/builder.ml +=================================================================== +--- libguestfs-1.26.10.orig/builder/builder.ml ++++ libguestfs-1.26.10/builder/builder.ml +@@ -159,7 +159,7 @@ let main () = + (* Try to make the directory. If that fails, warn and continue + * without any cache. + *) +- try mkdir dir 0o755; Some dir ++ try mkdir_p dir 0o755; Some dir + with exn -> + warning ~prog (f_"cache %s: %s") dir (Printexc.to_string exn); + warning ~prog (f_"disabling the cache"); +Index: libguestfs-1.26.10/mllib/common_utils.ml +=================================================================== +--- libguestfs-1.26.10.orig/mllib/common_utils.ml ++++ libguestfs-1.26.10/mllib/common_utils.ml +@@ -508,3 +508,14 @@ let is_char_device file = + let is_directory path = + try Sys.is_directory path + with Sys_error _ -> false ++ ++let rec mkdir_p path permissions = ++ try Unix.mkdir path permissions ++ with ++ | Unix.Unix_error (Unix.EEXIST, _, _) -> () ++ | Unix.Unix_error (Unix.ENOENT, _, _) -> ++ (* A component in the path does not exist, so first try ++ * creating the parent directory, and then again the requested ++ * directory. *) ++ mkdir_p (Filename.dirname path) permissions; ++ Unix.mkdir path permissions +Index: libguestfs-1.26.10/mllib/common_utils.mli +=================================================================== +--- libguestfs-1.26.10.orig/mllib/common_utils.mli ++++ libguestfs-1.26.10/mllib/common_utils.mli +@@ -117,3 +117,6 @@ val is_block_device : string -> bool + val is_char_device : string -> bool + val is_directory : string -> bool + (** These don't throw exceptions, unlike the [Sys] functions. *) ++ ++val mkdir_p : string -> int -> unit ++(** Creates a directory, and its parents if missing. *) diff --git a/libguestfs.changes b/libguestfs.changes index 003a0bd..a66702c 100644 --- a/libguestfs.changes +++ b/libguestfs.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Sep 14 11:27:19 UTC 2015 - cbosdonnat@suse.com + +- Create the .cache folder if it doesn't exist already. + bsc#939097. + ------------------------------------------------------------------- Wed Sep 9 12:50:11 UTC 2015 - cbosdonnat@suse.com