sensei icon indicating copy to clipboard operation
sensei copied to clipboard

`autospec` doesn't pick up new packages in the package database

Open soenkehahn opened this issue 9 years ago • 3 comments

If you install a new package into the used package database while autospec is running it doesn't pick up this new package. I guess this is because ghci has to be restarted to scan the package database anew.

I'm not sure how this could be solved or if it should be solved at all. Restarting autospec seems easy enough. It's just somewhat confusing if you're not aware of the behaviour.

Maybe autospec could monitor the package database through inotify.

soenkehahn avatar Apr 18 '15 07:04 soenkehahn

Do you think there is a reliable way to determine the used package database?

Sent from my iPhone

On 18 Apr 2015, at 3:54 pm, Sönke Hahn [email protected] wrote:

If you install a new package into the used package database while autospec is running it doesn't pick up this new package. I guess this is because ghci has to be restarted to scan the package database anew.

I'm not sure how this could be solved or if it should be solved at all. Restarting autospec seems easy enough. It's just somewhat confusing if you're not aware of the behaviour.

Maybe autospec could monitor the package database through inotify.

— Reply to this email directly or view it on GitHub.

sol avatar Apr 18 '15 08:04 sol

I don't know if there is a 100% reliable way. There is also the issue (as you mentioned offline) of packages installed by package managers. The thing is that it is not harmful to trigger restarts too often. So autospec could just look in the usual places for package databases, i.e. in sandboxes in the current directory and ~/.ghc.

soenkehahn avatar Apr 20 '15 12:04 soenkehahn

I think I found a way to do this:

https://github.com/liqd/thentos/commit/5b45a6e38db2fd2dbcc9de70d869fbb7b0163cdb

It is not pretty, but I think it works:

  1. remove the packages you want to watch from the package database
  2. add cabal Path_* modules as explained in http://neilmitchell.blogspot.de/2008/02/adding-data-files-using-cabal.html
  3. use -i to add source trees to the current package.

fisx avatar Oct 17 '15 14:10 fisx