-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux: add support for building snap packages #436
Conversation
Hmm that's a bit annoying. Maybe both flatpak and snap packaging should be moved out into separate repositories? But then auto-build on commit still wouldn't work when a new commit to solvespace/solvespace is made. I'm not sure how to address this.
An
Yes ideally that would be done. The Travis CI configuration already has the necessary logic, but that presumes we'll build with Travis, which is not currently actually possible, since Travis builds turn GUI off due to an extremely outdated GTK there. |
Documentation exists to build snap packages from a Docker container under Travis(https://tutorials.ubuntu.com/tutorial/continuous-snap-delivery-from-travis-ci). So skipping the build server is probably an option. Another option: Keep the snap integration in a separate repo and just trigger an update into a file in that repo like
Can do. |
I'd say: let's put it under |
snapcraft mounts the working directory into the build container like so:
Thus, we cannot access the solvespace src with a relative path in snapcraft.yaml. Options?
|
That's uh, pretty obnoxious on the part of snapcraft. I guess I'll have to go through every option it has with a fine-toothed comb... |
It's very clearly intended to be in a separate repo or to reside in the first-level subdirectory Here is an example of a snap that uses a build-trigger file to fire the build: |
Well, neither of Canonical's supposed solutions works for me, and this isn't an issue with pretty much any other packaging system, so... |
If there is absolutely no way to get |
A worktree does not work with the
This then fails the git commands. What works, is to just clone from the parent path like so:
That's certainly an option for staying close to the paradigm of not generating I'll investigate whether it is maybe even possible to somehow contain the setup and cleanup commands in |
Thank you! |
I think the build script is a sensible choice. As I understand it, the build environment for snapcraft is basically either |
I adapted the official snapcraft Dockerfile to work with The result is published as Building with docker works like this:
Beware: Building like this will pollute Bringing Travis into the picture
Maybe that functionality belongs in another pull request entirely. What do you think? |
d15b571
to
a630824
Compare
Another option: Run a Travis job that syncs this repo's In the |
Sorry, I missed your edit. I'll take a look soon! |
Note to ourselves: Snapcraft supports remote builds on Launchpad: https://forum.snapcraft.io/t/preview-snapcraft-remote-build/11541 A possible pipeline: Github -> Travis --- (Snapcraft) ---> Launchpad => snaps for multiple architectures This would offload all building again and of course the issue of compiling for other architectures (if so desired) is not our concern. |
I think that's a reasonable option. What should we do for that? Separate repo, an encrypted SSH key on Travis, and trigger builds from there? |
Oh. I'm sorry I haven't replied yet. I'll investigate and create a prototype as soon as I'm not swamped with work any more... |
Coming back to this, a few observations:
The SSH key and the snapcraft credentials must be stored on Travis. From the snapcraft example:
Build & release then something like this:
To summarize, we need:
I'll report back when I have a usable Travis cfg. |
@whitequark I have a sample travis config at https://github.com/ppd1990/solvespace-travis that makes use of snapcraft remote-build and this branch Builds are successful. Build log: https://travis-ci.org/ppd1990/solvespace-travis/builds/576488983 |
Note regarding maintainability: One of the very next snapcraft releases will ship the gnome/desktop extension and will thus render lots of the fluff (the extra part, those gtk-common-themes plugs...) in snapcraft.yaml obsolete, making everything look a lot cleaner. |
Is that happening soon? If so we might just wait a bit. |
I guess so. Seems like they do about one release per month and the last non-minor release was on 2019-07-23. We're also still waiting for the remote-build functionality that is still not in a stable release of snapcraft. So we might soon get the new release but the remote-build branch of snapcraft is not guaranteed to instantly rebase on this release. |
Implemented changes:
|
Looks great. The only blocker I see right now is |
Can you adjust |
Oh yeah. That is a rather naive implementation so far. I'll look into it.
What's your preferred strategy? |
Looks like |
Ideally check if the commit corresponds to a tag, and select grade based on that. |
Is it possible to make the CLI install as |
That's easy. I'll update the PR soon |
I addressed the requests and also added license info to the snapcraft declaration. One thing that still bugs me a bit: The hardcoded version scheme |
Thanks. |
I'm curious: why is the |
The reason is a bit convoluted: By default, snaps will not have access to exotic PAM providers like SSSD and thus will not recognize "non-traditional" users like those configured via LDAP etc. A workaround, as proposed in https://forum.snapcraft.io/t/accessing-unix-users-and-groups-from-a-strict-snap/9035/7, is to install a user info proxy on the machine like |
OK but ... SolveSpace doesn't care one bit about UNIX groups and users. |
Oh right, we do care about |
|
This is a "copy & paste" integration of the solvespace snap repo @ https://github.com/ppd1990/solvespace-snap as discussed in ppd/solvespace-snap#2
A few things left to discuss
The integration resides in$ROOT/snap
. This is what build.snapcraft.io requires. If using the Ubuntu provided build server (and thus easy auto-build on commit) is not wanted, we could move it to mirror the flatpak integrationThe svg icon should probably find its place inres/freedesktop
or we could just use a png icon. At the moment snap packages need an absolute path to an icon.The svg icon was proposed for inclusion in freedesktop: Add svg icon #441
The snap is declaredgrade: stable
. Maybe that should only apply to tagged versions. Some extra logic would be requiredThe next step
Publishing of the snap should be done under the flag of the upstream project. Therefore I propose a name transfer to a newly created "SolveSpace" publisher. This has to be requested on forum.snapcraft.io.
Testing the build process