Table of Contents
O pacote build-essential tem de ser instalado no ambiente de compilação.
The devscripts package should be installed in the development environment of the maintainer.
It is a good idea to install and set up all of the popular set of packages mentioned in this chapter. These enable us to share the common baseline working environment, although these are not necessarily absolute requirements.
Please also consider to install the tools mentioned in the “Overview of Debian Maintainer Tools” in the “Debian Developer’s Reference”, as needed.
![]() | Caution |
---|---|
As configurações de ferramenta apresentadas aqui servem apenas de exemplo e podem não estar atualizadas com os pacotes mais recentes no sistema. O desenvolvimento Debian é um alvo em movimento. Por favor certifique-se de ler a documentação pertinente e actualize a configuração se necessário. |
Várias ferramentas de manutenção Debian reconhecem o seu endereço de email e nome a usar pelas variáveis de ambiente da shell $DEBEMAIL e $DEBFULLNAME.
Let’s set these environment variables by adding the following lines to ~/.bashrc [6].
Adicione ao ficheiro ~/.bashrc.
DEBEMAIL="osamu@debian.org" DEBFULLNAME="Osamu Aoki" export DEBEMAIL DEBFULLNAME
![]() | Note |
---|---|
The above is for the author of this manual. The configuration and operation examples presented in this manual use these email address and name settings. You must use your email address and name for your system. |
O comando mc oferece maneiras muito fáceis de gerir ficheiros. Ele pode abrir o ficheiro binário deb para verificar o seu conteúdo ao pressionar a tecla Enter sobre o ficheiro binário deb. Ele usa o comando dpkg-deb como seu back-end. Vamos configura-lo para usar chdir fácil como se segue.
Adicione ao ficheiro ~/.bashrc.
# mc related if [ -f /usr/lib/mc/mc.sh ]; then . /usr/lib/mc/mc.sh fi
Hoje em dia, o comando git e a ferramenta essencial para gerir a árvore fonte com histórico.
A configuração de utilizador global para o comando git como o seu nome e endereço de email pode ser definida em ~/.gitconfig como se segue.
$ git config --global user.name "Osamu Aoki" $ git config --global user.email osamu@debian.org
Se você está muito acostumado aos comandos do CVS ou Subversion, pode desejar definir vários nomes alternativos de comandos como se segue.
$ git config --global alias.ci "commit -a" $ git config --global alias.co checkout
Você pode verificar a sua configuração global como se segue.
$ git config --global --list
![]() | Tip |
---|---|
É essencial usar algumas ferramentas GUI do git como gitk ou gitg para trabalha efectivamente com o histórico do repositório git. |
O comando quilt oferece um método básico de gravar modificações. Para o empacotamento Debian, deve ser personalizado para guardar modificações no directório debian/patches/ em vez de no seu directório predefinido patches/.
De modo a evitar alterar o comportamento do próprio comando quilt, vamos criar um nome alternativo dquilt para o empacotamento Debian ao adicionar as seguintes linhas ao ficheiro ~/.bashrc. A segunda linha fornece a mesma funcionalidade de completação da shell do comando quilt para o comando dquilt.
Adicione ao ficheiro ~/.bashrc.
alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg" . /usr/share/bash-completion/completions/quilt complete -F _quilt_completion $_quilt_complete_opt dquilt
Depois vamos criar ~/.quiltrc-dpkg como se segue.
d=. while [ ! -d $d/debian -a `readlink -e $d` != / ]; do d=$d/..; done if [ -d $d/debian ] && [ -z $QUILT_PATCHES ]; then # if in Debian packaging tree with unset $QUILT_PATCHES QUILT_PATCHES="debian/patches" QUILT_PATCH_OPTS="--reject-format=unified" QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto" QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index" QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:" QUILT_COLORS="${QUILT_COLORS}diff_ctx=35:diff_cctx=33" if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi fi
See quilt(1) and “How To Survive With Many Patches or Introduction to Quilt (quilt.html)” on how to use the quilt command.
Veja “Section 5.9, “Step 3 (alternatives): Modification to the upstream source”” para exemplos de utilização.
O comando debsign, incluído no pacote devscripts, é usado para assinar o pacote Debian com a sua chave GPG privada.
O comando debuild, incluído no pacote devscripts, compila o pacote binário e verifica-o com o comando lintian. É útil ter resultados detalhados gerados do comando lintian.
Você pode configurar estes no ~/.devscripts como se segue.
DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i -I -us -uc" DEBUILD_LINTIAN_OPTS="-i -I --show-overrides" DEBSIGN_KEYID="Your_GPG_keyID"
The -i and -I options in DEBUILD_DPKG_BUILDPACKAGE_OPTS for the dpkg-source command help rebuilding of Debian packages without extraneous contents (see “Chapter 7, Sanitization of the source”).
Actualmente, uma chave RSA com 4096 bits é uma boa ideia. Veja “Criando uma nova chave GPG”.
The sbuild package provides a clean room (“chroot”) build environment. It offers this efficiently with the help of schroot using the bind-mount feature of the modern Linux kernel.
Since it is the same build environment as the Debian’s buildd infrastructure, it is always up to date and comes full of useful features.
Pode ser personalizado para oferecer as seguintes funcionalidades:
Let’s set up sbuild environment [7]:
$ sudo apt install sbuild piuparts autopkgtest lintian $ sudo apt install sbuild-debian-developer-setup $ sudo sbuild-debian-developer-setup -s unstable
Let’s update your group membership to include sbuild and verify it:
$ newgrp - $ id uid=1000(<yourname>) gid=1000(<yourname>) groups=...,132(sbuild)
Here, “reboot of system” or “kill -TERM -1” can be used instead to update your group membership [8] .
Let’s create the configuration file ~/.sbuildrc in line with recent Debian practice of “source-only-upload” as:
cat >~/.sbuildrc << 'EOF' ############################################################################## # PACKAGE BUILD RELATED (source-only-upload as default) ############################################################################## # -d $distribution = 'unstable'; # -A $build_arch_all = 1; # -s $build_source = 1; # --source-only-changes $source_only_changes = 1; # -v $verbose = 1; ############################################################################## # POST-BUILD RELATED (turn off functionality by setting variables to 0) ############################################################################## $run_lintian = 1; $lintian_opts = ['-i', '-I']; $run_piuparts = 1; $piuparts_opts = ['--schroot', 'unstable-amd64-sbuild']; $run_autopkgtest = 1; $autopkgtest_root_args = ''; $autopkgtest_opts = [ '--', 'schroot', '%r-%a-sbuild' ]; ############################################################################## # PERL MAGIC ############################################################################## 1; EOF
![]() | Note |
---|---|
There are some exceptional cases such as NEW uploads, uploads with NEW binary packages, and security uploads where you can’t do source-only-upload but are required to upload with binary packages. The above configuration needs to be adjusted for those exceptional cases. |
Following document assumes that sbuild is configured this way.
Edite isto à sua necessidade. Os testes pós-compilação pode ser ligados e desligados ao atribuir 1 ou 0 às variáveis correspondentes,
![]() | Warning |
---|---|
A personalização opcional pode causar efeitos negativos. Em caso de dúvidas. desative-a. |
![]() | Note |
---|---|
O make paralelo pode falhar para alguns pacotes existentes e pode tornar o relatório de compilação difícil de ler. |
![]() | Tip |
---|---|
Many sbuild related hints are available at “Section 8.7, “Note on sbuild”” and “https://wiki.debian.org/sbuild” . |
![]() | Note |
---|---|
Use of independent copied chroot filesystem prevents contaminating the source chroot used by sbuild. |
For building new experimental packages or for debugging buggy packages, let’s setup dedicated persistent chroot “source:unstable-amd64-desktop” by:
$ sudo cp -a /srv/chroot/unstable-amd64-sbuild-$suffix /srv/chroot/unstable-amd64-desktop $ sudo tee /etc/schroot/chroot.d/unstable-amd64-desktop << EOF [unstable-desktop] description=Debian sid/amd64 persistent chroot groups=root,sbuild root-groups=root,sbuild profile=desktop type=directory directory=/srv/chroot/unstable-amd64-desktop union-type=overlay EOF
Here, desktop profile is used instead of sbuild profile. Please make sure to adjust /etc/schroot/desktop/fstab to make package source accessible from inside of the chroot.
You can log into this chroot “source:unstable-amd64-desktop” by:
$ sudo schroot -c source:unstable-amd64-desktop
The git-buildpackage package offers the gbp(1) command. Its user configuration file is ~/.gbp.conf.
# Configuration file for "gbp <command>" [DEFAULT] # the default build command: builder = sbuild # use pristine-tar: pristine-tar = True # Use color when on a terminal, alternatives: on/true, off/false or auto color = auto
Você deve configurar um proxy de cache HTTP local para poupar na largura de banda para o acesso ao repositório de pacotes Debian. Existem várias escolhas:
In order to use this HTTP proxy without manual configuration adjustment, it’s a good idea to install either auto-apt-proxy or squid-deb-proxy-client package to everywhere.
Você pode definir um repositório de pacotes Debian privado com o pacote reprepro.
For testing GUI application, it is a good idea to have virtual machines. Install virt-manager and qemu-kvm packages.
Use of chroot and virtual machines allows us not to update the whole host PC to the latest unstable suite.
In order to access virtual machines easily over the local network, setting up multicast DNS service discovery infrastructure by installing avahi-utils is a good idea.
Para todas as máquinas virtuais a correr e o PC anfitrião, nós podemos usar cada nome de máquina acrescentado com .local para o SSH para aceder a cada uma.
[6] Isto assume que você está a usar Bash como shell de login. Se você está a usar outra shell de login como a shell Z, use os seus ficheiros de configuração correspondentes em vez de ~/.bashrc.
[7] Be careful since some older HOWTOs may use different chroot setups.
[8] Simply “logout and login under some modern GUI Desktop environment” may not update your group membership.