Chroot

This was done by pbuilder, but is now done by sbuild.

# Setup tasks for sudo users:

# BUILD
# HOME directory in chroot, user:sbuild, 0770 perms, from
# passwd/group copying to chroot, filtered
# Maybe source 50sbuild, or move into common location.

Next, copy the example sbuildrc file to the home directory of each user and
set the variables for your system:

   cp /usr/share/doc/sbuild/examples/example.sbuildrc /home/svetlana/.sbuildrc

 Now try a build:

  cd /path/to/source
  sbuild-update -ud <distribution>
  (or "sbuild-apt <distribution> apt-get -f install"
       first if the chroot is broken)
  sbuild -d <distribution> <package>_<version>

Download source

The first step when packaging is to obtain the source code and debian metadata for the package. Normally this is done using apt-get source packagename but if a package is maintained in git then we use gbp commands (intro, also import (branch naming)). gbp clone clones the package (--pristine-tar tracks the pristine-tar branch but this is rarely needed).

Import upstream

The next step is importing the upstream. It is impotrted either from a release tarball using gbp import-orig command, (gbp import-orig --uscan imports the upstream as tarball using debian/watch file), or from git (if the upstream uses git; then pristine-tar still keeps a release tarball for Debian).

Apply Debian patches

Then the Debian patches need to be applied to make sure they still work for the new upstream release. Setting an environment variable via export QUILT_PATCHES=debian/patches is important when doing so; quilt defaults to patches and this does not work. quilt push one patch at a time, then fix or quilt refresh it. a howto; how to use.

Commit

Edit the changelog. dch -v 0.6.2-1 opens it in an editor.

Then if the package uses git we need to save our changes. Use git commit -a.

Build

To build the package, use gbp buildpackage, with -us -uc to disable signing.

After the package is ready, gbp buildpackage --git-tag creates a tag from debian/changelog.

Extra documentation