[gnome-boxes] vm-configurator: Ensure we use best architecture



commit 39c8b558cddf3dec76852e238747319ab4970e29
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Dec 20 19:48:14 2013 +0000

    vm-configurator: Ensure we use best architecture
    
    This fixes the issue of Boxes picking-up 'i686' architecture if
    architecture of installer media is unknown. Boxes will now pick 'x86_64'
    in such situation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720800

 src/vm-configurator.vala |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 5b5fcba..e907fc3 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -444,6 +444,23 @@ private class Boxes.VMConfigurator {
     private static CapabilitiesGuest get_best_guest_caps (Capabilities caps, InstallerMedia install_media)
                                                           throws VMConfiguratorError {
         var guests_caps = caps.get_guests ();
+        // Ensure we have the best caps on the top
+        guests_caps.sort ((caps_a, caps_b) => {
+            var arch_a = caps_a.get_arch ().get_name ();
+            var arch_b = caps_b.get_arch ().get_name ();
+
+            if (arch_a == "i686") {
+                if (arch_b == "x86_64")
+                    return 1;
+                else
+                    return -1;
+            } else if (arch_a == "x86_64") {
+                return -1;
+            } else if (arch_b == "x86_64" || arch_b == "i686") {
+                return 1;
+            } else
+                return 0;
+        });
 
         // First find all compatible guest caps
         var compat_guests_caps = new GLib.List<CapabilitiesGuest> ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]