From 6c62d21d8ee75f09dec849d2405219310c6344b0 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 4 Aug 2020 19:55:15 +0000 Subject: [PATCH] download: Introduce secondary architectures for i586 and aarch64 Signed-off-by: Michael Tremer --- src/backend/releases.py | 34 ++++++++++- src/templates/download/release.html | 94 +++++++++++++++++++---------- 2 files changed, 94 insertions(+), 34 deletions(-) diff --git a/src/backend/releases.py b/src/backend/releases.py index fb50448f..a0a8cf93 100644 --- a/src/backend/releases.py +++ b/src/backend/releases.py @@ -160,7 +160,7 @@ class File(Object): @property def arch(self): - known_arches = ("x86_64", "aarch64", "i586", "arm") + known_arches = ("x86_64", "aarch64", "arm", "i586") for arch in known_arches: if arch in self.basename: @@ -224,6 +224,38 @@ class Release(Object): if arch in (f.arch for f in self.files): yield arch + @property + def primary_arches(self): + arches = [] + + # Add x86_64 when available, otherwise add i586 + for arch in ("x86_64", "i586"): + if arch in self.arches: + arches.append(arch) + break + + # Add ARM if available + if "arm" in self.arches: + arches.append("arm") + + return arches + + @property + def secondary_arches(self): + arches = [] + + for arch in self.arches: + if arch in self.primary_arches: + continue + + arches.append(arch) + + return arches + + @property + def experimental_arches(self): + return ("aarch64",) + @property def files(self): if not self.__files: diff --git a/src/templates/download/release.html b/src/templates/download/release.html index 56f3947f..a73a47a9 100644 --- a/src/templates/download/release.html +++ b/src/templates/download/release.html @@ -18,43 +18,30 @@ {% end %} -
- {% for arch in release.arches %} -
-
-
{{ arch }}
-
+ {% for arch in release.primary_arches %} +
+
{{ arch }}
- -
- {% end %} -
- - + {% if file.size >= 1024 * 1024 %} + {{ format_size(file.size) }} + {% end %} +
-
-
-
{% for f in release.files %}{{ "%-50s %s: %s\n" % (f.basename, "SHA256" if f.sha256 else "SHA1", f.sha256 or f.sha1) }}{% end %}
+

+ {{ "%s: %s" % ("SHA256" if file.sha256 else "SHA1", file.sha256 or file.sha1) }} +

+ + {% end %} +
- + {% end %} @@ -81,4 +68,45 @@ + + {% if release.secondary_arches %} +
+
+

{{ _("Secondary Architectures") }}

+ + {% for arch in release.secondary_arches %} +
+
+ {{ arch }} + + {% if arch in release.experimental_arches %} + {{ _("Experimental") }} + {% else %} + {{ _("Legacy") }} + {% end %} +
+ + +
+ {% end %} +
+
+ {% end %} {% end block %} -- 2.47.2