Debian Packaging - Introduction
Esteban Manchado Velázquez <emanchado@demiurgo.org>
Roadmap
- This introduction (concepts, basic tools)
- Packaging a simple app
- Backporting packages from other distributions
- Related tools (SVN-, Perl- and Python-related, and equivs)
What is packaging?
- Integrating some software into a larger system
- Also turning tarball into easy-to-install .deb package
- The software you package is called upstream
- Packaging may involve changing upstream code!
- You also have native packages (without upstream)
- Source package -> binary package(s)
On versions (small digression)
- When you package some software, you package a version of it
- It might sound trivial, but it's important
- Use software versions and tag in your VCS
- For unreleased software, dates as versions: foo-snapshot_20081106
Types of packages: standard (non-native)
- Concept: Upstream tarball + packaging changes (debian/)
- Three files:
- Upstream tarball (pristine!): .orig.tar.gz
- Packaging changes: .diff.gz
- Description: .dsc
- Package versions look like 1.2.5-4
- 1.2.5 is the upstream version (memcached_1.2.5.orig.tar.gz)
- 4 is the package revision (memcached-patched_1.2.5-4_amd64.deb)
- When upgrading upstream, next is 1.2.6-1, not
1.2.6-5
Types of packages: native packages
- Used for software specific for Debian
- Just a tarball and the .dsc file
- Packaging files are still under debian/
- Package versions are something like 1.2.5 (or 12 or
whatever)
- Point being, no dashes!
- It's the version that defines if a source package is native or not
- Don't change the type of a package!
Some interesting packaging files
- debian/control - general metadata
- debian/rules - Makefile to create the binary package(s)
- debian/changelog - description of changes (important for versions!)
- debian/copyright - copyright information (ignore for internal packages)
- debian/README.Debian - package notes
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
- *.deb - the binary packages ready to install with dpkg or upload to some repo
- *.build - log of the compilation process
- *.changes - describes the package revision, with checksums and digital signatures
- *.diff.gz - compressed patch between upstream and final source package (ideally just debian/ directory)
- *.dsc - similar to *.changes, but shorter
The "source package" is actually
three files:
*.orig.tar.gz,
*.diff.gz and
*.dsc.