Differences between revisions 45 and 47 (spanning 2 versions)
Revision 45 as of 2012-07-21 22:36:05
Size: 6151
Editor: ?Alexander Pashaliyski
Comment:
Revision 47 as of 2012-07-22 09:20:38
Size: 6590
Editor: ?Alexander Pashaliyski
Comment:
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:

== Setup reprepro for local repository ==

0. Installing reprepro
{{{
apt-get install reprepro
}}}
1. Creating directories for the repository
{{{
mkdir -p /org/ftp.debian.org/ftp/apt/
cd /org/ftp.debian.org/ftp/apt/
mkdir conf dists incoming indices logs pool project
}}}
2. Configuring reprepro
{{{
cd /org/ftp.debian.org/ftp/apt/conf/
vim distributions
}}}
{{{
Origin: Alexander Pashaliyski
Label: Alexander Pashaliyski
Codename: sid
Architectures: i386 amd64 source
Components: main
Description: Alexander Pashaliyski APT Repository
SignWith: yes
}}}

Create and edit incoming conf file:
{{{
vim incoming
}}}
{{{
Name: default
IncomingDir: incoming
TempDir: /tmp
Allow: sid
Cleanup: on_deny on_error
}}}

Create and edit options conf file:
{{{
vim options
}}}
{{{
verbose
ask-passphrase
basedir .
}}}

Create and edit uploaders conf file:
{{{
vim uploaders
}}}
{{{
allow * by unsigned
}}}

Then create some other files
{{{
cd ../indices
touch override.sid.main
touch override.sid.main.debian-installer
touch override.sid.main.src
cd ..
}}}

3. Generating gpg key
{{{
gpg --gen-key
}}}

4. Export the repository
{{{
reprepro -vb /org/ftp.debian.org/ftp/apt export
}}}

5. Adding packages to the repository
To add a package to the repository, use one of these commands (replace <...> with the name of your package):
{{{
reprepro includedeb sid <deb filename>
reprepro includedsc sid <dsc filename>
}}}

Example:
{{{
reprepro includedeb sid openssh-client_5.9p1-5_amd64.deb
reprepro includedsc sid eglibc_2.13-32.dsc
}}}

'''Tip'''
If while generating gpg-key there's not enough entropy, here's a command that can be useful for generating entropy:

{{{
find /usr /var /tmp /opt -type f -print0 | xargs -0 cat > /dev/null
}}}

--------
Line 100: Line 198:
=== Patch buildd ===
The latest version of sbuild has a feature to clean up the environment before starting the building process. However there are some bugs associated with it and the simplest way to go around them is to disable the filters from the script. This change and two bug fixes are done with the attached patch [[attachment:sbuild.patch]]. Apply the patch (assuming that you have it in /root/sbuild.patch):
=== Patch sbuild and buildd ===
The latest version of sbuild has a feature to clean up the environment before starting the building process. However there are some bugs associated with it and the simplest way to go around them is to disable the filters from the script. There is a patch that solves this problem and some more. The binary packages sbuild and buildd are located in the same source package. After you have installed the binary packages, you can patch them together using [[attachment:sbuild.patch]]. Apply the patch (assuming that you have it in /root/sbuild.patch):
Line 108: Line 206:
== Run and test buildd ==
Now, when everything is configured, we have to import the packages from our repository to wanna-build's database:
{{{
su - wbadm
cd /org/wanna-build/triggers/
./trigger.local
}}}

Start the buildd daemon:
{{{
/etc/init.d/buildd start
}}}
Line 115: Line 226:
'''Tip'''
If while generating gpg-key there's not enough entropy, here's a command that can be useful for generating entropy:

{{{
find /usr /var /tmp /opt -type f -print0 | xargs -0 cat > /dev/null
}}}

--------

Line 126: Line 227:

== Setup reprepro for local repository ==

0. Installing reprepro
{{{
apt-get install reprepro
}}}
1. Creating directories for the repository
{{{
mkdir -p /org/ftp.debian.org/ftp/apt/
cd /org/ftp.debian.org/ftp/apt/
mkdir conf dists incoming indices logs pool project
}}}
2. Configuring reprepro
{{{
cd /org/ftp.debian.org/ftp/apt/conf/
vim distributions
}}}
{{{
Origin: Alexander Pashaliyski
Label: Alexander Pashaliyski
Codename: sid
Architectures: i386 amd64 source
Components: main
Description: Alexander Pashaliyski APT Repository
SignWith: yes
}}}

Create and edit incoming conf file:
{{{
vim incoming
}}}
{{{
Name: default
IncomingDir: incoming
TempDir: /tmp
Allow: sid
Cleanup: on_deny on_error
}}}

Create and edit options conf file:
{{{
vim options
}}}
{{{
verbose
ask-passphrase
basedir .
}}}

Create and edit uploaders conf file:
{{{
vim uploaders
}}}
{{{
allow * by unsigned
}}}

Then create some other files
{{{
cd ../indices
touch override.sid.main
touch override.sid.main.debian-installer
touch override.sid.main.src
cd ..
}}}

3. Generating gpg key
{{{
gpg --gen-key
}}}

4. Export the repository
{{{
reprepro -vb /org/ftp.debian.org/ftp/apt export
}}}

5. Adding packages to the repository
To add a package to the repository, use one of these commands (replace <...> with the name of your package):
{{{
reprepro includedeb sid <deb filename>
reprepro includedsc sid <dsc filename>
}}}

Example:
{{{
reprepro includedeb sid openssh-client_5.9p1-5_amd64.deb
reprepro includedsc sid eglibc_2.13-32.dsc
}}}

This is a step by step tutorial about Build services setup for Wanna-build.

Translation(s): none

(!) ?Discussion


