Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Conversation

@klihub
Copy link
Contributor

@klihub klihub commented Jun 16, 2017

This patch set adds flatpak-session support to meta-flatpak on top of the existing basic flatpak support.

This mostly consists of

  1. a daemon for monitoring configured flatpak remotes, pulling in/updating published apps
  2. a systemd generator to set up 'flatpak sessions' for monitored flatpak repositories during boot
  3. a helper binary to launch flatpak applications belonging to a 'flatpak session'
  4. optionally a set of pre-declared flatpak remotes/repositories to preconfigure the images with (IOW set up remote URL, signing public key, and associated session user)

flatpak-session support has its dedicated DISTRO_FEATURE ('flatpak-session'). There is also a corresponding flatpak-session.inc configuration fragment which is used to enable flatpak-sessions.

By default flatpak-session support is disabled.

@klihub klihub force-pushed the flatpak-layer+flatpak-session branch 5 times, most recently from 732c776 to 12529fc Compare June 18, 2017 07:09

i = strtol(val, &e, 10);

if (!e && !*e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be if (e && !*e)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, well spotted.


SYSTEMD_PACKAGES += "${PN}"
SYSTEMD_SERVICE_${PN} = "flatpak-sessions.target flatpak-update.service"
SYSTEMD_AUTO_ENABLE = "enable"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is enable by default, no need to set it. And anyway if you set it, you might want to use ?=.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed SYSTEMD_AUTO_ENABLE.

EXTRA_OECONF += "--with-systemdunitdir=${systemd_unitdir}"

# possible package configurations
PACKAGECONFIG ??= ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed empty PACKAGECONFIG.


SRC_URI = " \
git://git@github.com/klihub/flatpak-utils.git;protocol=https;branch=master \
file://flatpak-utils \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't patch a file which you introduced in the same PR. Just change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squashed commits.


# This is the only way with automake I know of to force 'check-git-hooks'
# to be evaluated before 'all'. If there is a nicer way, I'm all ears...
BUILT_SOURCES = install-git-hooks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to install git hooks, if you have the source distribution inside the layer. There is no corresponding .git directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ripped out githooks and removed associated rule.

#include "flatpak-session.h"


int fsys_prepare_session(context_t *c)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You anyway need to link against glib (you are using GError etc. in the flatpak interfacing code). Have you checked if you could just just glib file system functions (see https://developer.gnome.org/glib/stable/glib-File-Utilities.html)? That would reduce the amount of custom code we have to maintain.

Copy link
Contributor Author

@klihub klihub Jun 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I could have used. glib has a g-wrapper for every imaginable POSIX filesystem-related system call and then some. It was an arbitrary but deliberate choice to use glib only where I have to, mostly for interfacing with libflatpak.

@ipuustin
Copy link
Contributor

A README file for flatpak-utils would be nice. There are functions which are either dead code or used from somewhere I don't see, like fpak_app_systemd_scope. Also the restart logic is not fully clear. Is the whole daemon restarted when any flatpak app is updated? Or are you running one daemon for each app?

@klihub
Copy link
Contributor Author

klihub commented Jun 21, 2017

I've added a very brief README and removed the unused function.

The restart logic is that whenever anything changes (gets updated) in a session, the whole session gets restarted. The actual restart is delegated to systemd. When a restart is desired, the daemon exits with a special exit code reserved for this purpose which systemd is let know about in the service file. Systemd will then restart the daemon which will then relaunch the applications within the session. At least that's the general idea...

@klihub klihub force-pushed the flatpak-layer+flatpak-session branch from 12529fc to 9d5c3c5 Compare June 21, 2017 13:49
@ipuustin
Copy link
Contributor

Great. Let's wait until testing is done. Is everything you want to include in this PR now in place?

@klihub
Copy link
Contributor Author

klihub commented Jun 21, 2017

Well, not quite yet. I need to still migrate some documentation over from the old repo. Also while I have added basic sanity tests, we still need to make sure they still work with latest meta-iotqa and CI infra. Once the tests work and the docs are in place, then I think this would be ready to go in.

@klihub klihub force-pushed the flatpak-layer+flatpak-session branch 2 times, most recently from 93b275a to 369af92 Compare June 21, 2017 18:47
@klihub
Copy link
Contributor Author

klihub commented Jun 21, 2017

Unfortunately running the tests for the flatpak-enabled gateway runtime image was not enabled at all. Fixed it. We'll have to check once the latest queued build is finished. Someone with supercow powers could show mercy on the currently running futile builds using the /stop REST API...

@klihub klihub force-pushed the flatpak-layer+flatpak-session branch from 369af92 to 4b7234a Compare June 22, 2017 12:12
klihub and others added 2 commits June 22, 2017 15:12
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
Signed-off-by: Krisztian Litkey <kli@iki.fi>
@klihub
Copy link
Contributor Author

klihub commented Jun 22, 2017

The test were run and have passed. I've also the added initial documentation snippets about flatpak support.

klihub added 7 commits June 22, 2017 15:14
Added recipe for flatpak-utils. Currently it only contains flatpak-
session, our daemon to start up flatpak sessions, and the associated
systemd generator. Also declared flatpak-utils as a supported recipe.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
Added recipe for pre-declaring and populating the image with a set
of pre-declared flatpak remotes/repositories and their associated
flatpak-session users. These are then monitored for applications to
automatically pull in/update and start in flatpak-sessions.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
Added the necessary configuration bits for, and documented the whole
process of, adding pre-declared remotes/repositories.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
Added a flatpak-session packagegroup. It pulls in packagegroup-flatpak,
flatpak-utils (for flatpak-session), and flatpak-predefined-repos.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
Pull in packagegroup-flatpak-session if flatpak-session is among
DISTRO_FEATURES.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
…ons.

If included/required, enable flatpak-session in DISTRO_FEATURES and
also pull in basic flatpak support.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
…gment.

Added a commented out require for flatpak-session.inc and a comment
about its purpose.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
klihub and others added 3 commits June 22, 2017 15:14
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
@klihub klihub force-pushed the flatpak-layer+flatpak-session branch from 4b7234a to 2c64cce Compare June 22, 2017 12:17
@klihub
Copy link
Contributor Author

klihub commented Jun 22, 2017

teat this please

@okartau
Copy link
Contributor

okartau commented Jun 22, 2017

test this please (there needs to be 's' in 1st word :-)

@klihub
Copy link
Contributor Author

klihub commented Jun 23, 2017

Thanks! Oh boy, I hate touchscreens...

@klihub
Copy link
Contributor Author

klihub commented Jun 24, 2017

@ipuustin Now, this could go in. If we don't want to enable flatpak sessions by default, we should leave the config change commit out.

@refkit-ci
Copy link

Can one of the admins verify this patch?

mythi added a commit to mythi/intel-iot-refkit that referenced this pull request Jun 27, 2017
@Arthil
Copy link

Arthil commented Jun 27, 2017

Retest this please.

mythi added a commit to mythi/intel-iot-refkit that referenced this pull request Jun 27, 2017
@mythi mythi merged commit 2c64cce into intel:master Jun 27, 2017
@klihub klihub deleted the flatpak-layer+flatpak-session branch August 21, 2017 12:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants