Ticket #5977 (closed feature request: fixed)
Allow ignoring global package db
| Reported by: | duncan | Owned by: | pcapriotti |
|---|---|---|---|
| Priority: | high | Milestone: | 7.6.1 |
| Component: | Compiler | Version: | 7.4.1 |
| Keywords: | Cc: | JeremyShaw | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
For sandboxing, users want to be able to use only local package dbs. To handle rts, base etc, they copy those specific packages from the global package db into a local package db.
Currently however there is no sensible way to tell ghc to look only at the listed package dbs, and not the global db. There is a flag -no-user-package-conf to avoid looking at the per-user one, but no equivalent to ignore or to specify the global one.
(Note: as a quirky non-sensible way, you can use GHC_PACKAGE_PATH="" to clear the package db stack, but this should be possible using command line flags.)
The user interface we're now using in cabal is like this:
- --global sets the initial db stack to [GlobalPackageDB]
- --user sets the initial db stack to [GlobalPackageDB, UserPackageDB]
- --package-db=clear clears the db stack to []
- --package-db=global pushes GlobalPackageDB on the top of the stack
- --package-db=user pushes UserPackageDB on the top of the stack
- --package-db=${otherfile} pushes SpecificPackageDB ${otherfile} on the top of the stack
It seems to me we could do something similar with ghc. Currently in ghc we have a -hide-all-packages flag that resets the package set to empty. We could do with an equivalent for the package database stack. I suggest something like:
- -clear-package-conf
- -global-package-conf
- -user-package-conf (and the existing -no-user-package-conf)
- -package-conf file
The default would remain that the global and user dbs are used, but this can be reset using -clear-package-conf.
Personally I prefer the nomenclarture "package db" rather than "package conf" here, but it's not that important.

