[Hackage] #437: generalise the package db settings and flags

#437: generalise the package db settings and flags ----------------------------+----------------------------------------------- Reporter: duncan | Owner: Type: enhancement | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.2.3.0 Severity: normal | Keywords: Difficulty: normal | Ghcversion: 6.8.3 Platform: | ----------------------------+----------------------------------------------- Currently the user has just one knob to turn to select which package databases to use. This is not enough control. In general we can use a whole stack of package dbs to look for dependent packages and we can use at most one package db to register a package into. If we use a whole stack then it seems sensible that the destination package db be the top one. So we should generalise the setting from a single value to a list of package dbs. There are some constraints for example the global package db generally cannot be omitted and has to be first. Currently we have the flags `--global`, `--user` and `--package-db`. The global and user flags affect several settings. They select the default install prefix and which package db to use. The `--package-db` flag overrides the choice of package db. Of course the user and specific db choices are taken to be on top of the global db. It seems sensible to leave the user and global flags as kind of general policy flags that affect the defaults of other things in one convenient way. The `--global` flag in isolation would correspond to the db stack `[GlobalPackageDB]`. The `--user` flag would correspond to `[GlobalPackageDB, UserPackageDB]`, though perhaps only if the user does not specify any other specific dbs. So here's a proposal: * `--package-db=package.conf.local` appends that db to the stack * The special values `--package-db=$global` and `--package-db=$global` correspond to those package dbs. * The db stack is always taken to be prefixed with the global one. * If the db stack would be empty and the `--user` flag is used then the stack includes the user db. So it's absent if any `--package-db` flag is given and would have to be added explicitly using `--package-db=$user`. It may be useful to have a `--package-dbs` flag that sets several dbs in one go to use with `--package-dbs=$GHC_PACKAGE_PATH`. See #335. However note that ghc considers `$GHC_PACKAGE_PATH` in the search path style where an earlier path overrides later where as we typically have later flags override earlier ones. Examples: * `--global` == `[GlobalPackageDB]` * `--user` == `[GlobalPackageDB, UserPackageDB]` * `--user --package-db=foo` == `[GlobalPackageDB, SpecificPackageDB "foo"]` * `--user --package-db=$user --package-db=foo` == `[GlobalPackageDB, UserPackageDB, SpecificPackageDB "foo"]` If people find this confusing that `--package-db` automatically overrides `--user` then we would instead need a way of undoing the effect of `--user` so that people can get the stack `[GlobalPackageDB, SpecificPackageDB "foo"]` while in other respects doing using an ordinary per-user install. I should note that `--user --package-db=foo` currently does mean `[GlobalPackageDB, SpecificPackageDB "foo"]` and not `[GlobalPackageDB, UserPackageDB, SpecificPackageDB "foo"]` -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/437 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects
participants (1)
-
Hackage