This tutorial follows the installation of Wanna Build.

Setup reprepro for local repository

0. Installing reprepro

apt-get install reprepro

1. Creating directories for the repository

mkdir -p /org/ftp.debian.org/ftp/apt/
cd /org/ftp.debian.org/ftp/apt/
mkdir conf dists incoming indices logs pool project

2. Configuring reprepro

cd /org/ftp.debian.org/ftp/apt/conf/
vim distributions

Origin: Alexander Pashaliyski
Label: Alexander Pashaliyski
Codename: sid
Architectures: i386 amd64 source
Components: main
Description: Alexander Pashaliyski APT Repository
SignWith: yes

Create and edit incoming conf file:

vim incoming

Name: default
IncomingDir: incoming
TempDir: /tmp
Allow: sid
Cleanup: on_deny on_error

Create and edit options conf file:

vim options

verbose
ask-passphrase
basedir .

Create and edit uploaders conf file:

vim uploaders

allow * by unsigned

Then create some other files

cd ../indices
touch override.sid.main
touch override.sid.main.debian-installer
touch override.sid.main.src
cd ..

3. Generating gpg key

gpg --gen-key

4. Export the repository

reprepro -vb /org/ftp.debian.org/ftp/apt export

5. Adding packages to the repository To add a package to the repository, use one of these commands (replace <...> with the name of your package):

reprepro includedeb sid <deb filename>
reprepro includedsc sid <dsc filename>

Example:

reprepro includedeb sid openssh-client_5.9p1-5_amd64.deb
reprepro includedsc sid eglibc_2.13-32.dsc

Tip If while generating gpg-key there's not enough entropy, here's a command that can be useful for generating entropy:

find /usr /var /tmp /opt -type f -print0 | xargs -0 cat > /dev/null


Setup Buildd and Sbuild

Install sbuild and buildd

We're going to install sbuild, buildd and its dependencies.

apt-get install sbuild buildd sudo schroot debootstrap

Configure sbuild

Configuring sbuild is explained in http://wiki.debian.org/sbuild

In this tutorial we're only going to talk about how to configure schroot.

Configure schroot

sbuild uses schroot to build packages. We'll create a directory for it and configure sbuild to use it.

distribution=sid
architecture=amd64

mkdir -p /srv/chroot/$distribution-$architecture-sbuild
debootstrap $distribution /srv/chroot/$distribution-$architecture-sbuild
chown -R buildd. /srv/chroot/$distribution-$architecture-sbuild

Lets configure the chroot:

vim /etc/schroot/schroot.conf

echo "
[sid]
description=Debian sid (unstable)
directory=/srv/chroot/$distribution-$architecture-sbuild
users=buildd
groups=buildd
root-groups=buildd
aliases=unstable,default
" >> /etc/schroot/schroot.conf

We need to modify /etc/fstab in order to make proc and devpts mount automatically in the schroot:

echo "
proc            /srv/chroot/$distribution-$architecture-sbuild/proc   proc    defaults        0       0
devpts          /srv/chroot/$distribution-$architecture-sbuild/dev/pts devpts rw,noexec,nosuid,gid=5,mode=620  0  0
" >> /etc/fstab

mount -a

We'll now configure the schroot environment. We'll create two users and copy the sources.list file to chroot.

cp /etc/apt/sources.list /srv/chroot/$distribution-$architecture-sbuild/etc/apt/
usersfile=/srv/chroot/$distribution-$architecture-sbuild/root/users
echo "#\!/bin/sh" > "$usersfile"
echo "groupadd -g $(id -g buildd) buildd" >> "$usersfile"
echo "useradd -u $(id -u buildd) -g $(id -g buildd) buildd" >> "$usersfile"
echo "groupadd -g $(id -g sbuild) sbuild" >> "$usersfile"
echo "useradd -u $(id -u sbuild) -g $(id -g sbuild) sbuild" >> "$usersfile"
chmod a+x "$usersfile"

chroot /srv/chroot/$distribution-$architecture-sbuild/
# Run the script
/root/users

Configure buildd

User buildd has to be in the sbuild group for buildd to work properly:

usermod -a -G sbuild buildd

You need to let buildd access the wanna-build database. The simplest way to do this is to generate ssh keys (buildd uses ssh to connect to wanna-build).

su - buildd
ssh-keygen

You will be asked some questions. You should enter an empty passphrase (so that buildd can use the key without human intervention). You can leave everything else to the default value. If you used the default values, your key should be in /var/lib/buildd/.ssh/

cd /var/lib/buildd/.ssh/
cat id_rsa.pub > authorized_keys
ssh 127.0.0.1

When you enter the last command you'll be asked to accept the key. This is all you have to do here - now buildd can automatically connect to wanna-build. The IP address 127.0.0.1 is the location of wanna-build - I'm assuming it's located on the same machine.

Patch sbuild and buildd

The latest version of sbuild has a feature to clean up the environment before starting the building process. However there are some bugs associated with it and the simplest way to go around them is to disable the filters from the script. There is a patch that solves this problem and some more. The binary packages sbuild and buildd are located in the same source package. After you have installed the binary packages, you can patch them together using sbuild.patch. Apply the patch (assuming that you have it in /root/sbuild.patch):

cd /usr/share/perl5/
patch -p2 < /root/sbuild.patch

Run and test buildd

Now, when everything is configured, we have to import the packages from our repository to wanna-build's database:

su - wbadm
cd /org/wanna-build/triggers/
./trigger.local

Start the buildd daemon:

/etc/init.d/buildd start

Tip This file:

/var/lib/buildd/build/SBUILD-GIVEN-BACK

contains packages that will be skipped because they've already failed. There are cases in which you may want to edit or delete it.

#TODO: What is next ? How to test ?