[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Using packages.conf.d for Haskell libraries

Reading the source can pay off.  I found this gem in

> getSystemPackageConfigs :: DynFlags -> IO [FilePath]
> getSystemPackageConfigs dflags = do
>         -- System one always comes first
>    let system_pkgconf = systemPackageConfig dflags
>         -- allow package.conf.d to contain a bunch of .conf files
>         -- containing package specifications.  This is an easier way
>         -- to maintain the package database on systems with a package
>         -- management system, or systems that don't want to run ghc-pkg
>         -- to register or unregister packages.  Undocumented feature for now.
>    let system_pkgconf_dir = system_pkgconf <.> "d"
>    system_pkgconf_dir_exists <- doesDirectoryExist system_pkgconf_dir
>    system_pkgconfs <-
>      if system_pkgconf_dir_exists
>        then do files <- getDirectoryContents system_pkgconf_dir
>                return [ system_pkgconf_dir </> file
>                       | file <- files
>                       , takeExtension file == ".conf" ]
>        else return []

I'd say that using that is much simpler than either calling ghc-pkg in
individual postinst/postrm or using triggers in the ghc6 package.
packages.conf.d is already supported by both ghc and ghc-pkg.

Also, I'd like to move packages.conf to /var/lib/ghc-$version/ in the
next version.  IMHO, it's more of a /var than a /usr thing.

I'd like to patch haskell-devscripts to install a
$cabalname-$version.conf file to /var/lib/ghc-6.10.2/packages.conf.d/
when uploading ghc 6.10.2.  Any comments on this?  Anyone seeing this
interfere with how people like to use ghc-pkg locally?

Reply to: