[Libguestfs] [PATCH 1/7] ocaml: Rename Config module as Guestfs_config.

Richard W.M. Jones rjones at redhat.com
Thu Oct 29 19:12:19 UTC 2015


Unfortunately Coccinelle places a Config module in the ocaml libdir,
and this confuses ocamlfind (only when Coccinelle is installed).
Since this is a private module that only libguestfs tools use
internally, just rename it from Config -> Guestfs_config.
---
 .gitignore                   |  2 +-
 builder/Makefile.am          |  2 +-
 builder/cmdline.ml           |  2 +-
 configure.ac                 |  2 +-
 customize/Makefile.am        |  2 +-
 customize/customize_run.ml   |  4 ++--
 customize/firstboot.ml       |  2 +-
 dib/Makefile.am              |  2 +-
 dib/utils.ml                 |  2 +-
 get-kernel/Makefile.am       |  2 +-
 mllib/Makefile.am            |  6 +++---
 mllib/common_utils.ml        |  6 +++---
 mllib/config.ml.in           | 25 -------------------------
 mllib/guestfs_config.ml.in   | 25 +++++++++++++++++++++++++
 po/POTFILES-ml               |  2 +-
 resize/Makefile.am           |  2 +-
 sparsify/Makefile.am         |  2 +-
 sysprep/Makefile.am          |  2 +-
 v2v/Makefile.am              |  4 ++--
 v2v/OVF.ml                   |  2 +-
 v2v/convert_windows.ml       |  4 ++--
 v2v/test-harness/Makefile.am |  2 +-
 v2v/v2v.ml                   |  2 +-
 23 files changed, 53 insertions(+), 53 deletions(-)
 delete mode 100644 mllib/config.ml.in
 create mode 100644 mllib/guestfs_config.ml.in

diff --git a/.gitignore b/.gitignore
index 701b6eb..8f3ecff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -331,8 +331,8 @@ Makefile.in
 /mllib/.depend
 /mllib/common_gettext.ml
 /mllib/common_utils_tests
-/mllib/config.ml
 /mllib/dummy
+/mllib/guestfs_config.ml
 /mllib/JSON_tests
 /mllib/libdir.ml
 /mllib/oUnit-*
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 68b7176..8ab5b9d 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -121,7 +121,7 @@ virt_builder_CFLAGS = \
 
 BOBJECTS = \
 	$(top_builddir)/mllib/libdir.cmo \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/mllib/fsync.cmo \
diff --git a/builder/cmdline.ml b/builder/cmdline.ml
index e6753ae..1d0d3ba 100644
--- a/builder/cmdline.ml
+++ b/builder/cmdline.ml
@@ -276,7 +276,7 @@ read the man page virt-builder(1).
   (* Check the architecture. *)
   let arch =
     match arch with
-    | "" -> Config.host_cpu
+    | "" -> Guestfs_config.host_cpu
     | arch -> arch in
   let arch = normalize_arch arch in
 
