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 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 /srv
cd /srv/
git clone https://buildd.debian.org/git/wanna-build.git/
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-get install libdbi-perl libyaml-tiny-perl libhash-merge-perl libstring-format-perl libtimedate-perl libdpkg-perl libdbd-pg-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-get install edos-debcheck

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

Installing database

In this example, PostgreSQL will be used as database.

apt-get install postgresql-9.1 postgresql-9.1-debversion

Generating SQLs for wanna-build

cd /srv/wanna-build/schema/
vim arches-tables.sh
./arches-tables.sh

and remove the unwanted architectures

Importing the database

Switch to the PostgreSQL's superuser and start a client.

su postgres
psql

Then create database and user for wanna-build.

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

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

First import main-tables.sql, it could indicate 'language "plpgsql" already exists', also that the role 'wb_all' doesn't exist.

psql -d wannadb -f main-tables.sql

Then, load roles from file 'roles.sql', it might output an error related to the role 'wbadm', which was created previously, also import to the database the architectures we want to support (file generated earlier).

psql -d wannadb -f roles.sql
psql -d wannadb -f arches-tables.sql

Create the system user wbadm and a temp directory for it(it will be the account accessing to the database)

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>/

# in Debian stable
cp /usr/share/postgresql/8.4/pg_service.conf.sample /etc/postgresql-common/pg_service.conf
# or
cp /usr/share/postgresql/9.1/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/8.4/main/pg_hba.conf

or

vim /etc/postgresql/9.1/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 local login for wbadm.

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.

# as wbadm
psql 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,archive) VALUES ('sid','','');
INSERT INTO architectures(architecture) VALUES ('amd64'),('i386');
INSERT INTO distribution_architectures(distribution,architecture) VALUES ('sid','amd64'),('sid','i386');

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 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, volatile, etc.).

If you want to get packages and sources from a local repository you can use the trigger.local script. You may 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.

su wbadm
triggers/trigger.local

Download trigger.local

Next steps

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