What is Debian packaging

A Debian package is a collection of files that allow for applications or libraries to be distributed via the Debian package management system. The aim of packaging is to allow the automation of installing, upgrading, configuring, and removing computer programs for Debian in a consistent manner. A Debian specific binary package is a .deb file used to install some software while a source package is .dsc file that can provide us with all of the necessary files to compile or otherwise, build the desired piece of software. The act of producing source packages (.dsc) and binary packages (.deb) usually from an upstream release tarball (.tar.gz) either manually or by using tools such as debmake and dpkg-buildpackage is called Debian packaging.

The main aim of this tutorial is to provide a basic overview of the whole packaging process without missing any important points rather than a detailed tutorial. For a detailed guide see Debian New Maintainer's Guide instead.

Structure of a source package

A source package not only contains the upstream source distribution and options for the Debian package build system but also lists of run-time dependencies and conflicting packages, a machine-readable description of copyright and license information, initial configurations, etc.

A source package in Debian consists of the following:

  1. The upstream (original software source) tarball .tar.gz ending.

  2. A tarball (usually with .debian.tar.gz or .debian.tar.xz ending), with any changes made to upstream source, plus all the files created for the Debian package.

  3. A description file with .dsc ending which has checksums (md5, sha etc) for the above 2 files.

Structure of a binary package

A binary package (.deb) in Debian consists of the following:

  1. debian-binary: version of the deb file format.

  2. control.tar.gz: metadata about the package.

  3. data.tar.gz: data files of the package.

Creating a basic source package

* debmake is broken currently (not yet fixed), use dh_make command from dh-make package instead run this following commands and this should run fine

apt install dh-make
cd <replace with unpacked directory>

dpkg-source -b .


cd ..
gbp import-dsc --pristine-tar <source_package>_<version>.dsc

git tag -d debian/<version>

dch -e

cme update dpkg-copyright

See also

This tutorial is based on the following guides: