Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
439228e8
Commit
439228e8
authored
Oct 01, 2008
by
Duncan Coutts
Browse files
Add some checks on the repository sections
parent
6c3d869e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Distribution/PackageDescription/Check.hs
View file @
439228e8
...
...
@@ -89,7 +89,8 @@ import Distribution.Text
(
display
,
simpleParse
)
import
Language.Haskell.Extension
(
Extension
(
..
))
import
System.FilePath
(
takeExtension
,
isRelative
,
splitDirectories
,
(
</>
),
splitPath
)
(
(
</>
),
takeExtension
,
isRelative
,
isAbsolute
,
splitDirectories
,
splitPath
)
import
System.FilePath.Windows
as
FilePath.Windows
(
isValid
)
...
...
@@ -166,6 +167,7 @@ checkConfiguredPackage pkg =
checkSanity
pkg
++
checkFields
pkg
++
checkLicense
pkg
++
checkSourceRepos
pkg
++
checkGhcOptions
pkg
++
checkCCOptions
pkg
++
checkPaths
pkg
...
...
@@ -328,6 +330,42 @@ checkLicense pkg =
PackageDistSuspicious
"A 'license-file' is not specified."
]
checkSourceRepos
::
PackageDescription
->
[
PackageCheck
]
checkSourceRepos
pkg
=
catMaybes
$
concat
[[
case
repoKind
repo
of
RepoKindUnknown
kind
->
Just
$
PackageDistInexcusable
$
quote
kind
++
" is not a recognised kind of source-repository. "
++
"The repo kind is usually 'head' or 'this'"
_
->
Nothing
,
check
(
repoType
repo
==
Nothing
)
$
PackageDistInexcusable
"The source-repository 'type' is a required field."
,
check
(
repoLocation
repo
==
Nothing
)
$
PackageDistInexcusable
"The source-repository 'location' is a required field."
,
check
(
repoType
repo
==
Just
CVS
&&
repoModule
repo
==
Nothing
)
$
PackageDistInexcusable
"For a CVS source-repository, the 'module' is a required field."
,
check
(
repoKind
repo
==
RepoThis
&&
repoTag
repo
==
Nothing
)
$
PackageDistInexcusable
$
"For the 'this' kind of source-repository, the 'tag' is a required "
++
"field. It should specify the tag corresponding to this version "
++
"or release of the package."
,
check
(
maybe
False
System
.
FilePath
.
isAbsolute
(
repoSubdir
repo
))
$
PackageDistInexcusable
"The 'subdir' field of a source-repository must be a relative path."
]
|
repo
<-
sourceRepos
pkg
]
--TODO: check location looks like a URL for some repo types.
checkGhcOptions
::
PackageDescription
->
[
PackageCheck
]
checkGhcOptions
pkg
=
catMaybes
[
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment