Skip to content

feature for checking files in temp location

ghc-pkg register can do sanity checks on files being in the right place. These are a useful sanity check. The checks can also be disabled with the --force-files flag.

When installing package files and registering we can either install files and then register or the reverse. The reverse style can be helpful in simplifying the locking system that allows concurrent package installation and use.

In particular, new versions of cabal will

  1. prepare all package files in a temporary directory;
  2. register with ghc-pkg; and
  3. use an atomic directory rename to move the package files to their final location

This procedure simplifies the locking considerably by not requiring any locks between concurrent package readers and writers, just requiring locks between concurrent writers.

Step 2 above requires that we be able to register when the files are not yet in their final location. This can be done with the --force-files flag, but we lose out on the useful sanity checks.

So this feature request is for a flag that lets us say "do please do the file checks, but instead of looking for files in their final locations, look for them here".

Since file paths in the package registration info are usually absolute paths, then the specification of where to look for files would need to be done in terms of changing a prefix.

For example, a registration file may contain:

import-dirs: /home/me/.cabal/store/uniplate-1.6.12-3K1HlYoxKOQ3XlQlOoSFWj

And this is used to check for the .hi files for all the modules. But in the above scenario the files will actually all be in /home/me/.cabal/store/**incoming**/uniplate-1.6.12-3K1HlYoxKOQ3XlQlOoSFWj so we will want to say something like:

ghc-pkg register uniplate.conf \
   --file-root=/home/me/.cabal/store/=/home/me/.cabal/store/incoming/

or another example of a slightly different use case would be

ghc-pkg register uniplate.conf \
   --file-root=/=$PWD/image/

this is for the case of --prefix=/usr/local and make install DESTDIR=$PWD/image

Trac metadata
Trac field Value
Version 8.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component ghc-pkg
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information