[Libguestfs] [PATCH 2/5] builder: templates: generalize debian location

Pino Toscano ptoscano at redhat.com
Mon Jul 10 14:46:20 UTC 2017


Add an helper function to translate our architecture to the Debian
naming, and use it to get the location for all the architectures.
---
 builder/templates/make-template.ml | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index ab89488..9c46f79 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -349,6 +349,15 @@ and string_of_arch = function
   | PPC64le -> "ppc64le"
   | S390X -> "s390x"
 
+and debian_arch_of_arch = function
+  | X86_64 -> "amd64"
+  | Aarch64 -> "arm64"
+  | Armv7 -> "armhf"
+  | I686 -> "i386"
+  | PPC64 -> "ppc64"
+  | PPC64le -> "ppc64el"
+  | S390X -> "s390x"
+
 and filename_of_os os arch ext =
   match os with
   | Fedora ver ->
@@ -587,9 +596,9 @@ and make_location os arch =
       *)
      sprintf "http://mirror.centos.org/centos-7/%d/os/x86_64/" major
 
-  | Debian (_, dist), X86_64 ->
-     sprintf "http://deb.debian.org/debian/dists/%s/main/installer-amd64"
-             dist
+  | Debian (_, dist), arch ->
+     sprintf "http://deb.debian.org/debian/dists/%s/main/installer-%s"
+             dist (debian_arch_of_arch arch)
 
   | Fedora ver, Aarch64 ->
      sprintf "https://download.fedoraproject.org/pub/fedora-secondary/releases/%d/Server/aarch64/os/" ver
-- 
2.9.4




More information about the Libguestfs mailing list