Cabal bugs

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Mar 4 20:59:15 EST 2008


On Tue, 2008-03-04 at 14:35 +0000, Neil Mitchell wrote:
> Hi,
> 
> Using cabal and cabal-install from yesterday:
> 
> D:\sources\contrib\google-chart>cabal install --hugs
> cabal: user error (Pattern match failure in do expression at Hackage/Install.hs:
> 99:6-19)
> 
> D:\sources\contrib\google-chart>runhaskell Setup configure --hugs
> Configuring GoogleChart-0.2...
> Setup: The following installed packages are broken because other packages
> they depend on are missing. These broken packages must be rebuilt
> before they can be used.
> 
> Two separate errors, one in cabal, one in cabal-install. The cabal
> error should at least tell me which packages are missing.

Both errors are a consequence of the fact that we do not know what
packages are installed for hugs. It is printing all the packages that it
thinks are missing, that is... none. That's because we do not know of
any installed packages at all. It comes from this quirk of
PackageIndex.dependencyClosure:
-- * Note that if any of the result is @Right []@ it is because at
-- least one of the original given 'PackageIdentifier's do not occur
-- in the index.
It should probably deal with that case better, but the reason it happens
is because all of the packages that the current package depends on are
not installed (at least as far as cabal knows).

So that second error simply needs to be fixed because the Cabal lib has
previously worked with implementations that do not track installed
packages. The sensible fix is probably just to skip the check entirely
for hugs and other implementations where we do not know the installed
packages.

The first error is basically unfixable unless we get code to enumerate
the installed packages for hugs. It's not really possible for a package
manager to limp along without knowing what packages are already
installed.

So it should be possible already to get some minimal information for the
names of hugs packages by looking in /usr/lib/hugs/packages/ or the
equivalent on other OSs. Unfortunately that does not give us versions. I
don't know of any portable way to discover where hugs keeps its packages
directory. We know where cabal would install packages for hugs but
that's not necessarily the same thing.

For a future hugs release it would be enormously helpful if it would
include the InstalledPackageInfo files for all the bundled packages and
if there was a way of discovering what directory to look in to find
these packages. Then we could build a proper index of the installed
packages as we do for ghc. Also we need a hugs --version flag so Cabal
can actually figure out the hugs version so it knows whether it supports
an installed package database. Currently hugs is almost unversioned
(check System.Info.compilerVersion).

So yes, it'd be great if Cabal could work better with hugs but we'll
need some help from hugs.

Duncan



More information about the cabal-devel mailing list