From 4de5a560474d4e5a9e4084f3fa47a18426c2217a Mon Sep 17 00:00:00 2001 From: Felipe Borges Date: Tue, 21 Jan 2020 11:44:14 +0100 Subject: [PATCH] media-manager: Filter architectures only for known medias https://bugzilla.redhat.com/show_bug.cgi?id=1793413 os-database: Only offer supported arches for download app-window: Fix build with new Vala --- src/app-window.vala | 2 +- src/installed-media.vala | 2 +- src/media-manager.vala | 11 ++++++++++- src/os-database.vala | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/app-window.vala b/src/app-window.vala index ebe7007a..7e951945 100644 --- a/src/app-window.vala +++ b/src/app-window.vala @@ -422,7 +422,7 @@ public bool on_key_pressed (Widget widget, Gdk.EventKey event) { return true; } else if (event.keyval == Gdk.Key.A && - (event.state & default_modifiers) == Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK) { + (event.state & default_modifiers) == (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK)) { foreach_view ((view) => { view.unselect_all (); }); return true; diff --git a/src/installed-media.vala b/src/installed-media.vala index 09ceffdf..e60f3508 100644 --- a/src/installed-media.vala +++ b/src/installed-media.vala @@ -12,7 +12,7 @@ ".vpc", ".vpc.gz", ".cloop", ".cloop.gz" }; public const string[] supported_architectures = { - "i686", "i586", "i486", "i386" + "i686", "i586", "i486", "i386", "x86_64", "amd64" }; private static Regex date_regex = /20[0-9]{6,6}/; diff --git a/src/media-manager.vala b/src/media-manager.vala index 427ce874..f3651d4b 100644 --- a/src/media-manager.vala +++ b/src/media-manager.vala @@ -150,7 +150,16 @@ else if (VMConfigurator.is_libvirt_cloning_config (config)) continue; } - list.insert_sorted (media, compare_media_by_vendor); + if (os_id != null) { + var os = yield os_db.get_os_by_id (os_id); + var os_media = os_db.get_media_by_id (os, media_id); + + if (os_media == null || !(os_media.architecture in InstalledMedia.supported_architectures)) { + continue; + } + } + + list.insert_sorted (media, compare_media_by_vendor); } catch (GLib.Error error) { warning ("Failed to use ISO '%s': %s", path, error.message); } diff --git a/src/os-database.vala b/src/os-database.vala index d636cae2..26c0a500 100644 --- a/src/os-database.vala +++ b/src/os-database.vala @@ -124,6 +124,9 @@ public async Os get_os_by_id (string id) throws OSDatabaseError { if (media.url == null) continue; + if (!(media.architecture in InstalledMedia.supported_architectures)) + continue; + var eol = (os as Product).get_eol_date (); if (eol == null || now.compare (eol) > 1) after_list.append (media); -- 2.17.2