Bug 1442419 - Fix failure to open files after downloading with snap r=jlorenzo
authorKen VanDine <ken.vandine@canonical.com>
Thu, 01 Mar 2018 22:02:21 +0000
changeset 406306 3800cbeee1e3d01cb5c7688fb8f50bca72ad7442
parent 406305 640e1784f2dbd5a71f08cc32195183bdfdad6f42
child 406307 fa85e73273106b6a2919e4ff7b7c0d0ba33c79c7
push id60517
push userjlorenzo@mozilla.com
push dateFri, 02 Mar 2018 16:38:01 +0000
treeherderautoland@3800cbeee1e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlorenzo
bugs1442419
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1442419 - Fix failure to open files after downloading with snap r=jlorenzo This fix does several things: * Removes the mime cache generated by the desktop-gtk3 remote part * Installs a stub shared-mime-info database * Set default association for all types to use xdg-open Note: There is still work[1] to be completed in snapd, adding OpenFile support to xdg-open. Landing this is harmless though, it will fail silently just as it does today but will start working when the snapd feature lands. 1. https://github.com/snapcore/snapd/pull/4766 opening requested files, MozReview-Commit-ID: 1eeOLeVN8xQ
taskcluster/docker/firefox-snap/mime-handler.xml
taskcluster/docker/firefox-snap/mimeapps.list
taskcluster/docker/firefox-snap/snapcraft.yaml.in
new file mode 100644
--- /dev/null
+++ b/taskcluster/docker/firefox-snap/mime-handler.xml
@@ -0,0 +1,7 @@
+<mime-info
+    xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+  <mime-type type="application/octet-stream">
+    <comment>Unknown</comment>
+    <glob pattern="*"/>
+  </mime-type>
+</mime-info>
new file mode 100644
--- /dev/null
+++ b/taskcluster/docker/firefox-snap/mimeapps.list
@@ -0,0 +1,4 @@
+[Default Applications]
+application/octet-stream=xdg-open.desktop
+text/plain=xdg-open.desktop
+inode/directory=xdg-open.desktop
--- a/taskcluster/docker/firefox-snap/snapcraft.yaml.in
+++ b/taskcluster/docker/firefox-snap/snapcraft.yaml.in
@@ -31,32 +31,55 @@ apps:
       - x11
 
 plugs:
   browser-sandbox:
     interface: browser-support
     allow-sandbox: true
 
 parts:
+  desktop-gtk3:
+    prime:
+      - -usr/share/mime
+
   firefox:
     plugin: dump
     source: source
     stage-packages:
       - libxt6
       - libdbus-glib-1-2
       - libasound2
       - libpulse0
       - libgl1-mesa-dri
       - libgl1-mesa-glx
       - libmirclient9
       - desktop-file-utils
       - xdg-utils
       - ffmpeg
     after: [desktop-gtk3]
 
-  optimization:
+  xdg-open:
     after: [firefox]
     plugin: nil
-    stage-packages:
-      - shared-mime-info
+    source: .
     install: |
       set -eux
+      mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/applications
+      install -m 644 mimeapps.list $SNAPCRAFT_PART_INSTALL/usr/share/applications
+      update-desktop-database -v $SNAPCRAFT_PART_INSTALL/usr/share/applications
+    build-packages:
+      - desktop-file-utils
+    build-attributes: [no-system-libraries]
+
+  shared-mime-info:
+    after: [xdg-open]
+    plugin: nil
+    source: .
+    build-packages:
+      - shared-mime-info
+    build-attributes: [no-system-libraries]
+    install: |
+      set -eux
+      mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/mime/packages
+      install -m 644 mime-handler.xml $SNAPCRAFT_PART_INSTALL/usr/share/mime/packages
       update-mime-database $SNAPCRAFT_PART_INSTALL/usr/share/mime
+    stage:
+      - usr/share/mime