diff --git a/.gitignore b/.gitignore index 7441421c3..8a1ffefad 100644 --- a/.gitignore +++ b/.gitignore @@ -274,6 +274,7 @@ Makefile.in /mllib/.depend /mllib/common_gettext.ml /mllib/common_utils_tests +/mllib/config.ml /mllib/dummy /mllib/libdir.ml /ocaml/bindtests.bc diff --git a/builder/Makefile.am b/builder/Makefile.am index caa2d9d11..086af62a7 100644 --- a/builder/Makefile.am +++ b/builder/Makefile.am @@ -83,6 +83,7 @@ OBJECTS = \ $(top_builddir)/mllib/fsync-c.o \ $(top_builddir)/mllib/fsync.cmx \ $(top_builddir)/mllib/password.cmx \ + $(top_builddir)/mllib/config.cmx \ get_kernel.cmx \ downloader.cmx \ sigchecker.cmx \ diff --git a/builder/cmdline.ml b/builder/cmdline.ml index 57e3efdef..17e625e23 100644 --- a/builder/cmdline.ml +++ b/builder/cmdline.ml @@ -39,10 +39,7 @@ let default_cachedir = let parse_cmdline () = let display_version () = - let g = new G.guestfs () in - let version = g#version () in - printf (f_"virt-builder %Ld.%Ld.%Ld%s\n") - version.G.major version.G.minor version.G.release version.G.extra; + printf "virt-builder %s\n" Config.package_version; exit 0 in diff --git a/configure.ac b/configure.ac index 603c4af79..eeca3fa60 100644 --- a/configure.ac +++ b/configure.ac @@ -1674,6 +1674,7 @@ AC_CONFIG_FILES([Makefile lua/Makefile lua/examples/Makefile mllib/Makefile + mllib/config.ml ocaml/META ocaml/Makefile ocaml/examples/Makefile diff --git a/mllib/Makefile.am b/mllib/Makefile.am index 3e750b3ff..32e0ddf7a 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -27,6 +27,7 @@ SOURCES = \ common_gettext.ml \ common_utils.ml \ common_utils_tests.ml \ + config.ml \ crypt-c.c \ crypt.ml \ crypt.mli \ @@ -65,6 +66,7 @@ OBJECTS = \ progress-c.o \ uri-c.o \ crypt-c.o \ + config.cmx \ libdir.cmx \ common_gettext.cmx \ common_utils.cmx \ diff --git a/mllib/config.ml.in b/mllib/config.ml.in new file mode 100644 index 000000000..d18bf7bdf --- /dev/null +++ b/mllib/config.ml.in @@ -0,0 +1,20 @@ +(* configuration for mllib. + * 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@" diff --git a/po/POTFILES-ml b/po/POTFILES-ml index 509e786de..185f87b7b 100644 --- a/po/POTFILES-ml +++ b/po/POTFILES-ml @@ -9,6 +9,7 @@ builder/sigchecker.ml mllib/common_gettext.ml mllib/common_utils.ml mllib/common_utils_tests.ml +mllib/config.ml mllib/crypt.ml mllib/firstboot.ml mllib/fsync.ml diff --git a/resize/Makefile.am b/resize/Makefile.am index 914427794..8333ed90d 100644 --- a/resize/Makefile.am +++ b/resize/Makefile.am @@ -44,6 +44,7 @@ OBJECTS = \ $(top_builddir)/mllib/uRI.cmx \ $(top_builddir)/mllib/common_gettext.cmx \ $(top_builddir)/mllib/common_utils.cmx \ + $(top_builddir)/mllib/config.cmx \ resize.cmx bin_SCRIPTS = virt-resize diff --git a/resize/resize.ml b/resize/resize.ml index 029e16cc0..3a143bd00 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -39,10 +39,7 @@ let infile, outfile, align_first, alignment, copy_boot_loader, lv_expands, machine_readable, ntfsresize_force, output_format, quiet, resizes, resizes_force, shrink, sparse = let display_version () = - let g = new G.guestfs () in - let version = g#version () in - printf (f_"virt-resize %Ld.%Ld.%Ld%s\n") - version.G.major version.G.minor version.G.release version.G.extra; + printf "virt-resize %s\n" Config.package_version; exit 0 in diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am index 28dce731e..98d9c707c 100644 --- a/sparsify/Makefile.am +++ b/sparsify/Makefile.am @@ -40,6 +40,7 @@ OBJECTS = \ $(top_builddir)/mllib/common_utils.cmx \ $(top_builddir)/mllib/tTY.cmx \ $(top_builddir)/mllib/progress.cmx \ + $(top_builddir)/mllib/config.cmx \ statvfs-c.o \ sparsify.cmx diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml index c7d2d567d..da0d7ccc6 100644 --- a/sparsify/sparsify.ml +++ b/sparsify/sparsify.ml @@ -39,10 +39,7 @@ let indisk, outdisk, check_tmpdir, compress, convert, debug_gc, format, ignores, machine_readable, option, quiet, verbose, trace, zeroes = let display_version () = - let g = new G.guestfs () in - let version = g#version () in - printf "virt-sparsify %Ld.%Ld.%Ld%s\n" - version.G.major version.G.minor version.G.release version.G.extra; + printf "virt-sparsify %s\n" Config.package_version; exit 0 in diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index c5be5bada..a74d45576 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -92,6 +92,7 @@ OBJECTS = \ $(top_builddir)/mllib/random_seed.cmx \ $(top_builddir)/mllib/hostname.cmx \ $(top_builddir)/mllib/firstboot.cmx \ + $(top_builddir)/mllib/config.cmx \ sysprep_operation.cmx \ $(patsubst %,sysprep_operation_%.cmx,$(operations)) \ main.cmx diff --git a/sysprep/main.ml b/sysprep/main.ml index cacf7b2e5..8712a76a6 100644 --- a/sysprep/main.ml +++ b/sysprep/main.ml @@ -46,10 +46,7 @@ let debug_gc, operations, g, selinux_relabel, quiet, mount_opts = let mount_opts = ref "" in let display_version () = - let g = new G.guestfs () in - let version = g#version () in - printf "virt-sysprep %Ld.%Ld.%Ld%s\n" - version.G.major version.G.minor version.G.release version.G.extra; + printf "virt-sysprep %s\n" Config.package_version; exit 0 and add_file arg = let uri =