hasLibs and hasExes honest reporting?

Thomas Schilling nominolo at googlemail.com
Wed Apr 30 19:24:24 EDT 2008

On 1 maj 2008, at 00.30, Duncan Coutts wrote:
> If we look in xmonad.cabal we see:
> library
>     exposed-modules:    XMonad
>                         XMonad.Main
> [...snip...]
>     if flag(testing)
>         buildable: False
> So when the testing flag is True, the library will not be  
> buildable. The
> hasLibs function actually only tells you about buildable libraries  
> (the
> same goes for hasExes).
> If you use flattenPackageDescription on this description you will  
> get a
> PackageDescription whith buildable: False because flattening  
> ignores all
> conditions and includes *both* sides of conditionals.

The key part here is that 'flattenPackageDescription' (more precisely  
'unionBuildInfo' uses '&&' to join multiple occurences of buildable.   
If at any time a branch claims the package is not buildable, we, of  
course, want this property to be propagated.  Using a '||' only for  
within flattenPackageDescription doesn't seem like a good idea to me.

> So what you want is finalizePackageDescription to get a
> PackageDescription that reflects how the package can actually be
> configured given the environment in which you expect to use it.
> I discussed this point with Brian O'Sullivan on irc the other day.
> One API improvement we should do is to make hasLibs and similar
> functions take a parameter to say if you want to include or exclude
> buildable components since the choice is important and we've had a
> couple bugs in cabal because of this issue (for example bugs like not
> including non-buildable components in the source tarball).
> Duncan
> _______________________________________________
> cabal-devel mailing list
> cabal-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/cabal-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/cabal-devel/attachments/20080501/394a5a76/PGP.bin

More information about the cabal-devel mailing list