[gnome-boxes/nightly-gnome-images] installed-media: Make it easier to test the GNOME Nightly images



commit f1be6bf1e256c17815b06e999478c1dfcf31ea9d
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Feb 11 16:32:26 2020 +0100

    installed-media: Make it easier to test the GNOME Nightly images
    
    The GNOME Nightly VM images are currently produced as GitLab CI
    jobs, and therefore available for a limited amount of time to be
    downloaded.
    
    This way, we now launch a File Chooser to allow users to pick the
    VM image.
    
    https://gitlab.gnome.org/GNOME/gnome-build-meta/issues/208
    
    Fixes #419

 data/osinfo/gnome-nightly.xml  | 47 ++++++++++++++++++++++++++++++++++++++++++
 data/osinfo/meson.build        |  1 +
 data/recommended-downloads.xml |  1 +
 src/assistant/index-page.vala  | 13 +++++++++++-
 src/installed-media.vala       | 20 +++++++++++++++++-
 5 files changed, 80 insertions(+), 2 deletions(-)
---
diff --git a/data/osinfo/gnome-nightly.xml b/data/osinfo/gnome-nightly.xml
new file mode 100644
index 00000000..ba0d2a48
--- /dev/null
+++ b/data/osinfo/gnome-nightly.xml
@@ -0,0 +1,47 @@
+<libosinfo version="0.0.1">
+<!-- Licensed under the GNU General Public License version 2 or later.
+     See http://www.gnu.org/licenses/ for a copy of the license text -->
+  <os id="http://gnome.org/gnome/nightly";>
+    <short-id>gnomenightly</short-id>
+    <name>GNOME</name>
+    <version>Nightly</version>
+    <vendor>The GNOME Project</vendor>
+    <family>linux</family>
+    <distro>gnome</distro>
+
+    <logo>https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/gnome-logo.svg</logo>
+
+    <firmware arch="x86_64" type="efi"/>
+
+    <devices>
+      <device id="http://pcisig.com/pci/1af4/1041"/> <!-- virtio1.0-net -->
+      <device id="http://pcisig.com/pci/1af4/1050"/> <!-- virtio1.0-gpu -->
+      <device id="http://pcisig.com/pci/8086/10d3"/> <!-- e1000e -->
+      <device id="http://usb.org/usb/80ee/0021"/> <!-- tablet -->
+      <device id="http://pcisig.com/pci/8086/293e"/> <!-- ich9-hda -->
+    </devices>
+
+    <variant id="nightly">
+      <name>GNOME Nightly</name>
+    </variant>
+
+    <media arch="x86_64" format="qcow2">
+      <variant id="nightly"/>
+    </media>
+
+    <resources arch="all">
+      <minimum>
+        <n-cpus>1</n-cpus>
+        <cpu>1000000000</cpu>
+        <ram>1073741824</ram>
+        <storage>10737418240</storage>
+      </minimum>
+
+      <recommended>
+        <ram>3147483648</ram>
+        <storage>21474836480</storage>
+      </recommended>
+    </resources>
+
+  </os>
+</libosinfo>
diff --git a/data/osinfo/meson.build b/data/osinfo/meson.build
index cefb43ac..80c1dc21 100644
--- a/data/osinfo/meson.build
+++ b/data/osinfo/meson.build
@@ -5,6 +5,7 @@ osinfo_db = [
   ['eos-3.3.xml', 'gnome-boxes/osinfo/os/endlessos.com'],
   ['fedora-1.xml', 'gnome-boxes/osinfo/os/fedoraproject.org'],
   ['freedos-1.2.xml', 'gnome-boxes/osinfo/os/freedos.org'],
+  ['gnome-nightly.xml', 'osinfo/os/gnome.org'],
   ['opensuse-10.2.xml', 'gnome-boxes/osinfo/os/opensuse.org'],
   ['ubuntu-4.10.xml', 'gnome-boxes/osinfo/os/ubuntu.com'],
   ['popos-17.10.xml', 'gnome-boxes/osinfo/os/system76.com'],
diff --git a/data/recommended-downloads.xml b/data/recommended-downloads.xml
index 827da8e6..26612393 100644
--- a/data/recommended-downloads.xml
+++ b/data/recommended-downloads.xml
@@ -9,6 +9,7 @@
   available.
  -->
 <list>
+  <os_id>http://gnome.org/gnome/nightly</os_id>
   <os_id>http://redhat.com/rhel/8.1</os_id>
   <os_id>http://fedoraproject.org/fedora/31</os_id>
   <os_id>http://fedoraproject.org/silverblue/31</os_id>
diff --git a/src/assistant/index-page.vala b/src/assistant/index-page.vala
index 8587dd48..fdbe7ad0 100644
--- a/src/assistant/index-page.vala
+++ b/src/assistant/index-page.vala
@@ -119,11 +119,22 @@ private void on_source_media_selected (Gtk.ListBoxRow row) {
     }
 
     [GtkCallback]
-    private void on_featured_media_selected (Gtk.ListBoxRow row) {
+    private async void on_featured_media_selected (Gtk.ListBoxRow row) {
         var entry = row as WizardDownloadableEntry;
 
         if (entry.os != null && entry.os.id.has_prefix ("http://redhat.com/rhel/";)) {
             (new RHELDownloadDialog (dialog, entry).run ());
+        } else if (entry.os != null && entry.os.id.has_prefix ("http://gnome.org/gnome/";)) {
+            var file_chooser = new Gtk.FileChooserNative (_("Select the GNOME Nightly VM image"),
+                                                          App.app.main_window,
+                                                          Gtk.FileChooserAction.OPEN,
+                                                          _("Select"), _("Cancel"));
+            file_chooser.bind_property ("visible", dialog, "visible", BindingFlags.INVERT_BOOLEAN);
+            if (file_chooser.run () == Gtk.ResponseType.ACCEPT) {
+                var media = yield new InstalledMedia.gnome_nightly (file_chooser.get_filename ());
+                done (media);
+                return;
+            }
         } else {
             DownloadsHub.get_instance ().add_item (entry);
         }
diff --git a/src/installed-media.vala b/src/installed-media.vala
index 6a3ac5e3..c10ed36c 100644
--- a/src/installed-media.vala
+++ b/src/installed-media.vala
@@ -20,11 +20,12 @@
     public override bool need_user_input_for_vm_creation { get { return false; } }
     public override bool ready_to_create { get { return true; } }
     public override bool live { get { return false; } }
+    private bool is_gnome;
 
     protected override string? architecture {
         owned get {
             // Many distributors provide arch name on the image file so lets try to use that if possible
-            if (device_file.contains ("amd64") || device_file.contains ("x86_64"))
+            if (device_file.contains ("amd64") || device_file.contains ("x86_64") || is_gnome)
                 return "x86_64";
             else {
                 foreach (var arch in supported_architectures) {
@@ -67,6 +68,23 @@ public InstalledMedia (string path, bool known_qcow2 = false) throws GLib.Error
         label_setup ();
     }
 
+    public async InstalledMedia.gnome_nightly (string path) throws GLib.Error {
+        this (path, true);
+        is_gnome = true;
+
+        try {
+            var media_manager = MediaManager.get_instance ();
+            os = yield media_manager.os_db.get_os_by_id ("http://gnome.org/gnome/nightly";);
+            os_media = os.get_media_list ().get_nth (0) as Osinfo.Media;
+        } catch (OSDatabaseError.UNKNOWN_OS_ID error) {
+            debug (error.message);
+        }
+
+        resources = OSDatabase.get_default_resources ();
+
+        label_setup ();
+    }
+
     // Also converts to native format (QCOW2)
     public async void copy (string destination_path) throws GLib.Error {
         var decompressed = yield decompress ();


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