Richard W.M. Jones
2017-Sep-26 12:16 UTC
[Libguestfs] [PATCH 0/5] Miscellaneous refactoring of common/utils, create common/mltools
Miscellaneous refactoring, but the main one is to rename mllib/ as common/mltools/ Rich.
Richard W.M. Jones
2017-Sep-26 12:16 UTC
[Libguestfs] [PATCH 1/5] common/utils: Move ‘full_path’ and ‘is_reg’ (etc) into utils (from visit).
I also renamed the functions with the correct ‘guestfs_int_*’ namespace. The corresponding change is made for OCaml C_utils and Visit. No functional change, just code motion. --- cat/ls.c | 23 ++++--- common/mlutils/c_utils-c.c | 32 +++++++++ common/mlutils/c_utils.ml | 10 +++ common/mlutils/c_utils.mli | 19 ++++++ common/mlvisit/Makefile.am | 6 +- common/mlvisit/visit-c.c | 32 --------- common/mlvisit/visit.ml | 11 --- common/mlvisit/visit.mli | 19 ------ common/mlvisit/visit_tests.ml | 1 + common/utils/guestfs-utils.h | 8 +++ common/utils/utils.c | 109 ++++++++++++++++++++++++++++++ common/visit/visit.c | 82 ++-------------------- common/visit/visit.h | 10 --- diff/diff.c | 36 ++++++---- sysprep/sysprep_operation_backup_files.ml | 1 + 15 files changed, 225 insertions(+), 174 deletions(-) diff --git a/cat/ls.c b/cat/ls.c index d71b800f0..9f0641892 100644 --- a/cat/ls.c +++ b/cat/ls.c @@ -47,6 +47,7 @@ #include "options.h" #include "display-options.h" +#include "guestfs-utils.h" #include "visit.h" /* Currently open libguestfs handle. */ @@ -481,19 +482,19 @@ show_file (const char *dir, const char *name, /* Display the basic fields. */ output_start_line (); - if (is_reg (stat->st_mode)) + if (guestfs_int_is_reg (stat->st_mode)) filetype = "-"; - else if (is_dir (stat->st_mode)) + else if (guestfs_int_is_dir (stat->st_mode)) filetype = "d"; - else if (is_chr (stat->st_mode)) + else if (guestfs_int_is_chr (stat->st_mode)) filetype = "c"; - else if (is_blk (stat->st_mode)) + else if (guestfs_int_is_blk (stat->st_mode)) filetype = "b"; - else if (is_fifo (stat->st_mode)) + else if (guestfs_int_is_fifo (stat->st_mode)) filetype = "p"; - else if (is_lnk (stat->st_mode)) + else if (guestfs_int_is_lnk (stat->st_mode)) filetype = "l"; - else if (is_sock (stat->st_mode)) + else if (guestfs_int_is_sock (stat->st_mode)) filetype = "s"; else filetype = "u"; @@ -527,10 +528,12 @@ show_file (const char *dir, const char *name, output_xattrs (xattrs); */ - path = full_path (dir, name); + path = guestfs_int_full_path (dir, name); + if (!path) + error (EXIT_FAILURE, errno, "guestfs_int_full_path"); if (checksum) { - if (is_reg (stat->st_mode)) { + if (guestfs_int_is_reg (stat->st_mode)) { csum = guestfs_checksum (g, checksum, path); if (!csum) exit (EXIT_FAILURE); @@ -542,7 +545,7 @@ show_file (const char *dir, const char *name, output_string (path); - if (is_lnk (stat->st_mode)) + if (guestfs_int_is_lnk (stat->st_mode)) /* XXX Fix this for NTFS. */ link = guestfs_readlink (g, path); if (link) diff --git a/common/mlutils/c_utils-c.c b/common/mlutils/c_utils-c.c index 50841de42..2e8aeff9b 100644 --- a/common/mlutils/c_utils-c.c +++ b/common/mlutils/c_utils-c.c @@ -75,3 +75,35 @@ guestfs_int_mlutils_shell_unquote (value strv) free (ret); CAMLreturn (retv); } + +#define is(t) \ + value \ + guestfs_int_mlutils_is_##t (value iv) \ + { \ + return Val_bool (guestfs_int_is_##t (Int64_val (iv))); \ + } +is(reg) +is(dir) +is(chr) +is(blk) +is(fifo) +is(lnk) +is(sock) + +value +guestfs_int_mlutils_full_path (value dirv, value namev) +{ + CAMLparam2 (dirv, namev); + CAMLlocal1 (rv); + const char *name = NULL; + char *ret; + + if (namev != Val_int (0)) + name = String_val (Field (namev, 0)); + + ret = guestfs_int_full_path (String_val (dirv), name); + rv = caml_copy_string (ret); + free (ret); + + CAMLreturn (rv); +} diff --git a/common/mlutils/c_utils.ml b/common/mlutils/c_utils.ml index e4263962d..00a6fff4e 100644 --- a/common/mlutils/c_utils.ml +++ b/common/mlutils/c_utils.ml @@ -24,3 +24,13 @@ external drive_name : int -> string = "guestfs_int_mlutils_drive_name" external drive_index : string -> int = "guestfs_int_mlutils_drive_index" external shell_unquote : string -> string = "guestfs_int_mlutils_shell_unquote" + +external is_reg : int64 -> bool = "guestfs_int_mlutils_is_reg" "noalloc" +external is_dir : int64 -> bool = "guestfs_int_mlutils_is_dir" "noalloc" +external is_chr : int64 -> bool = "guestfs_int_mlutils_is_chr" "noalloc" +external is_blk : int64 -> bool = "guestfs_int_mlutils_is_blk" "noalloc" +external is_fifo : int64 -> bool = "guestfs_int_mlutils_is_fifo" "noalloc" +external is_lnk : int64 -> bool = "guestfs_int_mlutils_is_lnk" "noalloc" +external is_sock : int64 -> bool = "guestfs_int_mlutils_is_sock" "noalloc" + +external full_path : string -> string option -> string = "guestfs_int_mlutils_full_path" diff --git a/common/mlutils/c_utils.mli b/common/mlutils/c_utils.mli index 7824f9658..68edc47a9 100644 --- a/common/mlutils/c_utils.mli +++ b/common/mlutils/c_utils.mli @@ -28,3 +28,22 @@ val shell_unquote : string -> string This is just intended to deal with quoting in configuration files (like ones under /etc/sysconfig), and it doesn't deal with some situations such as $variable interpolation. *) + +val is_reg : int64 -> bool +(** Returns true if [G.statns.st_mode] represents a regular file. *) +val is_dir : int64 -> bool +(** Returns true if [G.statns.st_mode] represents a directory. *) +val is_chr : int64 -> bool +(** Returns true if [G.statns.st_mode] represents a character device. *) +val is_blk : int64 -> bool +(** Returns true if [G.statns.st_mode] represents a block device. *) +val is_fifo : int64 -> bool +(** Returns true if [G.statns.st_mode] represents a FIFO. *) +val is_lnk : int64 -> bool +(** Returns true if [G.statns.st_mode] represents a symbolic link. *) +val is_sock : int64 -> bool +(** Returns true if [G.statns.st_mode] represents a Unix domain socket. *) + +val full_path : string -> string option -> string +(** This can be called with the [dir] and [name] parameters from + [visitor_function] to return the full canonical path. *) diff --git a/common/mlvisit/Makefile.am b/common/mlvisit/Makefile.am index fcf3bc0be..6466efbe0 100644 --- a/common/mlvisit/Makefile.am +++ b/common/mlvisit/Makefile.am @@ -70,6 +70,7 @@ XOBJECTS = $(BOBJECTS:.cmo=.cmx) # installed copy of libguestfs. OCAMLPACKAGES = \ -package str,unix \ + -I $(top_builddir)/common/mlutils \ -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ @@ -108,10 +109,13 @@ visit_tests_THEOBJECTS = $(visit_tests_XOBJECTS) visit_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) endif -OCAMLLINKFLAGS = mlguestfs.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) +OCAMLLINKFLAGS = \ + mlcutils.$(MLARCHIVE) \ + mlguestfs.$(MLARCHIVE) $(LINK_CUSTOM_OCAMLC_ONLY) visit_tests_DEPENDENCIES = \ $(visit_tests_THEOBJECTS) \ + ../mlutils/mlcutils.$(MLARCHIVE) \ $(MLVISIT_CMA) \ $(top_srcdir)/ocaml-link.sh visit_tests_LINK = \ diff --git a/common/mlvisit/visit-c.c b/common/mlvisit/visit-c.c index 4cd1c6cea..fcd0428f7 100644 --- a/common/mlvisit/visit-c.c +++ b/common/mlvisit/visit-c.c @@ -133,38 +133,6 @@ visitor_function_wrapper (const char *dir, CAMLreturnT (int, 0); } -value -guestfs_int_mllib_full_path (value dirv, value namev) -{ - CAMLparam2 (dirv, namev); - CAMLlocal1 (rv); - const char *name = NULL; - char *ret; - - if (namev != Val_int (0)) - name = String_val (Field (namev, 0)); - - ret = full_path (String_val (dirv), name); - rv = caml_copy_string (ret); - free (ret); - - CAMLreturn (rv); -} - -#define is(t) \ - value \ - guestfs_int_mllib_is_##t (value iv) \ - { \ - return Val_bool (is_##t (Int64_val (iv))); \ - } -is(reg) -is(dir) -is(chr) -is(blk) -is(fifo) -is(lnk) -is(sock) - /* The functions below are copied from ocaml/guestfs-c-actions.c. */ static value diff --git a/common/mlvisit/visit.ml b/common/mlvisit/visit.ml index c979e3e9e..da2e122ed 100644 --- a/common/mlvisit/visit.ml +++ b/common/mlvisit/visit.ml @@ -23,14 +23,3 @@ external c_visit : int64 -> string -> visitor_function -> unit let visit g dir f c_visit (Guestfs.c_pointer g) dir f - -external full_path : string -> string option -> string - "guestfs_int_mllib_full_path" - -external is_reg : int64 -> bool = "guestfs_int_mllib_is_reg" "noalloc" -external is_dir : int64 -> bool = "guestfs_int_mllib_is_dir" "noalloc" -external is_chr : int64 -> bool = "guestfs_int_mllib_is_chr" "noalloc" -external is_blk : int64 -> bool = "guestfs_int_mllib_is_blk" "noalloc" -external is_fifo : int64 -> bool = "guestfs_int_mllib_is_fifo" "noalloc" -external is_lnk : int64 -> bool = "guestfs_int_mllib_is_lnk" "noalloc" -external is_sock : int64 -> bool = "guestfs_int_mllib_is_sock" "noalloc" diff --git a/common/mlvisit/visit.mli b/common/mlvisit/visit.mli index 57ff85fa9..cba85785e 100644 --- a/common/mlvisit/visit.mli +++ b/common/mlvisit/visit.mli @@ -50,22 +50,3 @@ val visit : Guestfs.t -> string -> visitor_function -> unit If the visit function returns normally you can assume there was no error. *) - -val full_path : string -> string option -> string -(** This can be called with the [dir] and [name] parameters from - [visitor_function] to return the full canonical path. *) - -val is_reg : int64 -> bool -(** Returns true if [G.statns.st_mode] represents a regular file. *) -val is_dir : int64 -> bool -(** Returns true if [G.statns.st_mode] represents a directory. *) -val is_chr : int64 -> bool -(** Returns true if [G.statns.st_mode] represents a character device. *) -val is_blk : int64 -> bool -(** Returns true if [G.statns.st_mode] represents a block device. *) -val is_fifo : int64 -> bool -(** Returns true if [G.statns.st_mode] represents a FIFO. *) -val is_lnk : int64 -> bool -(** Returns true if [G.statns.st_mode] represents a symbolic link. *) -val is_sock : int64 -> bool -(** Returns true if [G.statns.st_mode] represents a Unix domain socket. *) diff --git a/common/mlvisit/visit_tests.ml b/common/mlvisit/visit_tests.ml index f5d2b57d3..7b0f01347 100644 --- a/common/mlvisit/visit_tests.ml +++ b/common/mlvisit/visit_tests.ml @@ -20,6 +20,7 @@ open Printf +open C_utils open Visit module G = Guestfs diff --git a/common/utils/guestfs-utils.h b/common/utils/guestfs-utils.h index 5758059ec..452611620 100644 --- a/common/utils/guestfs-utils.h +++ b/common/utils/guestfs-utils.h @@ -62,6 +62,14 @@ extern void guestfs_int_fadvise_noreuse (int fd); //extern void guestfs_int_fadvise_dontneed (int fd); //extern void guestfs_int_fadvise_willneed (int fd); extern char *guestfs_int_shell_unquote (const char *str); +extern int guestfs_int_is_reg (int64_t mode); +extern int guestfs_int_is_dir (int64_t mode); +extern int guestfs_int_is_chr (int64_t mode); +extern int guestfs_int_is_blk (int64_t mode); +extern int guestfs_int_is_fifo (int64_t mode); +extern int guestfs_int_is_lnk (int64_t mode); +extern int guestfs_int_is_sock (int64_t mode); +extern char *guestfs_int_full_path (const char *dir, const char *name); /* Not all language bindings know how to deal with Pointer arguments. * Those that don't will use this macro which complains noisily and diff --git a/common/utils/utils.c b/common/utils/utils.c index 58953e58a..105fd03cf 100644 --- a/common/utils/utils.c +++ b/common/utils/utils.c @@ -624,3 +624,112 @@ guestfs_int_shell_unquote (const char *str) return strdup (str); } + +/* In the libguestfs API, modes returned by lstat and friends are + * defined to contain Linux ABI values. However since the "current + * operating system" might not be Linux, we have to hard-code those + * numbers in the functions below. + */ + +/** + * Return true if the C<guestfs_statns> or C<guestfs_lstatns> + * C<st_mode> field represents a regular file. + */ +int +guestfs_int_is_reg (int64_t mode) +{ + return (mode & 0170000) == 0100000; +} + +/** + * Return true if the C<guestfs_statns> or C<guestfs_lstatns> + * C<st_mode> field represents a directory. + */ +int +guestfs_int_is_dir (int64_t mode) +{ + return (mode & 0170000) == 0040000; +} + +/** + * Return true if the C<guestfs_statns> or C<guestfs_lstatns> + * C<st_mode> field represents a char device. + */ +int +guestfs_int_is_chr (int64_t mode) +{ + return (mode & 0170000) == 0020000; +} + +/** + * Return true if the C<guestfs_statns> or C<guestfs_lstatns> + * C<st_mode> field represents a block device. + */ +int +guestfs_int_is_blk (int64_t mode) +{ + return (mode & 0170000) == 0060000; +} + +/** + * Return true if the C<guestfs_statns> or C<guestfs_lstatns> + * C<st_mode> field represents a named pipe (FIFO). + */ +int +guestfs_int_is_fifo (int64_t mode) +{ + return (mode & 0170000) == 0010000; +} + +/** + * Return true if the C<guestfs_statns> or C<guestfs_lstatns> + * C<st_mode> field represents a symbolic link. + */ +int +guestfs_int_is_lnk (int64_t mode) +{ + return (mode & 0170000) == 0120000; +} + +/** + * Return true if the C<guestfs_statns> or C<guestfs_lstatns> + * C<st_mode> field represents a Unix domain socket. + */ +int +guestfs_int_is_sock (int64_t mode) +{ + return (mode & 0170000) == 0140000; +} + +/** + * Concatenate C<dir> and C<name> to create a path. This correctly + * handles the case of concatenating C<"/" + "filename"> as well + * as C<"/dir" + "filename">. C<name> may be C<NULL>. + * + * The caller must free the returned path. + * + * This function sets C<errno> and returns C<NULL> on error. + */ +char * +guestfs_int_full_path (const char *dir, const char *name) +{ + int r; + char *path; + int len; + + len = strlen (dir); + if (len > 0 && dir[len - 1] == '/') + --len; + + if (STREQ (dir, "/")) + r = asprintf (&path, "/%s", name ? name : ""); + else if (name) + r = asprintf (&path, "%.*s/%s", len, dir, name); + else + r = asprintf (&path, "%.*s", len, dir); + + if (r == -1) + return NULL; + + return path; +} diff --git a/common/visit/visit.c b/common/visit/visit.c index 18380ab43..a7ee0f8fa 100644 --- a/common/visit/visit.c +++ b/common/visit/visit.c @@ -158,8 +158,12 @@ _visit (guestfs_h *g, int depth, const char *dir, return -1; /* Recursively call visit, but only on directories. */ - if (is_dir (stats->val[i].st_mode)) { - path = full_path (dir, names[i]); + if (guestfs_int_is_dir (stats->val[i].st_mode)) { + path = guestfs_int_full_path (dir, names[i]); + if (!path) { + perror ("guestfs_int_full_path"); + return -1; + } if (_visit (g, depth + 1, path, f, opaque) == -1) return -1; } @@ -167,77 +171,3 @@ _visit (guestfs_h *g, int depth, const char *dir, return 0; } - -char * -full_path (const char *dir, const char *name) -{ - int r; - char *path; - int len; - - len = strlen (dir); - if (len > 0 && dir[len - 1] == '/') - --len; - - if (STREQ (dir, "/")) - r = asprintf (&path, "/%s", name ? name : ""); - else if (name) - r = asprintf (&path, "%.*s/%s", len, dir, name); - else - r = asprintf (&path, "%.*s", len, dir); - - if (r == -1) { - perror ("asprintf"); - abort (); - } - - return path; -} - -/* In the libguestfs API, modes returned by lstat and friends are - * defined to contain Linux ABI values. However since the "current - * operating system" might not be Linux, we have to hard-code those - * numbers here. - */ -int -is_reg (int64_t mode) -{ - return (mode & 0170000) == 0100000; -} - -int -is_dir (int64_t mode) -{ - return (mode & 0170000) == 0040000; -} - -int -is_chr (int64_t mode) -{ - return (mode & 0170000) == 0020000; -} - -int -is_blk (int64_t mode) -{ - return (mode & 0170000) == 0060000; -} - -int -is_fifo (int64_t mode) -{ - return (mode & 0170000) == 0010000; -} - -/* symbolic link */ -int -is_lnk (int64_t mode) -{ - return (mode & 0170000) == 0120000; -} - -int -is_sock (int64_t mode) -{ - return (mode & 0170000) == 0140000; -} diff --git a/common/visit/visit.h b/common/visit/visit.h index 3bf0524ff..c8de5adec 100644 --- a/common/visit/visit.h +++ b/common/visit/visit.h @@ -23,14 +23,4 @@ typedef int (*visitor_function) (const char *dir, const char *name, const struct extern int visit (guestfs_h *g, const char *dir, visitor_function f, void *opaque); -extern char *full_path (const char *dir, const char *name); - -extern int is_reg (int64_t mode); -extern int is_dir (int64_t mode); -extern int is_chr (int64_t mode); -extern int is_blk (int64_t mode); -extern int is_fifo (int64_t mode); -extern int is_lnk (int64_t mode); -extern int is_sock (int64_t mode); - #endif /* VISIT_H */ diff --git a/diff/diff.c b/diff/diff.c index ed02f84b7..5851a1c9c 100644 --- a/diff/diff.c +++ b/diff/diff.c @@ -49,6 +49,7 @@ #include "options.h" #include "display-options.h" +#include "guestfs-utils.h" #include "visit.h" /* Internal tree structure built for each guest. */ @@ -479,7 +480,11 @@ visit_entry (const char *dir, const char *name, struct guestfs_xattr_list *xattrs = NULL; size_t i; - path = full_path (dir, name); + path = guestfs_int_full_path (dir, name); + if (!path) { + perror ("guestfs_int_full_path"); + goto error; + } /* Copy the stats and xattrs because the visit function will * free them after we return. @@ -491,7 +496,7 @@ visit_entry (const char *dir, const char *name, if (xattrs == NULL) goto error; - if (checksum && is_reg (stat->st_mode)) { + if (checksum && guestfs_int_is_reg (stat->st_mode)) { csum = guestfs_checksum (t->g, checksum, path); if (!csum) goto error; @@ -504,13 +509,13 @@ visit_entry (const char *dir, const char *name, /* If --dir-links option was NOT passed, flatten nlink field in * directories. */ - if (!dir_links && is_dir (stat->st_mode)) + if (!dir_links && guestfs_int_is_dir (stat->st_mode)) stat->st_nlink = 0; /* If --dir-times option was NOT passed, flatten time fields in * directories. */ - if (!dir_times && is_dir (stat->st_mode)) + if (!dir_times && guestfs_int_is_dir (stat->st_mode)) stat->st_atime_sec = stat->st_mtime_sec = stat->st_ctime_sec stat->st_atime_nsec = stat->st_mtime_nsec = stat->st_ctime_nsec = 0; @@ -652,7 +657,8 @@ changed (guestfs_h *g1, struct file *file1, { /* Did file content change? */ if (cst != 0 || - (is_reg (file1->stat->st_mode) && is_reg (file2->stat->st_mode) && + (guestfs_int_is_reg (file1->stat->st_mode) && + guestfs_int_is_reg (file2->stat->st_mode) && (file1->stat->st_mtime_sec != file2->stat->st_mtime_sec || file1->stat->st_ctime_sec != file2->stat->st_ctime_sec || file1->stat->st_size != file2->stat->st_size))) { @@ -713,8 +719,8 @@ diff (struct file *file1, guestfs_h *g1, struct file *file2, guestfs_h *g2) CLEANUP_FREE char *tmpd, *tmpda = NULL, *tmpdb = NULL, *cmd = NULL; int r; - assert (is_reg (file1->stat->st_mode)); - assert (is_reg (file2->stat->st_mode)); + assert (guestfs_int_is_reg (file1->stat->st_mode)); + assert (guestfs_int_is_reg (file2->stat->st_mode)); if (asprintf (&tmpd, "%s/virtdiffXXXXXX", tmpdir) < 0) error (EXIT_FAILURE, errno, "asprintf"); @@ -759,19 +765,19 @@ output_file (guestfs_h *g, struct file *file) size_t i; CLEANUP_FREE char *link = NULL; - if (is_reg (file->stat->st_mode)) + if (guestfs_int_is_reg (file->stat->st_mode)) filetype = "-"; - else if (is_dir (file->stat->st_mode)) + else if (guestfs_int_is_dir (file->stat->st_mode)) filetype = "d"; - else if (is_chr (file->stat->st_mode)) + else if (guestfs_int_is_chr (file->stat->st_mode)) filetype = "c"; - else if (is_blk (file->stat->st_mode)) + else if (guestfs_int_is_blk (file->stat->st_mode)) filetype = "b"; - else if (is_fifo (file->stat->st_mode)) + else if (guestfs_int_is_fifo (file->stat->st_mode)) filetype = "p"; - else if (is_lnk (file->stat->st_mode)) + else if (guestfs_int_is_lnk (file->stat->st_mode)) filetype = "l"; - else if (is_sock (file->stat->st_mode)) + else if (guestfs_int_is_sock (file->stat->st_mode)) filetype = "s"; else filetype = "u"; @@ -807,7 +813,7 @@ output_file (guestfs_h *g, struct file *file) output_string (file->path); - if (is_lnk (file->stat->st_mode)) { + if (guestfs_int_is_lnk (file->stat->st_mode)) { /* XXX Fix this for NTFS. */ link = guestfs_readlink (g, file->path); if (link) diff --git a/sysprep/sysprep_operation_backup_files.ml b/sysprep/sysprep_operation_backup_files.ml index 64df8d758..a8b22e1b8 100644 --- a/sysprep/sysprep_operation_backup_files.ml +++ b/sysprep/sysprep_operation_backup_files.ml @@ -19,6 +19,7 @@ open Printf open Std_utils +open C_utils open Common_utils open Common_gettext.Gettext open Visit -- 2.13.2
Richard W.M. Jones
2017-Sep-26 12:16 UTC
[Libguestfs] [PATCH 2/5] common/mlgettext: Move common_gettext.ml{, i} to common/mlgettext.
Mostly just code motion, but common_gettext.mli was the same whether or not ocaml-gettext exists, so instead of generating it, add the file to git. --- .gitignore | 4 +- Makefile.am | 1 + builder/Makefile.am | 3 ++ common/mlgettext/Makefile.am | 86 +++++++++++++++++++++++++++++++++++++ common/mlgettext/common_gettext.mli | 59 +++++++++++++++++++++++++ common/mlgettext/dummy.c | 2 + configure.ac | 1 + customize/Makefile.am | 3 ++ dib/Makefile.am | 3 ++ docs/C_SOURCE_FILES | 1 + docs/guestfs-hacking.pod | 5 +++ get-kernel/Makefile.am | 3 ++ m4/guestfs-ocaml-gettext.m4 | 56 ------------------------ m4/guestfs_ocaml.m4 | 12 +++--- mllib/Makefile.am | 8 +++- ocaml-dep.sh.in | 1 + po/POTFILES | 1 + po/POTFILES-ml | 1 - resize/Makefile.am | 3 ++ sparsify/Makefile.am | 3 ++ sysprep/Makefile.am | 3 ++ v2v/Makefile.am | 4 ++ 22 files changed, 195 insertions(+), 68 deletions(-) diff --git a/.gitignore b/.gitignore index de82ec835..3ffa7302f 100644 --- a/.gitignore +++ b/.gitignore @@ -124,6 +124,8 @@ Makefile.in /common/errnostring/errnostring.h /common/miniexpect/miniexpect.3 /common/mlaugeas/.depend +/common/mlgettext/.depend +/common/mlgettext/common_gettext.ml /common/mlpcre/.depend /common/mlpcre/pcre_tests /common/mlprogress/.depend @@ -378,8 +380,6 @@ Makefile.in /make-fs/virt-make-fs.1 /missing /mllib/.depend -/mllib/common_gettext.ml -/mllib/common_gettext.mli /mllib/common_utils_tests /mllib/getopt_tests /mllib/JSON_tests diff --git a/Makefile.am b/Makefile.am index 10a2c8ae2..eac2288e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -158,6 +158,7 @@ SUBDIRS += csharp # OCaml tools. Note 'common/ml*', 'mllib' and 'customize' contain # shared code used by other OCaml tools, so these must come first. if HAVE_OCAML +SUBDIRS += common/mlgettext SUBDIRS += common/mlprogress SUBDIRS += common/mlvisit SUBDIRS += common/mlxml diff --git a/builder/Makefile.am b/builder/Makefile.am index e3d37667b..2acc6022f 100644 --- a/builder/Makefile.am +++ b/builder/Makefile.am @@ -128,6 +128,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlutils \ + -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/mllib \ -I $(top_builddir)/customize @@ -159,6 +160,7 @@ OBJECTS = $(XOBJECTS) endif OCAMLLINKFLAGS = \ + mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlstdutils.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ @@ -170,6 +172,7 @@ OCAMLLINKFLAGS = \ virt_builder_DEPENDENCIES = \ $(OBJECTS) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ ../mllib/mllib.$(MLARCHIVE) \ diff --git a/common/mlgettext/Makefile.am b/common/mlgettext/Makefile.am new file mode 100644 index 000000000..0b232fb55 --- /dev/null +++ b/common/mlgettext/Makefile.am @@ -0,0 +1,86 @@ +# Wrapper around ocaml-gettext. +# Copyright (C) 2009-2017 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. + +include $(top_srcdir)/subdir-rules.mk + +EXTRA_DIST = \ + $(SOURCES_MLI) \ + $(SOURCES_ML) + +SOURCES_MLI = \ + common_gettext.mli + +SOURCES_ML = \ + common_gettext.ml + +if HAVE_OCAML + +# We pretend that we're building a C library. automake handles the +# compilation of the C sources for us. At the end we take the C +# objects and OCaml objects and link them into the OCaml library. +# This C library is never used. + +noinst_LIBRARIES = libmlgettext.a + +if !HAVE_OCAMLOPT +MLGETTEXT_CMA = mlgettext.cma +else +MLGETTEXT_CMA = mlgettext.cmxa +endif + +noinst_DATA = $(MLGETTEXT_CMA) + +libmlgettext_a_SOURCES = dummy.c +libmlgettext_a_CPPFLAGS = \ + -I. \ + -I$(top_builddir) +libmlgettext_a_CFLAGS = \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ + -fPIC + +BOBJECTS = $(SOURCES_ML:.ml=.cmo) +XOBJECTS = $(BOBJECTS:.cmo=.cmx) + +OCAMLPACKAGES = -I $(builddir) +if HAVE_OCAML_PKG_GETTEXT +OCAMLPACKAGES += -package gettext-stub +endif + +OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) + +if !HAVE_OCAMLOPT +OBJECTS = $(BOBJECTS) +else +OBJECTS = $(XOBJECTS) +endif + +libmlgettext_a_DEPENDENCIES = $(OBJECTS) + +mlgettext.cma: $(BOBJECTS) + $(OCAMLFIND) ocamlc $(OCAMLPACKAGES) -a $^ -o $@ + +if HAVE_OCAMLOPT +mlgettext.cmxa: $(XOBJECTS) + $(OCAMLFIND) ocamlopt $(OCAMLPACKAGES) -a $^ -o $@ +endif + +# Dependencies. +.depend: *.mli *.ml + $(top_builddir)/ocaml-dep.sh $^ +-include .depend + +endif diff --git a/common/mlgettext/common_gettext.mli b/common/mlgettext/common_gettext.mli new file mode 100644 index 000000000..d333458ce --- /dev/null +++ b/common/mlgettext/common_gettext.mli @@ -0,0 +1,59 @@ +(* Wrapper around ocaml-gettext. + * Copyright (C) 2009-2017 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. + *) + +(** Gettext functions for OCaml virt tools. + + The Common_gettext module provides gettext functions, or dummy + functions if ocaml-gettext was not available at configure time. + + {b Note}: Don't translate debug strings, or strings which are + meant to be read/written only by machine. + + There are two ways to translate constant strings in OCaml programs. + + For ordinary strings, replace ["string"] with [s_"string"]. Since + this is a function call to a function called [s_], you may have + to put parentheses around the expression. + + For format strings, use: + +{v + printf (f_"zeroing filesystem %s") filename; +v} + + Note for format strings, the parentheses are almost always required, + and they just go around the [(f_"string")], {i not} around the other + arguments of the printf function. + + At build time, a program parses the OCaml code into an abstract + syntax tree and statically determines all calls to the special + [s_] and [f_] functions, which means: (a) You can be very loose + with syntax, unlike ordinary xgettext, but (b) you cannot rename + these functions. +*) + +module Gettext : sig + val s_ : string -> string + val f_ : + ('a, 'b, 'c, 'c, 'c, 'd) format6 -> ('a, 'b, 'c, 'c, 'c, 'd) format6 + val sn_ : string -> string -> int -> string + val fn_ : + ('a, 'b, 'c, 'c, 'c, 'd) format6 -> + ('a, 'b, 'c, 'c, 'c, 'd) format6 -> + int -> ('a, 'b, 'c, 'c, 'c, 'd) format6 +end diff --git a/common/mlgettext/dummy.c b/common/mlgettext/dummy.c new file mode 100644 index 000000000..ebab6198c --- /dev/null +++ b/common/mlgettext/dummy.c @@ -0,0 +1,2 @@ +/* Dummy source, to be used for OCaml-based tools with no C sources. */ +enum { foo = 1 }; diff --git a/configure.ac b/configure.ac index 1ab54500d..f1deadde9 100644 --- a/configure.ac +++ b/configure.ac @@ -227,6 +227,7 @@ AC_CONFIG_FILES([Makefile common/edit/Makefile common/miniexpect/Makefile common/mlaugeas/Makefile + common/mlgettext/Makefile common/mlpcre/Makefile common/mlprogress/Makefile common/mlstdutils/Makefile diff --git a/customize/Makefile.am b/customize/Makefile.am index ff2c2e2d0..b3edc2e9b 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -126,6 +126,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlutils \ + -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/mllib \ -I $(builddir) @@ -156,6 +157,7 @@ endif OCAMLLINKFLAGS = \ mlstdutils.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ + mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ mllib.$(MLARCHIVE) \ @@ -178,6 +180,7 @@ virt_customize_DEPENDENCIES = \ $(CUSTOMIZE_THEOBJECTS) \ $(CUSTOMIZE_CMA) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../mllib/mllib.$(MLARCHIVE) virt_customize_LINK = \ diff --git a/dib/Makefile.am b/dib/Makefile.am index fda074b45..37fa3224b 100644 --- a/dib/Makefile.am +++ b/dib/Makefile.am @@ -85,6 +85,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlutils \ + -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/mllib if HAVE_OCAML_PKG_GETTEXT @@ -110,6 +111,7 @@ OCAMLLINKFLAGS = \ mlstdutils.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ + mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mllib.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) @@ -118,6 +120,7 @@ virt_dib_DEPENDENCIES = \ $(OBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../mllib/mllib.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index 2b947a81c..9ef9b0257 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -16,6 +16,7 @@ common/edit/file-edit.h common/miniexpect/miniexpect.c common/miniexpect/miniexpect.h common/mlaugeas/augeas-c.c +common/mlgettext/dummy.c common/mlpcre/dummy.c common/mlpcre/pcre-c.c common/mlprogress/progress-c.c diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index d0a28b094..56982d2c8 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -105,6 +105,11 @@ in virt-p2v. Bindings for the Augeas library. These come from the ocaml-augeas library L<http://git.annexia.org/?p=ocaml-augeas.git> +=item F<common/mlgettext> + +Small, generated wrapper which allows libguestfs to be compiled with +or without ocaml-gettext. This is generated by F<./configure>. + =item F<common/mlpcre> Lightweight OCaml bindings for Perl Compatible Regular Expressions diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am index f833f35f4..dad96bbe2 100644 --- a/get-kernel/Makefile.am +++ b/get-kernel/Makefile.am @@ -68,6 +68,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlutils \ + -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/mllib if HAVE_OCAML_PKG_GETTEXT @@ -92,6 +93,7 @@ endif OCAMLLINKFLAGS = \ mlstdutils.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ + mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ mllib.$(MLARCHIVE) \ @@ -101,6 +103,7 @@ virt_get_kernel_DEPENDENCIES = \ $(OBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../mllib/mllib.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh diff --git a/m4/guestfs-ocaml-gettext.m4 b/m4/guestfs-ocaml-gettext.m4 index a95a062dd..ebb203226 100644 --- a/m4/guestfs-ocaml-gettext.m4 +++ b/m4/guestfs-ocaml-gettext.m4 @@ -62,59 +62,3 @@ EOF chmod -w $1 ]) - -AC_DEFUN([GUESTFS_CREATE_COMMON_GETTEXT_MLI],[ - dnl Check for ocaml-gettext package to translate OCaml tools. - AC_CHECK_OCAML_PKG(gettext) - - AC_MSG_NOTICE([creating $1]) - rm -f $1 - - cat <<EOF > $1 -(* This file is generated automatically by ./configure. *) - -(** Gettext functions for OCaml virt tools. - - The Common_gettext module provides gettext functions, or dummy - functions if ocaml-gettext was not available at configure time. - - {b Note}: Don't translate debug strings, or strings which are - meant to be read/written only by machine. - - There are two ways to translate constant strings in OCaml programs. - - For ordinary strings, replace [["string"]] with [[s_"string"]]. Since - this is a function call to a function called [[s_]], you may have - to put parentheses around the expression. - - For format strings, use: - -{v - printf (f_"zeroing filesystem %s") filename; -v} - - Note for format strings, the parentheses are almost always required, - and they just go around the [[(f_"string")]], {i not} around the other - arguments of the printf function. - - At build time, a program parses the OCaml code into an abstract - syntax tree and statically determines all calls to the special - [[s_]] and [[f_]] functions, which means: (a) You can be very loose - with syntax, unlike ordinary xgettext, but (b) you cannot rename - these functions. -*) - -module Gettext : sig - val s_ : string -> string - val f_ : - ('a, 'b, 'c, 'c, 'c, 'd) format6 -> ('a, 'b, 'c, 'c, 'c, 'd) format6 - val sn_ : string -> string -> int -> string - val fn_ : - ('a, 'b, 'c, 'c, 'c, 'd) format6 -> - ('a, 'b, 'c, 'c, 'c, 'd) format6 -> - int -> ('a, 'b, 'c, 'c, 'c, 'd) format6 -end -EOF - - chmod -w $1 -]) diff --git a/m4/guestfs_ocaml.m4 b/m4/guestfs_ocaml.m4 index bb4cfb070..f3d470929 100644 --- a/m4/guestfs_ocaml.m4 +++ b/m4/guestfs_ocaml.m4 @@ -90,15 +90,13 @@ OCAML_PKG_oUnit=no ounit_is_v2=no have_Bytes_module=no AS_IF([test "x$OCAMLC" != "xno"],[ - # Create mllib/common_gettext.ml and mllib/commit_gettext.mli, - # gettext functions or stubs. + # Create common/mlgettext/common_gettext.ml gettext functions or stubs. - # If we're building in a different directory, then mllib/ might - # not exist yet, so create it: - mkdir -p mllib + # If we're building in a different directory, then common/mlgettext + # might not exist yet, so create it: + mkdir -p common/mlgettext - GUESTFS_CREATE_COMMON_GETTEXT_ML([mllib/common_gettext.ml]) - GUESTFS_CREATE_COMMON_GETTEXT_MLI([mllib/common_gettext.mli]) + GUESTFS_CREATE_COMMON_GETTEXT_ML([common/mlgettext/common_gettext.ml]) AC_CHECK_OCAML_PKG(libvirt) AC_CHECK_OCAML_PKG(oUnit) diff --git a/mllib/Makefile.am b/mllib/Makefile.am index 3f2af3c61..f9f23c669 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -28,7 +28,6 @@ EXTRA_DIST = \ SOURCES_MLI = \ checksums.mli \ - common_gettext.mli \ common_utils.mli \ curl.mli \ getopt.mli \ @@ -40,7 +39,6 @@ SOURCES_MLI = \ xpath_helpers.mli SOURCES_ML = \ - common_gettext.ml \ getopt.ml \ common_utils.ml \ URI.ml \ @@ -86,6 +84,7 @@ libmllib_a_CPPFLAGS = \ -I$(top_srcdir)/common/utils \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/common/options \ + -I$(top_srcdir)/common/mlgettext \ -I$(top_srcdir)/common/mlpcre \ -I$(top_srcdir)/common/mlxml \ -I$(top_srcdir)/common/mlstdutils \ @@ -107,6 +106,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/lib/.libs \ -I $(top_builddir)/gnulib/lib/.libs \ -I $(top_builddir)/ocaml \ + -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/common/mlxml \ -I $(top_builddir)/common/mlstdutils \ @@ -191,6 +191,7 @@ endif OCAMLLINKFLAGS = \ mlstdutils.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ + mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) @@ -198,6 +199,7 @@ OCAMLLINKFLAGS = \ common_utils_tests_DEPENDENCIES = \ $(common_utils_tests_THEOBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ $(MLLIB_CMA) \ $(top_srcdir)/ocaml-link.sh @@ -210,6 +212,7 @@ common_utils_tests_LINK = \ getopt_tests_DEPENDENCIES = \ $(getopt_tests_THEOBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ $(MLLIB_CMA) \ $(top_srcdir)/ocaml-link.sh @@ -222,6 +225,7 @@ getopt_tests_LINK = \ JSON_tests_DEPENDENCIES = \ $(JSON_tests_THEOBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ $(MLLIB_CMA) \ $(top_srcdir)/ocaml-link.sh diff --git a/ocaml-dep.sh.in b/ocaml-dep.sh.in index a8c501cf8..1bea4da72 100755 --- a/ocaml-dep.sh.in +++ b/ocaml-dep.sh.in @@ -34,6 +34,7 @@ set -e # dependencies don't get built right. include_dirs=" common/mlaugeas +common/mlgettext common/mlpcre common/mlprogress common/mlstdutils diff --git a/po/POTFILES b/po/POTFILES index 7d58151b3..c8a36a247 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -17,6 +17,7 @@ common/errnostring/errnostring-gperf.c common/errnostring/errnostring.c common/miniexpect/miniexpect.c common/mlaugeas/augeas-c.c +common/mlgettext/dummy.c common/mlpcre/dummy.c common/mlpcre/pcre-c.c common/mlprogress/progress-c.c diff --git a/po/POTFILES-ml b/po/POTFILES-ml index 9b8752915..f4cb5f154 100644 --- a/po/POTFILES-ml +++ b/po/POTFILES-ml @@ -48,7 +48,6 @@ mllib/JSON.ml mllib/JSON_tests.ml mllib/URI.ml mllib/checksums.ml -mllib/common_gettext.ml mllib/common_utils.ml mllib/common_utils_tests.ml mllib/curl.ml diff --git a/resize/Makefile.am b/resize/Makefile.am index 035bfb9fe..2dd33c797 100644 --- a/resize/Makefile.am +++ b/resize/Makefile.am @@ -65,6 +65,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlprogress \ -I $(top_builddir)/common/mlutils \ + -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/mllib if HAVE_OCAML_PKG_GETTEXT @@ -91,6 +92,7 @@ OCAMLLINKFLAGS = \ mlstdutils.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ mlprogress.$(MLARCHIVE) \ + mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ mllib.$(MLARCHIVE) \ @@ -100,6 +102,7 @@ virt_resize_DEPENDENCIES = \ $(OBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../mllib/mllib.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am index 427d35670..d8efc4bc2 100644 --- a/sparsify/Makefile.am +++ b/sparsify/Makefile.am @@ -73,6 +73,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlprogress \ -I $(top_builddir)/common/mlutils \ + -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/mllib if HAVE_OCAML_PKG_GETTEXT @@ -99,6 +100,7 @@ OCAMLLINKFLAGS = \ mlstdutils.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ mlprogress.$(MLARCHIVE) \ + mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ mllib.$(MLARCHIVE) \ @@ -108,6 +110,7 @@ virt_sparsify_DEPENDENCIES = \ $(OBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../mllib/mllib.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index c1aca2966..778c36c8b 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -117,6 +117,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/visit/.libs \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlutils \ + -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/common/mlvisit \ -I $(top_builddir)/mllib \ @@ -146,6 +147,7 @@ endif OCAMLLINKFLAGS = \ mlstdutils.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ + mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ mllib.$(MLARCHIVE) \ @@ -157,6 +159,7 @@ virt_sysprep_DEPENDENCIES = \ $(OBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../mllib/mllib.$(MLARCHIVE) \ ../customize/customize.$(MLARCHIVE) \ diff --git a/v2v/Makefile.am b/v2v/Makefile.am index 3a38b3a98..b7148e2c2 100644 --- a/v2v/Makefile.am +++ b/v2v/Makefile.am @@ -151,6 +151,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlutils \ + -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/common/mlxml \ -I $(top_builddir)/mllib \ @@ -178,6 +179,7 @@ endif OCAMLLINKFLAGS = \ mlstdutils.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ + mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlxml.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ @@ -220,6 +222,7 @@ virt_v2v_copy_to_local_DEPENDENCIES = \ $(COPY_TO_LOCAL_OBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlxml/mlxml.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ ../mllib/mllib.$(MLARCHIVE) \ @@ -511,6 +514,7 @@ v2v_unit_tests_DEPENDENCIES = \ $(v2v_unit_tests_THEOBJECTS) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlxml/mlxml.$(MLARCHIVE) \ + ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ ../mllib/mllib.$(MLARCHIVE) \ -- 2.13.2
Richard W.M. Jones
2017-Sep-26 12:16 UTC
[Libguestfs] [PATCH 3/5] po: Add common/ml* directories to POTFILES-ml.
Although it's not too likely that these libraries will contain translatable strings, it's consistent to add them to po/POTFILES-ml because mllib/*.ml are also in this file. --- Makefile.am | 2 +- po/POTFILES-ml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index eac2288e7..913a40325 100644 --- a/Makefile.am +++ b/Makefile.am @@ -351,7 +351,7 @@ po/POTFILES: configure.ac po/POTFILES-ml: configure.ac rm -f $@ $@-t cd $(srcdir); \ - find builder customize dib get-kernel mllib resize sparsify sysprep v2v -name '*.ml' | \ + find builder common/ml* customize dib get-kernel mllib resize sparsify sysprep v2v -name '*.ml' | \ grep -v '^builder/templates/' | \ LC_ALL=C sort > $@-t mv $@-t $@ diff --git a/po/POTFILES-ml b/po/POTFILES-ml index f4cb5f154..23c6e50b0 100644 --- a/po/POTFILES-ml +++ b/po/POTFILES-ml @@ -16,6 +16,22 @@ builder/sources.ml builder/utils.ml builder/yajl.ml builder/yajl_tests.ml +common/mlaugeas/augeas.ml +common/mlgettext/common_gettext.ml +common/mlpcre/PCRE.ml +common/mlpcre/pcre_tests.ml +common/mlprogress/progress.ml +common/mlstdutils/guestfs_config.ml +common/mlstdutils/std_utils.ml +common/mlstdutils/std_utils_tests.ml +common/mlstdutils/stringMap.ml +common/mlstdutils/stringSet.ml +common/mlutils/c_utils.ml +common/mlutils/c_utils_unit_tests.ml +common/mlutils/unix_utils.ml +common/mlvisit/visit.ml +common/mlvisit/visit_tests.ml +common/mlxml/xml.ml customize/SELinux_relabel.ml customize/append_line.ml customize/crypt.ml -- 2.13.2
Richard W.M. Jones
2017-Sep-26 12:16 UTC
[Libguestfs] [PATCH 4/5] Rename mllib -> common/mltools.
This directory which previously contained random modules and functions now has an official purpose: to be the place for any OCaml utility needed by the OCaml virt tools. This is just code movement, I didn't (yet) rename or move any of the modules. --- .gitignore | 10 ++--- Makefile.am | 8 ++-- builder/Makefile.am | 8 ++-- {mllib => common/mltools}/JSON.ml | 0 {mllib => common/mltools}/JSON.mli | 0 {mllib => common/mltools}/JSON_tests.ml | 4 +- {mllib => common/mltools}/Makefile.am | 52 ++++++++++++------------- {mllib => common/mltools}/URI.ml | 0 {mllib => common/mltools}/URI.mli | 0 {mllib => common/mltools}/checksums.ml | 0 {mllib => common/mltools}/checksums.mli | 0 {mllib => common/mltools}/common_utils-c.c | 0 {mllib => common/mltools}/common_utils.ml | 0 {mllib => common/mltools}/common_utils.mli | 0 {mllib => common/mltools}/common_utils_tests.ml | 0 {mllib => common/mltools}/curl.ml | 0 {mllib => common/mltools}/curl.mli | 0 {mllib => common/mltools}/dummy.c | 0 {mllib => common/mltools}/getopt-c.c | 0 {mllib => common/mltools}/getopt.ml | 0 {mllib => common/mltools}/getopt.mli | 0 {mllib => common/mltools}/getopt_tests.ml | 0 {mllib => common/mltools}/planner.ml | 0 {mllib => common/mltools}/planner.mli | 0 {mllib => common/mltools}/regedit.ml | 0 {mllib => common/mltools}/regedit.mli | 0 {mllib => common/mltools}/registry.ml | 0 {mllib => common/mltools}/registry.mli | 0 {mllib => common/mltools}/test-getopt.sh | 0 {mllib => common/mltools}/uri-c.c | 0 {mllib => common/mltools}/xpath_helpers.ml | 0 {mllib => common/mltools}/xpath_helpers.mli | 0 common/options/display-options.c | 2 +- configure.ac | 2 +- customize/Makefile.am | 6 +-- dib/Makefile.am | 6 +-- dib/output_format.mli | 2 +- docs/C_SOURCE_FILES | 8 ++-- docs/guestfs-hacking.pod | 10 ++--- get-kernel/Makefile.am | 6 +-- ocaml-dep.sh.in | 2 +- resize/Makefile.am | 6 +-- sparsify/Makefile.am | 6 +-- sysprep/Makefile.am | 6 +-- sysprep/sysprep_operation.mli | 2 +- v2v/Makefile.am | 8 ++-- v2v/test-harness/Makefile.am | 2 +- 47 files changed, 78 insertions(+), 78 deletions(-) diff --git a/.gitignore b/.gitignore index 3ffa7302f..0932f9ea6 100644 --- a/.gitignore +++ b/.gitignore @@ -134,6 +134,11 @@ Makefile.in /common/mlstdutils/guestfs_config.ml /common/mlstdutils/oUnit-* /common/mlstdutils/std_utils_tests +/common/mltools/.depend +/common/mltools/common_utils_tests +/common/mltools/getopt_tests +/common/mltools/JSON_tests +/common/mltools/oUnit-* /common/mlutils/.depend /common/mlutils/c_utils_unit_tests /common/mlutils/oUnit-* @@ -379,11 +384,6 @@ Makefile.in /make-fs/virt-make-fs /make-fs/virt-make-fs.1 /missing -/mllib/.depend -/mllib/common_utils_tests -/mllib/getopt_tests -/mllib/JSON_tests -/mllib/oUnit-* /ocaml-dep.sh /ocaml/bindtests.bc /ocaml/bindtests.opt diff --git a/Makefile.am b/Makefile.am index 913a40325..81b0058f7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -155,14 +155,14 @@ endif # Unconditional because nothing is built yet. SUBDIRS += csharp -# OCaml tools. Note 'common/ml*', 'mllib' and 'customize' contain -# shared code used by other OCaml tools, so these must come first. +# OCaml tools. Note 'common/ml*' and 'customize' contain shared code +# used by other OCaml tools, so these must come first. if HAVE_OCAML SUBDIRS += common/mlgettext SUBDIRS += common/mlprogress SUBDIRS += common/mlvisit SUBDIRS += common/mlxml -SUBDIRS += mllib +SUBDIRS += common/mltools SUBDIRS += customize SUBDIRS += builder builder/templates SUBDIRS += get-kernel @@ -351,7 +351,7 @@ po/POTFILES: configure.ac po/POTFILES-ml: configure.ac rm -f $@ $@-t cd $(srcdir); \ - find builder common/ml* customize dib get-kernel mllib resize sparsify sysprep v2v -name '*.ml' | \ + find builder common/ml* customize dib get-kernel resize sparsify sysprep v2v -name '*.ml' | \ grep -v '^builder/templates/' | \ LC_ALL=C sort > $@-t mv $@-t $@ diff --git a/builder/Makefile.am b/builder/Makefile.am index 2acc6022f..8407800d1 100644 --- a/builder/Makefile.am +++ b/builder/Makefile.am @@ -130,7 +130,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlutils \ -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ - -I $(top_builddir)/mllib \ + -I $(top_builddir)/common/mltools \ -I $(top_builddir)/customize OCAMLPACKAGES_TESTS if HAVE_OCAML_PKG_GETTEXT @@ -165,7 +165,7 @@ OCAMLLINKFLAGS = \ mlstdutils.$(MLARCHIVE) \ mlguestfs.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ - mllib.$(MLARCHIVE) \ + mltools.$(MLARCHIVE) \ customize.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) @@ -175,7 +175,7 @@ virt_builder_DEPENDENCIES = \ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) \ + ../common/mltools/mltools.$(MLARCHIVE) \ ../customize/customize.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh virt_builder_LINK = \ @@ -249,7 +249,7 @@ yajl_tests_DEPENDENCIES = \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) \ + ../common/mltools/mltools.$(MLARCHIVE) \ ../customize/customize.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh yajl_tests_LINK = \ diff --git a/mllib/JSON.ml b/common/mltools/JSON.ml similarity index 100% rename from mllib/JSON.ml rename to common/mltools/JSON.ml diff --git a/mllib/JSON.mli b/common/mltools/JSON.mli similarity index 100% rename from mllib/JSON.mli rename to common/mltools/JSON.mli diff --git a/mllib/JSON_tests.ml b/common/mltools/JSON_tests.ml similarity index 99% rename from mllib/JSON_tests.ml rename to common/mltools/JSON_tests.ml index 281d38e0a..55a474474 100644 --- a/mllib/JSON_tests.ml +++ b/common/mltools/JSON_tests.ml @@ -1,4 +1,4 @@ -(* mllib +(* mltools JSON tests * Copyright (C) 2015 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify @@ -221,7 +221,7 @@ let test_builder ctx (* Suites declaration. *) let suite - "mllib JSON" >::: + "mltools JSON" >::: [ "basic.empty" >:: test_empty; "basic.string" >:: test_string; diff --git a/mllib/Makefile.am b/common/mltools/Makefile.am similarity index 87% rename from mllib/Makefile.am rename to common/mltools/Makefile.am index f9f23c669..b00e126a1 100644 --- a/mllib/Makefile.am +++ b/common/mltools/Makefile.am @@ -51,9 +51,9 @@ SOURCES_ML = \ xpath_helpers.ml SOURCES_C = \ - ../common/options/decrypt.c \ - ../common/options/keys.c \ - ../common/options/uri.c \ + ../options/decrypt.c \ + ../options/keys.c \ + ../options/uri.c \ common_utils-c.c \ getopt-c.c \ uri-c.c @@ -65,18 +65,18 @@ if HAVE_OCAML # objects and OCaml objects and link them into the OCaml library. # This C library is never used. -noinst_LIBRARIES = libmllib.a +noinst_LIBRARIES = libmltools.a if !HAVE_OCAMLOPT -MLLIB_CMA = mllib.cma +MLTOOLS_CMA = mltools.cma else -MLLIB_CMA = mllib.cmxa +MLTOOLS_CMA = mltools.cmxa endif -noinst_DATA = $(MLLIB_CMA) +noinst_DATA = $(MLTOOLS_CMA) -libmllib_a_SOURCES = $(SOURCES_C) -libmllib_a_CPPFLAGS = \ +libmltools_a_SOURCES = $(SOURCES_C) +libmltools_a_CPPFLAGS = \ -I. \ -I$(top_builddir) \ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ @@ -89,7 +89,7 @@ libmllib_a_CPPFLAGS = \ -I$(top_srcdir)/common/mlxml \ -I$(top_srcdir)/common/mlstdutils \ -I$(top_srcdir)/common/mlutils -libmllib_a_CFLAGS = \ +libmltools_a_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \ -fPIC @@ -112,7 +112,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlutils \ -I $(builddir) -OCAMLPACKAGES_TESTS = $(MLLIB_CMA) +OCAMLPACKAGES_TESTS = $(MLTOOLS_CMA) if HAVE_OCAML_PKG_GETTEXT OCAMLPACKAGES += -package gettext-stub endif @@ -137,11 +137,11 @@ else OBJECTS = $(XOBJECTS) endif -libmllib_a_DEPENDENCIES = $(OBJECTS) +libmltools_a_DEPENDENCIES = $(OBJECTS) -$(MLLIB_CMA): $(OBJECTS) libmllib.a +$(MLTOOLS_CMA): $(OBJECTS) libmltools.a $(OCAMLFIND) mklib $(OCAMLPACKAGES) \ - $(OBJECTS) $(libmllib_a_OBJECTS) -o mllib + $(OBJECTS) $(libmltools_a_OBJECTS) -o mltools # Tests. @@ -198,10 +198,10 @@ OCAMLLINKFLAGS = \ common_utils_tests_DEPENDENCIES = \ $(common_utils_tests_THEOBJECTS) \ - ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ - ../common/mlgettext/mlgettext.$(MLARCHIVE) \ - ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - $(MLLIB_CMA) \ + ../mlstdutils/mlstdutils.$(MLARCHIVE) \ + ../mlgettext/mlgettext.$(MLARCHIVE) \ + ../mlpcre/mlpcre.$(MLARCHIVE) \ + $(MLTOOLS_CMA) \ $(top_srcdir)/ocaml-link.sh common_utils_tests_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '-lutils $(LIBXML2_LIBS) -lgnu' -- \ @@ -211,10 +211,10 @@ common_utils_tests_LINK = \ getopt_tests_DEPENDENCIES = \ $(getopt_tests_THEOBJECTS) \ - ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ - ../common/mlgettext/mlgettext.$(MLARCHIVE) \ - ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - $(MLLIB_CMA) \ + ../mlstdutils/mlstdutils.$(MLARCHIVE) \ + ../mlgettext/mlgettext.$(MLARCHIVE) \ + ../mlpcre/mlpcre.$(MLARCHIVE) \ + $(MLTOOLS_CMA) \ $(top_srcdir)/ocaml-link.sh getopt_tests_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '-lutils $(LIBXML2_LIBS) -lgnu' -- \ @@ -224,10 +224,10 @@ getopt_tests_LINK = \ JSON_tests_DEPENDENCIES = \ $(JSON_tests_THEOBJECTS) \ - ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ - ../common/mlgettext/mlgettext.$(MLARCHIVE) \ - ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - $(MLLIB_CMA) \ + ../mlstdutils/mlstdutils.$(MLARCHIVE) \ + ../mlgettext/mlgettext.$(MLARCHIVE) \ + ../mlpcre/mlpcre.$(MLARCHIVE) \ + $(MLTOOLS_CMA) \ $(top_srcdir)/ocaml-link.sh JSON_tests_LINK = \ $(top_srcdir)/ocaml-link.sh -- \ diff --git a/mllib/URI.ml b/common/mltools/URI.ml similarity index 100% rename from mllib/URI.ml rename to common/mltools/URI.ml diff --git a/mllib/URI.mli b/common/mltools/URI.mli similarity index 100% rename from mllib/URI.mli rename to common/mltools/URI.mli diff --git a/mllib/checksums.ml b/common/mltools/checksums.ml similarity index 100% rename from mllib/checksums.ml rename to common/mltools/checksums.ml diff --git a/mllib/checksums.mli b/common/mltools/checksums.mli similarity index 100% rename from mllib/checksums.mli rename to common/mltools/checksums.mli diff --git a/mllib/common_utils-c.c b/common/mltools/common_utils-c.c similarity index 100% rename from mllib/common_utils-c.c rename to common/mltools/common_utils-c.c diff --git a/mllib/common_utils.ml b/common/mltools/common_utils.ml similarity index 100% rename from mllib/common_utils.ml rename to common/mltools/common_utils.ml diff --git a/mllib/common_utils.mli b/common/mltools/common_utils.mli similarity index 100% rename from mllib/common_utils.mli rename to common/mltools/common_utils.mli diff --git a/mllib/common_utils_tests.ml b/common/mltools/common_utils_tests.ml similarity index 100% rename from mllib/common_utils_tests.ml rename to common/mltools/common_utils_tests.ml diff --git a/mllib/curl.ml b/common/mltools/curl.ml similarity index 100% rename from mllib/curl.ml rename to common/mltools/curl.ml diff --git a/mllib/curl.mli b/common/mltools/curl.mli similarity index 100% rename from mllib/curl.mli rename to common/mltools/curl.mli diff --git a/mllib/dummy.c b/common/mltools/dummy.c similarity index 100% rename from mllib/dummy.c rename to common/mltools/dummy.c diff --git a/mllib/getopt-c.c b/common/mltools/getopt-c.c similarity index 100% rename from mllib/getopt-c.c rename to common/mltools/getopt-c.c diff --git a/mllib/getopt.ml b/common/mltools/getopt.ml similarity index 100% rename from mllib/getopt.ml rename to common/mltools/getopt.ml diff --git a/mllib/getopt.mli b/common/mltools/getopt.mli similarity index 100% rename from mllib/getopt.mli rename to common/mltools/getopt.mli diff --git a/mllib/getopt_tests.ml b/common/mltools/getopt_tests.ml similarity index 100% rename from mllib/getopt_tests.ml rename to common/mltools/getopt_tests.ml diff --git a/mllib/planner.ml b/common/mltools/planner.ml similarity index 100% rename from mllib/planner.ml rename to common/mltools/planner.ml diff --git a/mllib/planner.mli b/common/mltools/planner.mli similarity index 100% rename from mllib/planner.mli rename to common/mltools/planner.mli diff --git a/mllib/regedit.ml b/common/mltools/regedit.ml similarity index 100% rename from mllib/regedit.ml rename to common/mltools/regedit.ml diff --git a/mllib/regedit.mli b/common/mltools/regedit.mli similarity index 100% rename from mllib/regedit.mli rename to common/mltools/regedit.mli diff --git a/mllib/registry.ml b/common/mltools/registry.ml similarity index 100% rename from mllib/registry.ml rename to common/mltools/registry.ml diff --git a/mllib/registry.mli b/common/mltools/registry.mli similarity index 100% rename from mllib/registry.mli rename to common/mltools/registry.mli diff --git a/mllib/test-getopt.sh b/common/mltools/test-getopt.sh similarity index 100% rename from mllib/test-getopt.sh rename to common/mltools/test-getopt.sh diff --git a/mllib/uri-c.c b/common/mltools/uri-c.c similarity index 100% rename from mllib/uri-c.c rename to common/mltools/uri-c.c diff --git a/mllib/xpath_helpers.ml b/common/mltools/xpath_helpers.ml similarity index 100% rename from mllib/xpath_helpers.ml rename to common/mltools/xpath_helpers.ml diff --git a/mllib/xpath_helpers.mli b/common/mltools/xpath_helpers.mli similarity index 100% rename from mllib/xpath_helpers.mli rename to common/mltools/xpath_helpers.mli diff --git a/common/options/display-options.c b/common/options/display-options.c index c411f4f3d..450b021d2 100644 --- a/common/options/display-options.c +++ b/common/options/display-options.c @@ -19,7 +19,7 @@ /** * This file contains common code used to implement I<--short-options> * and I<--long-options> in C virt tools. (The equivalent for - * OCaml virt tools is implemented by F<mllib/getopt.ml>). + * OCaml virt tools is implemented by F<common/mltools/getopt.ml>). * * These "hidden" options are used to implement bash tab completion. */ diff --git a/configure.ac b/configure.ac index f1deadde9..b4c639457 100644 --- a/configure.ac +++ b/configure.ac @@ -232,6 +232,7 @@ AC_CONFIG_FILES([Makefile common/mlprogress/Makefile common/mlstdutils/Makefile common/mlstdutils/guestfs_config.ml + common/mltools/Makefile common/mlutils/Makefile common/mlvisit/Makefile common/mlxml/Makefile @@ -275,7 +276,6 @@ AC_CONFIG_FILES([Makefile lua/Makefile lua/examples/Makefile make-fs/Makefile - mllib/Makefile ocaml/META ocaml/Makefile ocaml/examples/Makefile diff --git a/customize/Makefile.am b/customize/Makefile.am index b3edc2e9b..2d358e293 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -128,7 +128,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlutils \ -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ - -I $(top_builddir)/mllib \ + -I $(top_builddir)/common/mltools \ -I $(builddir) if HAVE_OCAML_PKG_GETTEXT OCAMLPACKAGES += -package gettext-stub @@ -160,7 +160,7 @@ OCAMLLINKFLAGS = \ mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ - mllib.$(MLARCHIVE) \ + mltools.$(MLARCHIVE) \ customize.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) @@ -182,7 +182,7 @@ virt_customize_DEPENDENCIES = \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) + ../common/mltools/mltools.$(MLARCHIVE) virt_customize_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \ diff --git a/dib/Makefile.am b/dib/Makefile.am index 37fa3224b..316f49903 100644 --- a/dib/Makefile.am +++ b/dib/Makefile.am @@ -87,7 +87,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlutils \ -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ - -I $(top_builddir)/mllib + -I $(top_builddir)/common/mltools if HAVE_OCAML_PKG_GETTEXT OCAMLPACKAGES += -package gettext-stub endif @@ -113,7 +113,7 @@ OCAMLLINKFLAGS = \ mlcutils.$(MLARCHIVE) \ mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ - mllib.$(MLARCHIVE) \ + mltools.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) virt_dib_DEPENDENCIES = \ @@ -122,7 +122,7 @@ virt_dib_DEPENDENCIES = \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) \ + ../common/mltools/mltools.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh virt_dib_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ diff --git a/dib/output_format.mli b/dib/output_format.mli index 76683adbc..469080ccc 100644 --- a/dib/output_format.mli +++ b/dib/output_format.mli @@ -73,7 +73,7 @@ type format = { and extra_arg = { extra_argspec : Getopt.keys * Getopt.spec * Getopt.doc; - (** The argspec. See [Getopt] module in [mllib]. *) + (** The argspec. See [Getopt] module in [common/mltools]. *) } val defaults : format diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index 9ef9b0257..6130e459f 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -21,6 +21,10 @@ common/mlpcre/dummy.c common/mlpcre/pcre-c.c common/mlprogress/progress-c.c common/mlstdutils/dummy.c +common/mltools/common_utils-c.c +common/mltools/dummy.c +common/mltools/getopt-c.c +common/mltools/uri-c.c common/mlutils/c_utils-c.c common/mlutils/dummy.c common/mlutils/unix_utils-c.c @@ -345,10 +349,6 @@ lib/whole-file.c lib/yara.c lua/lua-guestfs.c make-fs/make-fs.c -mllib/common_utils-c.c -mllib/dummy.c -mllib/getopt-c.c -mllib/uri-c.c ocaml/guestfs-c-actions.c ocaml/guestfs-c-errnos.c ocaml/guestfs-c.c diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod index 56982d2c8..9998e6d2b 100644 --- a/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod @@ -124,6 +124,11 @@ OCaml bindings for the progress bar functions (see F<common/progress>). A library of pure OCaml utility functions used in many places. +=item F<common/mltools> + +OCaml utility functions only used by the OCaml virt tools (like +C<virt-sysprep>, C<virt-v2v> etc.) + =item F<common/mlutils> OCaml bindings for C functions in C<common/utils>, and some POSIX @@ -262,11 +267,6 @@ M4 macros used by autoconf. See L</THE BUILD SYSTEM>. L<virt-make-fs(1)> command and documentation. -=item F<mllib> - -Various libraries and common code used by L<virt-resize(1)> and -the other tools which are written in OCaml. - =item F<p2v> L<virt-p2v(1)> command, documentation and scripts for building the diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am index dad96bbe2..03d4b9815 100644 --- a/get-kernel/Makefile.am +++ b/get-kernel/Makefile.am @@ -70,7 +70,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlutils \ -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ - -I $(top_builddir)/mllib + -I $(top_builddir)/common/mltools if HAVE_OCAML_PKG_GETTEXT OCAMLPACKAGES += -package gettext-stub endif @@ -96,7 +96,7 @@ OCAMLLINKFLAGS = \ mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ - mllib.$(MLARCHIVE) \ + mltools.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) virt_get_kernel_DEPENDENCIES = \ @@ -105,7 +105,7 @@ virt_get_kernel_DEPENDENCIES = \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) \ + ../common/mltools/mltools.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh virt_get_kernel_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ diff --git a/ocaml-dep.sh.in b/ocaml-dep.sh.in index 1bea4da72..6517b52e6 100755 --- a/ocaml-dep.sh.in +++ b/ocaml-dep.sh.in @@ -38,11 +38,11 @@ common/mlgettext common/mlpcre common/mlprogress common/mlstdutils +common/mltools common/mlutils common/mlvisit common/mlxml customize -mllib ocaml " diff --git a/resize/Makefile.am b/resize/Makefile.am index 2dd33c797..9f0cd46ac 100644 --- a/resize/Makefile.am +++ b/resize/Makefile.am @@ -67,7 +67,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlutils \ -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ - -I $(top_builddir)/mllib + -I $(top_builddir)/common/mltools if HAVE_OCAML_PKG_GETTEXT OCAMLPACKAGES += -package gettext-stub endif @@ -95,7 +95,7 @@ OCAMLLINKFLAGS = \ mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ - mllib.$(MLARCHIVE) \ + mltools.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) virt_resize_DEPENDENCIES = \ @@ -104,7 +104,7 @@ virt_resize_DEPENDENCIES = \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) \ + ../common/mltools/mltools.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh virt_resize_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am index d8efc4bc2..ca3fd3bd6 100644 --- a/sparsify/Makefile.am +++ b/sparsify/Makefile.am @@ -75,7 +75,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlutils \ -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ - -I $(top_builddir)/mllib + -I $(top_builddir)/common/mltools if HAVE_OCAML_PKG_GETTEXT OCAMLPACKAGES += -package gettext-stub endif @@ -103,7 +103,7 @@ OCAMLLINKFLAGS = \ mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ - mllib.$(MLARCHIVE) \ + mltools.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) virt_sparsify_DEPENDENCIES = \ @@ -112,7 +112,7 @@ virt_sparsify_DEPENDENCIES = \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) \ + ../common/mltools/mltools.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh virt_sparsify_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index 778c36c8b..f201affae 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -120,7 +120,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/common/mlvisit \ - -I $(top_builddir)/mllib \ + -I $(top_builddir)/common/mltools \ -I $(top_builddir)/customize if HAVE_OCAML_PKG_GETTEXT OCAMLPACKAGES += -package gettext-stub @@ -150,7 +150,7 @@ OCAMLLINKFLAGS = \ mlgettext.$(MLARCHIVE) \ mlpcre.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ - mllib.$(MLARCHIVE) \ + mltools.$(MLARCHIVE) \ mlvisit.$(MLARCHIVE) \ customize.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) @@ -161,7 +161,7 @@ virt_sysprep_DEPENDENCIES = \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) \ + ../common/mltools/mltools.$(MLARCHIVE) \ ../customize/customize.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh virt_sysprep_LINK = \ diff --git a/sysprep/sysprep_operation.mli b/sysprep/sysprep_operation.mli index 7291dd67f..3d9f12550 100644 --- a/sysprep/sysprep_operation.mli +++ b/sysprep/sysprep_operation.mli @@ -107,7 +107,7 @@ type operation = { and extra_arg = { extra_argspec : Getopt.keys * Getopt.spec * Getopt.doc; - (** The argspec. See [Getopt] module in [mllib]. *) + (** The argspec. See [Getopt] module in [common/mltools]. *) extra_pod_argval : string option; (** The argument value, used only in the virt-sysprep man page. *) diff --git a/v2v/Makefile.am b/v2v/Makefile.am index b7148e2c2..e1e6f9c80 100644 --- a/v2v/Makefile.am +++ b/v2v/Makefile.am @@ -154,7 +154,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/common/mlgettext \ -I $(top_builddir)/common/mlpcre \ -I $(top_builddir)/common/mlxml \ - -I $(top_builddir)/mllib \ + -I $(top_builddir)/common/mltools \ -I $(top_builddir)/customize if HAVE_OCAML_PKG_GETTEXT OCAMLPACKAGES += -package gettext-stub @@ -183,7 +183,7 @@ OCAMLLINKFLAGS = \ mlpcre.$(MLARCHIVE) \ mlxml.$(MLARCHIVE) \ mlcutils.$(MLARCHIVE) \ - mllib.$(MLARCHIVE) \ + mltools.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) virt_v2v_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh @@ -225,7 +225,7 @@ virt_v2v_copy_to_local_DEPENDENCIES = \ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) \ + ../common/mltools/mltools.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh virt_v2v_copy_to_local_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ @@ -517,7 +517,7 @@ v2v_unit_tests_DEPENDENCIES = \ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ ../common/mlutils/mlcutils.$(MLARCHIVE) \ - ../mllib/mllib.$(MLARCHIVE) \ + ../common/mltools/mltools.$(MLARCHIVE) \ $(top_srcdir)/ocaml-link.sh v2v_unit_tests_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ diff --git a/v2v/test-harness/Makefile.am b/v2v/test-harness/Makefile.am index 8691c57c3..0bc5d2a38 100644 --- a/v2v/test-harness/Makefile.am +++ b/v2v/test-harness/Makefile.am @@ -44,7 +44,7 @@ OCAMLPACKAGES = \ -I $(top_builddir)/ocaml \ -I $(top_builddir)/common/mlstdutils \ -I $(top_builddir)/common/mlxml \ - -I $(top_builddir)/mllib \ + -I $(top_builddir)/common/mltools \ -I $(top_builddir)/v2v OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) -- 2.13.2
Richard W.M. Jones
2017-Sep-26 12:16 UTC
[Libguestfs] [PATCH 5/5] common/mltools: Rename Common_utils to Tools_utils.
Reflecting the purpose of this module now, which is to act as a place for utility functions shared only by the OCaml virt tools. --- .gitignore | 4 +-- builder/builder.ml | 2 +- builder/cache.ml | 2 +- builder/cmdline.ml | 2 +- builder/downloader.ml | 2 +- builder/index.ml | 2 +- builder/index_parser.ml | 2 +- builder/ini_reader.ml | 2 +- builder/languages.ml | 2 +- builder/list_entries.ml | 2 +- builder/paths.ml | 2 +- builder/sigchecker.ml | 2 +- builder/simplestreams_parser.ml | 2 +- builder/sources.ml | 2 +- builder/utils.ml | 2 +- builder/yajl.ml | 2 +- common/mltools/Makefile.am | 38 +++++++++++----------- common/mltools/checksums.ml | 2 +- common/mltools/curl.ml | 2 +- common/mltools/getopt_tests.ml | 2 +- common/mltools/regedit.ml | 2 +- common/mltools/registry.ml | 2 +- common/mltools/test-getopt.sh | 4 +-- .../mltools/{common_utils-c.c => tools_utils-c.c} | 0 common/mltools/{common_utils.ml => tools_utils.ml} | 0 .../mltools/{common_utils.mli => tools_utils.mli} | 0 ...{common_utils_tests.ml => tools_utils_tests.ml} | 14 ++++---- common/mltools/xpath_helpers.ml | 2 +- customize/SELinux_relabel.ml | 2 +- customize/append_line.ml | 2 +- customize/customize_main.ml | 2 +- customize/customize_run.ml | 2 +- customize/firstboot.ml | 2 +- customize/hostname.ml | 2 +- customize/password.ml | 2 +- customize/perl_edit.ml | 2 +- customize/ssh_key.ml | 2 +- customize/subscription_manager.ml | 2 +- customize/timezone.ml | 2 +- dib/cmdline.ml | 2 +- dib/dib.ml | 2 +- dib/elements.ml | 2 +- dib/output_format.ml | 2 +- dib/output_format_docker.ml | 2 +- dib/output_format_qcow2.ml | 2 +- dib/output_format_squashfs.ml | 2 +- dib/output_format_tar.ml | 2 +- dib/output_format_tgz.ml | 2 +- dib/output_format_vhd.ml | 2 +- dib/utils.ml | 2 +- docs/C_SOURCE_FILES | 2 +- generator/customize.ml | 2 +- get-kernel/get_kernel.ml | 2 +- po/POTFILES | 8 ++--- po/POTFILES-ml | 26 +++++++-------- resize/resize.ml | 2 +- sparsify/cmdline.ml | 2 +- sparsify/copying.ml | 2 +- sparsify/in_place.ml | 2 +- sparsify/sparsify.ml | 2 +- sysprep/main.ml | 2 +- sysprep/sysprep_operation.ml | 2 +- sysprep/sysprep_operation_backup_files.ml | 2 +- sysprep/sysprep_operation_cron_spool.ml | 2 +- sysprep/sysprep_operation_fs_uuids.ml | 4 +-- sysprep/sysprep_operation_net_hostname.ml | 2 +- sysprep/sysprep_operation_net_hwaddr.ml | 2 +- sysprep/sysprep_operation_package_manager_cache.ml | 2 +- sysprep/sysprep_operation_script.ml | 2 +- sysprep/sysprep_operation_user_account.ml | 2 +- v2v/DOM.ml | 2 +- v2v/changeuid.ml | 2 +- v2v/cmdline.ml | 2 +- v2v/convert_linux.ml | 2 +- v2v/convert_windows.ml | 2 +- v2v/copy_to_local.ml | 2 +- v2v/create_libvirt_xml.ml | 2 +- v2v/create_ovf.ml | 2 +- v2v/input_disk.ml | 2 +- v2v/input_libvirt.ml | 2 +- v2v/input_libvirt_other.ml | 2 +- v2v/input_libvirt_vcenter_https.ml | 2 +- v2v/input_libvirt_vddk.ml | 2 +- v2v/input_libvirt_xen_ssh.ml | 2 +- v2v/input_libvirtxml.ml | 2 +- v2v/input_ova.ml | 2 +- v2v/input_vmx.ml | 2 +- v2v/inspect_source.ml | 2 +- v2v/linux.ml | 2 +- v2v/linux_bootloaders.ml | 2 +- v2v/linux_kernels.ml | 2 +- v2v/name_from_disk.ml | 2 +- v2v/output_glance.ml | 2 +- v2v/output_libvirt.ml | 2 +- v2v/output_local.ml | 2 +- v2v/output_null.ml | 2 +- v2v/output_qemu.ml | 2 +- v2v/output_rhv.ml | 2 +- v2v/output_vdsm.ml | 2 +- v2v/parse_libvirt_xml.ml | 2 +- v2v/parse_ovf_from_ova.ml | 2 +- v2v/parse_vmx.ml | 2 +- v2v/target_bus_assignment.ml | 2 +- v2v/test-harness/v2v_test_harness.ml | 2 +- v2v/types.ml | 2 +- v2v/utils.ml | 2 +- v2v/v2v.ml | 2 +- v2v/v2v_unit_tests.ml | 2 +- v2v/vCenter.ml | 2 +- v2v/windows.ml | 2 +- v2v/windows_virtio.ml | 2 +- 111 files changed, 149 insertions(+), 151 deletions(-) diff --git a/.gitignore b/.gitignore index 0932f9ea6..36a193054 100644 --- a/.gitignore +++ b/.gitignore @@ -135,9 +135,9 @@ Makefile.in /common/mlstdutils/oUnit-* /common/mlstdutils/std_utils_tests /common/mltools/.depend -/common/mltools/common_utils_tests /common/mltools/getopt_tests /common/mltools/JSON_tests +/common/mltools/tools_utils_tests /common/mltools/oUnit-* /common/mlutils/.depend /common/mlutils/c_utils_unit_tests @@ -295,8 +295,6 @@ Makefile.in /fuse/test-guestmount-fd /fuse/test-guestunmount-fd /generator/.depend -/generator/common_utils.ml -/generator/common_utils.mli /generator/files-generated.txt /generator/generator /generator/.pod2text.data* diff --git a/builder/builder.ml b/builder/builder.ml index 3c1f04c77..97a9f0d37 100644 --- a/builder/builder.ml +++ b/builder/builder.ml @@ -21,7 +21,7 @@ open Common_gettext.Gettext module G = Guestfs open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Password open Planner diff --git a/builder/cache.ml b/builder/cache.ml index 494796edb..dbd222fda 100644 --- a/builder/cache.ml +++ b/builder/cache.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/builder/cmdline.ml b/builder/cmdline.ml index a1f901144..8cbd4ca68 100644 --- a/builder/cmdline.ml +++ b/builder/cmdline.ml @@ -19,7 +19,7 @@ (* Command line argument parsing. *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/builder/downloader.ml b/builder/downloader.ml index d6b27c8c7..3e776fdc2 100644 --- a/builder/downloader.ml +++ b/builder/downloader.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/builder/index.ml b/builder/index.ml index 54af6e719..b5f51163f 100644 --- a/builder/index.ml +++ b/builder/index.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/builder/index_parser.ml b/builder/index_parser.ml index fb546831f..66e921ec4 100644 --- a/builder/index_parser.ml +++ b/builder/index_parser.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/builder/ini_reader.ml b/builder/ini_reader.ml index 2d8ff7e59..3e1bfdfae 100644 --- a/builder/ini_reader.ml +++ b/builder/ini_reader.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils type sections = section list and section = string * fields (* [name] + fields *) diff --git a/builder/languages.ml b/builder/languages.ml index 155322014..e97b1e3da 100644 --- a/builder/languages.ml +++ b/builder/languages.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils let re_locale PCRE.compile ~caseless:true "^([a-z]+)(_([a-z]+))?(\\.([a-z0-9-]+))?(@([a-z]+))?$" diff --git a/builder/list_entries.ml b/builder/list_entries.ml index ea607107c..c0aae1675 100644 --- a/builder/list_entries.ml +++ b/builder/list_entries.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Printf diff --git a/builder/paths.ml b/builder/paths.ml index e0fb9a024..b8ce57191 100644 --- a/builder/paths.ml +++ b/builder/paths.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils let xdg_cache_home try Some (Sys.getenv "XDG_CACHE_HOME" // "virt-builder") diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml index 55e743940..d7fba405b 100644 --- a/builder/sigchecker.ml +++ b/builder/sigchecker.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext diff --git a/builder/simplestreams_parser.ml b/builder/simplestreams_parser.ml index c550675ba..7f1a4e726 100644 --- a/builder/simplestreams_parser.ml +++ b/builder/simplestreams_parser.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Yajl diff --git a/builder/sources.ml b/builder/sources.ml index 48687bb26..93609bef6 100644 --- a/builder/sources.ml +++ b/builder/sources.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Printf diff --git a/builder/utils.ml b/builder/utils.ml index 26f158d6f..acb6c2f4b 100644 --- a/builder/utils.ml +++ b/builder/utils.ml @@ -20,7 +20,7 @@ open Printf -open Common_utils +open Tools_utils type gpgkey_type | No_Key diff --git a/builder/yajl.ml b/builder/yajl.ml index 5ae1c5d9b..a555baa22 100644 --- a/builder/yajl.ml +++ b/builder/yajl.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext type yajl_val diff --git a/common/mltools/Makefile.am b/common/mltools/Makefile.am index b00e126a1..921d1f00a 100644 --- a/common/mltools/Makefile.am +++ b/common/mltools/Makefile.am @@ -21,26 +21,26 @@ EXTRA_DIST = \ $(SOURCES_MLI) \ $(SOURCES_ML) \ $(SOURCES_C) \ - common_utils_tests.ml \ getopt_tests.ml \ JSON_tests.ml \ - test-getopt.sh + test-getopt.sh \ + tools_utils_tests.ml SOURCES_MLI = \ checksums.mli \ - common_utils.mli \ curl.mli \ getopt.mli \ JSON.mli \ planner.mli \ regedit.mli \ registry.mli \ + tools_utils.mli \ URI.mli \ xpath_helpers.mli SOURCES_ML = \ getopt.ml \ - common_utils.ml \ + tools_utils.ml \ URI.ml \ planner.ml \ registry.ml \ @@ -54,8 +54,8 @@ SOURCES_C = \ ../options/decrypt.c \ ../options/keys.c \ ../options/uri.c \ - common_utils-c.c \ getopt-c.c \ + tools_utils-c.c \ uri-c.c if HAVE_OCAML @@ -145,14 +145,14 @@ $(MLTOOLS_CMA): $(OBJECTS) libmltools.a # Tests. -common_utils_tests_SOURCES = dummy.c -common_utils_tests_CPPFLAGS = \ +tools_utils_tests_SOURCES = dummy.c +tools_utils_tests_CPPFLAGS = \ -I. \ -I$(top_builddir) \ -I$(shell $(OCAMLC) -where) \ -I$(top_srcdir)/lib -common_utils_tests_BOBJECTS = common_utils_tests.cmo -common_utils_tests_XOBJECTS = $(common_utils_tests_BOBJECTS:.cmo=.cmx) +tools_utils_tests_BOBJECTS = tools_utils_tests.cmo +tools_utils_tests_XOBJECTS = $(tools_utils_tests_BOBJECTS:.cmo=.cmx) getopt_tests_SOURCES = dummy.c getopt_tests_CPPFLAGS = \ @@ -169,8 +169,8 @@ JSON_tests_XOBJECTS = $(JSON_tests_BOBJECTS:.cmo=.cmx) # Can't call the following as <test>_OBJECTS because automake gets confused. if !HAVE_OCAMLOPT -common_utils_tests_THEOBJECTS = $(common_utils_tests_BOBJECTS) -common_utils_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) +tools_utils_tests_THEOBJECTS = $(tools_utils_tests_BOBJECTS) +tools_utils_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) getopt_tests_THEOBJECTS = $(getopt_tests_BOBJECTS) getopt_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) @@ -178,8 +178,8 @@ getopt_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) JSON_tests_THEOBJECTS = $(JSON_tests_BOBJECTS) JSON_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) else -common_utils_tests_THEOBJECTS = $(common_utils_tests_XOBJECTS) -common_utils_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) +tools_utils_tests_THEOBJECTS = $(tools_utils_tests_XOBJECTS) +tools_utils_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) getopt_tests_THEOBJECTS = $(getopt_tests_XOBJECTS) getopt_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS) @@ -196,18 +196,18 @@ OCAMLLINKFLAGS = \ mlguestfs.$(MLARCHIVE) \ $(LINK_CUSTOM_OCAMLC_ONLY) -common_utils_tests_DEPENDENCIES = \ - $(common_utils_tests_THEOBJECTS) \ +tools_utils_tests_DEPENDENCIES = \ + $(tools_utils_tests_THEOBJECTS) \ ../mlstdutils/mlstdutils.$(MLARCHIVE) \ ../mlgettext/mlgettext.$(MLARCHIVE) \ ../mlpcre/mlpcre.$(MLARCHIVE) \ $(MLTOOLS_CMA) \ $(top_srcdir)/ocaml-link.sh -common_utils_tests_LINK = \ +tools_utils_tests_LINK = \ $(top_srcdir)/ocaml-link.sh -cclib '-lutils $(LIBXML2_LIBS) -lgnu' -- \ $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \ $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \ - $(common_utils_tests_THEOBJECTS) -o $@ + $(tools_utils_tests_THEOBJECTS) -o $@ getopt_tests_DEPENDENCIES = \ $(getopt_tests_THEOBJECTS) \ @@ -243,8 +243,8 @@ check_PROGRAMS = \ getopt_tests if HAVE_OCAML_PKG_OUNIT -check_PROGRAMS += common_utils_tests JSON_tests -TESTS += common_utils_tests JSON_tests +check_PROGRAMS += JSON_tests tools_utils_tests +TESTS += JSON_tests tools_utils_tests endif check-valgrind: diff --git a/common/mltools/checksums.ml b/common/mltools/checksums.ml index f4c414f57..a40edca76 100644 --- a/common/mltools/checksums.ml +++ b/common/mltools/checksums.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Printf diff --git a/common/mltools/curl.ml b/common/mltools/curl.ml index ccf98acef..85fe1a8b2 100644 --- a/common/mltools/curl.ml +++ b/common/mltools/curl.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils type t = { curl : string; diff --git a/common/mltools/getopt_tests.ml b/common/mltools/getopt_tests.ml index 22e4282fa..1314d3bca 100644 --- a/common/mltools/getopt_tests.ml +++ b/common/mltools/getopt_tests.ml @@ -23,7 +23,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Getopt.OptionName let adds = ref [] diff --git a/common/mltools/regedit.ml b/common/mltools/regedit.ml index e07700bb1..81c82d467 100644 --- a/common/mltools/regedit.ml +++ b/common/mltools/regedit.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext type regedits = regedit list diff --git a/common/mltools/registry.ml b/common/mltools/registry.ml index 7738ecc64..7ed7eb6b8 100644 --- a/common/mltools/registry.ml +++ b/common/mltools/registry.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext type node = int64 diff --git a/common/mltools/test-getopt.sh b/common/mltools/test-getopt.sh index 002bd10f6..f5aa71b89 100755 --- a/common/mltools/test-getopt.sh +++ b/common/mltools/test-getopt.sh @@ -1,6 +1,6 @@ #!/bin/bash - # libguestfs -# Copyright (C) 2016 Red Hat Inc. +# Copyright (C) 2016-2017 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 @@ -38,7 +38,7 @@ expect_fail () # Program works. $t -# Flags added automatically by Common_utils. +# Flags added automatically by Tools_utils. $t | grep '^trace = false' $t | grep '^verbose = false' diff --git a/common/mltools/common_utils-c.c b/common/mltools/tools_utils-c.c similarity index 100% rename from common/mltools/common_utils-c.c rename to common/mltools/tools_utils-c.c diff --git a/common/mltools/common_utils.ml b/common/mltools/tools_utils.ml similarity index 100% rename from common/mltools/common_utils.ml rename to common/mltools/tools_utils.ml diff --git a/common/mltools/common_utils.mli b/common/mltools/tools_utils.mli similarity index 100% rename from common/mltools/common_utils.mli rename to common/mltools/tools_utils.mli diff --git a/common/mltools/common_utils_tests.ml b/common/mltools/tools_utils_tests.ml similarity index 96% rename from common/mltools/common_utils_tests.ml rename to common/mltools/tools_utils_tests.ml index f7a4eafd1..d43a72891 100644 --- a/common/mltools/common_utils_tests.ml +++ b/common/mltools/tools_utils_tests.ml @@ -16,12 +16,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -(* This file tests the Common_utils module. *) +(* This file tests the Tools_utils module. *) open OUnit2 open Std_utils -open Common_utils +open Tools_utils (* Utils. *) let assert_equal_string = assert_equal ~printer:(fun x -> x) @@ -29,7 +29,7 @@ let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) let assert_equal_intlist = assert_equal ~printer:(fun x -> "(" ^ (String.concat ";" (List.map string_of_int x)) ^ ")") -(* Test Common_utils.parse_size and Common_utils.parse_resize. *) +(* Test Tools_utils.parse_size and Tools_utils.parse_resize. *) let test_parse_resize ctx assert_equal_int64 1_L (parse_size "1b"); assert_equal_int64 10_L (parse_size "10b"); @@ -76,7 +76,7 @@ let test_parse_resize ctx assert_equal_int64 101100_L (parse_resize 100000_L "+1.1%"); assert_equal_int64 101100_L (parse_resize 100000_L "+1.12%") -(* Test Common_utils.human_size. *) +(* Test Tools_utils.human_size. *) let test_human_size ctx assert_equal_string "100" (human_size 100_L); assert_equal_string "-100" (human_size (-100_L)); @@ -89,7 +89,7 @@ let test_human_size ctx assert_equal_string "3.4G" (human_size 3650722201_L); assert_equal_string "-3.4G" (human_size (-3650722201_L)) -(* Test Common_utils.run_command. *) +(* Test Tools_utils.run_command. *) let test_run_command ctx assert_equal_int 0 (run_command ["true"]); begin @@ -108,7 +108,7 @@ let test_run_command ctx end; () -(* Test Common_utils.run_commands. *) +(* Test Tools_utils.run_commands. *) let test_run_commands ctx begin let res = run_commands [] in @@ -158,7 +158,7 @@ let test_run_commands ctx (* Suites declaration. *) let suite - "mllib Common_utils" >::: + "mltools Tools_utils" >::: [ "sizes.parse_resize" >:: test_parse_resize; "sizes.human_size" >:: test_human_size; diff --git a/common/mltools/xpath_helpers.ml b/common/mltools/xpath_helpers.ml index e6185bf3d..05fad89a4 100644 --- a/common/mltools/xpath_helpers.ml +++ b/common/mltools/xpath_helpers.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext (* Parse an xpath expression and return a string/int. Returns diff --git a/customize/SELinux_relabel.ml b/customize/SELinux_relabel.ml index ab373b33a..d404c35fa 100644 --- a/customize/SELinux_relabel.ml +++ b/customize/SELinux_relabel.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Printf diff --git a/customize/append_line.ml b/customize/append_line.ml index 405080617..3371c73ac 100644 --- a/customize/append_line.ml +++ b/customize/append_line.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext module G = Guestfs diff --git a/customize/customize_main.ml b/customize/customize_main.ml index 55ec3cb78..55e1b6d8e 100644 --- a/customize/customize_main.ml +++ b/customize/customize_main.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/customize/customize_run.ml b/customize/customize_run.ml index 3dcf755eb..b42dd774d 100644 --- a/customize/customize_run.ml +++ b/customize/customize_run.ml @@ -20,7 +20,7 @@ open Unix open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Customize_cmdline diff --git a/customize/firstboot.ml b/customize/firstboot.ml index 25203cf91..5bff9159a 100644 --- a/customize/firstboot.ml +++ b/customize/firstboot.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Regedit diff --git a/customize/hostname.ml b/customize/hostname.ml index ee2c91e6a..66fcaaacb 100644 --- a/customize/hostname.ml +++ b/customize/hostname.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Printf diff --git a/customize/password.ml b/customize/password.ml index dc69b8eb7..b928e1a11 100644 --- a/customize/password.ml +++ b/customize/password.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Printf diff --git a/customize/perl_edit.ml b/customize/perl_edit.ml index bb44ea062..415cae9f9 100644 --- a/customize/perl_edit.ml +++ b/customize/perl_edit.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils external c_edit_file : verbose:bool -> Guestfs.t -> int64 -> string -> string -> unit = "virt_customize_edit_file_perl" diff --git a/customize/ssh_key.ml b/customize/ssh_key.ml index da0e7d90c..518d48fe8 100644 --- a/customize/ssh_key.ml +++ b/customize/ssh_key.ml @@ -21,7 +21,7 @@ open Sys open Unix open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext module G = Guestfs diff --git a/customize/subscription_manager.ml b/customize/subscription_manager.ml index 56ba28ab9..104602462 100644 --- a/customize/subscription_manager.ml +++ b/customize/subscription_manager.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext type sm_credentials = { diff --git a/customize/timezone.ml b/customize/timezone.ml index bc40d6e3e..2ac7a1056 100644 --- a/customize/timezone.ml +++ b/customize/timezone.ml @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -open Common_utils +open Tools_utils open Printf diff --git a/dib/cmdline.ml b/dib/cmdline.ml index 549f01546..9f0a70a72 100644 --- a/dib/cmdline.ml +++ b/dib/cmdline.ml @@ -19,7 +19,7 @@ (* Command line argument parsing. *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/dib/dib.ml b/dib/dib.ml index e59ff94a8..5cbb10b09 100644 --- a/dib/dib.ml +++ b/dib/dib.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext diff --git a/dib/elements.ml b/dib/elements.ml index 2d518c739..d8eb6c145 100644 --- a/dib/elements.ml +++ b/dib/elements.ml @@ -19,7 +19,7 @@ (* Parsing and handling of elements. *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/dib/output_format.ml b/dib/output_format.ml index 6499ee259..537469ab6 100644 --- a/dib/output_format.ml +++ b/dib/output_format.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/dib/output_format_docker.ml b/dib/output_format_docker.ml index f48da0f79..bc0f234b6 100644 --- a/dib/output_format_docker.ml +++ b/dib/output_format_docker.ml @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/dib/output_format_qcow2.ml b/dib/output_format_qcow2.ml index a32b2a4f9..5ef93f6c3 100644 --- a/dib/output_format_qcow2.ml +++ b/dib/output_format_qcow2.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/dib/output_format_squashfs.ml b/dib/output_format_squashfs.ml index 333e711a3..d81589b09 100644 --- a/dib/output_format_squashfs.ml +++ b/dib/output_format_squashfs.ml @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -open Common_utils +open Tools_utils open Common_gettext.Gettext open Output_format diff --git a/dib/output_format_tar.ml b/dib/output_format_tar.ml index 132532d6c..2367d2768 100644 --- a/dib/output_format_tar.ml +++ b/dib/output_format_tar.ml @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -open Common_utils +open Tools_utils open Common_gettext.Gettext open Output_format diff --git a/dib/output_format_tgz.ml b/dib/output_format_tgz.ml index 155afb578..447dfe6d9 100644 --- a/dib/output_format_tgz.ml +++ b/dib/output_format_tgz.ml @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -open Common_utils +open Tools_utils open Common_gettext.Gettext open Output_format diff --git a/dib/output_format_vhd.ml b/dib/output_format_vhd.ml index a4bad66f9..15dd582c8 100644 --- a/dib/output_format_vhd.ml +++ b/dib/output_format_vhd.ml @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/dib/utils.ml b/dib/utils.ml index 8b6bb1576..856705d09 100644 --- a/dib/utils.ml +++ b/dib/utils.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Printf diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index 6130e459f..41bb6c9eb 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -21,9 +21,9 @@ common/mlpcre/dummy.c common/mlpcre/pcre-c.c common/mlprogress/progress-c.c common/mlstdutils/dummy.c -common/mltools/common_utils-c.c common/mltools/dummy.c common/mltools/getopt-c.c +common/mltools/tools_utils-c.c common/mltools/uri-c.c common/mlutils/c_utils-c.c common/mlutils/dummy.c diff --git a/generator/customize.ml b/generator/customize.ml index 381ed0627..75984c9d5 100644 --- a/generator/customize.ml +++ b/generator/customize.ml @@ -624,7 +624,7 @@ and generate_customize_cmdline_ml () open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/get-kernel/get_kernel.ml b/get-kernel/get_kernel.ml index 1c9ece44b..a15582834 100644 --- a/get-kernel/get_kernel.ml +++ b/get-kernel/get_kernel.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/po/POTFILES b/po/POTFILES index c8a36a247..40c0708a0 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -22,6 +22,10 @@ common/mlpcre/dummy.c common/mlpcre/pcre-c.c common/mlprogress/progress-c.c common/mlstdutils/dummy.c +common/mltools/dummy.c +common/mltools/getopt-c.c +common/mltools/tools_utils-c.c +common/mltools/uri-c.c common/mlutils/c_utils-c.c common/mlutils/dummy.c common/mlutils/unix_utils-c.c @@ -408,10 +412,6 @@ lib/whole-file.c lib/yara.c lua/lua-guestfs.c make-fs/make-fs.c -mllib/common_utils-c.c -mllib/dummy.c -mllib/getopt-c.c -mllib/uri-c.c ocaml/guestfs-c-actions.c ocaml/guestfs-c-errnos.c ocaml/guestfs-c.c diff --git a/po/POTFILES-ml b/po/POTFILES-ml index 23c6e50b0..dbf151ea1 100644 --- a/po/POTFILES-ml +++ b/po/POTFILES-ml @@ -26,6 +26,19 @@ common/mlstdutils/std_utils.ml common/mlstdutils/std_utils_tests.ml common/mlstdutils/stringMap.ml common/mlstdutils/stringSet.ml +common/mltools/JSON.ml +common/mltools/JSON_tests.ml +common/mltools/URI.ml +common/mltools/checksums.ml +common/mltools/curl.ml +common/mltools/getopt.ml +common/mltools/getopt_tests.ml +common/mltools/planner.ml +common/mltools/regedit.ml +common/mltools/registry.ml +common/mltools/tools_utils.ml +common/mltools/tools_utils_tests.ml +common/mltools/xpath_helpers.ml common/mlutils/c_utils.ml common/mlutils/c_utils_unit_tests.ml common/mlutils/unix_utils.ml @@ -60,19 +73,6 @@ dib/output_format_tgz.ml dib/output_format_vhd.ml dib/utils.ml get-kernel/get_kernel.ml -mllib/JSON.ml -mllib/JSON_tests.ml -mllib/URI.ml -mllib/checksums.ml -mllib/common_utils.ml -mllib/common_utils_tests.ml -mllib/curl.ml -mllib/getopt.ml -mllib/getopt_tests.ml -mllib/planner.ml -mllib/regedit.ml -mllib/registry.ml -mllib/xpath_helpers.ml resize/resize.ml sparsify/cmdline.ml sparsify/copying.ml diff --git a/resize/resize.ml b/resize/resize.ml index 48c75161d..a19e57564 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Unix_utils open Getopt.OptionName diff --git a/sparsify/cmdline.ml b/sparsify/cmdline.ml index 6e0594f12..521f6733d 100644 --- a/sparsify/cmdline.ml +++ b/sparsify/cmdline.ml @@ -21,7 +21,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/sparsify/copying.ml b/sparsify/copying.ml index 02a53b9b4..7d004b550 100644 --- a/sparsify/copying.ml +++ b/sparsify/copying.ml @@ -24,7 +24,7 @@ open Unix open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Unix_utils diff --git a/sparsify/in_place.ml b/sparsify/in_place.ml index 1f3da2c70..de66e8c96 100644 --- a/sparsify/in_place.ml +++ b/sparsify/in_place.ml @@ -22,7 +22,7 @@ open Unix open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml index 60c6d468e..0f9c9036e 100644 --- a/sparsify/sparsify.ml +++ b/sparsify/sparsify.ml @@ -19,7 +19,7 @@ open Unix open Printf -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/sysprep/main.ml b/sysprep/main.ml index ab631c479..634254d41 100644 --- a/sysprep/main.ml +++ b/sysprep/main.ml @@ -20,7 +20,7 @@ open Unix open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/sysprep/sysprep_operation.ml b/sysprep/sysprep_operation.ml index 17d298fc1..5c5640c67 100644 --- a/sysprep/sysprep_operation.ml +++ b/sysprep/sysprep_operation.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/sysprep/sysprep_operation_backup_files.ml b/sysprep/sysprep_operation_backup_files.ml index a8b22e1b8..850cc3ad2 100644 --- a/sysprep/sysprep_operation_backup_files.ml +++ b/sysprep/sysprep_operation_backup_files.ml @@ -20,7 +20,7 @@ open Printf open Std_utils open C_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Visit open Unix_utils.Fnmatch diff --git a/sysprep/sysprep_operation_cron_spool.ml b/sysprep/sysprep_operation_cron_spool.ml index f48a5201a..0f8270e04 100644 --- a/sysprep/sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Sysprep_operation diff --git a/sysprep/sysprep_operation_fs_uuids.ml b/sysprep/sysprep_operation_fs_uuids.ml index f125eb0d4..8e93d44ce 100644 --- a/sysprep/sysprep_operation_fs_uuids.ml +++ b/sysprep/sysprep_operation_fs_uuids.ml @@ -19,7 +19,7 @@ open Printf open Common_gettext.Gettext -open Common_utils +open Tools_utils open Sysprep_operation @@ -31,7 +31,7 @@ let rec fs_uuids_perform g root side_effects | _, "unknown" -> () | dev, typ -> if not (is_btrfs_subvolume g dev) then ( - let new_uuid = Common_utils.uuidgen () in + let new_uuid = uuidgen () in try g#set_uuid dev new_uuid with diff --git a/sysprep/sysprep_operation_net_hostname.ml b/sysprep/sysprep_operation_net_hostname.ml index fe3f47412..3ffaa7c16 100644 --- a/sysprep/sysprep_operation_net_hostname.ml +++ b/sysprep/sysprep_operation_net_hostname.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Sysprep_operation diff --git a/sysprep/sysprep_operation_net_hwaddr.ml b/sysprep/sysprep_operation_net_hwaddr.ml index 344eadc5b..0f0de65cb 100644 --- a/sysprep/sysprep_operation_net_hwaddr.ml +++ b/sysprep/sysprep_operation_net_hwaddr.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Sysprep_operation diff --git a/sysprep/sysprep_operation_package_manager_cache.ml b/sysprep/sysprep_operation_package_manager_cache.ml index 428352d6c..109a7f213 100644 --- a/sysprep/sysprep_operation_package_manager_cache.ml +++ b/sysprep/sysprep_operation_package_manager_cache.ml @@ -18,7 +18,7 @@ open Sysprep_operation open Common_gettext.Gettext -open Common_utils +open Tools_utils module G = Guestfs diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml index 62a4a2d02..fd9e62aa0 100644 --- a/sysprep/sysprep_operation_script.ml +++ b/sysprep/sysprep_operation_script.ml @@ -20,7 +20,7 @@ open Printf open Unix open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/sysprep/sysprep_operation_user_account.ml b/sysprep/sysprep_operation_user_account.ml index 3102a6267..e7d89235e 100644 --- a/sysprep/sysprep_operation_user_account.ml +++ b/sysprep/sysprep_operation_user_account.ml @@ -20,7 +20,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/v2v/DOM.ml b/v2v/DOM.ml index 9986fc912..3ba93b4f6 100644 --- a/v2v/DOM.ml +++ b/v2v/DOM.ml @@ -19,7 +19,7 @@ (* Poor man's XML DOM, mutable for ease of modification. *) open Std_utils -open Common_utils +open Tools_utils open Printf diff --git a/v2v/changeuid.ml b/v2v/changeuid.ml index 639fcfe12..24fd91b6e 100644 --- a/v2v/changeuid.ml +++ b/v2v/changeuid.ml @@ -22,7 +22,7 @@ open Unix open Printf open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index c271b8242..6d4219bd8 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -21,7 +21,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index 016b03fd6..6c1d9afff 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -24,7 +24,7 @@ open Printf open C_utils open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml index c5bd3d9cf..38d584ba1 100644 --- a/v2v/convert_windows.ml +++ b/v2v/convert_windows.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Utils diff --git a/v2v/copy_to_local.ml b/v2v/copy_to_local.ml index 0a2b7ed75..108eb35ab 100644 --- a/v2v/copy_to_local.ml +++ b/v2v/copy_to_local.ml @@ -21,7 +21,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Getopt.OptionName diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml index 1551e259c..70c04cc64 100644 --- a/v2v/create_libvirt_xml.ml +++ b/v2v/create_libvirt_xml.ml @@ -20,7 +20,7 @@ open Printf open Std_utils open C_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml index fd7ec5fe8..01f966769 100644 --- a/v2v/create_ovf.ml +++ b/v2v/create_ovf.ml @@ -22,7 +22,7 @@ open Unix open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/input_disk.ml b/v2v/input_disk.ml index a92f3a602..8c9d9eb41 100644 --- a/v2v/input_disk.ml +++ b/v2v/input_disk.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/input_libvirt.ml b/v2v/input_libvirt.ml index e8143b6ad..708feccc7 100644 --- a/v2v/input_libvirt.ml +++ b/v2v/input_libvirt.ml @@ -21,7 +21,7 @@ open Printf open Common_gettext.Gettext -open Common_utils +open Tools_utils open Types open Utils diff --git a/v2v/input_libvirt_other.ml b/v2v/input_libvirt_other.ml index 05923e952..0bf64461a 100644 --- a/v2v/input_libvirt_other.ml +++ b/v2v/input_libvirt_other.ml @@ -19,7 +19,7 @@ open Printf open Common_gettext.Gettext -open Common_utils +open Tools_utils open Types open Utils diff --git a/v2v/input_libvirt_vcenter_https.ml b/v2v/input_libvirt_vcenter_https.ml index 8b6856c7e..b2ff58bce 100644 --- a/v2v/input_libvirt_vcenter_https.ml +++ b/v2v/input_libvirt_vcenter_https.ml @@ -19,7 +19,7 @@ (** [-i libvirt] when the source is VMware vCenter *) open Common_gettext.Gettext -open Common_utils +open Tools_utils open Unix_utils.Env open Types diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml index b6a57d374..8fa33fbeb 100644 --- a/v2v/input_libvirt_vddk.ml +++ b/v2v/input_libvirt_vddk.ml @@ -21,7 +21,7 @@ open Unix open Common_gettext.Gettext -open Common_utils +open Tools_utils open Std_utils open Unix_utils diff --git a/v2v/input_libvirt_xen_ssh.ml b/v2v/input_libvirt_xen_ssh.ml index fd3da2c44..a1b1dfa1e 100644 --- a/v2v/input_libvirt_xen_ssh.ml +++ b/v2v/input_libvirt_xen_ssh.ml @@ -19,7 +19,7 @@ (** [-i libvirt] when the source is Xen *) open Common_gettext.Gettext -open Common_utils +open Tools_utils open Types open Xml diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml index 570541d7d..746a8202b 100644 --- a/v2v/input_libvirtxml.ml +++ b/v2v/input_libvirtxml.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml index d521a9fc8..0be38ec27 100644 --- a/v2v/input_ova.ml +++ b/v2v/input_ova.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext diff --git a/v2v/input_vmx.ml b/v2v/input_vmx.ml index bb1650ae9..a6f138787 100644 --- a/v2v/input_vmx.ml +++ b/v2v/input_vmx.ml @@ -20,7 +20,7 @@ open Printf open Scanf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/inspect_source.ml b/v2v/inspect_source.ml index e5d1fd3aa..00197e2fa 100644 --- a/v2v/inspect_source.ml +++ b/v2v/inspect_source.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext module G = Guestfs diff --git a/v2v/linux.ml b/v2v/linux.ml index a1c2c25a5..a5673f737 100644 --- a/v2v/linux.ml +++ b/v2v/linux.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml index 59af38a86..548743749 100644 --- a/v2v/linux_bootloaders.ml +++ b/v2v/linux_bootloaders.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml index 9853b0029..59948cb61 100644 --- a/v2v/linux_kernels.ml +++ b/v2v/linux_kernels.ml @@ -21,7 +21,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/name_from_disk.ml b/v2v/name_from_disk.ml index 452d9462c..4480835eb 100644 --- a/v2v/name_from_disk.ml +++ b/v2v/name_from_disk.ml @@ -17,7 +17,7 @@ *) open Common_gettext.Gettext -open Common_utils +open Tools_utils let name_from_disk disk let name = Filename.basename disk in diff --git a/v2v/output_glance.ml b/v2v/output_glance.ml index a9d267e28..ed7c89878 100644 --- a/v2v/output_glance.ml +++ b/v2v/output_glance.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml index bc7f41ff9..02b4d54ff 100644 --- a/v2v/output_libvirt.ml +++ b/v2v/output_libvirt.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/output_local.ml b/v2v/output_local.ml index de432fb88..93d643f03 100644 --- a/v2v/output_local.ml +++ b/v2v/output_local.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/output_null.ml b/v2v/output_null.ml index e2302fc47..d01f45654 100644 --- a/v2v/output_null.ml +++ b/v2v/output_null.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml index 9e0c67a0b..021bf42df 100644 --- a/v2v/output_qemu.ml +++ b/v2v/output_qemu.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/output_rhv.ml b/v2v/output_rhv.ml index f1a193bde..c3b2294de 100644 --- a/v2v/output_rhv.ml +++ b/v2v/output_rhv.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml index 361a8e555..5b4214b62 100644 --- a/v2v/output_vdsm.ml +++ b/v2v/output_vdsm.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Unix diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml index c71707000..40d558a5e 100644 --- a/v2v/parse_libvirt_xml.ml +++ b/v2v/parse_libvirt_xml.ml @@ -20,7 +20,7 @@ open Printf open C_utils open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Xpath_helpers diff --git a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml index 613e8d075..e3518e30d 100644 --- a/v2v/parse_ovf_from_ova.ml +++ b/v2v/parse_ovf_from_ova.ml @@ -19,7 +19,7 @@ (* Parse OVF from an externally produced OVA file. *) open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext diff --git a/v2v/parse_vmx.ml b/v2v/parse_vmx.ml index 271066eb9..3c72527b9 100644 --- a/v2v/parse_vmx.ml +++ b/v2v/parse_vmx.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext (* As far as I can tell the VMX format is totally unspecified. diff --git a/v2v/target_bus_assignment.ml b/v2v/target_bus_assignment.ml index de6b0148d..b15a519e7 100644 --- a/v2v/target_bus_assignment.ml +++ b/v2v/target_bus_assignment.ml @@ -17,7 +17,7 @@ *) open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Types diff --git a/v2v/test-harness/v2v_test_harness.ml b/v2v/test-harness/v2v_test_harness.ml index ba8c5eeab..ae0033dde 100644 --- a/v2v/test-harness/v2v_test_harness.ml +++ b/v2v/test-harness/v2v_test_harness.ml @@ -24,7 +24,7 @@ open Unix open Printf open Std_utils -open Common_utils +open Tools_utils type test_plan = { guest_clock : float option; diff --git a/v2v/types.ml b/v2v/types.ml index 484f1a3d3..c47c3987a 100644 --- a/v2v/types.ml +++ b/v2v/types.ml @@ -19,7 +19,7 @@ open Printf open Common_gettext.Gettext -open Common_utils +open Tools_utils (* Types. See types.mli for documentation. *) diff --git a/v2v/utils.ml b/v2v/utils.ml index 12ebe23f4..467fd9a12 100644 --- a/v2v/utils.ml +++ b/v2v/utils.ml @@ -21,7 +21,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext (* URI quoting. *) diff --git a/v2v/v2v.ml b/v2v/v2v.ml index 00fbff2bc..9d40f3578 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -21,7 +21,7 @@ open Printf open C_utils open Std_utils -open Common_utils +open Tools_utils open Unix_utils open Common_gettext.Gettext diff --git a/v2v/v2v_unit_tests.ml b/v2v/v2v_unit_tests.ml index 76f04f6fe..ee27fd67b 100644 --- a/v2v/v2v_unit_tests.ml +++ b/v2v/v2v_unit_tests.ml @@ -23,7 +23,7 @@ open Printf open OUnit2 open Std_utils -open Common_utils +open Tools_utils open Types diff --git a/v2v/vCenter.ml b/v2v/vCenter.ml index 434c93395..59292e093 100644 --- a/v2v/vCenter.ml +++ b/v2v/vCenter.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Xml diff --git a/v2v/windows.ml b/v2v/windows.ml index fb68c86c9..5d5a3f09a 100644 --- a/v2v/windows.ml +++ b/v2v/windows.ml @@ -19,7 +19,7 @@ open Printf open Common_gettext.Gettext -open Common_utils +open Tools_utils open Utils diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml index 76af7ab2f..4aa45d100 100644 --- a/v2v/windows_virtio.ml +++ b/v2v/windows_virtio.ml @@ -19,7 +19,7 @@ open Printf open Std_utils -open Common_utils +open Tools_utils open Common_gettext.Gettext open Regedit -- 2.13.2
Maybe Matching Threads
- [PATCH v3 00/22] Replace almost all uses of the Str module with PCRE.
- [PATCH v2 00/18] Replace many more uses of the Str module with PCRE.
- [v2v PATCH] po: do not extract tests
- [PATCH] po: reduce the list of extracted sources
- [PATCH v3 4/4] v2v: Add --print-estimate option to print copy size