diff --git a/configure.ac b/configure.ac
index 90bf54b..cde7fe2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -222,7 +222,7 @@ AC_CONFIG_FILES([Makefile
                  lua/examples/Makefile
                  make-fs/Makefile
                  mllib/Makefile
-                 mllib/config.ml
+                 mllib/guestfs_config.ml
                  ocaml/META
                  ocaml/Makefile
                  ocaml/examples/Makefile
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 705aeb3..aee7729 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -91,7 +91,7 @@ virt_customize_CFLAGS = \
 	$(LIBXML2_CFLAGS)
 
 BOBJECTS = \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/mllib/regedit.cmo \
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index da3a906..ff7bd0d 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
@@ -53,7 +53,7 @@ let run (g : Guestfs.guestfs) root (ops : ops) =
   let do_run ~display cmd =
     if not guest_arch_compatible then
       error (f_"host cpu (%s) and guest arch (%s) are not compatible, so you cannot use command line options that involve running commands in the guest.  Use --firstboot scripts instead.")
-            Config.host_cpu guest_arch;
+            Guestfs_config.host_cpu guest_arch;
 
     (* Add a prologue to the scripts:
      * - Pass environment variables through from the host.
@@ -71,7 +71,7 @@ let run (g : Guestfs.guestfs) root (ops : ops) =
     let env_vars = String.concat "\n" env_vars ^ "\n" in
 
     let cmd =
-      match Config.host_cpu, guest_arch with
+      match Guestfs_config.host_cpu, guest_arch with
       | "x86_64", ("i386"|"i486"|"i586"|"i686") ->
         sprintf "setarch i686 <<\"__EOCMD\"
 %s
diff --git a/customize/firstboot.ml b/customize/firstboot.ml
index a421965..72049f4 100644
--- a/customize/firstboot.ml
+++ b/customize/firstboot.ml
@@ -183,7 +183,7 @@ module Windows = struct
     (* Get the data directory. *)
     let virt_tools_data_dir =
       try Sys.getenv "VIRT_TOOLS_DATA_DIR"
-      with Not_found -> Config.datadir // "virt-tools" in
+      with Not_found -> Guestfs_config.datadir // "virt-tools" in
 
     (* rhsrvany.exe must exist.
      *
diff --git a/dib/Makefile.am b/dib/Makefile.am
index 0a7975c..07dcd6d 100644
--- a/dib/Makefile.am
+++ b/dib/Makefile.am
@@ -52,7 +52,7 @@ virt_dib_CFLAGS = \
 
 BOBJECTS = \
 	$(top_builddir)/mllib/libdir.cmo \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/mllib/mkdtemp.cmo \
diff --git a/dib/utils.ml b/dib/utils.ml
index 835da88..a3be394 100644
--- a/dib/utils.ml
+++ b/dib/utils.ml
@@ -30,7 +30,7 @@ let unit_GB howmany =
 
 let current_arch () =
   (* Turn a CPU into the dpkg architecture naming. *)
-  match Config.host_cpu with
+  match Guestfs_config.host_cpu with
   | "amd64" | "x86_64" -> "amd64"
   | "i386" | "i486" | "i586" | "i686" -> "i386"
   | arch when String.is_prefix arch "armv" -> "armhf"
diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am
index a4a23a4..f764edc 100644
--- a/get-kernel/Makefile.am
+++ b/get-kernel/Makefile.am
@@ -54,7 +54,7 @@ virt_get_kernel_CFLAGS = \
 
 BOBJECTS = \
 	$(top_builddir)/mllib/libdir.cmo \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/mllib/uRI.cmo \
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 39f1b33..a075f14 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -19,7 +19,7 @@ include $(top_srcdir)/subdir-rules.mk
 
 EXTRA_DIST = \
 	$(SOURCES_MLI) \
-	$(filter-out config.ml libdir.ml,$(SOURCES_ML)) \
+	$(filter-out guestfs_config.ml libdir.ml,$(SOURCES_ML)) \
 	$(SOURCES_C) \
 	common_utils_tests.ml \
 	JSON_tests.ml
@@ -37,7 +37,7 @@ SOURCES_MLI = \
 	uRI.mli
 
 SOURCES_ML = \
-	config.ml \
+	guestfs_config.ml \
 	libdir.ml \
 	common_gettext.ml \
 	common_utils.ml \
@@ -143,7 +143,7 @@ libdir.ml: Makefile
 
 common_utils_tests_SOURCES = dummy.c
 common_utils_tests_BOBJECTS = \
-	config.cmo \
+	guestfs_config.cmo \
 	common_gettext.cmo \
 	common_utils.cmo \
 	common_utils_tests.cmo
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 4d07f3a..d444855 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -386,11 +386,11 @@ let run_main_and_handle_errors main =
  * the OCaml tools.
  *)
 let print_version_and_exit () =
-  printf "%s %s\n%!" prog Config.package_version_full;
+  printf "%s %s\n%!" prog Guestfs_config.package_version_full;
   exit 0
 
 let generated_by =
-  sprintf (f_"generated by %s %s") prog Config.package_version_full
+  sprintf (f_"generated by %s %s") prog Guestfs_config.package_version_full
 
 let read_whole_file path =
   let buf = Buffer.create 16384 in
@@ -787,7 +787,7 @@ let normalize_arch = function
  * to run commands in the libguestfs appliance?
  *)
 let guest_arch_compatible guest_arch =
-  let own = normalize_arch Config.host_cpu in
+  let own = normalize_arch Guestfs_config.host_cpu in
   let guest_arch = normalize_arch guest_arch in
   match own, guest_arch with
   | x, y when x = y -> true
diff --git a/mllib/config.ml.in b/mllib/config.ml.in
deleted file mode 100644
index fe7850b..0000000
--- a/mllib/config.ml.in
+++ /dev/null
@@ -1,25 +0,0 @@
-(* configuration for mllib.
- * @configure_input@
- * Copyright (C) 2013 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.
- *)
-
-let package_name = "@PACKAGE_NAME@"
-let package_version = "@PACKAGE_VERSION@"
-let package_version_full = "@PACKAGE_VERSION_FULL@"
-let prefix = "@prefix@"
-let datadir = prefix ^ "/share"
-let host_cpu = "@host_cpu@"
diff --git a/mllib/guestfs_config.ml.in b/mllib/guestfs_config.ml.in
new file mode 100644
index 0000000..04d1807
--- /dev/null
+++ b/mllib/guestfs_config.ml.in
@@ -0,0 +1,25 @@
+(* configuration for mllib.
+ * @configure_input@
+ * Copyright (C) 2013-2015 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.
+ *)
+
+let package_name = "@PACKAGE_NAME@"
+let package_version = "@PACKAGE_VERSION@"
+let package_version_full = "@PACKAGE_VERSION_FULL@"
+let prefix = "@prefix@"
+let datadir = prefix ^ "/share"
+let host_cpu = "@host_cpu@"
diff --git a/po/POTFILES-ml b/po/POTFILES-ml
index 28e2fa7..2555a88 100644
--- a/po/POTFILES-ml
+++ b/po/POTFILES-ml
@@ -41,8 +41,8 @@ mllib/JSON_tests.ml
 mllib/common_gettext.ml
 mllib/common_utils.ml
 mllib/common_utils_tests.ml
-mllib/config.ml
 mllib/fsync.ml
+mllib/guestfs_config.ml
 mllib/libdir.ml
 mllib/mkdtemp.ml
 mllib/planner.ml
diff --git a/resize/Makefile.am b/resize/Makefile.am
index d142288..a013bcb 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -56,7 +56,7 @@ BOBJECTS = \
 	$(top_builddir)/mllib/fsync.cmo \
 	$(top_builddir)/mllib/progress.cmo \
 	$(top_builddir)/mllib/uRI.cmo \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(SOURCES_ML:.ml=.cmo)
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index ab9af7a..b785dba 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -52,7 +52,7 @@ virt_sparsify_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 
 BOBJECTS = \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/mllib/progress.cmo \
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 1e30455..a586327 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -103,7 +103,7 @@ virt_sysprep_CFLAGS = \
 	$(LIBXML2_CFLAGS)
 
 BOBJECTS = \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/mllib/uRI.cmo \
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 0ed1ace..3718d45 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -143,7 +143,7 @@ virt_v2v_CFLAGS = \
 	$(LIBVIRT_CFLAGS)
 
 BOBJECTS = \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/mllib/regedit.cmo \
@@ -314,7 +314,7 @@ check_PROGRAMS += v2v_unit_tests
 endif
 
 v2v_unit_tests_BOBJECTS = \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	stringMap.cmo \
diff --git a/v2v/OVF.ml b/v2v/OVF.ml
index 17008ee..45edca5 100644
--- a/v2v/OVF.ml
+++ b/v2v/OVF.ml
@@ -32,7 +32,7 @@ open Types
 open Utils
 open DOM
 
-let title = sprintf "Exported by virt-v2v %s" Config.package_version
+let title = sprintf "Exported by virt-v2v %s" Guestfs_config.package_version
 
 (* We set the creation time to be the same for all dates in
  * all metadata files.  All dates in OVF are UTC.
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index fbd3ce1..de3aed5 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -46,14 +46,14 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source =
   (* Get the data directory. *)
   let virt_tools_data_dir =
     try Sys.getenv "VIRT_TOOLS_DATA_DIR"
-    with Not_found -> Config.datadir // "virt-tools" in
+    with Not_found -> Guestfs_config.datadir // "virt-tools" in
 
   let virtio_win =
     try Sys.getenv "VIRTIO_WIN"
     with Not_found ->
       try Sys.getenv "VIRTIO_WIN_DIR" (* old name for VIRTIO_WIN *)
       with Not_found ->
-        Config.datadir // "virtio-win" in
+        Guestfs_config.datadir // "virtio-win" in
 
   (* Check if RHEV-APT exists.  This is optional. *)
   let rhev_apt_exe = virt_tools_data_dir // "rhev-apt.exe" in
diff --git a/v2v/test-harness/Makefile.am b/v2v/test-harness/Makefile.am
index 7bba689..e562cf4 100644
--- a/v2v/test-harness/Makefile.am
+++ b/v2v/test-harness/Makefile.am
@@ -49,7 +49,7 @@ OCAMLPACKAGES = \
 OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 
 BOBJECTS = \
-	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/guestfs_config.cmo \
 	$(top_builddir)/mllib/common_gettext.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/v2v/xml.cmo \
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 2f473eb..a7f726b 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -57,7 +57,7 @@ let rec main () =
   (* Print the version, easier than asking users to tell us. *)
   if verbose () then
     printf "%s: %s %s (%s)\n%!"
-      prog Config.package_name Config.package_version Config.host_cpu;
+      prog Guestfs_config.package_name Guestfs_config.package_version Guestfs_config.host_cpu;
 
   let source = open_source input print_source in
   let source = amend_source source output_name network_map in
-- 
2.5.0




More information about the Libguestfs mailing list