Copyright | Simon Marlow 2004 |
---|---|
License | BSD3 |
Maintainer | cabal-devel@haskell.org |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 -> SDistFlags -> (FilePath -> FilePath) -> [PPSuffixHandler] -> IO ()
- printPackageProblems :: Verbosity -> PackageDescription -> IO ()
- prepareTree :: Verbosity -> Maybe (SymbolicPath CWD (Dir Pkg)) -> PackageDescription -> FilePath -> [PPSuffixHandler] -> IO ()
- createArchive :: Verbosity -> PackageDescription -> FilePath -> FilePath -> IO FilePath
- prepareSnapshotTree :: Verbosity -> Maybe (SymbolicPath CWD (Dir Pkg)) -> PackageDescription -> FilePath -> [PPSuffixHandler] -> IO ()
- snapshotPackage :: UTCTime -> PackageDescription -> PackageDescription
- snapshotVersion :: UTCTime -> Version -> Version
- dateToSnapshotNumber :: UTCTime -> Int
- listPackageSources :: Verbosity -> Maybe (SymbolicPath CWD (Dir Pkg)) -> PackageDescription -> [PPSuffixHandler] -> IO [SymbolicPath Pkg File]
- listPackageSourcesWithDie :: Verbosity -> (forall res. Verbosity -> CabalException -> IO [res]) -> Maybe (SymbolicPath CWD (Dir Pkg)) -> PackageDescription -> [PPSuffixHandler] -> IO [SymbolicPath Pkg File]
The top level action
:: PackageDescription | information from the tarball |
-> 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 () Source #
Note: must be called with the CWD set to the directory containing the '.cabal' file.
:: Verbosity | verbosity |
-> Maybe (SymbolicPath CWD (Dir Pkg)) | working directory |
-> PackageDescription | info from the cabal file |
-> FilePath | source tree to populate |
-> [PPSuffixHandler] | extra preprocessors (includes suffixes) |
-> IO () |
Prepare a directory tree of source files.
:: Verbosity | verbosity |
-> PackageDescription | info from cabal file |
-> 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.
Snapshots
:: Verbosity | verbosity |
-> Maybe (SymbolicPath CWD (Dir Pkg)) | working directory |
-> PackageDescription | info from the cabal file |
-> 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 :: UTCTime -> PackageDescription -> PackageDescription Source #
Modifies a PackageDescription
by appending a snapshot number
corresponding to the given date.
snapshotVersion :: UTCTime -> Version -> Version Source #
Modifies a Version
by appending a snapshot number corresponding
to the given date.
dateToSnapshotNumber :: UTCTime -> Int Source #
Given a date produce a corresponding integer representation.
For example given a date 18032008
produce the number 20080318
.
Extracting the source files
:: Verbosity | verbosity |
-> Maybe (SymbolicPath CWD (Dir Pkg)) | directory with cabal file |
-> PackageDescription | info from the cabal file |
-> [PPSuffixHandler] | extra preprocessors (include suffixes) |
-> IO [SymbolicPath Pkg File] |
List all source files of a package.
Since Cabal-3.4
returns a single list. There shouldn't be any
executable files, they are hardly portable.
listPackageSourcesWithDie Source #
:: Verbosity | verbosity |
-> (forall res. Verbosity -> CabalException -> IO [res]) |
|
-> Maybe (SymbolicPath CWD (Dir Pkg)) | directory with cabal file |
-> PackageDescription | info from the cabal file |
-> [PPSuffixHandler] | extra preprocessors (include suffixes) |
-> IO [SymbolicPath Pkg File] |
A variant of listPackageSources
with configurable die
.
Note: may still die
directly. For example on missing include file.
Since @3.4.0.0