Snap package for hamster
Created by: extraymond
Hi! Guys, I'm trying to build hamster in snap right now, I believe I'm half way there.
Motivation
My motivation for doing so is as follows:
- Snap is a great way to maintain stable run-time environment so app will continue to work regardless of distro versions. It support various build systems too, waf is automatically handled.
- Snaps have some nice update mechanisms, we can easily switch between channels as desired. It have some safety mechanisms that perform auto rollback when newer version crashed.
- Combining the two, I think it might give hamster a greater chance to reach it's audience.
So here I am trying to reach out and see if anything clicks.
Problems
However there are some problems regarding invoking services with dbus.
For the manual build version, the hamster launch file with automatically invoke the hamster-service and hamster-windows-service if it's not started, but on the snap service I can't find a way to do so. So currently I have to manually start the two service before launching the GUI. Which works!
I would really appreciate any help regarding to setup dbus service so that it can be invoked by dbus name.
Here's the snapcraft.yaml if anyone is interested:
name: hamster-snap # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: "0.1" # just for humans, typically '1.2+git' or '1.3.2'
summary: snap for project hamster # 79 char long summary
description: |
First attempt for creating a snap for project hamster.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
slots:
dbus-hamster:
interface: dbus
bus: session
name: org.gnome.Hamster
plugs:
gnome-3-28-1804:
interface: content
target: $SNAP/gnome-platform
default-provider: gnome-3-28-1804
gtk-3-themes:
interface: content
target: $SNAP/data-dir/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/data-dir/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/data-dir/sounds
default-provider: gtk-common-themes
apps:
hamster-service:
command: desktop-launch ${SNAP}/usr/lib/hamster-time-tracker/hamster-service
plugs:
- desktop
- desktop-legacy
- gsettings
- home
environment:
PYTHONPATH: $SNAP/usr/lib/python2.7/dist-packages
hamster-windows-service:
command: desktop-launch ${SNAP}/usr/lib/hamster-time-tracker/hamster-windows-service
plugs:
- desktop
- desktop-legacy
- gsettings
- home
environment:
PYTHONPATH: $SNAP/usr/lib/python2.7/dist-packages
hamster:
command: desktop-launch ${SNAP}/usr/bin/hamster
desktop: usr/share/applications/hamster-time-tracker.desktop
plugs:
- desktop
- desktop-legacy
- gsettings
- home
- unity7
environment:
PYTHONPATH: $SNAP/usr/lib/python2.7/dist-packages
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/share/hamster-time-tracker
parts:
desktop-gnome-platform:
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: gtk
plugin: make
make-parameters: ["FLAVOR=gtk3"]
build-packages:
- build-essential
- libgtk-3-dev
override-build: |
snapcraftctl build
mkdir -pv $SNAPCRAFT_PART_INSTALL/gnome-platform
hamster:
# See 'snapcraft plugins'
after: [desktop-gnome-platform]
build-packages:
- gettext
- intltool
- python-gconf
- gconf2
stage-packages:
- gir1.2-gconf-2.0
- python3-gi-cairo
- python3-dbus
- python3-gi
- python3-xdg
source: snap/src
plugin: waf
configflags:
- --prefix=/usr