hoogle
hoogle copied to clipboard
hoogle generate chokes on its own CHANGES.txt file
Sorry that the title sounds like a tabloid newspaper headline but I couldn't think of anything else!
If I run the following command
hoogle generate --database=default.hoo --local=~HOME/.cabal/store/ghc-8.8.3/hoogle-5.0.18-49c45236e55e64b13b4bc02e45c0a98f2ba025846800562043c89b44dfe8c287/share/doc/
hoogle fails with the following:
Starting generate
[1/2] CHANGES... 0.01shoogle: hseToItem failed, Add mode = embed support
CallStack (from HasCallStack):
error, called at src/Input/Haddock.hs:89:47 in hoogle-5.0.18-2ca429a1cd3458b1986ef981580c2f8fdf5c05edfd5cc1776345a6a9b450e5e4:Input.Haddock
This confused me at first because I thought I needed use "embed" mode but it turns out that if I remove the CHANGES.txt file from the directory it works properly. So after a bit of digging I narrowed it down to a single line in that file: line 269 (commit #4bd66888 which is the current master). The offending line is:
Add mode=embed support
I see on #355 you mention that the method you use to search for .txt
files is not very robust but do you have any thoughts about how best to handle this in the long term?
What does the doc
folder contain within it? Are CHANGES.txt and hoogle.txt at the same level of the directory hierarchy. I don't really use local generation of Hoogle databases, so don't have much opinion on what the right way to do it is - it needs someone to figure out the use case, and then make it work.
Yeah the CHANGES.txt
file is in share/doc/html
. I would argue, certainly in the short term, that CHANGES.txt
shouldn't be in share/doc/html
, it should be one level up with LICENSE
.
In the longer term can hoogle simply read the text file named after the package name. I've just checked every package installed on my machine and they all conform to that pattern though the number of packages on my machine is a small sample compared to every package on hackage.
This could also be addressed by changing the hard-fail on https://github.com/ndmitchell/hoogle/blob/master/src/Input/Haddock.hs#L89 to a log message. That may be the easiest fix.