Allow ignoring global package db
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
pushesGlobalPackageDB
on the top of the stack -
--package-db=user
pushesUserPackageDB
on the top of the stack -
--package-db=
${otherfile} pushesSpecificPackageDB
${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.
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |