registering packages in ghc using a directory of package files

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon Mar 13 08:32:41 EST 2006


On Mon, 2006-03-13 at 13:17 +0000, Simon Marlow wrote:
> Duncan Coutts wrote:
> 
> > Attached is the current patch I'm testing.
> 
> I think I've said in the past that in principle I like the idea.  I'll 
> commit your patch.

Great.

> In terms of making this a feature we advertise in the documentation, I 
> think we could tweak the details a bit.

Sure.

> I had in mind allowing -package-conf to specify either a directory or
> a file, with the obvious interpretation.

I think that's how I did a version of this patch a year or so ago.

> Also, with your patch, each file in package.conf.d contains a list of 
> packages.

Yes.

> Having just a single package per file seems cleaner,

Yes it does.

> unless you have a good reason to want the possibility for multiples.
> I realise this means wider-ranging changes.

It was just that this was the simplest change that reused as much code
as possible. Coincidentally it is also how we keep the per-package .conf
files in gentoo, ie they're installed package.conf databases rather than
indivdual package files. There are reasons we did that in gentoo but
they're not essential. For ghc I'd recommend a dir of individual package
files.

The other problem with my patch is that each .conf file that is loaded
up is it's own package db so ghc-pkg reports:

/usr/lib64/ghc-6.4.1/package.conf.d/hsql-postgresql-1.7.conf:
    hsql-postgresql-1.7
/usr/lib64/ghc-6.4.1/package.conf.d/hsql-sqlite-1.7.conf:
    hsql-sqlite3-1.1
/usr/lib64/ghc-6.4.1/package.conf:
    rts-1.0, base-1.0, haskell98-1.0, template-haskell-1.0, unix-1.0,
    parsec-1.0, haskell-src-1.0, network-1.0, QuickCheck-1.0,
    HUnit-1.1, mtl-1.0, fgl-5.2, stm-1.0, readline-1.0, (lang-1.0),
    (concurrent-1.0), (posix-1.0), (util-1.0), (data-1.0), (text-1.0),
    (net-1.0), (hssource-1.0)

But this is just because I was taking a very simple approach in my
patch.

It would obviously be better to consider a single directory of
individual package files to be one package database. That will of course
need more code changes.

Then to do this fully there would need to be further changes to use a
dir as ghc's main package db rather than the current file, and to get
ghc-pkg to understand directory package dbs so it could register
packages in them.

Duncan



More information about the Libraries mailing list