Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Cabal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
af77559c
Commit
af77559c
authored
Mar 04, 2015
by
Duncan Coutts
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2445 from HJvT/master
Added checks to see if files and directories exist
parents
fcd23eb2
1b930232
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
20 deletions
+29
-20
Cabal/Distribution/PackageDescription/Check.hs
Cabal/Distribution/PackageDescription/Check.hs
+29
-20
No files found.
Cabal/Distribution/PackageDescription/Check.hs
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
{
...
...
Write
Preview
Markdown
is supported
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