This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Packaging

Basic packaging recommendations

This guide is intended for projects to be distributed through our update servers and is based on our internal guidelines.
Users can still install packages manually, via PPA, Docker…. but maintenance can be problematic.

Target

If you are a maintainer of an interesting project that should be available on our platform we would like to provide it from our package repository.
It is possible to provide packages by a self hosted personal package archives (PPA) but we will not guarantee compatibility in this case.

Basic ideas

  1. The package must be maintainable. Concepts like installation/removal/purge/upgrade must be considered.
  2. The platform is an embedded device, we do want to keep the resource as low as possible.

Requirements

  • The source code must be located in Github, Gitlab or any other public repository.
  • The project must be actively maintained.
  • If the package is designed as service it must use/support systemd.
  • If you do not have experience in packaging Debian archives we recommend to use our script based template [TODO: Link].
  • The package must be provided in “.deb” Debian archive format.
    • The package should be build against the libraries in our repository.
      • If the package requires additional or newer libs they should be provided as separate package.
      • Static builds require an explicit statement why this is needed.
    • The package must be support clean installation, upgrade and removal.
    • The package must define all dependencies and incompatibilities (in the .deb conf file).
    • The package is not allowed to change core libs or system configuration files.
  • Environment specific notes:
    • Python packages:
      • The installation of python packages via “pip” or similar tools is forbidden.
      • The packages from our repository (python3-*) should be used, we can easily provide missing packages from pypi.org on request.
      • If there are good technical reasons the package may use a virtual environment. It must be created on installation and removed on removal.
    • Java packages:
      • Java packages should use the installed runtime.
    • Docker containers:
      • Docker containers can be used but are not recommended due to the overhead and maintenance problems.
        • They must be packed in a Debian archive (docker save) and support installation/removal/upgrade to avoid “pollution” of the system by unused/deprecated containers [TODO: Add guide].

1 - Packaging guide

How to package projects for official support

This describes how our Github packages are built.

To build Debian packages for our platform the following information is important:

  • We use the official Debian build tools for packaging. The following dependencies must be installed before building:
    sudo apt-get install devscripts quilt chrpath git wget apt-utils debhelper
    Depending on the project, there may be more dependencies.
  • The official Debian packaging process is (historically) complicated.
    To simplify the package build configuration we use a single script.
    Each project contains a makedeb.sh file which generates the package content and metadata on execution.
    All configs are in this file and on execution the directory builddeb is created which contains the build data and the resulting debian archive file.
  • The script’s workflow looks like this:
    • Declare build variables
    • Create an empty builddeb directory
    • Copy all the relevant files from the project to a virtual root structure under builddeb/
    • Generate the Debian archive metadata
    • Generate the install/removal/upgrade files
    • Build the package
  • Architecture dependent projects (C/C++, Rust…) usually need to build the executable/library before the script is called.
  • The packages must be built with the official image (root filesystem) and its dependencies.
    The image/rootfs can run on real hardware or be emulated.
    Package-cross-builds from other architectures (x86, amd64) or distributions (Ubuntu) are not possible!
    This refers only to the packaging, but cross-compilation of the binaries is recommended.

Example

This must be executed on the Nexus:

  • sudo apt-get install devscripts quilt chrpath git wget apt-utils debhelper
  • git clone https://github.com/noreya-nexus/PROJECT
  • Follow the project build steps (Note: Building projects can take very long!)
  • ./makedeb.sh
  • ls -l builddeb/*.deb