Skip to content
GitLab
Menu
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
b87252cf
Commit
b87252cf
authored
Dec 02, 2008
by
Duncan Coutts
Browse files
Add checks for file glob syntax
It requires cabal-version: >= 1.6 to be specified
parent
d69ba229
Changes
2
Hide whitespace changes
Inline
Side-by-side
Distribution/PackageDescription/Check.hs
View file @
b87252cf
...
...
@@ -79,7 +79,7 @@ import Distribution.System
import
Distribution.License
(
License
(
..
)
)
import
Distribution.Simple.Utils
(
cabalVersion
,
intercalate
)
(
cabalVersion
,
intercalate
,
parseFileGlob
,
FileGlob
(
..
)
)
import
Distribution.Version
(
Version
(
..
),
VersionRange
(
..
),
orLaterVersion
,
withinRange
)
...
...
@@ -596,7 +596,32 @@ checkCabalVersion pkg =
++
"'cabal-version: >= 1.6'. Alternatively, if broader compatability "
++
"is important then use: "
++
commaSep
[
display
(
Dependency
name
(
eliminateWildcardSyntax
versionRange
))
|
Dependency
name
versionRange
<-
depsUsingWildcardSyntax
]
|
Dependency
name
versionRange
<-
depsUsingWildcardSyntax
]
-- check use of "data-files: data/*.txt" syntax
,
checkVersion
[
1
,
6
]
(
not
(
null
dataFilesUsingGlobSyntax
))
$
PackageDistInexcusable
$
"Using wildcards like "
++
commaSep
(
map
quote
$
take
3
dataFilesUsingGlobSyntax
)
++
" in the 'data-files' field requires 'cabal-version: >= 1.6'. "
++
"Alternatively if you require compatability with earlier Cabal "
++
"versions then list all the files explicitly."
,
checkVersion
[
1
,
6
]
(
not
(
null
extraSrcFilesUsingGlobSyntax
))
$
PackageDistInexcusable
$
"Using wildcards like "
++
commaSep
(
map
quote
$
take
3
extraSrcFilesUsingGlobSyntax
)
++
" in the 'data-files' field requires 'cabal-version: >= 1.6'. "
++
"Alternatively if you require compatability with earlier Cabal "
++
"versions then list all the files explicitly."
-- check use of "source-repository" section
,
checkVersion
[
1
,
6
]
(
not
(
null
(
sourceRepos
pkg
)))
$
PackageDistInexcusable
$
"The 'source-repository' section is new in Cabal-1.6. "
++
"Unfortunately it messes up the parser in earlier Cabal versions "
++
"so you need to specify 'cabal-version: >= 1.6'."
]
where
checkVersion
::
[
Int
]
->
Bool
->
PackageCheck
->
Maybe
PackageCheck
...
...
@@ -614,6 +639,12 @@ checkCabalVersion pkg =
--TODO: need a better version view that excludes the middle posibilities:
_
->
False
dataFilesUsingGlobSyntax
=
filter
usesGlobSyntax
(
dataFiles
pkg
)
extraSrcFilesUsingGlobSyntax
=
filter
usesGlobSyntax
(
extraSrcFiles
pkg
)
usesGlobSyntax
str
=
case
parseFileGlob
str
of
Just
(
FileGlob
_
_
)
->
True
_
->
False
depsUsingWildcardSyntax
=
[
dep
|
dep
@
(
Dependency
_
vr
)
<-
buildDepends
pkg
,
usesWildcardSyntax
vr
]
...
...
Distribution/Simple/Utils.hs
View file @
b87252cf
...
...
@@ -84,6 +84,8 @@ module Distribution.Simple.Utils (
-- * simple file globbing
matchFileGlob
,
matchDirFileGlob
,
parseFileGlob
,
FileGlob
(
..
),
-- * temp files and dirs
withTempFile
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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