Distribution.Simple.SrcDist

Cabal-1.16.0: A framework for packaging Haskell software

Portability | portable
Maintainer | cabal-devel@haskell.org
Safe Haskell | None

Distribution.Simple.SrcDist

Contents

- The top level action
  - Parts of `sdist`
  - Snaphots

Description

This handles the `sdist` command. The module exports an `sdist` action but also some of the phases that make it up so that other tools can use just the bits they need. In particular the preparation of the tree of files to go into the source tarball is separated from actually building the source tarball.

The `createArchive` action uses the external `tar` program and assumes that it accepts the `-z` flag. Neither of these assumptions are valid on Windows. The `sdist` action now also does some distribution QA checks.

Synopsis

- sdist :: PackageDescription -> Maybe LocalBuildInfo -> SDistFlags -> (FilePath -> FilePath) -> [PPSuffixHandler] -> IO ()
- printPackageProblems :: Verbosity -> PackageDescription -> IO ()
- prepareTree :: Verbosity -> PackageDescription -> Maybe LocalBuildInfo -> FilePath -> FilePath -> [PPSuffixHandler] -> IO ()
- createArchive :: Verbosity -> PackageDescription -> Maybe LocalBuildInfo -> FilePath -> FilePath -> IO FilePath
- prepareSnapshotTree :: Verbosity -> PackageDescription -> Maybe LocalBuildInfo -> FilePath -> FilePath -> [PPSuffixHandler] -> IO ()
- snapshotPackage :: CalendarTime -> PackageDescription -> PackageDescription
- snapshotVersion :: CalendarTime -> Version -> Version
- dateToSnapshotNumber :: CalendarTime -> Int

# The top level action

sdist

Arguments

:: PackageDescription | information from the tarball
-> Maybe LocalBuildInfo | Information from configure
-> SDistFlags | verbosity & snapshot
-> (FilePath -> FilePath) | build prefix (temp dir)
-> [PPSuffixHandler] | extra preprocessors (includes suffixes)
-> IO () |

Create a source distribution.

## Parts of `sdist`

printPackageProblems :: Verbosity -> PackageDescription -> IO ()

prepareTree

Arguments

:: Verbosity | verbosity
-> PackageDescription | info from the cabal file
-> Maybe LocalBuildInfo |
-> FilePath | dist dir
-> FilePath | source tree to populate
-> [PPSuffixHandler] | extra preprocessors (includes suffixes)
-> IO () |

Prepare a directory tree of source files.

createArchive

Arguments

:: Verbosity | verbosity
-> PackageDescription | info from cabal file
-> Maybe LocalBuildInfo | info from configure
-> FilePath | source tree to archive
-> FilePath | name of archive to create
-> IO FilePath |

Create an archive from a tree of source files, and clean up the tree.

## Snaphots

prepareSnapshotTree

Arguments

:: Verbosity | verbosity
-> PackageDescription | info from the cabal file
-> Maybe LocalBuildInfo |
-> FilePath | dist dir
-> FilePath | source tree to populate
-> [PPSuffixHandler] | extra preprocessors (includes suffixes)
-> IO () |

Prepare a directory tree of source files for a snapshot version. It is expected that the appropriate snapshot version has already been set in the package description, eg using `snapshotPackage` or `snapshotVersion`.

snapshotPackage :: CalendarTime -> PackageDescription -> PackageDescription

Modifies a `PackageDescription` by appending a snapshot number corresponding to the given date.

snapshotVersion :: CalendarTime -> Version -> Version

Modifies a `Version` by appending a snapshot number corresponding to the given date.

dateToSnapshotNumber :: CalendarTime -> Int

Given a date produce a corresponding integer representation. For example given a date `18032008` produce the number `20080318`.