[Libguestfs] [PATCH 2/2] builder: normalize architectures

Pino Toscano ptoscano at redhat.com
Tue Aug 11 13:45:12 UTC 2015


Normalize the target architecture, and also each architecture when
checking for a compatible image.

This sort of reverts the effects of
commit 8864c47b94cf44ac2d0d8d4b5019073ad1da121b, but at least it is
possible to build e.g. Debian-based amd64 images on any x86_64 system
without being considered as foreign architecture.
---
 builder/builder.ml | 2 +-
 builder/cmdline.ml | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/builder/builder.ml b/builder/builder.ml
index adfa412..d59380b 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -238,7 +238,7 @@ let main () =
   let item =
     try List.find (
       fun (name, { Index.arch = a }) ->
-        name = arg && arch = a
+        name = arg && arch = normalize_arch a
     ) index
     with Not_found ->
       error (f_"cannot find os-version '%s' with architecture '%s'.\nUse --list to list available guest types.")
diff --git a/builder/cmdline.ml b/builder/cmdline.ml
index eca8c89..49435ae 100644
--- a/builder/cmdline.ml
+++ b/builder/cmdline.ml
@@ -295,6 +295,7 @@ read the man page virt-builder(1).
     match arch with
     | "" -> Config.host_cpu
     | arch -> arch in
+  let arch = normalize_arch arch in
 
   (* If user didn't elect any root password, that means we set a random
    * root password.
-- 
2.1.0




More information about the Libguestfs mailing list