[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ next ]
We should now be ready to build the package.
In order to properly make complete (re)build of a package, you have to ensure to install
the build-essential
package,
packages listed in the Build-Depends: field (see control
file, Section 4.1),
and
packages listed in the Build-Depends-indep: field (see control
file, Section 4.1).
Then you issue the following command in the source directory:
$ dpkg-buildpackage
This will do everything to make full binary and source packages for you. It will:
clean the source tree ("debian/rules clean")
build the source package ("dpkg-source -b")
build the program ("debian/rules build")
build binary packages ("fakeroot debian/rules binary")
sign the source .dsc
file, using gpg
create and sign the upload .changes
file, using
dpkg-genchanges
and gpg
The only input that will be required of you is your GPG secret pass phrase, twice.
After all this is done, you will see the following files in the directory above
(~/gentoo
):
gentoo_0.9.12.orig.tar.gz
This is the original source code tarball, merely renamed to the above so that it adheres to the Debian standard. Note that this was created initially by the "dh_make -f ../gentoo-0.9.12.tar.gz".
gentoo_0.9.12-1.dsc
This is a summary of the contents of the source code. The file is generated
from your control
file, and is used when unpacking the source with
dpkg-source(1)
. This file is GPG signed, so that people can be
sure that it's really yours.
gentoo_0.9.12-1.debian.tar.gz
This compressed tarball contains your debian
directory contents.
Each and every addition you made to the original source code are stored as
quilt patches in debian/patches
.
If someone else wants to re-create your package from scratch, they can easily do so using the above three files. The extraction procedure is trivial: just copy the three files somewhere else and run "dpkg-source -x gentoo_0.9.12-1.dsc". [40]
gentoo_0.9.12-1_i386.deb
This is your completed binary package. You can use dpkg
to
install and remove this just like any other package.
gentoo_0.9.12-1_i386.changes
This file describes all the changes made in the current package revision, and
it is used by the Debian FTP archive maintenance programs to install the binary
and source packages in it. It is partly generated from the
changelog
file and the .dsc
file. This file is GPG
signed, so that people can be sure that it's really yours.
As you keep working on the package, behavior will change and new features will
be added. People downloading your package can look at this file and quickly
see what has changed. Debian archive maintenance programs will also post the
contents of this file to the debian-devel-announce@lists.debian.org
mailing list.
The long strings of numbers in the .dsc
and .changes
files are MD5/SHA1/SHA256 checksums for the files mentioned. A person
downloading your files can test them with md5sum(1)
,
sha1sum(1)
, or sha256sum(1)
and if the numbers don't
match, they'll know the file is corrupt or has been tampered with.
Debian supports many ports
with the autobuilder network
running buildd
daemons on many different architecture computers.
Although you do not need to do this by yourself, you should be aware of what
will happen on your packages. Let's look into roughly how your packages are
rebuild for many different architectures by them. [41]
For "Architecture: any" packages, the autobuilder system rebuild them. It ensures to install
the build-essential
package, and
packages listed in the Build-Depends: field (see control
file, Section 4.1).
Then it issues the following command in the source directory:
$ dpkg-buildpackage -B
This will do everything to make architecture dependent binary packages on another architecture. It will:
clean the source tree ("debian/rules clean")
build the program ("debian/rules build")
build architecture dependent binary packages ("fakeroot debian/rules binary-arch")
sign the source .dsc
file, using gpg
create and sign the upload .changes
file, using
dpkg-genchanges
and gpg
This is why you see your package for other architectures.
Although packages listed in the Build-Depends-indep: field are
required to be installed for the normal packaging by us (see Complete (re)build, Section 6.1), they are not
required to be installed for the autobuilder system since it build only
architecture dependent binary packages. [42] This difference between normal packaging and autobuilder
situation dictates whether you record such required packages in the
Build-Depends: or Build-Depends-indep: fields of the
debian/control
file (see control
file, Section 4.1).
orig.tar.gz
for upload
When you first upload the package to the archive, you need to include the
original orig.tar.gz
source. If the last changelog entry is not
the first one for the given upstream version, you must provide
dpkg-buildpackage
command with the "-sa"
option. On the other hand, the "-sd" option will force
to exclude the original orig.tar.gz
source.
debuild
command
You can automate package build process of the dpkg-buildpackage
command further with the debuild
command. See
debuild(1)
.
Customization of the debuild
command can be done through
/etc/devscripts.conf
or ~/.devscripts
. I would
suggest at least following items:
DEBSIGN_KEYID="Your_GPG_keyID" DEBUILD_LINTIAN=yes DEBUILD_LINTIAN_OPTS="-i -I --show-overrides"
With these, packages are signed by your specified GPG key ID (good for
sponsoring packages) and checked by the lintian
command in
details.
Cleaning source and rebuilding package from a user account is as simple as:
$ debuild
Please note that the dpkg-buildpackage
option
"-sa" to include the original orig.tar.gz
source can be specified as:
$ debuild -sa
You can clean source tree as simple as:
$ debuild clean
pbuilder
package
For a clean room (chroot
) build environment to verify the build
dependencies, the pbuilder
package is very useful. [43] This ensures a clean build
from the source under the sid auto-builder for different
architectures and avoids the severity serious FTBFS (Fails To Build From
Source) bug which is always in the RC (release critical) category. See
http://buildd.debian.org/
for more on the Debian package auto-builder.
Let's customize the pbuilder
package by the following.
setting /var/cache/pbuilder/result
directory writable by the user.
creating a directory, e.g. /var/cache/pbuilder/hooks
,
writable by the user to place hook scripts.
setting ~/.pbuilderrc
or /etc/pbuilderrc
to include
as follows.
AUTO_DEBSIGN=yes HOOKDIR="/var/cache/pbuilder/hooks"
This will allow you to sign generated packages with your secret GPG key in the
~/.gnupg/
directory.
Let's then initialize the local pbuilder
chroot
system first as follows.
$ sudo pbuilder create
If you already have the completed source packages, issue the following commands
in the directory where the foo.orig.tar.gz
,
foo.debian.tar.gz
, and foo.dsc
files exist to update the local pbuilder
chroot
system and to build binary packages in it.
$ sudo pbuilder --update $ sudo pbuilder --build foo.dsc
Please note that the dpkg-buildpackage
option
"-sa" to include the original orig.tar.gz
source can be specified as:
$ sudo pbuilder --build --debbuildopts "-sa" foo.dsc
The newly built packages will be located in
/var/cache/pbuilder/result/
with non-root ownership.
If you already have the updated source tree without generating the matching
source packages, issue the following commands in the source directory where the
debian
directory exists, instead.
$ sudo pbuilder --update $ pdebuild
Please note that the dpkg-buildpackage
option
"-sa" to include the original orig.tar.gz
source can be specified as:
$ pdebuild --debbuildopts "-sa"
You can log into its chroot
environment with the
"pbuilder --login --save-after-login" command and
configure it as you wish. This environment can be saved by leaving its shell
prompt with ^D (Control-D).
The latest version of the lintian
command can be executed in the
chroot environment using the hook script configured as follows.
[44]
$ cat > /var/cache/pbuilder/hooks/B90lintian <<EOF #!/bin/sh set -e install_packages() { apt-get -y --force-yes install "$@" } install_packages lintian echo "+++ lintian output +++" su -c "lintian -i -I --show-overrides /tmp/buildd/*.changes" - pbuilder # use this version if you don't want lintian to fail the build #su -c "lintian -i -I --show-overrides /tmp/buildd/*.changes; :" - pbuilder echo "+++ end of lintian output +++" EOF
You need to have access to the latest sid environment to build
packages properly for sid. In reality, sid may be
experiencing issues which makes it not desirable for you to migrate your whole
system. The pbuilder
package can help you to cope with this kind
of situation.
You may need to update your stable packages after their release
for stable-proposed-updates, stable/updates, etc.
[45] For such occasions,
"I am running sid system" is not good enough excuse not
to update them promptly. The pbuilder
package can help you to
access environments of almost any Debian derivative distributions of the same
CPU architecture.
See http://www.netfort.gr.jp/~dancer/software/pbuilder.html
,
pdebuild(1)
, pbuilderrc(5)
, and
pbuilder(8)
.
git-buildpackage
command and similars
If your upstream uses the source code management system (VCS
)
to maintain their code, you should consider to use them. That makes merging
and cherry-picking upstream patches much easier. There are several specialized
wrapper script packages for the Debian package building for each VCS.
git-buildpackage
: Suite to help with Debian packages in Git
repositories.
topgit
: a Git patch queue manager
svn-buildpackage
: helper programs to maintain Debian packages with
Subversion.
cvs-buildpackage
: A set of Debian package scripts for CVS source
trees.
These packages offer more elegant working environment than manual use of the
quilt
commands for advanced audiences to automate
building of packages. I will not explain them in this tutorial. [46]
With a large package, you may not want to rebuild from scratch every time while
you tune details in debian/rules
. For testing purposes, you can
make a .deb
file without rebuilding the upstream sources like this
[47]:
$ fakeroot debian/rules binary
Or, simply as following to see if it build or not.
$ fakeroot debian/rules build
Once you are finished with your tuning, remember to rebuild following the
proper procedure. You may not be able to upload correctly if you try to upload
.deb
files built this way.
[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ next ]
Debian New Maintainers' Guide
version 1.2.19, 2010-05-31 13:48:35 UTCjoy-mg@debian.org