[Haskell-cafe] Cabal and using a throw-away package database during distro package building

Magnus Therning magnus at therning.org
Fri Nov 5 06:43:10 EDT 2010


Recently I experimented a little with putting several Hackage packages
into a single Linux distro package, but I ran into a slight problem
with registering Haskell packages temporarily.

These are the basic steps taken to configure, compile, and stage a
Haskell package in ArchLinux:

    runhaskell Setup configure --prefix=/usr --docdir=/usr/share/doc/${pkgname}
    runhaskell Setup build
    runhaskell Setup haddock
    runhaskell Setup register   --gen-script
    runhaskell Setup unregister --gen-script
    runhaskell Setup copy --destdir=${pkgdir}

This works fine for a single Hackage package, but if I want to compile
two or more of them into a single distro package, and there are
dependencies between them, then it won't do.  I also don't want to
fully install and/or register the Hackage packages during the build
for obvious reasons of containment and system contamination.  So,
looking at the Cabal help I found the --package-db flag for configure.
 The steps now become:

    runhaskell Setup configure --prefix=/usr
--docdir=/usr/share/doc/${pkgname} --package-db=my-temp-db
    runhaskell Setup build
    runhaskell Setup haddock
    runhaskell Setup register --inplace
    runhaskell Setup register   --gen-script
    runhaskell Setup unregister --gen-script
    runhaskell Setup copy --destdir=${pkgdir}

That works and I can satisfy dependencies between the Hackage
packages, without affecting the system-wide database.  Great.  Except
that the generated register/unregister scripts now also point to
my-temp-db, and there seems to be no way to prevent this.  I solved it
for now by using sed, but I'd love to leave sed out, if at all
possible.

So, have I missed something, or is this a use case that wasn't
considered when developing Cabal?
Would it be worth raising a bug for this at all?

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


More information about the Haskell-Cafe mailing list