Size: 7403
Comment: CategoryPackaging
|
Size: 7372
Comment: wanna-build setup is not related to packaging
|
Deletions are marked like this. | Additions are marked like this. |
Line 205: | Line 205: |
---- CategoryPackaging |
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 install libdbi-perl libyaml-libyaml-perl libhash-merge-perl libstring-format-perl libtimedate-perl libyaml-tiny-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 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 database.
apt install postgresql postgresql-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
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 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.
# 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-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