Anatomy of a Debian Package

Let’s look at the fictive debianized Foo::Bar at version 0.03.

General Package Name Conventions for Perl Modules

  • All package names are lower case.
  • Replace :: by - (dash), prepend lib and append -perl: module Foo::Bar becomes package libfoo-bar-perl
  • Exceptions for modules which are more application than library, e.g. App::Cleo is packaged as just cleo.
  • Package name, version number and architecture are delimited by _ (underscore; compared to dash as used for CPAN modules).
  • Upstream version (e.g. 0.03) and Debian revision (e.g. 1) are delimited by - (dash).

Binary Packages (.deb)

  • libfoo-bar-perl_0.03-1_all.deb (pure perl) or libfoo-bar-perl_0.03-1_$ARCH.deb (XS module), e.g. libfoo-bar-perl_0.03-1_amd64.deb on x86_64.
  • libfoo-bar-perl-dbgsym_0.03-1_$ARCH.deb (automatic debug symbols for XS module)

Debian Source Package

The "debian/" Directory: Most Important Files

  • debian/changelog: Packaging changelog, defines actual version of the package.
  • debian/control: Static source and binary package metadata.
  • debian/copyright: License declaration (machine-readable)
  • debian/rules: Makefile which defines what happens on package build. Nowadays only contains one default rule using dh aka debhelper plus what differs from the default.
    • You can run single Makefile targets like e.g. make -f debian/rules clean or—if the file is executable—like debian/rules clean.
  • debian/watch: Where to watch for new upstream releases.

dh-make-perl

Easy to Remember Short Forms for Quick Results

  • cpan2dsc Foo:Bar (also builds a Debian source package using dpkg-buildpackage -b)
  • cpan2deb Foo:Bar (also builds a Debian binary package using dpkg-buildpackage -S)

Dependency Resolution

  • Checks which dependencies are already packaged. (via apt-file search + corelist)
  • Checks for git repositories of the Debian Perl Group e.g. for WIP or to find packages available in Debian Unstable but not Debian Stable.

Helpful Tools and Packages: Package Building

Helpful Tools and Packages: Quality Assurrance

Demo: dh-make-perl and Friends

Bringing Your Debian Package Into Debian

Talk to the Debian Perl Group, e.g. on IRC. They are very helpful and always welcome new contributors.

The group already maintains over 3500 CPAN modules as Debian packages.

Links & Thanks

Thanks

  • Boris Däppen for the basci idea and for making me aware of cleo (many SPW ago :-)
  • gregor herrmann of the Debian Perl Team for a review of the slides and for fixing the dh-make-perl issue I found during writing these slides. :-)