knuthaugen

Howto: cpan packages to deb-packages

Author: knut (a) knuthaugen dot no, copyright 2004.
Legalese: Please read the copyright and the disclaimer wich apply to this document

Suppose you want to make a Debian package of the module Foo::Bar version 1.23, the recipe is something like this:

  1. Download the package from CPAN. Go for the latest stable release.
  2. Run
    tar xzf Foo-Bar-1.23.tar.gz
    mv Foo-Bar-1.23.tar.gz libfoo-bar-perl_1.23.orig.tar.gz
    cd Foo-Bar-1.23
    dh-make-perl
        
    This last command creates a directory named debian which contains some useful skeleton files and saves you a lot of trouble..
  3. The you're up for some editing of the debian special files:

    • debian/README.Debian: Move the contents to the start of debian/copyright
    • debian/copyright: Make sure that "upstream author" and copyright looks ok and remove the part about auto generation.
    • debian/rules:
      - remove stuff like "# Add here commands to ...", #Build architecture-(in)dependent files here".
      - Move the build rules from binary-arch to binary-indep.
      - Remove unnecessary and commented dh_* calls.
    • debian/control: Change Build-Depends to Build-Depends-Indep and add any dependencies which isn't detected by dh_perl (build once to see what it detects).
    • debian/changelog: Remove the "Local variables thing at the end.

The actual building is done by invoking "debbuild" or "dpkg-buildpackage -rfakeroot".

Updating the package

Whe you want to update the source in the package, i.e. when the cpan package maintainer has released a new version, you download the new source archive and follow the procedure abow. But take a backup of the debian directory first!. Then, after dh-make-perl has done it's job, replace the fresh debian/ files with your old copy, thus saving changelog and saving you the trouble of doing the cleanup all over again. Laziness is a virtue.

Copyright © Knut Haugen 2004-05-12, last updated 2004-07-12, valid xhtml 1.0 strict