Snapcraft maintains a list of libraries that are contained in the core snap. The purpose of this list is so that it knows what it can exclude from the snaps it builds when crawling for libraries on the system. There are a number of issues surrounding this, and I just noticed one more: Snapcraft uses platform.linux_distribution() in order to determine the release on which it is building, and then uses that information to determine the core snap library set to use. There are two problems here:
platform.linux_distribution() is deprecated, and will be removed in Python v3.7
Ubuntu distro-patches platform.linux_distribution() to return Ubuntu as opposed to Debian
Problem (1) means we should probably move away from this before too long. Problem (2) means that, since the snap builds its own Python (that doesnât include the distro-patch) the snap thinks itâs running on Debian, which doesnât match up with the core snap library list, so nothing gets excluded:
$ snapcraft
<snip>
No libraries to exclude from this release
<snip>
Perhaps the short-term solution is to apply the distro-patch to the Python being built in the snap, but we should consider alternatives to platform.linux_distribution().
That will require a lot more filtering used by developers to strip stuff out of their snap (pulled in by their stage-packages). How will they learn whatâs contained in the core snap, and thus what could/should be stripped out?
Ah, youâre right-- this is a filter to be used when ldd crawling. By removing that feature this becomes a non-issue. Removing that from the snap and not the deb means they behave differently though, that sounds challenging to support.
@niemeyer what do you think about this? Should we keep things consistent for now? Perhaps itâs also time to start a v3 track, weâd like your thoughts on that as well.
I believe I fixed this on Monday with snapcore/snapcraft#1527. It needed to be changed for this to work correctly for non-Ubuntu systems, and the existing checks didnât work at all for RPM based distributions.
The usage of /etc/os-release also allows us to start being able to identify distributions as families (using the ID_LIKE field in os-release(5). That will make it easier to handle derivatives rather than having to deal with identifying each and every distribution.
Weâre not currently doing this, but it will be necessary for when we start supporting RPM based distributions, as the families are broader but still somewhat related.
$ snap list
Name Version Rev Developer Notes
core 16-2.27.5 2774 canonical core
snapcraft 2.33+git58.67089e0 489 canonical classic
$ snapcraft -d
<snip>
No libraries to exclude from this release
<snip>
That message indicates that something is still wrong, here.
@Conan_Kudo you got us most of the way there, I very much appreciate it. Turns out we actually had another bug that prevented your change from fixing this issue. With this PR and some good testing, Snapcraft can go to stable with my blessing: