Jump to content

Neon/Snap: Difference between revisions

From KDE Community Wiki
Riddell (talk | contribs)
Nmariusp (talk | contribs)
This page has old content.
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Note|This page has old content. See page history.}}
__TOC__
__TOC__
== 2023 Status ==
Snaps are now build in invent.kde.org, see the https://invent.kde.org/packaging/snapcraft-kde-applications/ repo.  They use KDE neon packages.
== Reading Material ==
* Snap & Snapcraft Documentation: https://docs.snapcraft.io
* Snap Guide: [[Guidelines_and_HOWTOs/Snap]]
* Content Snap: [[Neon/Snap/KF5Content]]


== Usage ==
== Usage ==
Line 7: Line 19:
https://apachelog.wordpress.com/2017/01/30/kde-applications-in-ubuntu-snap-store/
https://apachelog.wordpress.com/2017/01/30/kde-applications-in-ubuntu-snap-store/
{{Input|1=<nowiki>
{{Input|1=<nowiki>
sudo snap install kde-frameworks-5
sudo snap install kblocks</nowiki>}}
sudo snap install kblocks</nowiki>}}
ISOs from August 11 2017 already come shipped with kde-frameworks-5, this is a simple tar made by Jonathan by using a freshly installed virtual machine, running sudo snap install kde-frameworks-5 and putting /snap, /var/lib/snap and /var/snap into a tar http://embra.edinburghlinux.co.uk/~jr/snapd-kde-frameworks.tar.gz It adds about 600MB to the images.


=== No sudo ===
=== No sudo ===
Line 22: Line 31:
== Building ==
== Building ==


The snapcraft.yamls we have in our pacakging repositories are generally meant to be built via our tooling and the respective Jenkins jobs. Genearally they can however also be built manually as the tooling only extends them a bit to build from git
The snapcraft.yamls we have in our packaging repositories are generally meant to be built via our tooling and the respective Jenkins jobs. Generally they can however also be built manually as the tooling only extends them a bit to build from git
and install suitable packages for the current content-snap SDK. By and large this is optional though.
and install suitable packages for the current content-snap SDK. By and large this is optional though.


