|
|
ffd6ed |
From d4a1a398ec871c803f37a70efe3d2e8d083bd2fe Mon Sep 17 00:00:00 2001
|
|
|
ffd6ed |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
ffd6ed |
Date: Fri, 15 May 2015 10:02:28 +0100
|
|
|
ffd6ed |
Subject: [PATCH] customize: Give a clear error message if host_cpu not
|
|
|
ffd6ed |
compatible with guest arch.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
In cases where we are asked to run commands in the guest (eg. options
|
|
|
ffd6ed |
such as --run-command or --install), give a clear error in the cases
|
|
|
ffd6ed |
where the guest arch is not compatible with the host arch.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
Similar code existed in virt-builder, but I have removed that. Users
|
|
|
ffd6ed |
will still get an error message, it will just happen a bit later on.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
There is a slight change in semantics here, in that architectures are
|
|
|
ffd6ed |
no longer normalized when matching, but that's probably fine since
|
|
|
ffd6ed |
`virt-builder -l' prints the exact arch string that people should use.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
(cherry picked from commit 8864c47b94cf44ac2d0d8d4b5019073ad1da121b)
|
|
|
ffd6ed |
---
|
|
|
ffd6ed |
builder/Makefile.am | 9 +-------
|
|
|
ffd6ed |
builder/architecture.ml | 41 ----------------------------------
|
|
|
ffd6ed |
builder/builder.ml | 2 +-
|
|
|
ffd6ed |
builder/cmdline.ml | 21 ++----------------
|
|
|
ffd6ed |
builder/uname-c.c | 55 ----------------------------------------------
|
|
|
ffd6ed |
builder/uname.ml | 27 -----------------------
|
|
|
ffd6ed |
builder/uname.mli | 28 -----------------------
|
|
|
ffd6ed |
customize/Makefile.am | 1 +
|
|
|
ffd6ed |
customize/customize_run.ml | 10 +++++++++
|
|
|
ffd6ed |
mllib/Makefile.am | 4 ++--
|
|
|
ffd6ed |
mllib/common_utils.ml | 9 ++++++++
|
|
|
ffd6ed |
mllib/common_utils.mli | 4 ++++
|
|
|
ffd6ed |
po/POTFILES | 1 -
|
|
|
ffd6ed |
po/POTFILES-ml | 2 --
|
|
|
ffd6ed |
resize/Makefile.am | 1 +
|
|
|
ffd6ed |
sparsify/Makefile.am | 2 +-
|
|
|
ffd6ed |
sysprep/Makefile.am | 2 +-
|
|
|
ffd6ed |
v2v/Makefile.am | 2 +-
|
|
|
ffd6ed |
18 files changed, 34 insertions(+), 187 deletions(-)
|
|
|
ffd6ed |
delete mode 100644 builder/architecture.ml
|
|
|
ffd6ed |
delete mode 100644 builder/uname-c.c
|
|
|
ffd6ed |
delete mode 100644 builder/uname.ml
|
|
|
ffd6ed |
delete mode 100644 builder/uname.mli
|
|
|
ffd6ed |
|
|
|
ffd6ed |
diff --git a/builder/Makefile.am b/builder/Makefile.am
|
|
|
ffd6ed |
index dd96533..1698160 100644
|
|
|
ffd6ed |
--- a/builder/Makefile.am
|
|
|
ffd6ed |
+++ b/builder/Makefile.am
|
|
|
ffd6ed |
@@ -44,7 +44,6 @@ CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-builder
|
|
|
ffd6ed |
|
|
|
ffd6ed |
# Alphabetical order.
|
|
|
ffd6ed |
SOURCES = \
|
|
|
ffd6ed |
- architecture.ml \
|
|
|
ffd6ed |
builder.ml \
|
|
|
ffd6ed |
cache.mli \
|
|
|
ffd6ed |
cache.ml \
|
|
|
ffd6ed |
@@ -72,10 +71,7 @@ SOURCES = \
|
|
|
ffd6ed |
sigchecker.mli \
|
|
|
ffd6ed |
sigchecker.ml \
|
|
|
ffd6ed |
sources.mli \
|
|
|
ffd6ed |
- sources.ml \
|
|
|
ffd6ed |
- uname.ml \
|
|
|
ffd6ed |
- uname.mli \
|
|
|
ffd6ed |
- uname-c.c
|
|
|
ffd6ed |
+ sources.ml
|
|
|
ffd6ed |
|
|
|
ffd6ed |
man_MANS =
|
|
|
ffd6ed |
noinst_DATA =
|
|
|
ffd6ed |
@@ -121,9 +117,6 @@ deps = \
|
|
|
ffd6ed |
pxzcat.cmx \
|
|
|
ffd6ed |
setlocale-c.o \
|
|
|
ffd6ed |
setlocale.cmx \
|
|
|
ffd6ed |
- uname-c.o \
|
|
|
ffd6ed |
- uname.cmx \
|
|
|
ffd6ed |
- architecture.cmx \
|
|
|
ffd6ed |
ini_reader.cmx \
|
|
|
ffd6ed |
paths.cmx \
|
|
|
ffd6ed |
languages.cmx \
|
|
|
ffd6ed |
diff --git a/builder/architecture.ml b/builder/architecture.ml
|
|
|
ffd6ed |
deleted file mode 100644
|
|
|
ffd6ed |
index 59c1cf6..0000000
|
|
|
ffd6ed |
--- a/builder/architecture.ml
|
|
|
ffd6ed |
+++ /dev/null
|
|
|
ffd6ed |
@@ -1,41 +0,0 @@
|
|
|
ffd6ed |
-(* virt-builder
|
|
|
ffd6ed |
- * Copyright (C) 2014 Red Hat Inc.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * This program is free software; you can redistribute it and/or modify
|
|
|
ffd6ed |
- * it under the terms of the GNU General Public License as published by
|
|
|
ffd6ed |
- * the Free Software Foundation; either version 2 of the License, or
|
|
|
ffd6ed |
- * (at your option) any later version.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * This program is distributed in the hope that it will be useful,
|
|
|
ffd6ed |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ffd6ed |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ffd6ed |
- * GNU General Public License for more details.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * You should have received a copy of the GNU General Public License along
|
|
|
ffd6ed |
- * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
ffd6ed |
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
ffd6ed |
- *)
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-open Common_gettext.Gettext
|
|
|
ffd6ed |
-open Common_utils
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-open Unix
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-let filter_arch = function
|
|
|
ffd6ed |
- | "amd64" | "x86_64" | "x64" -> "x86_64"
|
|
|
ffd6ed |
- | "powerpc" | "ppc" -> "ppc"
|
|
|
ffd6ed |
- | arch -> arch
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-let arch_is_compatible nativearch otherarch =
|
|
|
ffd6ed |
- let nativearch = filter_arch nativearch in
|
|
|
ffd6ed |
- let otherarch = filter_arch otherarch in
|
|
|
ffd6ed |
- match nativearch, otherarch with
|
|
|
ffd6ed |
- | a, b when a = b -> true
|
|
|
ffd6ed |
- | "x86_64", "i386" -> true
|
|
|
ffd6ed |
- | "ppc64", "ppc" -> true
|
|
|
ffd6ed |
- | "sparc64", "sparc" -> true
|
|
|
ffd6ed |
- | a, b -> false
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-let current_arch =
|
|
|
ffd6ed |
- try filter_arch ((Uname.uname ()).Uname.machine)
|
|
|
ffd6ed |
- with Unix_error _ -> "unknown"
|
|
|
ffd6ed |
diff --git a/builder/builder.ml b/builder/builder.ml
|
|
|
ffd6ed |
index 121c5fb..1ab580b 100644
|
|
|
ffd6ed |
--- a/builder/builder.ml
|
|
|
ffd6ed |
+++ b/builder/builder.ml
|
|
|
ffd6ed |
@@ -243,7 +243,7 @@ let main () =
|
|
|
ffd6ed |
let item =
|
|
|
ffd6ed |
try List.find (
|
|
|
ffd6ed |
fun (name, { Index_parser.arch = a }) ->
|
|
|
ffd6ed |
- name = arg && arch = Architecture.filter_arch a
|
|
|
ffd6ed |
+ name = arg && arch = a
|
|
|
ffd6ed |
) index
|
|
|
ffd6ed |
with Not_found ->
|
|
|
ffd6ed |
eprintf (f_"%s: cannot find os-version '%s' with architecture '%s'.\nUse --list to list available guest types.\n")
|
|
|
ffd6ed |
diff --git a/builder/cmdline.ml b/builder/cmdline.ml
|
|
|
ffd6ed |
index 1242aaa..56447e7 100644
|
|
|
ffd6ed |
--- a/builder/cmdline.ml
|
|
|
ffd6ed |
+++ b/builder/cmdline.ml
|
|
|
ffd6ed |
@@ -312,25 +312,8 @@ read the man page virt-builder(1).
|
|
|
ffd6ed |
(* Check the architecture. *)
|
|
|
ffd6ed |
let arch =
|
|
|
ffd6ed |
match arch with
|
|
|
ffd6ed |
- | "" -> Architecture.current_arch
|
|
|
ffd6ed |
- | arch ->
|
|
|
ffd6ed |
- let target_arch = Architecture.filter_arch arch in
|
|
|
ffd6ed |
- if Architecture.arch_is_compatible Architecture.current_arch target_arch <> true then (
|
|
|
ffd6ed |
- let requires_execute_on_guest = List.exists (
|
|
|
ffd6ed |
- function
|
|
|
ffd6ed |
- | `Command _ | `InstallPackages _ | `Script _ | `Update -> true
|
|
|
ffd6ed |
- | `Delete _ | `Edit _ | `FirstbootCommand _ | `FirstbootPackages _
|
|
|
ffd6ed |
- | `FirstbootScript _ | `Hostname _ | `Link _ | `Mkdir _
|
|
|
ffd6ed |
- | `Password _ | `RootPassword _ | `Scrub _ | `Timezone _ | `Upload _
|
|
|
ffd6ed |
- | `Write _ | `Chmod _ -> false
|
|
|
ffd6ed |
- ) ops.ops in
|
|
|
ffd6ed |
- if requires_execute_on_guest then (
|
|
|
ffd6ed |
- eprintf (f_"%s: sorry, cannot run commands on a guest with a different architecture\n")
|
|
|
ffd6ed |
- prog;
|
|
|
ffd6ed |
- exit 1
|
|
|
ffd6ed |
- );
|
|
|
ffd6ed |
- );
|
|
|
ffd6ed |
- target_arch in
|
|
|
ffd6ed |
+ | "" -> Config.host_cpu
|
|
|
ffd6ed |
+ | arch -> arch in
|
|
|
ffd6ed |
|
|
|
ffd6ed |
(* If user didn't elect any root password, that means we set a random
|
|
|
ffd6ed |
* root password.
|
|
|
ffd6ed |
diff --git a/builder/uname-c.c b/builder/uname-c.c
|
|
|
ffd6ed |
deleted file mode 100644
|
|
|
ffd6ed |
index b8a6ef7..0000000
|
|
|
ffd6ed |
--- a/builder/uname-c.c
|
|
|
ffd6ed |
+++ /dev/null
|
|
|
ffd6ed |
@@ -1,55 +0,0 @@
|
|
|
ffd6ed |
-/* virt-builder
|
|
|
ffd6ed |
- * Copyright (C) 2014 Red Hat Inc.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * This program is free software; you can redistribute it and/or modify
|
|
|
ffd6ed |
- * it under the terms of the GNU General Public License as published by
|
|
|
ffd6ed |
- * the Free Software Foundation; either version 2 of the License, or
|
|
|
ffd6ed |
- * (at your option) any later version.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * This program is distributed in the hope that it will be useful,
|
|
|
ffd6ed |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ffd6ed |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ffd6ed |
- * GNU General Public License for more details.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * You should have received a copy of the GNU General Public License
|
|
|
ffd6ed |
- * along with this program; if not, write to the Free Software
|
|
|
ffd6ed |
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
ffd6ed |
- */
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-#include <config.h>
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-#include <errno.h>
|
|
|
ffd6ed |
-#include <sys/utsname.h>
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-#include <caml/alloc.h>
|
|
|
ffd6ed |
-#include <caml/fail.h>
|
|
|
ffd6ed |
-#include <caml/memory.h>
|
|
|
ffd6ed |
-#include <caml/mlvalues.h>
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-#ifdef HAVE_CAML_UNIXSUPPORT_H
|
|
|
ffd6ed |
-#include <caml/unixsupport.h>
|
|
|
ffd6ed |
-#else
|
|
|
ffd6ed |
-#define Nothing ((value) 0)
|
|
|
ffd6ed |
-extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
|
|
|
ffd6ed |
-#endif
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-value
|
|
|
ffd6ed |
-virt_builder_uname (value unit)
|
|
|
ffd6ed |
-{
|
|
|
ffd6ed |
- CAMLparam0 ();
|
|
|
ffd6ed |
- CAMLlocal1 (rv);
|
|
|
ffd6ed |
- struct utsname u;
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
- if (uname (&u) < 0)
|
|
|
ffd6ed |
- unix_error (errno, (char *) "uname", Val_int (0));
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
- rv = caml_alloc (5, 0);
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
- Store_field (rv, 0, caml_copy_string (u.sysname));
|
|
|
ffd6ed |
- Store_field (rv, 1, caml_copy_string (u.nodename));
|
|
|
ffd6ed |
- Store_field (rv, 2, caml_copy_string (u.release));
|
|
|
ffd6ed |
- Store_field (rv, 3, caml_copy_string (u.version));
|
|
|
ffd6ed |
- Store_field (rv, 4, caml_copy_string (u.machine));
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
- CAMLreturn (rv);
|
|
|
ffd6ed |
-}
|
|
|
ffd6ed |
diff --git a/builder/uname.ml b/builder/uname.ml
|
|
|
ffd6ed |
deleted file mode 100644
|
|
|
ffd6ed |
index c370c2c..0000000
|
|
|
ffd6ed |
--- a/builder/uname.ml
|
|
|
ffd6ed |
+++ /dev/null
|
|
|
ffd6ed |
@@ -1,27 +0,0 @@
|
|
|
ffd6ed |
-(* virt-builder
|
|
|
ffd6ed |
- * Copyright (C) 2014 Red Hat Inc.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * This program is free software; you can redistribute it and/or modify
|
|
|
ffd6ed |
- * it under the terms of the GNU General Public License as published by
|
|
|
ffd6ed |
- * the Free Software Foundation; either version 2 of the License, or
|
|
|
ffd6ed |
- * (at your option) any later version.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * This program is distributed in the hope that it will be useful,
|
|
|
ffd6ed |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ffd6ed |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ffd6ed |
- * GNU General Public License for more details.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * You should have received a copy of the GNU General Public License along
|
|
|
ffd6ed |
- * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
ffd6ed |
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
ffd6ed |
- *)
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-type uname_struct = {
|
|
|
ffd6ed |
- sysname : string;
|
|
|
ffd6ed |
- nodename : string;
|
|
|
ffd6ed |
- release : string;
|
|
|
ffd6ed |
- version : string;
|
|
|
ffd6ed |
- machine : string;
|
|
|
ffd6ed |
-}
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-external uname : unit -> uname_struct = "virt_builder_uname"
|
|
|
ffd6ed |
diff --git a/builder/uname.mli b/builder/uname.mli
|
|
|
ffd6ed |
deleted file mode 100644
|
|
|
ffd6ed |
index aea441b..0000000
|
|
|
ffd6ed |
--- a/builder/uname.mli
|
|
|
ffd6ed |
+++ /dev/null
|
|
|
ffd6ed |
@@ -1,28 +0,0 @@
|
|
|
ffd6ed |
-(* virt-builder
|
|
|
ffd6ed |
- * Copyright (C) 2014 Red Hat Inc.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * This program is free software; you can redistribute it and/or modify
|
|
|
ffd6ed |
- * it under the terms of the GNU General Public License as published by
|
|
|
ffd6ed |
- * the Free Software Foundation; either version 2 of the License, or
|
|
|
ffd6ed |
- * (at your option) any later version.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * This program is distributed in the hope that it will be useful,
|
|
|
ffd6ed |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ffd6ed |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ffd6ed |
- * GNU General Public License for more details.
|
|
|
ffd6ed |
- *
|
|
|
ffd6ed |
- * You should have received a copy of the GNU General Public License along
|
|
|
ffd6ed |
- * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
ffd6ed |
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
ffd6ed |
- *)
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-type uname_struct = {
|
|
|
ffd6ed |
- sysname : string;
|
|
|
ffd6ed |
- nodename : string;
|
|
|
ffd6ed |
- release : string;
|
|
|
ffd6ed |
- version : string;
|
|
|
ffd6ed |
- machine : string;
|
|
|
ffd6ed |
-}
|
|
|
ffd6ed |
-
|
|
|
ffd6ed |
-val uname : unit -> uname_struct
|
|
|
ffd6ed |
-(** [uname] Tiny wrapper to the C [uname]. *)
|
|
|
ffd6ed |
diff --git a/customize/Makefile.am b/customize/Makefile.am
|
|
|
ffd6ed |
index 0760476..ebdc2d4 100644
|
|
|
ffd6ed |
--- a/customize/Makefile.am
|
|
|
ffd6ed |
+++ b/customize/Makefile.am
|
|
|
ffd6ed |
@@ -64,6 +64,7 @@ if HAVE_OCAML
|
|
|
ffd6ed |
deps = \
|
|
|
ffd6ed |
$(top_builddir)/fish/guestfish-uri.o \
|
|
|
ffd6ed |
$(top_builddir)/fish/guestfish-file-edit.o \
|
|
|
ffd6ed |
+ $(top_builddir)/mllib/config.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/common_gettext.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/tty-c.o \
|
|
|
ffd6ed |
$(top_builddir)/mllib/tTY.cmx \
|
|
|
ffd6ed |
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
|
|
|
ffd6ed |
index af513f0..6b861d5 100644
|
|
|
ffd6ed |
--- a/customize/customize_run.ml
|
|
|
ffd6ed |
+++ b/customize/customize_run.ml
|
|
|
ffd6ed |
@@ -31,6 +31,12 @@ let run ~prog ~verbose ~quiet (g : Guestfs.guestfs) root (ops : ops) =
|
|
|
ffd6ed |
(* Timestamped messages in ordinary, non-debug non-quiet mode. *)
|
|
|
ffd6ed |
let msg fs = make_message_function ~quiet fs in
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+ (* Is the host_cpu compatible with the guest arch? ie. Can we
|
|
|
ffd6ed |
+ * run commands in this guest?
|
|
|
ffd6ed |
+ *)
|
|
|
ffd6ed |
+ let guest_arch = g#inspect_get_arch root in
|
|
|
ffd6ed |
+ let guest_arch_compatible = guest_arch_compatible guest_arch in
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
(* Based on the guest type, choose a log file location. *)
|
|
|
ffd6ed |
let logfile =
|
|
|
ffd6ed |
match g#inspect_get_type root with
|
|
|
ffd6ed |
@@ -55,6 +61,10 @@ let run ~prog ~verbose ~quiet (g : Guestfs.guestfs) root (ops : ops) =
|
|
|
ffd6ed |
|
|
|
ffd6ed |
(* Useful wrapper for scripts. *)
|
|
|
ffd6ed |
let do_run ~display cmd =
|
|
|
ffd6ed |
+ if not guest_arch_compatible then
|
|
|
ffd6ed |
+ error ~prog (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.")
|
|
|
ffd6ed |
+ Config.host_cpu guest_arch;
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
(* Add a prologue to the scripts:
|
|
|
ffd6ed |
* - Pass environment variables through from the host.
|
|
|
ffd6ed |
* - Send stdout and stderr to a log file so we capture all output
|
|
|
ffd6ed |
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
|
|
|
ffd6ed |
index 653b8aa..9916f7a 100644
|
|
|
ffd6ed |
--- a/mllib/Makefile.am
|
|
|
ffd6ed |
+++ b/mllib/Makefile.am
|
|
|
ffd6ed |
@@ -151,11 +151,11 @@ DEFAULT_INCLUDES = \
|
|
|
ffd6ed |
check_SCRIPTS = common_utils_tests
|
|
|
ffd6ed |
|
|
|
ffd6ed |
if HAVE_OCAMLOPT
|
|
|
ffd6ed |
-common_utils_tests: common_gettext.cmx tty-c.o tTY.cmx common_utils.cmx common_utils_tests.cmx
|
|
|
ffd6ed |
+common_utils_tests: config.cmx common_gettext.cmx tty-c.o tTY.cmx common_utils.cmx common_utils_tests.cmx
|
|
|
ffd6ed |
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
|
|
|
ffd6ed |
mlguestfs.cmxa -linkpkg $^ -cclib -lncurses -o $@
|
|
|
ffd6ed |
else
|
|
|
ffd6ed |
-common_utils_tests: common_gettext.cmo tty-c.o tTY.cmo common_utils.cmo common_utils_tests.cmo
|
|
|
ffd6ed |
+common_utils_tests: config.cmo common_gettext.cmo tty-c.o tTY.cmo common_utils.cmo common_utils_tests.cmo
|
|
|
ffd6ed |
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
|
|
|
ffd6ed |
mlguestfs.cma -linkpkg $^ -cclib -lncurses -custom -o $@
|
|
|
ffd6ed |
endif
|
|
|
ffd6ed |
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
|
|
|
ffd6ed |
index 7c64ad0..a2513ea 100644
|
|
|
ffd6ed |
--- a/mllib/common_utils.ml
|
|
|
ffd6ed |
+++ b/mllib/common_utils.ml
|
|
|
ffd6ed |
@@ -593,3 +593,12 @@ let is_directory path =
|
|
|
ffd6ed |
let absolute_path path =
|
|
|
ffd6ed |
if not (Filename.is_relative path) then path
|
|
|
ffd6ed |
else Sys.getcwd () // path
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+(* Are guest arch and host_cpu compatible, in terms of being able
|
|
|
ffd6ed |
+ * to run commands in the libguestfs appliance?
|
|
|
ffd6ed |
+ *)
|
|
|
ffd6ed |
+let guest_arch_compatible guest_arch =
|
|
|
ffd6ed |
+ match Config.host_cpu, guest_arch with
|
|
|
ffd6ed |
+ | x, y when x = y -> true
|
|
|
ffd6ed |
+ | "x86_64", ("i386"|"i486"|"i586"|"i686") -> true
|
|
|
ffd6ed |
+ | _ -> false
|
|
|
ffd6ed |
diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli
|
|
|
ffd6ed |
index 6d0a0fc..4cf9259 100644
|
|
|
ffd6ed |
--- a/mllib/common_utils.mli
|
|
|
ffd6ed |
+++ b/mllib/common_utils.mli
|
|
|
ffd6ed |
@@ -129,3 +129,7 @@ val is_directory : string -> bool
|
|
|
ffd6ed |
|
|
|
ffd6ed |
val absolute_path : string -> string
|
|
|
ffd6ed |
(** Convert any path to an absolute path. *)
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+val guest_arch_compatible : string -> bool
|
|
|
ffd6ed |
+(** Are guest arch and host_cpu compatible, in terms of being able
|
|
|
ffd6ed |
+ to run commands in the libguestfs appliance? *)
|
|
|
ffd6ed |
diff --git a/po/POTFILES b/po/POTFILES
|
|
|
ffd6ed |
index c64afda..320710f 100644
|
|
|
ffd6ed |
--- a/po/POTFILES
|
|
|
ffd6ed |
+++ b/po/POTFILES
|
|
|
ffd6ed |
@@ -6,7 +6,6 @@ builder/index-struct.c
|
|
|
ffd6ed |
builder/index-validate.c
|
|
|
ffd6ed |
builder/pxzcat-c.c
|
|
|
ffd6ed |
builder/setlocale-c.c
|
|
|
ffd6ed |
-builder/uname-c.c
|
|
|
ffd6ed |
cat/cat.c
|
|
|
ffd6ed |
cat/filesystems.c
|
|
|
ffd6ed |
cat/log.c
|
|
|
ffd6ed |
diff --git a/po/POTFILES-ml b/po/POTFILES-ml
|
|
|
ffd6ed |
index 7403497..915c611 100644
|
|
|
ffd6ed |
--- a/po/POTFILES-ml
|
|
|
ffd6ed |
+++ b/po/POTFILES-ml
|
|
|
ffd6ed |
@@ -1,4 +1,3 @@
|
|
|
ffd6ed |
-builder/architecture.ml
|
|
|
ffd6ed |
builder/builder.ml
|
|
|
ffd6ed |
builder/cache.ml
|
|
|
ffd6ed |
builder/cmdline.ml
|
|
|
ffd6ed |
@@ -13,7 +12,6 @@ builder/pxzcat.ml
|
|
|
ffd6ed |
builder/setlocale.ml
|
|
|
ffd6ed |
builder/sigchecker.ml
|
|
|
ffd6ed |
builder/sources.ml
|
|
|
ffd6ed |
-builder/uname.ml
|
|
|
ffd6ed |
customize/crypt.ml
|
|
|
ffd6ed |
customize/customize_cmdline.ml
|
|
|
ffd6ed |
customize/customize_main.ml
|
|
|
ffd6ed |
diff --git a/resize/Makefile.am b/resize/Makefile.am
|
|
|
ffd6ed |
index eb4ded3..26a6587 100644
|
|
|
ffd6ed |
--- a/resize/Makefile.am
|
|
|
ffd6ed |
+++ b/resize/Makefile.am
|
|
|
ffd6ed |
@@ -32,6 +32,7 @@ if HAVE_OCAML
|
|
|
ffd6ed |
|
|
|
ffd6ed |
# Note this list must be in dependency order.
|
|
|
ffd6ed |
deps = \
|
|
|
ffd6ed |
+ $(top_builddir)/mllib/config.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/tty-c.o \
|
|
|
ffd6ed |
$(top_builddir)/mllib/tTY.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/fsync-c.o \
|
|
|
ffd6ed |
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
|
|
|
ffd6ed |
index 48cd5f0..6717eb0 100644
|
|
|
ffd6ed |
--- a/sparsify/Makefile.am
|
|
|
ffd6ed |
+++ b/sparsify/Makefile.am
|
|
|
ffd6ed |
@@ -52,11 +52,11 @@ virt_sparsify_CFLAGS = \
|
|
|
ffd6ed |
$(WARN_CFLAGS) $(WERROR_CFLAGS)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
BOBJECTS = \
|
|
|
ffd6ed |
+ $(top_builddir)/mllib/config.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/common_gettext.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/tTY.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/common_utils.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/progress.cmo \
|
|
|
ffd6ed |
- $(top_builddir)/mllib/config.cmo \
|
|
|
ffd6ed |
$(SOURCES_ML:.ml=.cmo)
|
|
|
ffd6ed |
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
|
|
|
ffd6ed |
index b1cebc2..17991c9 100644
|
|
|
ffd6ed |
--- a/sysprep/Makefile.am
|
|
|
ffd6ed |
+++ b/sysprep/Makefile.am
|
|
|
ffd6ed |
@@ -81,13 +81,13 @@ if HAVE_OCAML
|
|
|
ffd6ed |
|
|
|
ffd6ed |
# Note this list must be in dependency order.
|
|
|
ffd6ed |
deps = \
|
|
|
ffd6ed |
+ $(top_builddir)/mllib/config.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/common_gettext.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/tty-c.o \
|
|
|
ffd6ed |
$(top_builddir)/mllib/tTY.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/common_utils.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/uri-c.o \
|
|
|
ffd6ed |
$(top_builddir)/mllib/uRI.cmx \
|
|
|
ffd6ed |
- $(top_builddir)/mllib/config.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/mkdtemp-c.o \
|
|
|
ffd6ed |
$(top_builddir)/mllib/mkdtemp.cmx \
|
|
|
ffd6ed |
$(top_builddir)/mllib/regedit.cmx \
|
|
|
ffd6ed |
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
|
|
|
ffd6ed |
index 242dd49..26955aa 100644
|
|
|
ffd6ed |
--- a/v2v/Makefile.am
|
|
|
ffd6ed |
+++ b/v2v/Makefile.am
|
|
|
ffd6ed |
@@ -123,12 +123,12 @@ virt_v2v_CFLAGS = \
|
|
|
ffd6ed |
$(LIBVIRT_CFLAGS)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
BOBJECTS = \
|
|
|
ffd6ed |
+ $(top_builddir)/mllib/config.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/common_gettext.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/tTY.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/common_utils.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/regedit.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/progress.cmo \
|
|
|
ffd6ed |
- $(top_builddir)/mllib/config.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/mkdtemp.cmo \
|
|
|
ffd6ed |
$(top_builddir)/mllib/JSON.cmo \
|
|
|
ffd6ed |
$(top_builddir)/customize/urandom.cmo \
|
|
|
ffd6ed |
--
|
|
|
ffd6ed |
1.8.3.1
|
|
|
ffd6ed |
|