Translation(s): none

(!) ?Discussion


Setting up a Wanna-Build Infrastructure on One Server

On this page, the wanna-build database setup is detailed and the configuration of build tools on one server. This may also be regarded as the simplest case.

Note that some commands and packages at the time are only available in the unstable (sid) distribution.

Getting wanna-build

Download wanna-build from the git repository.

mkdir -p /srv
git clone https://salsa.debian.org/wb-team/wanna-build.git /srv/wanna-build
ln -s /srv/wanna-build/bin/wanna-build /usr/local/bin/wanna-build

Note that /srv is hardcoded in wanna-build.

Setting up wanna-build's dependencies

wanna-build uses Perl and requires some additional modules.

apt install libdbi-perl libyaml-libyaml-perl libhash-merge-perl libstring-format-perl libtimedate-perl libyaml-tiny-perl libdpkg-perl libdbd-pg-perl libany-uri-escape-perl dctrl-tools moreutils dose-builddebcheck

Some of the tools that come with wanna-build require additional packages to work. In order to use these tools, you have to install these packages:

apt install dose-distcheck

wanna-build needs "parallel" from package moreutils and not from package parallel

Installing database

In this example, PostgreSQL will be used as a database.

apt-get install postgresql-${version} postgresql-${version}-debversion

Where ${version} is the default PostgreSQL version of your distribution.

Importing the database

Switch to PostgreSQL's superuser and start a client.

su postgres
psql

Then create a database and user for wanna-build.

CREATE DATABASE wannadb;
CREATE USER wbadm WITH PASSWORD 'wannapass';
GRANT ALL PRIVILEGES ON DATABASE wannadb to wbadm;
ALTER ROLE wbadm CREATEROLE;

Finally, exit the client and import the SQL files of wanna-build.

Import roles.sql and main-tables.sql.

psql -d wannadb -f /srv/wanna-build/schema/roles.sql
psql -d wannadb -f /srv/wanna-build/schema/main-tables.sql

Generating architecture specific SQL tables for wanna-build

For every $ARCH you want to add a table, run the following command:

cd /srv/wanna-build/schema/
./arches-tables.sh $ARCH | psql -d wannadb

Creating wbadm system user

Switch back to the root user, create the system user wbadm and a temp directory for it(it will be the account accessing to the database)

su
adduser --disabled-password --gecos ""  wbadm
mkdir -p /srv/wanna-build/tmp
chmod 750 /srv/wanna-build/tmp/
chown wbadm /srv/wanna-build/tmp/

Configuring PostgreSQL to work with wanna-build

You need to configure services for wanna-build. There is a sample configuration file in /usr/share/postgresql/<version>/

cp /usr/share/postgresql/*/pg_service.conf.sample /etc/postgresql-common/pg_service.conf

cat >> /etc/postgresql-common/pg_service.conf
[wanna-build]
dbname=wannadb
user=wbadm

[wanna-build-privileged]
dbname=wannadb
user=wbadm

Then press Ctrl+d to write the changes to the file.

You have to enable wanna-build to access the database. The simplest way to do that is to make all local connections to PostgreSQL trusted for the wanna-build user:

vim /etc/postgresql/*/main/pg_hba.conf

Add a line for the user wbadm to trust local access:

local   all             wbadm                                   trust

WARNING Make sure that this is the first line that matches the local login for wbadm. If you're not sure, put this line at the start of that file. A "Peer authentication failed" error results if this was done incorrectly.

Finally, restart PostgreSQL.

/etc/init.d/postgresql restart

Insert architecture and distribution information into the database

Now we're going to insert some data into the database of wanna-build.

su postgres
psql -U wbadm -d wannadb

We have to tell wanna-build the architectures and the distributions that we're going to support. We're also going to need additional entries for each (distribution,architecture) that wanna-build uses to lock the tables (thus preventing concurrency problems).

INSERT INTO distributions(distribution,build_dep_resolver) VALUES ('sid','apt');
INSERT INTO architectures(architecture) VALUES ('amd64'),('i386');
INSERT INTO distribution_architectures(distribution,architecture,archive) VALUES ('sid','amd64','debian'),('sid','i386','debian');
INSERT INTO locks(distribution,architecture) VALUES ('sid','amd64'),('sid','i386');

Each distribution has zero or more aliases (alternative names). In this example, we're going to create one alias to demonstrate the idea.

INSERT INTO distribution_aliases(distribution,alias) VALUES('sid','unstable');

Add "Packages-arch-specific"

When setting up a local wanna-build database, we have to provide a current "Packages-arch-specific" file for each suite, which is needed for wanna-build's operation. The path to it is defined in the variables $PAS_BASE and $PAS_FILE in /srv/wanna-build/triggers/common. When using the predefined paths, the file can be installed with:

su
SUITE=sid
mkdir -p /srv/buildd.debian.org/web/quinn-diff/${SUITE}
cd /srv/buildd.debian.org/web/quinn-diff/${SUITE}/
wget https://buildd.debian.org/quinn-diff/${SUITE}/Packages-arch-specific

Add packages to the database

Depending on your need you will want to use the official Debian repository or a custom one. In the triggers/ directory, there are a number of scripts that will help you feed your wanna-build database with packages and sources information. There is a separate script for each archive (debian, security, etc.).

If you want to get packages and sources from a local repository you can use the trigger.local script such as trigger.local. You will want to change the REPOSITORY variable in the script to where your repository is located.

Whatever script you choose to run, you have to do it with the wbadm user so that the script can access the database. Here's a trigger invocation. It only makes sense to run this after the repository has been set up, as described in the Next steps linked below.

# copy trigger.local into /srv/wanna-build/triggers
su
chmod a+x /srv/wanna-build/triggers/trigger.local
su wbadm
cd /srv/wanna-build/triggers
./trigger.local

NOTE: most trigger files use the function "ensure_lock()" defined in /srv/wanna-build/triggers/common. This function in turn uses "lockfile" which is part of the procmail package. Thus, before you can use most of the trigger files you have to install procmail:

apt install procmail

Next steps

The next steps will concern the setup of buildd/sbuild and reprepro