1
My biggest problem is the buggy caching of already build parts and steps in snapcraft. It just causes random problems while tinkering with snapcraft.yaml
and rebuilding it for testing.
Example: I changed the version number of PyGObject in the following part and for certain versions the build fails with the error that wheel and setuptools couldn’t be installed.
pygobject:
plugin: python
python-packages:
- pycairo==1.19.1
- PyGObject==3.34.0
After trying to debug the problem I realized that running snapcraft clean
cleared the issue. I previously just tried snapcraft clean pygobject
because that normally fixes similar problems.
Example: While testing the PR from @kenvandine I removed the line build-environment: *buildenv
from some modules and apparently that doesn’t cause a rebuild and snapcraft just continues to use the old cached result. (Take this example with a grain of salt because I haven’t looked into it too much and the issue might be something else.)
I ran into many similar problems that I can’t reproduce. Obviously this makes working with snapcraft painful because results of testing are basically random. The only way to be sure seems to be running snapcraft clean
but that takes a long time.
2
snapcraft builds are not reproducible and additionally random versions of dependencies are pulled from the internet. That just adds to the previous problem.
3
An annoyance is that paths change between compile time and runtime. This requires patching installed programs or setting environment variables for programs that can’t find resources that were located by the buildsystem when compiling.
I guess (2) and (3) are a side effect of snapcraft’s design and can’t be fixed.
4
In general there are many rough edges that require workarounds.
It works but I don’t quite understand why. I think I tested similar things. I currently don’t want to waste even more time trying to understand what exactly is going on. Thanks for looking into it.
I don’t think the following does anything:
environment:
PATH: $SNAP_DESKTOP_RUNTIME/usr/bin:$PATH
See the result of the following command:
$ snap run --shell video-downloader -c 'type python3'
python3 is /snap/video-downloader/x3/usr/bin/python3
$ snap run --shell video-downloader -c 'echo "$PATH"'
/snap/video-downloader/x3/usr/sbin:/snap/video-downloader/x3/usr/bin:/snap/video-downloader/x3/sbin:/snap/video-downloader/x3/bin:/snap/video-downloader/x3/gnome-platform/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/video-downloader/x3/gnome-platform/usr/bin
Edit: I’ve build the Snap without it and it still works.
Setting PYTHONPATH
shouldn’t be necessary when actually using Python from the extension, right?
environment:
...
PYTHONPATH: $PYTHONPATH:$SNAP_DESKTOP_RUNTIME/usr/lib/python3.6/site-packages:$SNAP/usr/lib/python3.6/site-packages:$SNAP/lib/python3.6/site-packages
I was under the impression that during build Python from the Gnome extension is preferred anyway. I might be remembering it wrong.
build-environment: &buildenv
- PATH: /snap/gnome-3-34-1804-sdk/current/usr/bin:$PATH