|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
| Various resources on [https://gitlab.com/postmarketOS/build.postmarketos.org builds.postmarketos.org] (bpo) development, which will be our [https://postmarketos.org/blog/2019/01/16/600-days-of-postmarketOS/#new-srht-based-binary-repository 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.
| | #REDIRECT [[bpo]] |
| | | <!-- this page used to talk about development of an early prototype of bpo that had been completely rewritten --> |
| == 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 ===
| |
| * Register at [https://builds.sr.ht/ builds.sr.ht]
| |
| * Install docker and docker-compose
| |
| | |
| === Store package signing key in builds.sr.ht ===
| |
| Run <code>pmbootstrap build_init</code> to generate a public and private key pair for signing packages. We will use the same private key on the bpo server.
| |
| Open [https://builds.sr.ht/secrets secrets] and fill out the "add new secret" form on the left:
| |
| | |
| * Name: "bpo test build key"
| |
| * Secret: (put here the output of <code>sudo cat ~/.local/var/pmbootstrap/config_abuild/pmos-*.rsa</code>)
| |
| * 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 ===
| |
| <syntaxhighlight lang="shell-session">
| |
| $ git clone https://gitlab.com/postmarketOS/build.postmarketos.org.git
| |
| $ cd build.postmarketos.org/
| |
| $ cp .env.dist .env
| |
| </syntaxhighlight>
| |
| | |
| Open <code>.env</code> in a text editor and change the following:
| |
| * SRHT_SECRET_ID: the secret ID for your build key, as generated above
| |
| * SRHT_TOKEN: [https://meta.sr.ht/oauth/register generate a personal access token]
| |
| | |
| === Run the development environment ===
| |
| Build the custom bpo docker container and run it, together with MariaDB and phpMyAdmin docker containers:
| |
| <syntaxhighlight lang="shell-session">
| |
| $ cd devel-env
| |
| $ ./run.sh
| |
| </syntaxhighlight>
| |
| | |
| You can access bpo at http://localhost and phpMyAdmin at http://localhost:8080 (login with: <code>root</code>, <code>devsetup</code>).
| |
| | |
| === Submitting a job ===
| |
| Open phpMyAdmin and open bpo / commit. Create a new entry:
| |
| | |
| <syntaxhighlight lang="sql">
| |
| INSERT INTO `commit` (`id`, `ref`, `branch`, `message`, `status`)
| |
| VALUES ('1', 'e8a7926eb6004ba57ae8b9a7250ce563188dd808', 'master', 'hello world', 'INDEXING');
| |
| </syntaxhighlight>
| |
| | |
| Make sure that bpo is still running, and execute:
| |
| <syntaxhighlight lang="shell-session"> | |
| $ cd devel-env
| |
| $ ./api-task-submit.sh > /tmp/out.html && head /tmp/out.html
| |
| </syntaxhighlight>
| |
| | |
| 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.
| |
| | |
| <syntaxhighlight lang="shell-session">
| |
| $ firefox /tmp/out.html
| |
| </syntaxhighlight>
| |
| | |
| When it went right, a new job should appear on top of your personal [https://builds.sr.ht/ 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 ===
| |
| <syntaxhighlight lang="shell-session">
| |
| $ cd devel-env
| |
| $ ./clean.sh
| |
| </syntaxhighlight>
| |
| | |
| === Changing the pmbootstrap branch ===
| |
| Pass the branch as argument to <code>./install_pmbootstrap.sh</code> [https://gitlab.com/postmarketOS/build.postmarketos.org/blob/cc5c0ff701e49063cfb9c2e420ddff49c1b30c8f/src/Helper/SrHtApi.php#L82 here], e.g. <code>./install_pmbootstrap.sh mycoolbranch</code>.
| |
| | |
| === Creating a new test ===
| |
| <syntaxhighlight lang="shell-session">
| |
| $ cd devel-env
| |
| $ ./shell.sh
| |
| ~/bpo $ bin/console make:unit-test
| |
| </syntaxhighlight>
| |
| | |
| == 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
| |
| | |
| [[Category:Guide]]
| |