Skip to content

cabal sdist should touch preprocessed .hs files #2940

@simonmar

Description

@simonmar

cabal sdist for alex is supposed to produce a tarball that builds without requiring Happy, but sometimes it doesn't. The failure is non-deterministic and happens about half the time.

Cabal bundles the Happy-generated .hs files into the source dist, but the problem appears to be that sometimes the timestamp on these files is slightly older than the .y file, so it is ignored when subsequently building the tarball.

For example, here is a correct run:

$ cabal sdist
$ tar tvzf dist/alex-3.1.6.tar.gz --full-time | grep Parser
-rw-r--r-- 0/0            5917 2015-11-30 10:24:29 alex-3.1.6/src/Parser.y
-rw-r--r-- 0/0           42504 2015-11-30 10:24:29 alex-3.1.6/dist/build/alex/alex-tmp/Parser.hs

And an incorrect one:

> tar tvzf dist/alex-3.1.6.tar.gz --full-time | grep Parser    
-rw-r--r-- 0/0            5917 2015-11-30 10:23:43 alex-3.1.6/src/Parser.y
-rw-r--r-- 0/0           42504 2015-11-30 10:23:42 alex-3.1.6/dist/build/alex/alex-tmp/Parser.hs

Here the timestamp on Parser.hs is one second older than Parser.y. If I try to build this tarball without Happy installed, I get this:

$ cabal configure
Resolving dependencies...
[1 of 1] Compiling Main             ( dist/setup/setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
Configuring alex-3.1.6...
$ cabal build
Building alex-3.1.6...
Preprocessing executable 'alex' for alex-3.1.6...
setup: The program 'happy' is required but it could not be found
[1]    29158 exit 1     cabal build

The fix would appear to be to touch the preprocessed files before packaging the tarball.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions