Debian Packaging - Introduction
Esteban Manchado Velázquez <emanchado@demiurgo.org>

Roadmap

What is packaging?

On versions (small digression)

Types of packages: standard (non-native)

Types of packages: native packages

Some interesting packaging files

Sample debian/control

Source: memcached
Section: web
Priority: optional
Maintainer: Esteban Manchado Velázquez <estebanm@example.com>
Build-Depends: debhelper (>= 4.0.0), libevent-dev-patched (>= 1.4.0)
Standards-Version: 3.6.1.0

Package: memcached-patched
Architecture: any
Depends: ${shlibs:Depends}, perl
Conflicts: memcached
Replaces: memcached
Provides: memcached
Suggests: libcache-memcached-perl
Description: High-performance memory object caching system
 Danga Interactive developed memcached to enhance the speed of LiveJournal.com,
 yadda, yadda...
  
One Source section, one or more Package sections.

Sample debian/rules

Too long to show here, but...
[...]

build: build-stamp

build-stamp:  config.status
        dh_testdir
        $(MAKE)
        touch build-stamp

[...]

install: build
        dh_testdir
        dh_testroot
        dh_clean -k
        dh_installdirs

        # Add here commands to install the package into debian/memcached-patched
        $(MAKE) install DESTDIR=$(CURDIR)/debian/$(PACKAGE)

[...]
  
Long story short, you compile and install the software under debian/PACKAGENAME, like debian/memcached-patched/usr/bin/memcached and so on...

Sample debian/changelog

memcached (1.2.5-4) unstable; urgency=low

  * Add Replaces: memcached
  * Remake the package, using "proper" patches in debian/patches.

 -- Esteban Manchado Velázquez (Debian packaging) <estebanm@example.com>  Fri, 27 Jun 2008 09:58:47 +0000

memcached (1.2.5-3) unstable; urgency=low

  * Init script is now copied correctly

 -- Cosimo Streppone <cosimo@example.com>  Thu, 19 Jun 2008 14:26:00 +0200

[... More crap ...]
  
This file has a format! Use dch to edit it!

How to compile a package

/usr/src/String-Diff-0.03$ ls
blib         Changes  inc            lib       Makefile.PL  META.yml    README
build-stamp  debian   install-stamp  Makefile  MANIFEST     pm_to_blib  t

/usr/src/String-Diff-0.03$ egrep Source debian/control
Source: libstring-diff-perl

/usr/src/String-Diff-0.03$ egrep Package debian/control
Package: libstring-diff-perl

/usr/src/String-Diff-0.03$ ls ../libstring-diff-perl*
../libstring-diff-perl_0.03.orig.tar.gz

/usr/src/String-Diff-0.03$ debuild
[...lots of crap...]

/usr/src/String-Diff-0.03$ ls ../libstring-diff-perl*
../libstring-diff-perl_0.03-1_all.deb
../libstring-diff-perl_0.03-1_amd64.build
../libstring-diff-perl_0.03-1_amd64.changes
../libstring-diff-perl_0.03-1.diff.gz
../libstring-diff-perl_0.03-1.dsc
../libstring-diff-perl_0.03.orig.tar.gz
  
Several files created. Most important are *.deb and *.diff.gz.

Compilation results explained

The "source package" is actually three files: *.orig.tar.gz, *.diff.gz and *.dsc.

Links

Picture credits

Takk!

Takk. Spørsmål?