[Haskell-cafe] PRE-ANNOUNCE: cabal-debian (automatically debianize cabal packages)

Jeremy Shaw jeremy at n-heptane.com
Tue Aug 19 17:28:36 EDT 2008

At Tue, 19 Aug 2008 14:06:23 +0100,
Ian Lynagh wrote:

> > Any reason the manual steps here aren't automated?
> There's not much benefit from automating them (although if someone did
> so, with a nice way to edit the description etc, then it would be
> handy). The vast majority of the time in creating Debian packages is:

We (at seereason) have a tool, cabal-debian, for automating the
process. It has the following features:

 1. automatically generates a working debian directory from the .cabal
 file with no user intervention (most of the time). It copies as much
 information from the .cabal file to the debian directory as possible.

 2. automatically calculates build-depends during initial (or
 subsequent) debianization

 3. checks that .cabal build-depends and debian build-depends are
 in-sync during dpkg-buildpackage run.

 4. automatically calculates install dependencies of binary .debs
 during dpkg-buildpackage run. (by writing substvar files and
 using ${haskell:Depends} in debian/control).

 5. can be used to create new debian/control and debian/changelog for
 an already debianized package. (Useful when information copied from
 the .cabal file changes in the .cabal file).

As you state, most generated packages would need additional polish
before they could be uploaded to Debian.

The Future

cabal-debian seems good enough for general release. I can imagine
cabal-debian being used in three ways:

 1. a way for users to quickly debianize a cabal library for local use
 (because going around the debian package system often leads to pain
 in the long run).

 2. a way for debian/ubuntu developers to create a starting point for
 a real Debian package.

 3. a way to standardize on policy issues, by encapsulating them in a
 tool which "Does It Right".

 4. a way to create an unofficial Haskell repository with lots of

In my opinion, cabal-debian is quite suitable for (1) already. (2) and
(3) require agreement from the Haskell Debian community as to what the
best practices really are, and patches to make that happen.

cabal-debian currently uses:

 - haskell-devscripts
 - the cdbs extension for supporting haskell (the one posted on
   debian-haskell mailing list a while ago)
 - haskell-utils

The basic build is done using the cdbs extension for Haskell (which
uses haskell-devscripts). But the version dependencies are updated
during the build process using a script from haskell-utils.

For (4), it should be pretty easy to use cabal-debian plus this


to easily create a repository of debian packages that not quite up to
debian standards. Whether you would *want* such a thing is obviously
an issue for debate: quantity vs quality. But the technology already
exists if the desire is there.

What's Next?

We are working on getting cabal-debian uploaded to hackage, but we
have some patches against haskell-devscripts, and a patch against

The patch against haskell-utils has not been accepted, and may
possibly be rejected due to some issue with the way Debian's
autobuilders work?

It does not make much sense to upload cabal-debian to hackage until
the supporting tools are up-to-date. So I guess we need to get our
patches accepted upstream. (modifying them if needed).

We have also started a tool that is essentially cabal-install +
cabal-debian. It has the same purpose as cabal-install, but it
debianizes the packages on-the-fly. 

How You Can Help

We, (at seereason), make no claims that cabal-debian does anything the
right way, the best way, or even a sensible way.

Our primary requirements are:

 1. that cabal-debian generates sane debianization with minimal pain

 2. that the generated debian packages can be built by our
 autobuilder. This essentially means that you should be able to build
 them in three steps:

    i. check out the source
    ii. install the build-depends listed in debian/control
    iii. run dpkg-buildpackage

 I believe this is slight issue with haskell-utils based packages
 which have a procedure more like:

  i. check out the source
  ii. run update-haskell-control 
  iii. install build-dependencies
  iv. run dpkg-buildpackage

 If update-haskell-control generated >= build-depends instead of =
 build-depends, then things would work ok with our autobuilder, but
 possibly not with Debian's?.

Anyway, the point is, we are wide open to suggestions and improvements
to cabal-debian. In fact, nothing would make us happier than someone
coming along and taking over the whole thing ;)


cabal-debian can be obtained (via darcs get) here:


but you will need other dependencies from here:


and you will need a patch to haskell-devscripts from here:


and haskell-utils from here:



Here is an example debian directory generated by cabal-debian (which
no manual modifications or intervention, AFAIK):


You would need the patched haskell-devscripts/haskell-utils and
possibly cabal-debian to actually build it though.


More information about the Haskell-Cafe mailing list