Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
Cabal
Commits
af77559c
Commit
af77559c
authored
10 years ago
by
Duncan Coutts
Browse files
Options
Downloads
Plain Diff
Merge pull request #2445 from HJvT/master
Added checks to see if files and directories exist
parents
fcd23eb2
1b930232
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Cabal/Distribution/PackageDescription/Check.hs
+29
-20
29 additions, 20 deletions
Cabal/Distribution/PackageDescription/Check.hs
with
29 additions
and
20 deletions
Cabal/Distribution/PackageDescription/Check.hs
+
29
−
20
View file @
af77559c
...
...
@@ -1383,30 +1383,36 @@ checkPackageContent :: Monad m => CheckPackageContentOps m
->
PackageDescription
->
m
[
PackageCheck
]
checkPackageContent
ops
pkg
=
do
licenseErrors
<-
checkLicensesExist
ops
pkg
setupError
<-
checkSetupExists
ops
pkg
configureError
<-
checkConfigureExists
ops
pkg
localPathErrors
<-
checkLocalPathsExist
ops
pkg
vcsLocation
<-
checkMissingVcsInfo
ops
pkg
fileExistsError
<-
checkFilesExist
ops
pkg
return
$
licenseErrors
++
catMaybes
[
setupError
,
configureError
]
return
$
catMaybes
[
setupError
,
configureError
]
++
localPathErrors
++
vcsLocation
checkLicensesExist
::
Monad
m
=>
CheckPackageContentOps
m
->
PackageDescription
->
m
[
PackageCheck
]
checkLicensesExist
ops
pkg
=
do
exists
<-
mapM
(
doesFileExist
ops
)
(
licenseFiles
pkg
)
return
[
PackageBuildWarning
$
"The '"
++
fieldname
++
"' field refers to the file "
++
quote
file
++
" which does not exist."
|
(
file
,
False
)
<-
zip
(
licenseFiles
pkg
)
exists
]
where
fieldname
|
length
(
licenseFiles
pkg
)
==
1
=
"license-file"
|
otherwise
=
"license-files"
++
fileExistsError
checkFilesExist
::
Monad
m
=>
CheckPackageContentOps
m
->
PackageDescription
->
m
[
PackageCheck
]
checkFilesExist
ops
pkg
=
do
let
filess
=
[
(
files
,
kind
)
|
(
files
,
kind
)
<-
[
(
files
,
"license-file"
)
|
files
<-
licenseFiles
pkg
]
++
[
(
files
,
"extra-source-files"
)
|
files
<-
extraSrcFiles
pkg
]
++
[
(
files
,
"data-files"
)
|
files
<-
dataFiles
pkg
]
++
[
(
files
,
"extra-doc-files"
)
|
files
<-
extraDocFiles
pkg
]
]
missing
<-
filterM
(
liftM
not
.
doesFileExist
ops
.
fst
)
filess
return
[
PackageBuildWarning
{
explanation
=
quote
(
kind
++
": "
++
file
)
++
" file does not exist."
}
|
(
file
,
kind
)
<-
missing
]
checkSetupExists
::
Monad
m
=>
CheckPackageContentOps
m
->
PackageDescription
...
...
@@ -1436,9 +1442,12 @@ checkLocalPathsExist ops pkg = do
let
dirs
=
[
(
dir
,
kind
)
|
bi
<-
allBuildInfo
pkg
,
(
dir
,
kind
)
<-
[
(
dir
,
"extra-lib-dirs"
)
|
dir
<-
extraLibDirs
bi
]
++
[
(
dir
,
"include-dirs"
)
|
dir
<-
includeDirs
bi
]
++
[
(
dir
,
"hs-source-dirs"
)
|
dir
<-
hsSourceDirs
bi
]
[
(
dir
,
"extra-lib-dirs"
)
|
dir
<-
extraLibDirs
bi
]
++
[
(
dir
,
"include-dirs"
)
|
dir
<-
includeDirs
bi
]
++
[
(
dir
,
"hs-source-dirs"
)
|
dir
<-
hsSourceDirs
bi
]
++
[
(
dir
,
"c-sources"
)
|
dir
<-
cSources
bi
]
++
[
(
dir
,
"js-sources"
)
|
dir
<-
jsSources
bi
]
,
isRelative
dir
]
missing
<-
filterM
(
liftM
not
.
doesDirectoryExist
ops
.
fst
)
dirs
return
[
PackageBuildWarning
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment