Copyright | Lennart Kolmodin 2008 |
---|---|
License | BSD3 |
Maintainer | cabal-devel@haskell.org |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This has code for checking for various problems in packages. There is one
set of checks that just looks at a
PackageDescription
in isolation and
another set of checks that also looks at files in the package. Some of the
checks are basic sanity checks, others are portability standards that we'd
like to encourage. There is a
PackageCheck
type that distinguishes the
different kinds of check so we can see which ones are appropriate to report
in different situations. This code gets uses when configuring a package when
we consider only basic problems. The higher standard is uses when when
preparing a source tarball and by Hackage when uploading new packages. The
reason for this is that we want to hold packages that are expected to be
distributed to a higher standard than packages that are only ever expected
to be used on the author's own environment.
Synopsis
-
data
PackageCheck
- = PackageBuildImpossible { }
- | PackageBuildWarning { }
- | PackageDistSuspicious { }
- | PackageDistSuspiciousWarn { }
- | PackageDistInexcusable { }
- checkPackage :: GenericPackageDescription -> Maybe PackageDescription -> [ PackageCheck ]
- checkConfiguredPackage :: PackageDescription -> [ PackageCheck ]
- checkPackageFiles :: Verbosity -> PackageDescription -> FilePath -> NoCallStackIO [ PackageCheck ]
- checkPackageContent :: Monad m => CheckPackageContentOps m -> PackageDescription -> m [ PackageCheck ]
-
data
CheckPackageContentOps
m =
CheckPackageContentOps
{
- doesFileExist :: FilePath -> m Bool
- doesDirectoryExist :: FilePath -> m Bool
- getDirectoryContents :: FilePath -> m [ FilePath ]
- getFileContents :: FilePath -> m ByteString
- checkPackageFileNames :: [ FilePath ] -> [ PackageCheck ]
Package Checking
data PackageCheck Source #
Results of some kind of failed package check.
There are a range of severities, from merely dubious to totally insane. All of them come with a human readable explanation. In future we may augment them with more machine readable explanations, for example to help an IDE suggest automatic corrections.
PackageBuildImpossible |
This package description is no good. There's no way it's going to build sensibly. This should give an error at configure time. |
PackageBuildWarning |
A problem that is likely to affect building the package, or an issue that we'd like every package author to be aware of, even if the package is never distributed. |
PackageDistSuspicious |
An issue that might not be a problem for the package author but might be annoying or detrimental when the package is distributed to users. We should encourage distributed packages to be free from these issues, but occasionally there are justifiable reasons so we cannot ban them entirely. |
PackageDistSuspiciousWarn |
Like PackageDistSuspicious but will only display warnings rather than causing abnormal exit when you run 'cabal check'. |
PackageDistInexcusable |
An issue that is OK in the author's environment but is almost certain to be a portability problem for other environments. We can quite legitimately refuse to publicly distribute packages with these problems. |
Instances
Eq PackageCheck Source # | |
Defined in Distribution.PackageDescription.Check (==) :: PackageCheck -> PackageCheck -> Bool Source # (/=) :: PackageCheck -> PackageCheck -> Bool Source # |
|
Ord PackageCheck Source # | |
Defined in Distribution.PackageDescription.Check compare :: PackageCheck -> PackageCheck -> Ordering Source # (<) :: PackageCheck -> PackageCheck -> Bool Source # (<=) :: PackageCheck -> PackageCheck -> Bool Source # (>) :: PackageCheck -> PackageCheck -> Bool Source # (>=) :: PackageCheck -> PackageCheck -> Bool Source # max :: PackageCheck -> PackageCheck -> PackageCheck Source # min :: PackageCheck -> PackageCheck -> PackageCheck Source # |
|
Show PackageCheck Source # | |
Defined in Distribution.PackageDescription.Check |
checkPackage :: GenericPackageDescription -> Maybe PackageDescription -> [ PackageCheck ] Source #
Check for common mistakes and problems in package descriptions.
This is the standard collection of checks covering all aspects except
for checks that require looking at files within the package. For those
see
checkPackageFiles
.
It requires the
GenericPackageDescription
and optionally a particular
configuration of that package. If you pass
Nothing
then we just check
a version of the generic description using
flattenPackageDescription
.
Checking package contents
checkPackageFiles :: Verbosity -> PackageDescription -> FilePath -> NoCallStackIO [ PackageCheck ] Source #
Sanity check things that requires IO. It looks at the files in the package and expects to find the package unpacked in at the given file path.
checkPackageContent :: Monad m => CheckPackageContentOps m -> PackageDescription -> m [ PackageCheck ] Source #
Sanity check things that requires looking at files in the package.
This is a generalised version of
checkPackageFiles
that can work in any
monad for which you can provide
CheckPackageContentOps
operations.
The point of this extra generality is to allow doing checks in some virtual file system, for example a tarball in memory.
data CheckPackageContentOps m Source #
A record of operations needed to check the contents of packages.
Used by
checkPackageContent
.
CheckPackageContentOps | |
|
checkPackageFileNames :: [ FilePath ] -> [ PackageCheck ] Source #
Check the names of all files in a package for portability problems. This should be done for example when creating or validating a package tarball.