Richard W.M. Jones
2016-Dec-08 13:01 UTC
[Libguestfs] [PATCH 0/2] mllib: Add quote function to Common_utils module.
Doing this allows us to remove the Customize_utils module completely, since it becomes empty. Rich.
Richard W.M. Jones
2016-Dec-08 13:01 UTC
[Libguestfs] [PATCH 1/2] mllib: Add quote function to Common_utils module.
Remove multiple places where we let quote = Filename.quote --- builder/utils.ml | 2 -- customize/customize_utils.ml | 2 -- dib/utils.ml | 2 -- mllib/common_utils.ml | 1 + mllib/common_utils.mli | 3 +++ mllib/curl.ml | 2 -- sparsify/utils.ml | 2 -- v2v/test-harness/v2v_test_harness.ml | 2 -- v2v/utils.ml | 2 -- v2v/utils.mli | 3 --- 10 files changed, 4 insertions(+), 17 deletions(-) diff --git a/builder/utils.ml b/builder/utils.ml index c5adff8..458edf9 100644 --- a/builder/utils.ml +++ b/builder/utils.ml @@ -30,8 +30,6 @@ and revision | Rev_int of int | Rev_string of string -let quote = Filename.quote - let string_of_revision = function | Rev_int n -> string_of_int n | Rev_string s -> s diff --git a/customize/customize_utils.ml b/customize/customize_utils.ml index 29ae89b..feb4a16 100644 --- a/customize/customize_utils.ml +++ b/customize/customize_utils.ml @@ -21,5 +21,3 @@ open Printf open Common_utils - -let quote = Filename.quote diff --git a/dib/utils.ml b/dib/utils.ml index 4026ee8..3775a41 100644 --- a/dib/utils.ml +++ b/dib/utils.ml @@ -21,8 +21,6 @@ open Common_utils open Printf -let quote = Filename.quote - let unit_GB howmany (Int64.of_int howmany) *^ 1024_L *^ 1024_L *^ 1024_L diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index e1d1ab8..f4ddf01 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -234,6 +234,7 @@ module String = struct end let (//) = Filename.concat +let quote = Filename.quote let ( +^ ) = Int64.add let ( -^ ) = Int64.sub diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 7b142d4..4a6ddd6 100644 --- a/mllib/common_utils.mli +++ b/mllib/common_utils.mli @@ -113,6 +113,9 @@ end val ( // ) : string -> string -> string (** Concatenate directory and filename. *) +val quote : string -> string +(** Shell-safe quoting of a string (alias for {!Filename.quote}). *) + val ( +^ ) : int64 -> int64 -> int64 val ( -^ ) : int64 -> int64 -> int64 val ( *^ ) : int64 -> int64 -> int64 diff --git a/mllib/curl.ml b/mllib/curl.ml index baa75ec..fa37254 100644 --- a/mllib/curl.ml +++ b/mllib/curl.ml @@ -20,8 +20,6 @@ open Printf open Common_utils -let quote = Filename.quote - type t = { curl : string; args : args; diff --git a/sparsify/utils.ml b/sparsify/utils.ml index 9a49504..ba715f3 100644 --- a/sparsify/utils.ml +++ b/sparsify/utils.ml @@ -24,8 +24,6 @@ open Common_utils module G = Guestfs -let quote = Filename.quote - (* Return true if the filesystem is a read-only LV (RHBZ#1185561). *) let is_read_only_lv (g : G.guestfs) let lvs = Array.to_list (g#lvs_full ()) in diff --git a/v2v/test-harness/v2v_test_harness.ml b/v2v/test-harness/v2v_test_harness.ml index b7f5e82..3c29a94 100644 --- a/v2v/test-harness/v2v_test_harness.ml +++ b/v2v/test-harness/v2v_test_harness.ml @@ -64,8 +64,6 @@ let default_plan = { let failwithf fs = ksprintf failwith fs -let quote = Filename.quote - let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () let input_disk match input_disk with diff --git a/v2v/utils.ml b/v2v/utils.ml index fb0b802..7485bf0 100644 --- a/v2v/utils.ml +++ b/v2v/utils.ml @@ -23,8 +23,6 @@ open Printf open Common_gettext.Gettext open Common_utils -let quote = Filename.quote - external drive_name : int -> string = "v2v_utils_drive_name" external drive_index : string -> int = "v2v_utils_drive_index" diff --git a/v2v/utils.mli b/v2v/utils.mli index 2bd1329..0a971d2 100644 --- a/v2v/utils.mli +++ b/v2v/utils.mli @@ -18,9 +18,6 @@ (** Utilities used in virt-v2v only. *) -val quote : string -> string -(** The {!Filename.quote} function. *) - val drive_name : int -> string val drive_index : string -> int -- 2.10.2
Richard W.M. Jones
2016-Dec-08 13:01 UTC
[Libguestfs] [PATCH 2/2] customize: Remove Customize_utils module.
After the previous commit this module is empty, so remove it. --- customize/Makefile.am | 1 - customize/customize_main.ml | 1 - customize/customize_run.ml | 1 - customize/customize_utils.ml | 23 ----------------------- customize/firstboot.ml | 1 - customize/password.ml | 2 -- customize/ssh_key.ml | 2 -- customize/timezone.ml | 2 -- generator/customize.ml | 2 -- po/POTFILES-ml | 1 - v2v/Makefile.am | 1 - 11 files changed, 37 deletions(-) delete mode 100644 customize/customize_utils.ml diff --git a/customize/Makefile.am b/customize/Makefile.am index f2e1c15..808f86f 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -52,7 +52,6 @@ SOURCES_MLI = \ # This list must be in dependency order. SOURCES_ML = \ - customize_utils.ml \ append_line.ml \ crypt.ml \ firstboot.ml \ diff --git a/customize/customize_main.ml b/customize/customize_main.ml index 5613277..5b46412 100644 --- a/customize/customize_main.ml +++ b/customize/customize_main.ml @@ -20,7 +20,6 @@ open Common_gettext.Gettext open Common_utils open Getopt.OptionName -open Customize_utils open Customize_cmdline open Printf diff --git a/customize/customize_run.ml b/customize/customize_run.ml index 9ec7b5a..32a2027 100644 --- a/customize/customize_run.ml +++ b/customize/customize_run.ml @@ -22,7 +22,6 @@ open Printf open Common_gettext.Gettext open Common_utils -open Customize_utils open Customize_cmdline open Password open Append_line diff --git a/customize/customize_utils.ml b/customize/customize_utils.ml deleted file mode 100644 index feb4a16..0000000 --- a/customize/customize_utils.ml +++ /dev/null @@ -1,23 +0,0 @@ -(* virt-customize - * Copyright (C) 2013-2016 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -(* Utilities/common functions used in virt-customize only. *) - -open Printf - -open Common_utils diff --git a/customize/firstboot.ml b/customize/firstboot.ml index f7213bc..34e58a0 100644 --- a/customize/firstboot.ml +++ b/customize/firstboot.ml @@ -21,7 +21,6 @@ open Printf open Common_utils open Common_gettext.Gettext -open Customize_utils open Regedit let unix2dos s diff --git a/customize/password.ml b/customize/password.ml index 8a9fed3..fbd42a8 100644 --- a/customize/password.ml +++ b/customize/password.ml @@ -19,8 +19,6 @@ open Common_gettext.Gettext open Common_utils -open Customize_utils - open Printf type password_crypto = [`MD5 | `SHA256 | `SHA512 ] diff --git a/customize/ssh_key.ml b/customize/ssh_key.ml index d05816c..41f900a 100644 --- a/customize/ssh_key.ml +++ b/customize/ssh_key.ml @@ -19,8 +19,6 @@ open Common_gettext.Gettext open Common_utils -open Customize_utils - open Printf open Sys open Unix diff --git a/customize/timezone.ml b/customize/timezone.ml index be5e41d..bc40d6e 100644 --- a/customize/timezone.ml +++ b/customize/timezone.ml @@ -18,8 +18,6 @@ open Common_utils -open Customize_utils - open Printf let set_timezone (g : Guestfs.guestfs) root timezone diff --git a/generator/customize.ml b/generator/customize.ml index 12c78a2..6d0b237 100644 --- a/generator/customize.ml +++ b/generator/customize.ml @@ -626,8 +626,6 @@ open Common_utils open Common_gettext.Gettext open Getopt.OptionName -open Customize_utils - "; generate_ops_struct_decl (); pr "\n"; diff --git a/po/POTFILES-ml b/po/POTFILES-ml index e9827f2..3ec812a 100644 --- a/po/POTFILES-ml +++ b/po/POTFILES-ml @@ -22,7 +22,6 @@ customize/crypt.ml customize/customize_cmdline.ml customize/customize_main.ml customize/customize_run.ml -customize/customize_utils.ml customize/firstboot.ml customize/hostname.ml customize/password.ml diff --git a/v2v/Makefile.am b/v2v/Makefile.am index 2802056..cbb974f 100644 --- a/v2v/Makefile.am +++ b/v2v/Makefile.am @@ -122,7 +122,6 @@ virt_v2v_CFLAGS = \ $(LIBVIRT_CFLAGS) BOBJECTS = \ - $(top_builddir)/customize/customize_utils.cmo \ $(top_builddir)/customize/firstboot.cmo \ $(top_builddir)/customize/SELinux_relabel.cmo \ $(SOURCES_ML:.ml=.cmo) -- 2.10.2
Pino Toscano
2016-Dec-09 09:24 UTC
Re: [Libguestfs] [PATCH 0/2] mllib: Add quote function to Common_utils module.
On Thursday, 8 December 2016 13:01:51 CET Richard W.M. Jones wrote:> Doing this allows us to remove the Customize_utils module > completely, since it becomes empty.The series LGTM. Thanks, -- Pino Toscano