[gnome-boxes/update-downloadable-oses: 2/2] wizard-downloads: Add RHEL8 Beta



commit 13d46e558de3968cd9b2e5c99bdb3ec17767ee4e
Author: Felipe Borges <felipeborges gnome org>
Date:   Fri Nov 16 12:52:58 2018 +0100

    wizard-downloads: Add RHEL8 Beta
    
    This is a quick fix so we don't loose the timing of the Beta
    release.
    
    In 3.32 we won't need these manual updates.

 build-aux/flatpak/org.gnome.Boxes.json |  4 +++-
 data/osinfo/meson.build                |  1 +
 data/osinfo/rhel-8.0.xml               | 10 ++++++++++
 data/recommended-downloads.xml         |  1 +
 src/wizard-source.vala                 | 31 +++++++++++++++++++++++++------
 5 files changed, 40 insertions(+), 7 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Boxes.json b/build-aux/flatpak/org.gnome.Boxes.json
index c2025003..0f7112d4 100644
--- a/build-aux/flatpak/org.gnome.Boxes.json
+++ b/build-aux/flatpak/org.gnome.Boxes.json
@@ -370,7 +370,9 @@
             "buildsystem" : "meson",
             "config-opts" : [
                 "-Dflatpak=true",
-                "-Dprofile=development"
+                "-Dprofile=development",
+                "-Ddistributor_name=gnome-boxes-nightly",
+                "-Ddistributor_version=master"
             ],
             "sources" : [
                 {
diff --git a/data/osinfo/meson.build b/data/osinfo/meson.build
index 20956cf3..6cc2881f 100644
--- a/data/osinfo/meson.build
+++ b/data/osinfo/meson.build
@@ -11,6 +11,7 @@ osinfo_db = [
   ['rhel-5.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
   ['rhel-6.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
   ['rhel-7.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
+  ['rhel-8.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
   ['silverblue-28.xml', 'gnome-boxes/osinfo/os/fedoraproject.org']
 ]
 
diff --git a/data/osinfo/rhel-8.0.xml b/data/osinfo/rhel-8.0.xml
new file mode 100644
index 00000000..cd692781
--- /dev/null
+++ b/data/osinfo/rhel-8.0.xml
@@ -0,0 +1,10 @@
+<libosinfo version="0.0.1">
+
+  <!-- Please read README.logos for any questions about usage of product logos in Boxes. !-->
+
+  <os id="http://redhat.com/rhel/8.0";>
+    <name>Red Hat Enterprise Linux 8 (Beta)</name>
+    <logo>https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/shadownman-pill.svg</logo>
+  </os>
+
+</libosinfo>
diff --git a/data/recommended-downloads.xml b/data/recommended-downloads.xml
index b389e945..37a4b790 100644
--- a/data/recommended-downloads.xml
+++ b/data/recommended-downloads.xml
@@ -10,6 +10,7 @@
  -->
 <list>
   <os_id>http://redhat.com/rhel/7.6</os_id>
+  <os_id>http://redhat.com/rhel/8.0</os_id>
   <os_id>http://fedoraproject.org/fedora/29</os_id>
   <os_id>http://fedoraproject.org/silverblue/29</os_id>
   <os_id>http://ubuntu.com/ubuntu/18.10</os_id>
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index 5b14bfa8..a4852ad1 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -277,6 +277,7 @@ private void on_notify_estimated_load_progress () {
     private Gtk.ListBox media_vbox;
     private Gtk.ListBox downloads_vbox;
     private Osinfo.Os rhel_os;
+    private bool is_rhel8 = false;
     private GLib.ListStore downloads_model;
 
     private Cancellable? rhel_cancellable;
@@ -286,9 +287,13 @@ private void on_notify_estimated_load_progress () {
     public string filename { get; set; }
 
     private string[] recommended_downloads = {
-        "http://ubuntu.com/ubuntu/16.04";,
+        "http://redhat.com/rhel/7.6";,
+        "http://redhat.com/rhel/8.0";,
+        "http://fedoraproject.org/fedora/29";,
+        "http://fedoraproject.org/silverblue/29";,
+        "http://ubuntu.com/ubuntu/18.10";,
         "http://opensuse.org/opensuse/42.3";,
-        "http://fedoraproject.org/fedora/27";,
+        "http://debian.org/debian/9";,
     };
 
     public bool download_required {
@@ -546,6 +551,8 @@ private void on_download_an_os_button_clicked () {
         window.wizard_window.show_downloads_page (media_manager.os_db, (entry) => {
             // Handle custom downloads
             if (entry.os.id.has_prefix ("http://redhat.com/rhel/";)) {
+                is_rhel8 = (entry.os.id == "http://redhat.com/rhel/8.0";);
+
                 on_install_rhel_button_clicked ();
 
                 return;
@@ -574,8 +581,17 @@ private void on_install_rhel_button_clicked () {
 
         var user_agent = get_user_agent ();
         var user_agent_escaped = GLib.Uri.escape_string (user_agent, null, false);
+
+        string rhel_version = "";
+        string rhel_variant = "";
+        if (is_rhel8) {
+            rhel_version = "8";
+            rhel_variant = "&description=DVD+iso";
+        }
+
         var authentication_uri = "https://developers.redhat.com/download-manager/rest/featured/file/rhel"; +
-                                 "?tag=" + user_agent_escaped;
+                                 rhel_version +
+                                 "?tag=" + user_agent_escaped + rhel_variant;
 
         debug ("RHEL ISO authentication URI: %s", authentication_uri);
 
@@ -591,7 +607,9 @@ private bool on_rhel_web_view_decide_policy (WebKit.WebView web_view,
         var action = (decision as WebKit.NavigationPolicyDecision).get_navigation_action ();
         var request = action.get_request ();
         var request_uri = request.get_uri ();
-        if (!request_uri.has_prefix ("https://developers.redhat.com/products/rhel";))
+
+        if (!request_uri.has_prefix ("https://developers.redhat.com/products/rhel";) &&
+            !request_uri.has_prefix ("https://access.cdn.redhat.com";))
             return false;
 
         var soup_request_uri = new Soup.URI (request_uri);
@@ -600,7 +618,8 @@ private bool on_rhel_web_view_decide_policy (WebKit.WebView web_view,
             return false;
 
         var key_value_pairs = Soup.Form.decode (query);
-        var download_uri = key_value_pairs.lookup ("tcDownloadURL");
+
+        var download_uri = is_rhel8 ? request_uri : key_value_pairs.lookup ("tcDownloadURL");
         if (download_uri == null)
             return false;
 
@@ -616,7 +635,7 @@ private bool on_rhel_web_view_decide_policy (WebKit.WebView web_view,
         return_val_if_fail (download_path.length > 0, false);
 
         if (!download_path.has_suffix (".iso")) {
-            download_path = "/rhel.iso";
+            download_path = is_rhel8 ? "/rhel8.iso" : "/rhel.iso";
         }
 
         filename = GLib.Path.get_basename (download_path);


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