Ticket #257 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

sdist doesn't include all files when using conditional and "buildable: False"

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Cabal library Version: 1.2.3.0
Severity: normal Keywords:
Cc: Difficulty: normal
GHC Version: 6.8.2 Platform:

Description

This is my cabal file:

Name: test
Version: 0.1
Cabal-Version: >=1.2

Executable exe1
    Hs-Source-Dirs: src
    Main-Is: Exe1.hs
    Build-Depends: base

Executable exe2
    Hs-Source-Dirs: src
    Main-Is: Exe2.hs
    if !os(linux)
        Buildable: False

Building, on linux, results in

% ./Setup.hs configure; ./Setup.hs build
Configuring test-0.1...
Warning: No license-file field.
Preprocessing executables for test-0.1...
Building test-0.1...
[1 of 1] Compiling Main             ( src/Exe1.hs, dist/build/exe1/exe1-tmp/Main.o )
Linking dist/build/exe1/exe1 ...
[1 of 1] Compiling Main             ( src/Exe2.hs, dist/build/exe2/exe2-tmp/Main.o )
Linking dist/build/exe2/exe2 ...

As is expected exe2 is built. However, sdist does not include the source file for exe2 in the tar-ball:

% ./Setup.hs sdist
Building source dist for test-0.1...
Preprocessing executables for test-0.1...
Source tarball created: dist/test-0.1.tar.gz
% tar -t -z -f dist/test-0.1.tar.gz
test-0.1/
test-0.1/Setup.hs
test-0.1/test.cabal
test-0.1/src/
test-0.1/src/Exe1.hs

Change History

Changed 5 years ago by guest

This happens because sdist uses flattenPackageDescription which doesn't properly handle conditionals like configure would do, and instead just joins the listed values for each field descriptor.

However it's not clear why sdist should care if an executable is buildable or not, I'd expect the sources to be included anyway, so the executable can be built where it's buildable.

Changed 5 years ago by ross@…

Indeed sdist shouldn't take any note of conditionals: it should pack all of the files in any environment.

Changed 5 years ago by duncan

Good catch. It was because sdist uses withLib and withExe which only run if the lib and exes are buildable.

Now fixed:

Fri Mar  7 02:09:33 GMT 2008  Duncan Coutts <duncan@haskell.org>
  * Fix sdist to ignore the buildable attribute
  Fixes ticket #257

Changed 5 years ago by duncan

  • status changed from new to closed
  • resolution set to fixed

Already fixed but the ticket was not closed.

Note: See TracTickets for help on using tickets.