Bug 1442419 - Fix failure to open files after downloading with snap r=jlorenzo draft
authorKen VanDine <ken.vandine@canonical.com>
Thu, 01 Mar 2018 22:02:21 +0000
changeset 762200 e948bafc583f91177530ce00ec26c69619a7f8f9
parent 761101 43b3e4a981e0e7bd8d83c98fc1b01fb64aa4f973
child 763152 1d9b57b7fbec3db47e7ee581208b1ce4f1d91a34
child 763154 a997df0d0b7ed11b7ba2ef19e3efb50469580cdd
push id101101
push userbmo:ken.vandine@canonical.com
push dateThu, 01 Mar 2018 22:02:59 +0000
reviewersjlorenzo
bugs1442419
milestone60.0a1
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