This documentation is a work in progress; it might be incomplete and outdated.
Table des matières
Liste des tableaux
Table des matières
pbuilder stands for Personal Builder, and it is an automatic Debian Package Building system for personal development workstation environments. pbuilder aims to be an easy-to-set-up system for auto-building Debian packages inside a clean-room environment, so that it is possible to verify that a package can be built on most Debian installations. The clean-room environment is achieved through the use of a base chroot image, so that only minimal packages will be installed inside the chroot.
La distribution Debian est constituée de logiciels libres accompagnés des sources. Tous les codes sources dans la section "main" de Debian doivent être construits uniquement à l'aide des dépendances sources explicitement spécifiées et contenues également dans la section "main".
L'objectif principal de pbuilder est différent de celui des autres systèmes de construction automatique dans Debian dans le sens où il ne s'agit pas de construire le maximum de paquets possible. Les paquets nécessaires ne sont pas devinés et quand un choix est nécessaire, c'est le plus souvent le plus mauvais choix qui est sélectionné.
De cette façon, pbuilder tente de garantir que les paquets construits à travers pbuilder se construiront certainement correctement sur la plupart des installations de Debian permettant ainsi d'obtenir la capacité de construire Debian à partir des sources.
The goal of making Debian buildable from source is somewhat accomplished, and has seen good progress. In the past age of Debian 3.0, there were many problems when building from source. More recent versions of Debian are much better.
Table des matières
Pour être opérationnel, il existe plusieurs commandes simples. pbuilder create, pbuilder update et pbuilder build sont les commandes les plus couramment utilisées. Regardons chacune de ces commandes.
pbuilder create will create a base chroot image tar-ball
(base.tgz). All other commands will operate on the resulting base.tgz. If
the Debian release to be created within chroot is not going to be "sid"
(which is the default), the distribution code-name needs to be specified
with the --distribution
command-line
option.
debootstrap [1] is used to create the bare minimum Debian installation, and then build-essential packages are installed on top of the minimum installation using the apt-get inside the chroot.
For more thorough documentation of command-line options, see the pbuilder(8)
manual page. Some configuration will be required for
/etc/pbuilderrc
for the mirror site [2] to use, and proxy configuration may be required to
allow access through HTTP. See the pbuilderrc(5) manual page for details.
pbuilder update will update the base.tgz. It will extract the chroot, invoke apt-get update and apt-get dist-upgrade inside the chroot, and then recreate the base.tgz (the base tar-ball).
It is possible to switch the distribution for which the base.tgz is targeted
at at this point. Specify --distribution
sid
--override-config
to change the distribution to
sid. [3]
For more thorough documentation of command-line options, see the pbuilder(8) manual page.
To build a package inside the chroot, invoke pbuilder build
whatever.dsc
. pbuilder will
extract the base.tgz to a temporary working directory, enter the directory
with chroot, satisfy the build-dependencies inside chroot, and build the
package. The built packages will be moved to a directory specified with the
--buildresult
command-line option.
The --basetgz
option can be used to
specify which base.tgz to use.
pbuilder will extract a fresh base chroot image from base.tgz. (base.tgz is created with the pbuilder create, and updated with the pbuilder update). The chroot is populated with build-dependencies by parsing debian/control and invoking apt-get.
For more thorough documentation of command-line options, see the pbuilder(8) manual page
pdebuild is a little wrapper script that does the most frequent of all tasks. A Debian Developer may try to run debuild, and build a package inside a Debian source directory. pdebuild will allow similar control, and allow the package to be built inside the chroot, to check that the current source tree will build happily inside the chroot.
pdebuild calls dpkg-source to build
the source packages, and then invokes pbuilder on the
resulting source package. However, unlike debuild, the resulting deb files
will be found in the --buildresult
directory.
See the pdebuild(1) manual page for more details.
There is a slightly different mode of operation available in
pdebuild since version 0.97. pdebuild
usually runs debian/rules clean outside of the chroot;
however, it is possible to change the behavior to run it inside the chroot
with the --use-pdebuild-internal
. It
will try to bind mount the working directory inside chroot, and run
dpkg-buildpackage inside. It has the following
characteristics, and is not yet the default mode of operation.
Satisfies build-dependency inside the chroot before creating source package (which is a good point that default pdebuild could not do).
Le répertoire de travail est modifié depuis l'environnement de base.
Construire en utilisant pdebuild ne garantit pas que cela fonctionnera également avec pbuilder.
Si la construction du paquet source ne réussit pas, la session utilisant l'environnement de base est gâchée (la création de cet environnement prend un peu de temps, ce qui peut être amélioré en utilisant cowdancer).
Does not work in the same manner as it used to; for example,
--buildresult
does not have any effect.
The build inside chroot is run with the current user outside chroot.
Il est possible de spécifier tous les paramètres en utilisant les options en ligne de commande. Toutefois, afin d'éviter de retaper celles-ci chaque fois, il est possible d'utiliser un fichier de configuration.
/etc/pbuilderrc
and
${HOME}/.pbuilderrc
are read in when
pbuilder is invoked. The possible options are documented
in the pbuilderrc(5) manual page.
It is useful to use the --configfile
option to load up a
preset configuration file when switching between configuration files for
different distributions.
Please note that ${HOME}/.pbuilderrc
supersedes system
settings. A caveat is that if you have some configuration, you may need to
tweak the configuration to work with new versions of pbuilder when
upgrading.
pbuilder requires full root privilege when it is satisfying the build-dependencies, but most packages do not need root privilege to build, or even refuse to build when they are built as root. pbuilder can create a user which is only used inside pbuilder and use that user id when building, and use the fakeroot command when root privilege is required.
The BUILDUSERID configuration option should be set to a value for a user id that does not already exist on the system, so that it is more difficult for packages that are being built with pbuilder to affect the environment outside the chroot. When the BUILDUSERNAME configuration option is also set, pbuilder will use the specified user name and fakeroot for building packages, instead of running as root inside chroot.
Même en utilisant ces options, pbuilder utilisera les privilèges du super-utilisateur quand ils seront réellement nécessaires, par exemple quand il doit installer des paquets dans l'environnement de base.
Pour pouvoir utiliser pbuilder sans être root, vous devez utiliser user-mode-linux comme expliqué dans Chapitre 3, Utiliser User-mode-linux avec pbuilder
pbuilder peut être utilisé pour rétroporter des logiciels de la dernière distribution Debian vers une version stable plus ancienne en utilisant une image de base de l'ancienne distribution et en construisant les paquets dans celle-ci. Il y a plusieurs points à considérer et, en raison de ceux-ci, le rétroportage automatique n'est généralement pas possible et une intervention manuelle est requise :
Le paquet de la distribution « unstable » peut dépendre de paquets ou de versions de paquets qui sont disponibles uniquement dans « unstable ». Il peut donc être impossible de satisfaire les dépendances de construction dans « stable » (sans travail supplémentaire).
La distribution « stable » peut contenir des bugs qui ont été corrigés dans « unstable » et qui ont besoin d'être contournés.
Le paquet dans « unstable » peut avoir des problèmes de construction, y compris dans « unstable ».
pbuilder peut être automatisé car le processus ne nécessite pas d'interactions. Il est possible d'exécuter pbuilder sur plusieurs paquets de manière non interactive. Plusieurs scripts destinés à cet usage existent. Junichi Uekawa utilise un tel script depuis 2001 et a envoyé des rapports de bugs pour les paquets qui n'ont pas pu être construits avec pbuilder. Plusieurs problèmes existent avec la construction automatique :
Les dépendances à la construction doivent s'installer sans nécessiter d'interactions. Cependant, certains paquets ne peuvent pas s'installer sans interaction (postgresql par exemple).
When a library package breaks, or gcc/gcj/g++ breaks, or even bison, a large number of build failures are reported. (gcj-3.0 had no "javac", bison got more strict, etc.)
Certaines personnes sont particulièrement hostiles vis-à-vis des rapports d'échecs de construction à partir des sources.
La plupart des bugs présents initialement dans pbuilder ont été résolus autour de 2002 mais ces problèmes transitionnels qui affectent une grande partie de l'archive Debian apparaissent de temps en temps. Les tests de régression sont alors utiles.
Un script qui était utilisé par Junichi Uekawa est désormais inclus dans la
distribution de pbuilder sous le nom
pbuildd.sh. Il est disponible dans
/usr/share/doc/pbuilder/examples/pbuildd/
et son
fichier de configuration est
/etc/pbuilder/pbuildd-config.sh
. Les personnes qui sont
habituées à pbuilder devraient facilement pouvoir
l'utiliser. Il existe depuis un certain temps et vous devriez aussi pouvoir
l'utiliser sur votre système. Cette version n'est pas la mieux testée mais
devrait pouvoir servir de base.
Pour configurer pbuildd, vous devez prendre en considération un certain nombre de points.
Un fichier ./avoidlist
doit contenir la liste des
paquets qu'il ne faut pas construire.
It will try building anything, even packages that are not intended for your architecture.
Parce que vous allez exécuter un certain nombre de scripts de construction, utilisez l'option fakeroot de pbuilder plutôt que de l'exécuter avec les privilèges du super-utilisateur.
Parce qu'il n'est pas garanti que toutes les constructions se finiront en un temps fini, placer une limite temporelle sur l'exécution est sans doute nécessaire. Dans le cas contraire, pbuildd peut rester indéfiniment sur un mauvais paquet.
Some packages require a lot of disk space; around 2GB seems to be sufficient for the largest packages for the time being. If you find otherwise, please inform the maintainer of this documentation.
Certaines personnes utilisent pbuilder pour rétroporter automatiquement un sous-ensemble de paquets vers la distribution stable.
I would like some information on how people are doing it. I would appreciate any feedback or information on how you are doing it, or any examples.
pbuilder peut être utilisé pour tester automatiquement les paquets. Il est possible de définir des crochets qui vont essayer d'installer le paquet dans l'image de base, les exécuter ou toute autre action. Voici quelques pistes :
Automatic install-remove-install-purge-upgrade-remove-upgrade-purge
test-suite (distributed as an example, B91dpkg-i
), or
just check that everything installs somewhat
(execute_installtest.sh
).
Lancer automatiquement lintian. Un exemple est fourni dans
/usr/share/doc/pbuilder/examples/B90lintian
).
Automatic debian-test of the package? The debian-test package has been removed from Debian. A pbuilder implementation can be found as debian/pbuilder-test directory, implemented through the B92test-pkg script.
To use the B92test-pkg script, first, add it to your hook directory.
[4]. The test files are shell scripts
placed in debian/pbuilder-test/NN_name
(where NN is a
number) following the run-parts standard[5] for file names. After a successful build, packages are first
tested for installation and removal, and then each test is run inside the
chroot. The current directory is the top directory of the source-code.
This means you can expect to be able to use the ./debian/ directory from
inside your scripts.
Example scripts for use with pbuilder-test can be found in
/usr/share/doc/pbuilder/examples/pbuilder-test
.
Most packages are compiled with gcc or g++ and use the default compiler version, which was gcc 2.95 for Debian GNU/Linux 3.0 (i386). However, Debian 3.0 was distributed with other compilers, under package names such as gcc-3.2 for gcc compiler version 3.2. It was therefore possible to try compiling packages against different compiler versions. pentium-builder provides an infrastructure for using a different compiler for building packages than the default gcc, by providing a wrapper script called gcc that calls the real gcc. To use pentium-builder in pbuilder, it is possible to set up the following in the configuration:
EXTRAPACKAGES="pentium-builder gcc-3.2 g++-3.2" export DEBIAN_BUILDARCH=athlon export DEBIAN_BUILDGCCVER=3.2
Cela indique à pbuilder d'installer le paquet pentium-builder ainsi que le compilateur GCC 3.2 dans l'image de base puis de renseigner les variables d'environnement nécessaires pour faire fonctionner pentium-builder.
[1] il est possible de choisir debootstrap ou cdebootstrap
[2] Il est préférable d'utiliser un miroir local ou un serveur cache afin de ne pas surcharger les miroirs publics avec un très grand nombre d'accès. L'utilisation d'outils tels que apt-proxy est conseillée.
[3] Seule une mise à jour est possible : Debian ne supporte pas (encore ?) les retours en arrière.
[4] It is possible to specify a --hookdir /usr/share/doc/pbuilder/examples command-line option to include all example hooks as well.
[5] Voyez run-parts(8). Par exemple, n'utilisez pas '.' dans les noms de fichiers !
Table des matières
It is possible to use user-mode-linux by invoking pbuilder-user-mode-linux instead of pbuilder. pbuilder-user-mode-linux doesn't require root privileges, and it uses the copy-on-write (COW) disk access method of User-mode-linux, which typically makes it much faster than the traditional pbuilder.
User-mode-linux is a somewhat less proven platform than the standard Unix tools that pbuilder relies on (chroot, tar, and gzip) but mature enough to support pbuilder-user-mode-linux since its version 0.59. And since then, pbuilder-user-mode-linux has seen a rapid evolution.
La configuration de pbuilder-user-mode-linux s'effectue en trois étapes :
Configuration de user-mode-linux
Configuration de rootstrap
Configuration de pbuilder-uml
user-mode-linux peut présenter quelques difficultés de configuration. Il est
préférable de se familiariser avec avant de tenter d'utiliser
rootstrap ou
pbuilder-user-mode-linux. Pour plus de détails,
reportez-vous au fichier
/usr/share/doc/uml-utilities/README.Debian
et à la
documentation de user-mode-linux qui se trouve dans le
paquet user-mode-linux-doc.
user-mode-linux nécessite que l'utilisateur appartienne au groupe uml-net de façon à configurer le réseau, sauf si utilisez slirp.
Si vous compilez votre propre noyau, vérifiez que le support de TUN/TAP est activé. Vous pouvez éventuellement appliquer le patch SKAS.
rootstrap est un utilitaire construit autour de debootstrap. Il crée une image disque de Debian destinée à être utilisée avec UML. Pour configurer rootstrap, il y a plusieurs prérequis.
Installer le paquet rootstrap.
TUN/TAP only: add the user to the uml-net group to allow access to the network
adduser dancer uml-net
Seulement pour utiliser TUN/TAP : vérifier que le noyau inclut l'interface TUN/TAP ou recompiler le noyau si nécessaire.
Set up /etc/rootstrap/rootstrap.conf
. For example, if
the current host is 192.168.1.2, changing the following entries to something
like this seems to work.
transport=tuntap interface=eth0 gateway=192.168.1.1 mirror=http://192.168.1.2:8081/debian host=192.168.1.198 uml=192.168.1.199 netmask=255.255.255.0
Some experimentation with configuration and running rootstrap ~/test.uml to actually test it would be handy.
Utiliser slirp nécessite moins de configuration. La configuration par défaut est livrée avec un exemple fonctionnel.
Suivre les étapes suivantes :
Installer le paquet pbuilder-uml.
Set up the configuration file
/etc/pbuilder/pbuilder-uml.conf
in the following
manner. It will be different for slirp.
MY_ETH0=tuntap,,,192.168.1.198 UML_IP=192.168.1.199 UML_NETMASK=255.255.255.0 UML_NETWORK=192.168.1.0 UML_BROADCAST=255.255.255.255 UML_GATEWAY=192.168.1.1 PBUILDER_UML_IMAGE="/home/dancer/uml-image"
Also, it needs to match the rootstrap configuration.
Assurez-vous que l'utilisateur a les droits pour écrire dans BUILDPLACE. Changez la valeur de BUILDPLACE dans le fichier de configuration pour un emplacement pour lequel l'utilisateur a les droits d'écriture.
Run pbuilder-user-mode-linux create --distribution
sid
to create the image.
Essayez pbuilder-user-mode-linux build.
pbuilder-user-mode-linux émule la plupart des fonctionnalités de pbuilder avec quelques différences.
pbuilder-user-mode-linux ne supporte pas encore correctement toutes les options de pbuilder. C'est un problème qui sera réglé au fur et à mesure.
/tmp is handled differently inside
pbuilder-user-mode-linux. In
pbuilder-user-mode-linux, /tmp
is
mounted as tmpfs inside UML, so accessing files under
/tmp
from outside user-mode-linux does not work. It
affects options like --configfile
, and
when trying to build packages placed under /tmp
.
Pour exécuter pbuilder-user-mode-linux en parallèle sur un système, un certain nombre de choses doivent être gardées à l'esprit.
Les méthodes create et update ne doivent pas être exécutées lorsqu'un paquet est en cours de construction. Dans le cas contraire, le fichier COW sera corrompu.
If you are not using slirp, user-mode-linux processes that are running in parallel need to have different IP addresses. Just trying to run the pbuilder-user-mode-linux several times will result in failure to access the network. But something like the following will work:
for IP in 102 103 104 105; do xterm -e pbuilder-user-mode-linux build --uml-ip 192.168.0.$IP \ 20030107/whizzytex_1.1.1-1.dsc & done
When using slirp, this problem does not exist.
It is possible to use pbuilder-user-mode-linux for other
uses than just building Debian packages. pbuilder-user-mode-linux
login
will let a user use a shell inside the
user-mode-linux pbuilder base image, and
pbuilder-user-mode-linux execute
will
allow the user to execute a script inside the image.
Vous pouvez utiliser un script pour installer ssh et ajouter un nouvel utilisateur ce qui permettra d'accéder à l'intérieur de user-mode-linux à l'aide de ssh.
Il n'est pas possible d'utiliser un script depuis /tmp
en raison du fait que pbuilder-user-mode-linux monte un
tmpfs sur /tmp
.
Le script d'exemple suivant permet de démarrer sshd dans user-mode-linux.
#!/bin/bash apt-get install -y ssh xbase-clients xterm echo "enter root password" passwd cp /etc/ssh/sshd_config{,-} sed 's/X11Forwarding.*/X11Forwarding yes/' /etc/ssh/sshd_config- > /etc/ssh/sshd_config /etc/init.d/ssh restart ifconfig echo "Hit enter to finish" read
Table des matières
Les problèmes fréquemment recontrés et les questions les plus courantes sont documentées ici. Cette portion était initialement disponible dans le fichier README.Debian mais a été déplacée ici.
Il est fréquent que pbuilder ne parvienne pas à créer une image de base récente. Essayez de mettre à jour pbuilder et debootstrap. Pour le moment, il n'est possible de concevoir que des logiciels sachant prendre en compte le passé. Une fois que nous serons à l'aise avec le passé, nous pourrons nous concentrer sur les prévisions du futur.
Certaines personnes rétroportent de manière occasionnelle debootstrap pour les versions stables ; trouvez-les.
Quand une erreur concerne la phase de debootstrap, c'est le script debootstrap qui doit être corrigé. pbuilder ne permet pas de pallier aux problèmes de debootstrap.
Because of the way pbuilder works, there are several
directories that cannot be bind-mounted when running
pbuilder. The directories include
/tmp
, /var/cache/pbuilder
, and
system directories such as /etc
and
/usr
. The recommendation is to use directories under
the user's home directory for bind-mounts.
It is possible to invoke a shell session after a build failure. Example
hook scripts are provided as C10shell
and
C11screen
scripts. The C10shell script will start bash
inside chroot, and the C11screen script will start a GNU screen inside the
chroot.
Il est parfois nécessaire de modifier l'image de
base. login supprimera toute modification après
déconnexion. Il est possible de lancer un shell en utilisant les
crochets. pbuilder update exécute les scripts commençant
par 'E' et un exemple pour lancer un shell est fourni sous le nom
C10shell
.
$ mkdir ~/loginhooks $ cp C10shell ~/loginhooks/E10shell $ sudo pbuilder update --hookdir ~/loginhooks/E10shell
It is also possible to add --save-after-exec
and/or
--save-after-login
options to the pbuilder
login session to accomplish the goal. It is possible to add the
--uml-login-nocow
option to
pbuilder-user-mode-linux login
session
as well.
It is possible to set
BUILDRESULTUID=$SUDO_UID
in pbuilderrc to set the proper BUILDRESULTUID when using sudo.
Si vous placez la variable $TMPDIR à une valeur inhabituelle, des erreurs peuvent se produire dans l'environnement de base telles que des échecs de dpkg-source.
There are two options: you may install a hook to create that directory, or set
export TMPDIR=/tmp
in pbuilderrc. Take your pick.
Un script d'exemple est fourni sous le nom
examples/D10tmp
avec pbuilder.
When working with multiple chroots, it would be nice to work with scripts
that reduce the amount of typing. An example script,
pbuilder-distribution.sh
, is provided as an example.
Invoking the script as pbuilder-squeeze
will invoke
pbuilder with a squeeze chroot.
This section[6] describes briefly a way to
set up and use multiple pbuilder setups by creating a pbuilderrc
configuration in your home path ($HOME/.pbuilderrc
)
and using the variable "DIST" when running pbuilder or pdebuild.
First, set up $HOME/.pbuilderrc
to look like:
if [ -n "${DIST}" ]; then BASETGZ="`dirname $BASETGZ`/$DIST-base.tgz" DISTRIBUTION="$DIST" BUILDRESULT="/var/cache/pbuilder/$DIST/result/" APTCACHE="/var/cache/pbuilder/$DIST/aptcache/" fi
Then, whenever you wish to use pbuilder for a particular distro, assign a value to "DIST" that is one of the distros available for Debian or any Debian based distro you happen to be running (i.e., whatever is found under /usr/lib/debootstrap/scripts).
Here are some examples for running pbuilder or pdebuild:
DIST=gutsy sudo pbuilder create DIST=sid sudo pbuilder create --mirror http://http.us.debian.org/debian DIST=gutsy sudo pbuilder create \ --othermirror "deb http://archive.ubuntu.com/ubuntu gutsy universe \ multiverse" DIST=gutsy sudo pbuilder update DIST=sid sudo pbuilder update --override-config --mirror \ http://http.us.debian.org/debian \ --othermirror "deb http://http.us.debian.org/debian sid contrib non-free" DIST=gutsy pdebuild
If you have some very specialized requirements on your apt setup inside
pbuilder, it is possible to specify them through the
--othermirror
option. Try something
like: --othermirror "deb http://local/mirror stable
main|deb-src http://local/source/repository ./"
To use the local file system instead of HTTP, it is necessary to do
bind-mounting. --bindmounts
is a
command-line option useful for such cases.
Utiliser les paquets que vous venez de construire dans l'environnement de base peut être pratique. Il est possible d'automatiser cette tâche en utilisant la configuration suivante. D'abord, configurez pbuilderrc pour rattacher votre répertoire contenant le résultat des constructions.
BINDMOUNTS="/var/cache/pbuilder/result"
Puis utilisez le crochet suivant
# cat /var/cache/pbuilder/hooks/D70results #!/bin/sh cd /var/cache/pbuilder/result/ /usr/bin/dpkg-scanpackages . /dev/null > /var/cache/pbuilder/result/Packages /usr/bin/apt-get update
De cette façon, vous pouvez utiliser deb
file:/var/cache/pbuilder/result
To add a new apt-key inside chroot:
sudo pbuilder --login --save-after-login # apt-key add - <<EOF ...public key goes here... EOF # logout
Vous pouvez utiliser à cet effet des crochets. Les scripts commençant par D sont lancés avant de résoudre les dépendances à la construction.
Pour indiquer que l'on se trouve à l'intérieur de
pbuilder, il est possible de modifier l'invite en
utilisant des variables comme PS1 dans pbuilderrc
With versions of bash more recent than 2.05b-2-15, the value of the debian_chroot variable, if set, is included in the value of PS1 (the Bash prompt) inside the chroot. In prior versions of bash,[7] setting PS1 in pbuilderrc worked.
Example of debian_chroot:
export debian_chroot="pbuild$$"
Example of PS1:
export PS1="pbuild chroot 32165 # "
L'invite de Bash vous aidera à vous souvenir que vous êtes dans un
environnement chrooté. Dans certains cas, vous pourriez souhaiter disposer
d'autres éléments l'indiquant. Utilisez le script crochet
examples/F90chrootmemo
. Il créera un fichier nommé
/CHROOT
dans l'environnement chrooté.
Pour les systèmes dont la bande passante est réduite, il est possible
d'utiliser /var/cache/apt/archives
comme cache pour les
paquets. Indiquez ce répertoire à la place de celui par défaut
/var/cache/pbuilder/aptcache
.
Il n'est cependant pas possible de faire ainsi pour le moment avec la
version pour user-mode-linux de pbuilder car
/var/cache/apt/archives
n'est généralement accessible
en écriture que par root.
L'utilisation d'outils comme apt-proxy est recommandé car la mise en cache des paquets profite également au reste du système.
Currently, a stable back port of pbuilder is available at backports.org.
Vous pourriez voir beaucoup de message d'alertes en exécutant pbuilder.
dpkg-genchanges: warning: no utmp entry available and LOGNAME not defined; using uid of process (1234)
Il n'est pas risqué d'ignorer ce message. Veuillez signaler tout problème avec LOGNAME non défini. Paramétrer LOGNAME cause quelques problèmes lors de l'appel à chroot. Par exemple, dpkg a besoin de getpwnam pour fonctionner dans le chroot, ce qui implique que LOGNAME et les informations relatives à l'utilisateur doivent être paramétrés dans le chroot.
pbuilder ne peut pas à permettre de conflit de construction ('Build-Conflict') sur des paquets essentiels. Il semble évident que les paquets essentiels ne devraient pas être enlevés d'un système Debian fonctionnel et qu'un paquet source ne devrait pas essayer de forcer la suppression de tels paquets pour des utilisateurs construisant le paquet.
By default, pbuilder uses hard links to manage the pbuilder package cache. It is not possible to make hard links across different devices; and thus this error will occur, depending on your set up. If this happens, set
APTCACHEHARDLINK=no
in your pbuilderrc file. Note that packages in APTCACHE will be copied into the chroot local cache, so plan for enough space on the BUILDPLACE device.
It is possible to use fakechroot instead of being root to run pbuilder; however, several things make this impractical. fakechroot overrides library loads and tries to override default libc functions when providing the functionality of virtual chroot. However, some binaries do not use libc to function, or override the overriding provided by fakechroot. One example is ldd. Inside fakechroot, ldd will check the library dependency outside of the chroot, which is not the expected behavior.
To work around the problem, debootstrap has a --variant
fakechroot
option. Use that, so that ldd and ldconfig are
overridden.
Assurez-vous d'avoir correctement renseigné la variable LD_PRELOAD, comme décrit dans la page de manuel de fakechroot.
Pour utiliser debconf à l'intérieur de pbuilder, placer
la variable DEBIAN_FRONTEND à « readline » dans
pbuilderrc
devrait faire l'affaire. La placer à
« dialog » devrait aussi marcher mais assurez-vous que whiptail
ou dialog sont installés dans l'environnement de base.
Si vous voyez de tels messages d'erreur lors de la construction de l'image de base, c'est que vous utilisez l'option nodev pour monter le système de fichiers.
/var/lib/dpkg/info/base-files.postinst: /dev/null: Permission denied
Vous aurez également des problèmes si vous montez le système de fichiers
avec l'option noexec ou nosuid. Assurez-vous qu'aucun de ces drapeaux ne
soient utilisés lorsque vous montez le système de fichiers pour
/var/cache/pbuilder
ou $BUILDPLACE.
Ce problème n'apparaît pas en utilisant user-mode-linux.
Référez-vous à 316135 pour un exemple.
pbuilder is often slow. The slowest part of pbuilder is extracting the tar.gz every time pbuilder is invoked. That can be avoided by using pbuilder-user-mode-linux. pbuilder-user-mode-linux uses the COW file system, and thus does not need to clean up and recreate the root file system.
pbuilder-user-mode-linux est plus lent à construire les paquets en raison du temps supplémentaire de traitement pour chaque appel système. Il est plus amical avec le disque dur.
pbuilder with cowdancer is also an alternative that improves the speed of pbuilder startup.
To sign a package marking it for sponsorship, it is possible to
use --auto-debsign
and
--debsign-k
options of
pdebuild.
pdebuild --auto-debsign
--debsign-k
XXXXXXXX
When running pdebuild, pbuilder will run dpkg-buildpackage to create a Debian source package to pass it on to pbuilder. A file named XXXX_YYY_source.changes is what remains from that process. It is harmless unless you try to upload it to the Debian archive.
This behavior is different when running through
--use-pdebuild-internal
amd64 architectures are capable of running binaries in i386 mode. It is
possible to use pbuilder to run packages, using
linux32 and the debootstrap
--arch
option. Specifically, a command-line
option like the following will work.
pbuilder create --distribution sid --debootstrapopts --arch --debootstrapopts i386 \ --basetgz /var/cache/pbuilder/base-i386.tgz --mirror http://deb.debian.org/debian linux32 pbuilder build --basetgz /var/cache/pbuilder/base-i386.tgz
To improve speed of operation, it is possible to use tmpfs for the pbuilder
build location. Mount tmpfs to
/var/cache/pbuilder/build
, and set
APTCACHEHARDLINK=no
.
The pdebuild command can be used with the svn-buildpackage --svn-builder command-line option: [8]
alias svn-cowbuilder="svn-buildpackage --svn-builder='pdebuild --pbuilder cowbuilder"
[6] This part of the documentation contributed by Andres Mejia.
Cette exemple est issu d'un wiki (https://wiki.ubuntu.com/PbuilderHowto).
[7] Versions of bash from and before Debian 3.0.
Table des matières
To report bugs, it would be important to have a log of what's going wrong.
Most of the time, adding a --debug
option and re-running the session should do the trick. Please send the log
of such a session along with your problem to ease the debugging process.
There is a mailing list for pbuilder on alioth (pbuilder-maint@lists.alioth.debian.org). You can subscribe through the alioth web interface: http://alioth.debian.org/mail/?group_id=30778.
Le canal IRC #pbuilder sur irc.oftc.net est utilisé pour la coordination et la communication. Indiquez-y votre intention avant d'effectuer un changement ou de publier une modification.
Cette section tente de documenter les actuelles pratiques de développement et comment les choses marchent dans le développement.
pbuilder is co-maintained with resources provided by Alioth. There is an Alioth project page at http://alioth.debian.org/projects/pbuilder. A home page is also available, at http://alioth.debian.org/projects/pbuilder, which shows this text. A git repository is available through http, git, or (if you have an account on alioth, ) ssh.
git-clone git://git.debian.org/git/pbuilder/pbuilder.git git-clone http://git.debian.org/git/pbuilder/pbuilder.git git-clone ssh://git.debian.org/git/pbuilder/pbuilder.git
Git commit message should have the first line describing what the commit does, formatted in the way debian/changelog is formatted because it is copied verbatim to changelog via git-dch. The second line is empty, and the rest should describe the background and extra information related to implementation of the commit.
Test-suites are available in the ./testsuite/
directory. Changes are expected not to break the test-suites.
./run-test.sh
is a basic test-suite, which puts a
summary in run-test.log
, and
run-test-cdebootstrap.log
.
./run-test-regression.sh
is a regression test-suite,
which puts the result in run-test-regression.log
.
Currently, run-test.sh is run automatically daily to ensure that pbuilder is
working.
Tableau 5.1. Structure des répertoires de la suite de tests
Répertoire | Signification |
---|---|
./testsuite/ | Directory for testsuite. |
./testsuite/run-test.sh | Tests de régression journaliers pour détecter les régressions dues aux changements survenus dans l'archive Debian. |
./testsuite/run-test.log | A summary of testsuite. |
./testsuite/normal/ | Directory for testsuite results of running pbuilder with debootstrap. |
./testsuite/cdebootstrap/ | Directory for testsuite results of running pbuilder with cdebootstrap. |
./testsuite/run-regression.sh | Regression testsuite, run every time change is made to pbuilder to make sure there is no regression. |
./testsuite/run-regression.log | Summary of test result. |
./testsuite/regression/BugID-*.sh | Regression tests, exit 0 for success, exit 1 for failure. |
./testsuite/regression/BugID-* | Fichiers utilisés pour les tests de régression. |
./testsuite/regression/log/BugID-*.sh.log | Output of the regression test; output from the script is redirected by run-regression.sh. |
When making changes, they should be documented in the Git commit log. git-dch will generate debian/changelog from the commit log. Make the first line of your commit log meaningful, and add any bug-closing information available. debian/changelog should not be edited directly except when releasing a new version.
A TODO file is available in debian/TODO
. It's mostly
not well-maintained, but hopefully it will be more up-to-date when people
start using it. Emacs todoo-mode is used in editing the file.
When releasing a new version of pbuilder, the version is tagged with the git tag X.XXX (version number). This is done with the ./git-tag.sh script, available in the source tree.
Table des matières
There are cases when some small amount of experimenting is required, and you do not want to damage the main system, like when installing experimental library packages, or compiling with experimental compilers. For such cases, the pbuilder login command is available.
pbuilder login est une fonctionnalité de diagnostic pour pbuilder, mais permet aux utilisateurs d'obtenir temporairement un environnement restreint.
À noter que l'environnement est nettoyé après la déconnexion du shell et que monter des systèmes de fichiers dans celui-ci est déconseillé.
Pour faciliter l'utilisation de pbuilder pour d'autres usages, la commande pbuilder execute est disponible. Celle-ci prend en paramètre un script qui sera exécuté dans l'environnement de base.
Le script peut être utilisé pour exécuter une suite d'opérations comme l'installation de ssh et l'ajout d'un nouvel utilisateur dans l'environnement de base.
Table des matières
pbuilder dispose de certaines fonctionnalités avancées pour certains usages spécifiques.
LVM2 has a useful snapshot function that features Copy-on-write images.
That could be used for pbuilder just as it can be used
for the user-mode-linux pbuilder port. The lvmpbuilder
script in the examples directory implements such a port. The scripts and
documentation can be found under
/usr/share/doc/pbuilder/examples/lvmpbuilder/
.
cowdancer allows copy-on-write semantics on a file system using hard links and hard-link-breaking-on-write tricks. pbuilder using cowdancer seems to be much faster and it is one ideal point for improvement. cowbuilder, a wrapper for pbuilder that uses cowdancer, is available from the cowdancer package since version 0.14.
Example command-lines for cowbuilder look like the following:
# cowbuilder --create --distribution sid # cowbuilder --update --distribution sid # cowbuilder --build XXX.dsc
It is also possible to use cowdancer with the pdebuild command. Specify
this with command-line option --pbuilder
or set it in the
PDEBUILD_PBUILDER configuration option.
$ pdebuild --pbuilder cowbuilder
The --no-targz
option of
pbuilder will allow usage of pbuilder
in a different way than conventional usage. It will try to use an existing
chroot, and will not try to clean up after working on it. It is an
operation mode more like sbuild.
It should be possible to create base chroot images for dchroot with the following commands:
# pbuilder create --distribution lenny --no-targz --basetgz /chroot/lenny # pbuilder create --distribution squeeze --no-targz --basetgz /chroot/squeeze # pbuilder create --distribution sid --no-targz --basetgz /chroot/sid
Il est possible d'utiliser pbuilder dans un vserver. Cela nécessite soit le paquet vserver-patches en version 2.1.1-rc14 ou plus récent ou bien un noyau Linux 2.6.16 ou plus récent.
Pour utiliser la commande pbuilder dans un vserver, vous avez besoin de placer le CAPS secure_mount dans les ccapabilities de ce vserver.
It is possible to use the C compiler cache ccache to speed up repeated builds of the same package (or packages that compile the same files multiple times for some reason). Using ccache can speed up repeated building of large packages dramatically, at the cost of some disk space and bookkeeping.
To enable usage of ccache with pbuilder, you should set CCACHEDIR in your pbuilderrc file.
Current implementation of ccache support has several bugs, such that CCACHEDIR must be owned by the pbuilder build user, and parallel runs of pbuilder are not supported. Therefore it is not enabled by default.
Table des matières
Tableau 8.1. Structure des répertoires à l'extérieur de l'environnement de base
Répertoire | Signification |
---|---|
/etc/pbuilderrc | Configuration file. |
/usr/share/pbuilder/pbuilderrc | Default configuration. |
/var/cache/pbuilder/base.tgz | Emplacement par défaut utilisé par pbuilder pour le fichier base.tgz contenant l'environnement de base constitué uniquement des paquets essentiels pour la construction des paquets. |
/var/cache/pbuilder/build/PID/ | Default location pbuilder uses for chroot. |
/var/cache/pbuilder/aptcache | Emplacement par défaut utilisé par pbuilder pour le cache apt pour stocker les paquets Debian pendant le processus de construction. |
/var/cache/pbuilder/ccache | Default location pbuilder will use as cache location. |
/var/cache/pbuilder/result | Default location where pbuilder puts the deb files and other files created after build. |
/var/cache/pbuilder/pbuilder-umlresult | Default location where pbuilder-user-mode-linux puts the deb files and other files created after build. |
/var/cache/pbuilder/pbuilder-mnt | Emplacement par défaut où pbuilder-user-mode-linux monte le système de fichiers COW pour l'environnement de base. |
/tmp | pbuilder-user-mode-linux montera le tmpfs ici. |
${HOME}/tmp/PID.cow | pbuilder-user-mode-linux uses this directory for location of COW file system. |
${HOME}/uml-image | pbuilder-user-mode-linux uses this directory for user-mode-linux full disk image. |
Tableau 8.2. Structure des répertoires à l'intérieur de l'image de base
Répertoire | Signification |
---|---|
/etc/mtab |
Symlink to /proc/mounts .
|
/tmp/buildd | Default place used in pbuilder to place the Debian
package to be processed.
/tmp/buildd/packagename-version/ will be the root
directory of the package being processed. HOME environment variable is set
to this value inside chroot by pbuilder-buildpackage.
--inputfile will place files here.
|
/runscript | Le script utilisé comme argument pour pbuilder execute est placé ici. |
/tmp/hooks | Emplacement des crochets. |
/var/cache/apt/archives | pbuilder copies the content of this directory to and from the aptcache directory located outside chroot. |
/var/cache/pbuilder/ccache | pbuilder bind-mounts this directory for use by ccache. |
/tmp/XXXX | pbuilder-user-mode-linux uses a script in
/tmp to bootstrap into user-mode-linux. |
Table des matières
Ce document a été commencé le 28 décembre 2002 par Junichi Uekawa qui essayait de documenter ce qui était connu à propos de pbuilder.
This documentation is available from the pbuilder source tar-ball, and from the git repository of pbuilder (web-based access is possible). A copy of this documentation can be found on the Alioth project page for pbuilder. There is also a PDF version. The homepage for pbuilder is http://pbuilder.alioth.debian.org/, hosted by the alioth project.
La documentation est écrite avec DocBook XML, en utilisant le mode PSGML d'Emacs et wysidocbookxml pour la prévisualisation en direct.
Ce qui suit explique, de manière sans doute incorrecte, comment pbuilder a vu le jour et les autres tentatives pour obtenir quelque chose de similaire. Cette partie de la documentation se trouvait initialement dans le fichier AUTHORS pour citer ceux qui existaient avant pbuilder.
There was once dbuild, which was a shell script to build Debian packages from source. Lars Wirzenius wrote that script, and it was good, short, and simple (probably). There was nothing like build-depends then (I think), and it was simple. It might have been improved; I could only find references and no actual source.
debbuild was probably written by James Troup. I don't know because I have never seen the actual code; I could only find some references to it on the net, and mailing list logs.
sbuild is a perl script to build Debian packages from source. It parses Build-Depends, and performs other miscellaneous checks, and has a lot of hacks to actually get things building, including a table of what package to use when virtual packages are specified (does it do that still?). It supports the use of a local database for packages that do not have build-dependencies. It was written by Ronan Hodek, and I think it was patched and fixed and extended by several people. It is part of wanna-build, and used extensively in the Debian buildd system. I think it was maintained mostly by Ryan Murray.
wanna-build (sbuild) était (en 2001) particulièrement difficile à configurer et il n'est jamais devenu un paquet Debian. dbuild a permis de promouvoir l'usage des dépendances source.
Construire des paquets depuis les sources en respectant les dépendances source semblait trivial et pbuilder est né. C'était initialement un script shell de seulement quelques lignes qui appelait debootstrap, chroot et dpkg-buildpackage à chaque exécution. Mais il a été rapidement décidé que cette approche était trop lente.
Yes, and it took almost a year to get things somewhat right, and in the middle of the process, Debian 3.0 was released. Yay. Debian 3.0 wasn't completely buildable with pbuilder, but the amount of packages which are not buildable is steadily decreasing (I hope).
Someone wanted pbuilder to not run as root, and as User-mode-linux has become more useful as time passed, I've started experimenting with pbuilder-user-mode-linux. pbuilder-user-mode-linux has not stayed functional as much as I would have liked, and bootstrapping the user-mode-linux environment has been pretty hard, due to the quality of user-mode-linux code or packaging at that time, which kept on breaking network support in one way or the other.
pbuilder is now widely adopted as an 'almost standard' tool for testing packages, and building packages in a pristine environment. There are other, similar tools that do similar tasks, but they do not share the exact same goal. To commemorate this fact, pbuilder is now co-maintained by several people.
sbuild is now a well-maintained Debian package within Debian, and with pbuilder being such a slow monster, some people prefer the approach of sbuild. Development to use LVM-snapshots, cowloop, or cowdancer are hoped to improve the situation somewhat.