To build run
To build you need a working snapd (for containerized use LXD is recommended because it has native systemd support).  You'll also want latest snapcraft:  <code>snap install --classic snapcraft</code>
{{Input|1=<nowiki>
 
SNAPCRAFT_PARTS_URI=http://metadata.neon.kde.org/snap/parts.yaml snapcraft</nowiki>}}
Building is done by running {{Input|1=<nowiki>snap run snapcraft --destructive-mode</nowiki>}}


The environment variable sets a different remote parts URI to load the -dev and -env parts from. Long term these should be
It's destructive because it needs to change your system. By default snapcraft since 2019 would try to throw builds in  a VM, since snaps mostly need neon's repos to build that isn't useful for us in its current form.
added to the upstream default parts.yaml though.


== Snapd Problems ==
== Snapd Problems ==
Line 36: Line 44:
(upstream issues ought to be filed/subscribed to and mentioned here)
(upstream issues ought to be filed/subscribed to and mentioned here)


# Content snap not getting installed if snap depending on it gets installed
# Theming [is kind of addressed by XDG Settings portal]
## https://bugs.launchpad.net/snapcraft/+bug/1711329
## https://github.com/snapcore/snapd/compare/master...mvo5:default-plugin-provider?expand=1
# Installing a content snap into the core ISO requires snapd which requires systemd which cannot (?) run in a docker/lxc/chroot
## current solution is to tar up /snap etc and extract that when generating the ISO.
## This needs the tar to be easy/automatically updated
## Needs openQA tests that it still works
# Theming
## How to get theme settings from the host into the snap?
## How to get theme settings from the host into the snap?
## QtStyles are binary plugins and so even when we know which style is configured on the host we cannot just load it
## QtStyles are binary plugins and so even when we know which style is configured on the host we cannot just load it
Line 59: Line 60:
### gdb/valgrind/strace need to be in the snap to be reachable
### gdb/valgrind/strace need to be in the snap to be reachable
## Possibly needs a way to catch and send cores and then retrace them server-side with (externally) generated debug symbol dumps?
## Possibly needs a way to catch and send cores and then retrace them server-side with (externally) generated debug symbol dumps?
# xdg-desktop-portals (with patches) + snapd (with patches). Needs landing or something
## FIleIO
## Printing
## wip https://forum.snapcraft.io/t/xdg-desktop-portal-proof-of-concept-demo/1027
# Discover Software Center integration isn't at the level of PackageKit or Flatpak. Mostly boils down to some appstream support
# Discover Software Center integration isn't at the level of PackageKit or Flatpak. Mostly boils down to some appstream support
## we are lacking appstream ids, useful for de-duplication
## we are lacking appstream ids, useful for de-duplication
Line 71: Line 68:
## https://bugs.launchpad.net/snapcraft/+bug/1711333
## https://bugs.launchpad.net/snapcraft/+bug/1711333
## https://forum.snapcraft.io/t/use-a-separate-manifest-file-or-save-everything-in-snap-snapcraft-yaml/1152
## https://forum.snapcraft.io/t/use-a-separate-manifest-file-or-save-everything-in-snap-snapcraft-yaml/1152
# Dolphin and kfileopen are cluttered with loopback mounts from snapd  https://bugs.launchpad.net/ubuntu/+source/snapcraft/+bug/1714941
# Live images should be able to turn off Snap updates
## https://bugs.launchpad.net/ubuntu/+source/casper/+bug/1723094


== Snapcraft Problems ==
== Snapcraft Problems ==
Line 79: Line 73:
## Talking with snapcraft developers, they suggested using "install: ctest ." much like in here: https://snapcraft.io/docs/build-snaps/node
## Talking with snapcraft developers, they suggested using "install: ctest ." much like in here: https://snapcraft.io/docs/build-snaps/node
## Implemented here: https://cgit.kde.org/scratch/apol/kf5-snap-env.git/plain/README.md
## Implemented here: https://cgit.kde.org/scratch/apol/kf5-snap-env.git/plain/README.md
# Content snap has "external" dev tarball which we utilize to build snaps off of the content snap, problem is that snapcraft does not like files diverging, so whenever a snap stages-packages something that is in the dev tarball (e.g. as part of a runtime dep) but binary different (e.g. newer build) the snapcraft will fail. On auto generated snaps this was worked around by maintaining an exclusion list of packages to not install, this may be auto-injectable into manual builds BUT won't be doable for non-infrastructure builds (i.e. a dev running snapcraft on their system).
# Content snap has problems
# Content snap has problems
## Make sure that on cleanbuilds we get the deps from the Neon repo instead of ubuntu (for the things Neon implements)
## Make sure that on cleanbuilds we get the deps from the Neon repo instead of ubuntu (for the things Neon implements)
Line 87: Line 80:
## Substantial metadata duplication. snap metadata excessively duplicates appstream metadata such as license, summary, version, icon. Makes it undesirable to maintain the data in snapcraft.yaml so it will simply go out of date at some point.
## Substantial metadata duplication. snap metadata excessively duplicates appstream metadata such as license, summary, version, icon. Makes it undesirable to maintain the data in snapcraft.yaml so it will simply go out of date at some point.
### https://forum.snapcraft.io/t/extracting-existing-data-from-projects-to-feed-into-snap-yaml/2285
### https://forum.snapcraft.io/t/extracting-existing-data-from-projects-to-feed-into-snap-yaml/2285
### https://github.com/snapcore/snapcraft/issues/1694
## Should be extracting the icon and desktop file from the package. Now it's copied in the packaging.
## Should be extracting the icon and desktop file from the package. Now it's copied in the packaging.
# Icons do not appear to get installed into hicolor nor hardcoded absolute paths in the desktop files, making icon availability entirely theme-dependent.
# GPG verification of incoming content is not supported. This breaks the signing chain from tag -> tarball -> pkg -> user. Only applies to tarballs. [Supposedly the tarball is somewhere in the build tree, so we could build custom rigging to download the gpg after snapcraft ran and verify the tarball snapcraft got is the signed one and abort if not]
# GPG verification of incoming content is not supported. This breaks the signing chain from tag -> tarball -> pkg -> user. Only applies to tarballs. [Supposedly the tarball is somewhere in the build tree, so we could build custom rigging to download the gpg after snapcraft ran and verify the tarball snapcraft got is the signed one and abort if not]


== Troubleshooting ==
== Other Problems ==
# on <2.26.0 We need to umount the snap if it was already installed: sudo umount /run/snapd/ns/dolphin.mnt
 
# kdoctools requires docbook-* packages in /usr always https://bugs.kde.org/show_bug.cgi?id=406177

Latest revision as of 06:04, 21 September 2023

Note

This page has old content. See page history.


2023 Status

Snaps are now build in invent.kde.org, see the https://invent.kde.org/packaging/snapcraft-kde-applications/ repo. They use KDE neon packages.

Reading Material

Usage

To use them

https://apachelog.wordpress.com/2017/01/30/kde-applications-in-ubuntu-snap-store/

sudo snap install kblocks

No sudo

To drop the requirement to have to sudo everything you need to login using ubuntu login credentials first.

sudo snap login

After that you should have a ~/.snap/auth.json file and snap should work without sudo.

Building

The snapcraft.yamls we have in our packaging repositories are generally meant to be built via our tooling and the respective Jenkins jobs. Generally they can however also be built manually as the tooling only extends them a bit to build from git and install suitable packages for the current content-snap SDK. By and large this is optional though.

To build you need a working snapd (for containerized use LXD is recommended because it has native systemd support). You'll also want latest snapcraft: snap install --classic snapcraft

Building is done by running

snap run snapcraft --destructive-mode

It's destructive because it needs to change your system. By default snapcraft since 2019 would try to throw builds in a VM, since snaps mostly need neon's repos to build that isn't useful for us in its current form.

Snapd Problems

(upstream issues ought to be filed/subscribed to and mentioned here)

  1. Theming [is kind of addressed by XDG Settings portal]
    1. How to get theme settings from the host into the snap?
    2. QtStyles are binary plugins and so even when we know which style is configured on the host we cannot just load it
    3. Icon themes in /usr/share and ~/.local cannot be accessed from inside snaps
    4. Same for mouse cursor themes
    5. Same for fonts
    6. upstream is aware and working on it
    7. https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1585332
  2. Hard to debug applications
    1. We have huge wrapper scripts that are required for applications to run properly
      1. https://cgit.kde.org/scratch/apol/kf5-snap-env.git/tree/
      2. https://forum.snapcraft.io/t/custom-environment-variables-for-parts/1639/10
    2. It's hard to reach out to debugging tools
      1. should be easy-ish to use gdb-server
      2. gdb/valgrind/strace need to be in the snap to be reachable
    3. Possibly needs a way to catch and send cores and then retrace them server-side with (externally) generated debug symbol dumps?
  3. Discover Software Center integration isn't at the level of PackageKit or Flatpak. Mostly boils down to some appstream support
    1. we are lacking appstream ids, useful for de-duplication
    2. cannot use snaps for the featured applications list (apps are listed as appstream ids)
    3. AppStream ID as id for reviews https://forum.snapcraft.io/t/best-way-to-key-a-snap-for-reviewing/854/2
    4. https://forum.snapcraft.io/t/support-for-appstream-id/2327
  4. No source code storage/retrieval for snaps
    1. https://bugs.launchpad.net/snapcraft/+bug/1711333
    2. https://forum.snapcraft.io/t/use-a-separate-manifest-file-or-save-everything-in-snap-snapcraft-yaml/1152

Snapcraft Problems

  1. No real way to run unit tests through snapcraft
    1. Talking with snapcraft developers, they suggested using "install: ctest ." much like in here: https://snapcraft.io/docs/build-snaps/node
    2. Implemented here: https://cgit.kde.org/scratch/apol/kf5-snap-env.git/plain/README.md
  2. Content snap has problems
    1. Make sure that on cleanbuilds we get the deps from the Neon repo instead of ubuntu (for the things Neon implements)
    2. Related https://bugs.kde.org/show_bug.cgi?id=385062
    3. https://bugs.launchpad.net/snapcraft/+bug/1719928
  3. Lack of Appstream support
    1. Substantial metadata duplication. snap metadata excessively duplicates appstream metadata such as license, summary, version, icon. Makes it undesirable to maintain the data in snapcraft.yaml so it will simply go out of date at some point.
      1. https://forum.snapcraft.io/t/extracting-existing-data-from-projects-to-feed-into-snap-yaml/2285
      2. https://github.com/snapcore/snapcraft/issues/1694
    2. Should be extracting the icon and desktop file from the package. Now it's copied in the packaging.
  4. GPG verification of incoming content is not supported. This breaks the signing chain from tag -> tarball -> pkg -> user. Only applies to tarballs. [Supposedly the tarball is somewhere in the build tree, so we could build custom rigging to download the gpg after snapcraft ran and verify the tarball snapcraft got is the signed one and abort if not]

Other Problems

  1. kdoctools requires docbook-* packages in /usr always https://bugs.kde.org/show_bug.cgi?id=406177