Cabal question: Generated data files

Hi, First off, this list seems a bit off-topic for a question about Cabal, but its what the web page told me to do: http://haskell.org/cabal/ - if this isn't the place for this email, could someone update the web page? The question is about generated data files, specifically for Hoogle. Hoogle generates search databases, which I want to be installed as read-only data, in datadir. For a release I want to bundle up these databases in the tarball, pregenerated. I don't want to include these databases in the darcs version (they are fairly specific to a particular version and regularly changing), but I do want people to be able to build the darcs version using cabal. To generate these databases requires a second Haskell program (included in the darcs repo), and an installed copy of the same version of Hoogle. So, I want to generate database files, which can only be done after install time, but which I then want to be installed. Is there any way to acheive this? Or some better idea? Currently I just generate the databases and have the .cabal file reference them, which means the darcs version can't be compiled with Cabal. Thanks Neil

Hi Neil,
Probably you've already considered this option but, How about a cabal
build-posthook
a) detects if the database-generating program is present (I asume it's
only present in the darcs version)
b) if present, generates the databases and puts them in the location
supplied in the cabal file.
I'm not aware though, if configure would complain about the databases
not being present at first instance.
On Wed, Aug 20, 2008 at 9:49 AM, Neil Mitchell
Hi,
First off, this list seems a bit off-topic for a question about Cabal, but its what the web page told me to do: http://haskell.org/cabal/ - if this isn't the place for this email, could someone update the web page?
The question is about generated data files, specifically for Hoogle.
Hoogle generates search databases, which I want to be installed as read-only data, in datadir. For a release I want to bundle up these databases in the tarball, pregenerated. I don't want to include these databases in the darcs version (they are fairly specific to a particular version and regularly changing), but I do want people to be able to build the darcs version using cabal. To generate these databases requires a second Haskell program (included in the darcs repo), and an installed copy of the same version of Hoogle.
So, I want to generate database files, which can only be done after install time, but which I then want to be installed. Is there any way to acheive this? Or some better idea? Currently I just generate the databases and have the .cabal file reference them, which means the darcs version can't be compiled with Cabal.
Thanks
Neil _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

Hi Alfonso,
Probably you've already considered this option but, How about a cabal build-posthook
I considered lots of options with hooks at loads of different points, but couldn't figure out what the right point is :-)
a) detects if the database-generating program is present (I asume it's only present in the darcs version)
That's easy enough to do. The other alternative is to detect if the databases I want to install aren't present, and generate them only then.
b) if present, generates the databases and puts them in the location supplied in the cabal file.
I'm not aware though, if configure would complain about the databases not being present at first instance.
That is also what I wondered. Also, as the hoogle binary is required to generate databases (it is called by the database generation program), I will have to find the hoogle binary at this point. Unfortunately it won't have been installed in $PATH, and I'm not sure if Cabal guarantees where it has put the binary. I'll probably try implementing something today. Thanks Neil

On Wed, Aug 20, 2008 at 2:35 PM, Neil Mitchell
That is also what I wondered. Also, as the hoogle binary is required to generate databases (it is called by the database generation program), I will have to find the hoogle binary at this point. Unfortunately it won't have been installed in $PATH, and I'm not sure if Cabal guarantees where it has put the binary.
Well, I guess that, If you create a Cabal posthook as I suggested, you could just use the inplace hoogle binary under dist/ (assuming, of course, you don't need any configuration value from Paths_Hoogle to generate the databases).

On Wed, Aug 20, 2008 at 2:35 PM, Neil Mitchell
The other alternative is to detect if the databases I want to install aren't present, and generate them only then.
That alternative has a big disadvantage. People pulling patches which change the database format won't rebuild the databases (they where already there from a previous installation) and will end up having a broken installation.

Hi Alfonso,
That alternative has a big disadvantage. People pulling patches which change the database format won't rebuild the databases (they where already there from a previous installation) and will end up having a broken installation.
I realise that, I'm hoping to do it like a "make" based thing, to some degree. I'm just trying to work around Cabal bug (http://hackage.haskell.org/trac/hackage/ticket/329), then I can make the databases regenerate if the .exe is newer. Thanks Neil

Hi
I realise that, I'm hoping to do it like a "make" based thing, to some degree. I'm just trying to work around Cabal bug (http://hackage.haskell.org/trac/hackage/ticket/329), then I can make the databases regenerate if the .exe is newer.
It appears its not very easy to work around that Cabal bug, and Cabal HEAD won't work with cabal-install HEAD, so I'm stuck. If I do generate databases, it will have to be unconditionally, which seems like an awful waste of time even if nothing has changed. Generating databases takes around a minute. Thanks Neil

Neil Mitchell
If I do generate databases, it will have to be unconditionally, which seems like an awful waste of time even if nothing has changed. Generating databases takes around a minute.
Have your database generator do the check itself by inserting some version marker for the databases, or whatever? If the databases exist and are compatible, just touch them instead of regenerating them. Ugly, but should work. Bart Massey bart@cs.pdx.edu
participants (3)
-
Alfonso Acosta
-
Bart Massey
-
Neil Mitchell