Some beginner question from a snap newbie

Hello community,

let me start off by introducing myself: I am an Arch Linux and Manjaro Linux user and also maintain some packages in Arch’s AUR. However, I never had any experience with snap, neither as maintainer nor as user.

In particular I maintain a package for Shutter in the AUR and some months ago I also started to maintain it upstream. Since I don’t know Perl, the “maintaining” mostly consists of applying patches submitted by people in the bug reports, giving support to users etc.

Recently I got to know that Ubuntu kicked several optional dependencies for Shutter from its repositories for Ubuntu 18.04 and Shutter itself most likely will be kicked out as well, because it relies on outdated libraries. However, a bunch of people still use it and so a vivid discussion emerged on this issue: https://bugs.launchpad.net/ubuntu/+source/libgoo-canvas-perl/+bug/1765726

At some point, a user brought up the idea that a snap is quite a fitting packaging format for Shutter since it would ship all the dependencies which are otherwise unavailable. This is why I ended up here. Since I have no experience with snap, I have some difficulties getting into it which I think will be easy to sort out for experienced snap users in this community.

My first question is the following: When clicking the “Build” button at snapcraft.io, I am offered to connect to Github. I use Github myself so this is not a problem. However, Shutter is hosted at Launchpad, not Github. Does it mean that I have to reupload Shutter’s code to Github in order to create a snap for it? What about the dependencies which should also be part of the snap? What exactly should be contained inside the Github repo?

Thanks in advance for your assistance,
Photon

2 Likes

You can use the same builders directly from launchpad:

  1. Navigate to the code page of your project on launchpad.
  2. Find midway down the page the option entitled “Related snap packages”
  3. Click the button in that section to “Create snap package”

You will need to add a top-level folder in your source code called snap within which you need to place an appropriate snapcraft.yaml to build the package when the build farm picks up changes to the code.

1 Like

Thanks for your reply! Looks like I am too confused to find it: If I search for “snap” with my browser’s text search (Ctrl+F) at https://code.launchpad.net/shutter I don’t get any hits…

This is a tad old so the UI will look a little different, but it should still help walk through setting up snap builds using Launchpad: https://kyrofa.com/posts/building-your-snap-on-device-there-s-a-better-way .

1 Like

it’s on the individual branches’ pages, e.g. https://code.launchpad.net/~shutter/shutter/devel

1 Like

Thanks to both of you, I will have a look and report back!

@diddledani @kyrofa

Sorry for the late reply and thanks for the support! I had a look and found the corresponding link on Launchpad. But reading the HowTo actually leads me to the idea that I could equally well build the snaps locally (the architecture problem is not relevant in my case). So I had a look into the documentation for the .yaml file which, as far as I understand, contains all the metadata and the build instructions for the snap. However, I still have some open questions: Where do the build commands (say, for compiling the source, copying files into correct locations etc.) go inside the .yaml? Also, how do I deal with the dependencies? As far as I understand the snap philosophy, all dependencies should be included inside a single snap, but how to handle this? Should I copy the code of all dependencies into the Shutter repo? Also, where can I find real life examples of .yaml files to get the hang of it? I found some examples like https://github.com/ubuntu-core/snapcraft-examples/blob/master/05-hello-world-combined/snapcraft.yaml but unfortunately, still cannot figure out answers for the above questions…

Sorry for the stupid questions! :slight_smile:

Sorry for double posting, and at the same time the rather late reply. Please let me know if my question indicate a lack of research effort on my side. I would be already very happy if you could point me to some reading where my questions are answered. Thanks in advance! :slight_smile: