ghc-pkg and -l

Simon Marlow simonmar at microsoft.com
Thu May 15 11:57:22 EDT 2003


 
> I just found out that the semantics of ghc-pkg has changed 
> between 5.04 and the recent HEAD:
> 
> ~/source/gtk2hs:$ ghc-pkg-5.04 -f
> /home/as49/source/gtk2hs/localpackage.conf -l
> defaultPackage
> 
> ~/source/gtk2hs:$ ghc-pkg-5.05 -f
> /home/as49/source/gtk2hs/localpackage.conf -l
> /home/as49/source/gtk2hs/localpackage.conf:
>     defaultPackage
> /home/as49/local/lib/ghc-5.05/package.conf:
>     rts, base, haskell98, network, haskell-src, readline, 
> OpenGL, GLUT,
>     unix, lang, concurrent, posix, util, data, text, net, hssource,
>     greencard

This is a side effect of ghc-pkg being rather more "correct" now, in the
sense that it treats all the packages files as a stack in which later
ones override earlier ones.  Previously it only considered a single
package file, which caused a number of problems (eg. dependencies which
crossed package-file boundaries weren't possible).

> This might be an improvement for the user but it is highly annoying in
> shell scripts. I used to grep for gtk2 which now matches the 
> file path.

Well, there are lots of ways to grep for a gtk2 package: 

  ghc-pkg -l | grep -v : | grep gtk 

is one.

> Furthermore I'd like to know if a certain package is installed in the
> given package file, so I don't really want to see what's globally
> available.
>
> If this verbosity is desired, could we have an -e flag which test if a
> certain package exists?

How about a -L flag which gives a list of packages in the given package
file?

Cheers,
	Simon



More information about the Glasgow-haskell-bugs mailing list