On maintaining Haskell packages for a Linux distro
- Magnus Therning
When trying to maintain set of binary packages of Haskell libraries for a Linux distribution there are a few issues that come up:
- The set of packages must be compilable at all times, and
- Updating one package requires all packages that depend on it, in one or more steps, to be re-compiled.
The first requires keeping track of all dependencies of the packages in the set and making sure that they are satisfiable at all times. For a while I was doing this by simple attempting to compile all updated packages and check for breakages. Which was both time-consuming and a painful when build-failures had to be resolved.
The second requires bumping the package release number for all packages that are reachable when following the dependencies in the reverse direction. Doing this manually is tedious and very error prone in my experience.
Of course it ought to be possible to make this a lot easier with the help of a tool. The last few days I’ve been writing such a tool. This is how I’ve been using it so far.
Building the initial database
GHC in ArchLinux ships with a few Haskell libraries and ArchLinux also has a few Haskell packages in its base repositories. Since I don’t need to maintain any of those packages I decided to treat these as a sort of base. Adding those is as simple as this:
% head base-pkgs
base,4.2.0.2
array,0.3.0.1
bytestring,0.9.1.7
Cabal,1.8.0.6
containers,0.3.0.0
directory,1.0.1.1
extensible-exceptions,0.1.1.1
filepath,1.1.0.4
haskell98,1.0.1.1
hpc,0.5.0.5
% cblrepo addbasepkg $(cat base-pkgs)
Success
Then I need to add the packages of the binary repo provided by ArchHaskell. I wrote a little script that extracts the package name and version from the ArchHaskell HABS tree (get-ah-cabals
):
#! /bin/bash
habsdir=$1
for d in ${habsdir}/habs/*; do
. ${d}/PKGBUILD
case $_hkgname in
(datetime|haskell-platform)
;;
(*)
echo ${_hkgname},${pkgver}
;;
esac
done
echo http://hackage.haskell.org/platform/2010.2.0.0/haskell-platform.cabal
Since haskell-platform
isn’t on Hackage it requires special handling. The reason why datetime
is excluded is slightly different. It’s the only package that requires old base
(version <4
). GHC
in Arch does whip with both old and new base
so datetime
can be built, but cblrepo
can’t deal with two versions of the same package. This is a limitation, but I’m not sure it’s worth fixing it since base
is the only library that comes in two versions, and datetime
is the only package that hasn’t been updated to use new base
.
Knowing this it’s easy to add all the ArchHaskell packages to the database:
% cblrepo idxupdate
% cblrepo add $(get-ah-cabals path/to/habs)
Success
Attempting an update
Now it’s possible to attempt to attempt an update:
% cblrepo add neither,0.2.0
Failed to satisfy the following dependencies for neither:
monad-peel >=0.1 && <0.2
Adding neither 0.2.0 would break:
yesod : neither >=0.1.0 && <0.2
persistent : neither >=0.1 && <0.2
The way to read this is that there first of all is a missing dependency to satisfy for neither
itself, and second there are two packages, yesod
and persistent
, that wouldn’t be buildable if neither
were updated.
Now if it were possible to update neither
, what packages would require a bump?
% cblrepo bump neither
persistent
yesod