Cabal and using a throw-away package database during distro package building

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

On 10-11-05 06:43 AM, Magnus Therning wrote:
runhaskell Setup register --gen-script runhaskell Setup unregister --gen-script
[...]
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.
Stealing from the scripts of Haskell Platform (source tarball): Don't use register --gen-script, use this instead: runhaskell Setup register --gen-pkg-config=NAME (You choose a suitable filename for NAME. If you omit =NAME, the default filename is "packagename-version.conf". Do play and customize.) Registration script is just: ghc-pkg update NAME or ghc-pkg register NAME (add options and full pathname of ghc-pkg as you see fit) Also don't bother with unregister --gen-script, the unregister script is just: ghc-pkg unregister packagename-version (add options and full pathname of ghc-pkg as you see fit) Haskell Platform build scripts are in exactly the same shoe as yours, i.e., dilemma between interdependent packages and containment. (It wants to register absolutely nothing if some packages fail to build.) You may like to look into it for inspirations. Except for how to unregister and uninstall. Who wants to get rid of Haskell Platform, haha!
participants (2)
-
Albert Y. C. Lai
-
Magnus Therning