Skip to content

endlessm/eos-companion-app-integration

Repository files navigation

# eos-companion-app-integration

This repository hosts the OS integration side of the Endless OS Companion App.

If you're looking for the Android App itself, you can find it at
https://github.com/endlessm/android-companion-app

## Building

This project encompasses two separate components. The first is a Python
webservice designed to be bundled with flatpak. On the default `configure`
target, this service will be built by default. The service itself is linked to
the `com.endlessm.apps.Platform//3` flatpak runtime and will read information
from apps linked to that runtime. To explicitly build the service, pass
`--enable-service --disable-integration` to `./configure`. The service is
explicitly built when building the flatpak from the
`com.endlessm.CompanionAppService.json.in` manifest.

Note that if you are running a "converted" system, avoid the pitfall of
of trying to build and test against the system installed eos-knowledge-lib! The
service currently uses the API and database schema exposed by
eos-knowledge-lib SDK version 3. Trying to build it against a system-installed
or git-master version will probably fail. Use the `./run_sdk3.sh` wrapper
or `flapjack` to run build commands against SDK version 3.

Separate to the service is a set of integration hooks. These hooks, amongst
other things, register systemd service and socket files so that the service
flatpak is automatically started up whenever a device makes a connection
to the computer. It also includes an 'avahi helper' script, which writes
some metadata to `/etc/avahi/services` causing the service to be persistently
registered as an avahi service even when it is not running (but activatable
by systemd socket activation). Finally, it includes a small 'configuration
manager' binary which runs on every boot, responsible for reading the
configuration file and managing the state of the system by enabling or
disabling systemd services, avahi service files, etc To explicitly build the
integration hooks, pass `--disable-service --enable-integration`
to `./configure`. The integration hooks are automatically built when
building the debian package, `eos-companion-app-os-integration`.

## Running

If installed globally, you can start the service using
`eos-companion-app-service`. Note that this does not register any avahi
services - that will need to be done by the integration hooks detailed
above.

In the normal case, the service will have been installed as a flatpak, in
which case it can be run with `flatpak run com.endlessm.CompanionAppService`.

## Testing

This package includes a suite of Python tests which test the external
API of the service. It runs end-to-end and builds some fake applications
to test from, so you will need `[basin](https://github.com/endlessm/basin)` and
`[flatpak](https://github.com/flatpak/flatpak)` in order to run
them. They can be run either from setuptools by using
`python setup_setuptools.py test` or from automake with `make check`.

## Dependency Management

The tests require that certain dependencies from PyPI are installed. Those
requirements are specified in `requirements.txt` as per PEP508. However, flatpak
wants those dependencies to be installed in the systemwide flatpak installation
so we have an extra tool to regenerate the flatpak pip manifest to include those
requirements at build-time and test-time and then clean them up afterwards. To
run that tool, just use `make regenerate-pip-manifest-template`.