registering packages in ghc using a directory of package files

All, Yet again I've got annoyed by the difficulties with the way ghc registers packages. It's hard to get right. This time I had someone testing hdbc-odbc for me on ppc64. He uninstalled ghc and reinstalled it (to pick up a fix I had made) then he found that building hdbc-odbc failed because the hdbc package was not registered. However portage (the Gentoo package management facility) knew that it was installed. Of course what happened is that when ghc was reinstalled all the ghc packages that were already installed were not re-registered. Actually that is my fault because our ghc ebuild is supposed to do this. (Technically to do this correctly we should re-register the packages in dependency order, but we don't and just use --force) The point is that there are several bits that the packaging system has to get right for this to all work. The majority of the code in our ghc-package.eclass is for dealing with this issue. If we could just have ghc use a directory of package files rather than registering via modifying one central file then this would all become much simpler and more robust. One concern is that it would remove a point where the package database can be checked for consistency. I don't think this is necessarily so. The place that this QA check is really important is when users are manually installing packages. If an package management system finds a QA problem at registration time then it's already an unrecoverable bug. So the ghc-pkg could continue to be used in the way it is now, it will do it's carious checks and then install a file into a global package.conf.d directory rather than modifying a global package.conf file. For distro packaging systems we could use "ghc-pkg --check" or something, and then the package system would take responsibility for actually installing the file (and removing it when the package is uninstalled/upgraded). I'm somewhat tempted to patch our current ghc to do this, it might be easier to get that working than to get our current hacks to work properly. Duncan

On Sun, 2006-03-12 at 21:41 +0000, Duncan Coutts wrote:
I'm somewhat tempted to patch our current ghc to do this, it might be easier to get that working than to get our current hacks to work properly.
Attached is the current patch I'm testing. It's pretty minimal. It doesn't convert everything over to use a directory of .conf files. It just makes ghc and ghc-pkg look for package.conf.d/*.conf in addition to the normal package.conf. So in fact ghc-pkg still registers by modifying the global package.conf file. It's just that this allows us to register without using ghc-pkg at all and directly dropping a file into the right directory. In fact in Gentoo we already have such a directory. We keep a .conf file per package anyway since we need these to be able to re-register packages if ghc is reinstalled. So I've tested it by just symlinking: /usr/lib/ghc-6.4.1/package.conf.d -> /usr/lib/ghc-6.4.1/gentoo/ So far this seems to work. ghc-pkg reports all the installed packages and ghci can still load them up. Duncan

Duncan Coutts
On Sun, 2006-03-12 at 21:41 +0000, Duncan Coutts wrote:
I'm somewhat tempted to patch our current ghc to do this, it might be easier to get that working than to get our current hacks to work properly.
Attached is the current patch I'm testing.
It's pretty minimal. It doesn't convert everything over to use a directory of .conf files. It just makes ghc and ghc-pkg look for package.conf.d/*.conf in addition to the normal package.conf.
So in fact ghc-pkg still registers by modifying the global package.conf file. It's just that this allows us to register without using ghc-pkg at all and directly dropping a file into the right directory.
I really like this idea. I've had a variety of package registration difficulties in the past, sometimes requiring hand editing of the ghc-pkg data. A directory holding per-package .conf files would be much easier to navigate and examine. -- I've tried to teach people autodidactism, | ScannedInAvian.com but it seems they always have to learn it for themselves.| Shae Matijs Erisson
participants (2)
-
Duncan Coutts
-
Shae Matijs Erisson