Open main menu

postmarketOS β

BPO development

Various resources on builds.postmarketos.org (bpo) development, which will be our future binary repository infrastructure. This article is only relevant for people who wish to contribute to that effort, it has nothing to do with running postmarketOS or creating packages for it.

Contents

Local development environment

These steps set up a local copy of bpo in docker, that runs against your username's namespace on the official builds.sr.ht instance.

Requirements

Store package signing key in builds.sr.ht

Run pmbootstrap build_init to generate a public and private key pair for signing packages. We will use the same private key on the bpo server. Open secrets and fill out the "add new secret" form on the left:

  • Name: "bpo test build key"
  • Secret: (put here the output of sudo cat ~/.local/var/pmbootstrap/config_abuild/pmos-*.rsa)
  • Secret Type: File
  • Path: ~/.secrets/build@postmarketos.org.priv
  • Mode: 644

Then click "Add secret". Note down the key it generated on the right (the string that looks like 46f739e5-4538-45dd-a79f-bf173b7a2ed9), you will need it in the next step.

Clone and configure

$ git clone https://gitlab.com/postmarketOS/build.postmarketos.org.git
$ cd build.postmarketos.org/
$ cp .env.dist .env

Open .env in a text editor and change the following:

Run the development environment

Build the custom bpo docker container and run it, together with MariaDB and phpMyAdmin docker containers:

$ cd devel-env
$ ./run.sh

You can access bpo at http://localhost and phpMyAdmin at http://localhost:8080 (login with: root, devsetup).

Submitting a job

Open phpMyAdmin and open bpo / commit. Create a new entry:

INSERT INTO `commit` (`id`, `ref`, `branch`, `message`, `status`)
VALUES ('1', 'e8a7926eb6004ba57ae8b9a7250ce563188dd808', 'master', 'hello world', 'INDEXING');

Make sure that bpo is still running, and execute:

$ cd devel-env
$ ./api-task-submit.sh > /tmp/out.html && head /tmp/out.html

When something goes wrong, this will output a full html page. In that case, the error is in the <title> tag, and you can see the whole thing with a stack trace and links to browse the code by opening the HTML page.

$ firefox /tmp/out.html

When it went right, a new job should appear on top of your personal builds.sr.ht start page.

Submitting the same job again

  • Remove the entry that appeared in the queue table
  • Now you can run api-task-submit.sh again

Clearing the database

$ cd devel-env
$ ./clean.sh

Changing the pmbootstrap branch

Pass the branch as argument to ./install_pmbootstrap.sh here, e.g. ./install_pmbootstrap.sh mycoolbranch.

Creating a new test

$ cd devel-env
$ ./shell.sh
~/bpo $ bin/console make:unit-test

Database

Status values for the "commits" table

  • INDEXING not running yet
  • BUILDING currently building on sr.ht
  • FAILED build failed on sr.ht
  • SUPERSEDED a job for a newer version of the package has been submitted
  • DONE everything build successfully