Blame SOURCES/gnome-boxes-filter-supported-arches.patch

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