HaLVM icon indicating copy to clipboard operation
HaLVM copied to clipboard

The output of `halvm-cabal sandbox hc-pkg list` does not include locally installed packages

Open ntc2 opened this issue 9 years ago • 2 comments

For example

$ halvm-cabal sandbox hc-pkg list | cat
/home/conathan/.stack/programs/x86_64-linux/ghc-7.8.4/lib/ghc-7.8.4/package.conf.d:
    Cabal-1.18.1.5
    array-0.5.0.0
    base-4.7.0.2
    bin-package-db-0.0.0.0
    binary-0.7.1.0
    rts-1.0
    bytestring-0.10.4.0
    containers-0.5.5.1
    deepseq-1.3.0.2
    directory-1.2.1.0
    filepath-1.3.0.2
    (ghc-7.8.4)
    ghc-prim-0.3.1.0
    haskeline-0.7.1.2
    (haskell2010-1.1.2.0)
    (haskell98-2.0.0.3)
    hoopl-3.10.0.1
    hpc-0.6.0.1
    integer-gmp-0.5.1.0
    old-locale-1.0.0.6
    old-time-1.1.0.2
    pretty-1.1.1.1
    process-1.2.0.0
    template-haskell-2.9.0.0
    terminfo-0.4.0.0
    time-1.4.2
    transformers-0.3.0.0
    unix-2.7.0.1
    xhtml-3000.2.1

/home/conathan/cc/cyber-chaff.git/.halvm-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d:
    (no packages)

whereas

$ ls /home/conathan/cc/cyber-chaff.git/.halvm-sandbox/x86_64-halvm-ghc-7.8.4-packages.conf.d
binary-0.8.0.0-1e93a8b7d4d7782296d47013aef3ced0.conf  bytestring-0.10.6.0-91a09239b0ef4609bfd1e180ec9a7479.conf  package.cache

Note that the empty local DB with "(no packages)" in the halvm-cabal sandbox hc-pkg list output is a linux DB, not a halvm DB. I.e., compare the the two paths:

/home/conathan/cc/cyber-chaff.git/.halvm-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d
/home/conathan/cc/cyber-chaff.git/.halvm-sandbox/x86_64-halvm-ghc-7.8.4-packages.conf.d

Not sure where the linux path came from, but hopefully the fix is as easy a replacing "linux" with "halvm" in some path generation code.

ntc2 avatar Jan 29 '16 23:01 ntc2

It appears that halvm-cabal sandbox hc-pkg unregister is also broken -- it can't unregister the local packages -- presumably due to the same path problem.

ntc2 avatar Jan 29 '16 23:01 ntc2

Hm, install and configure only work properly thanks to the --with-hc-pkg arg in cabal-install (https://github.com/GaloisInc/HaLVM/blob/master/src/scripts/halvm-cabal.in). You can't just add a case for sandbox, since cabal sandbox doesn't accept that option. (It probably should, but eh)

Might be easier to intercept the halvm-cabal sandbox hc-pkg call and send it to halvm-ghc-pkg with a custom --package-db

thumphries avatar Jan 31 '16 02:01 thumphries