Neil Mitchell | 20 Aug 09:47

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
Alfonso Acosta | 20 Aug 14:15

Re: Cabal question: Generated data files

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 <ndmitchell <at> gmail.com> wrote:
> 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
(Continue reading)

Neil Mitchell | 20 Aug 14:35

Re: Cabal question: Generated data files

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
(Continue reading)

Alfonso Acosta | 20 Aug 14:41

Re: Cabal question: Generated data files

On Wed, Aug 20, 2008 at 2:35 PM, Neil Mitchell <ndmitchell <at> gmail.com> wrote:
> 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).
Alfonso Acosta | 20 Aug 15:04

Re: Cabal question: Generated data files

On Wed, Aug 20, 2008 at 2:35 PM, Neil Mitchell <ndmitchell <at> gmail.com> wrote:
> 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.
Neil Mitchell | 20 Aug 15:23

Re: Cabal question: Generated data files

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
Neil Mitchell | 20 Aug 16:16

Re: Cabal question: Generated data files

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
Bart Massey | 20 Aug 20:17
Favicon
Gravatar

Re: Cabal question: Generated data files

Neil Mitchell <ndmitchell <at> gmail.com> writes:
> 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 <at> cs.pdx.edu

Gmane