Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
walint
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
hub
walint
Commits
0b29a7e8
Commit
0b29a7e8
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
fail on missing map assets
(but not (yet?) on missing maps/entrypoints)
parent
1338e4a1
No related branches found
No related tags found
No related merge requests found
Pipeline
#8289
failed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/WriteRepo.hs
+8
-3
8 additions, 3 deletions
lib/WriteRepo.hs
src/Main.hs
+6
-4
6 additions, 4 deletions
src/Main.hs
with
14 additions
and
7 deletions
lib/WriteRepo.hs
+
8
−
3
View file @
0b29a7e8
...
@@ -16,15 +16,18 @@ import Data.Set (Set)
...
@@ -16,15 +16,18 @@ import Data.Set (Set)
import
qualified
Data.Set
as
S
import
qualified
Data.Set
as
S
import
Paths
(
normalise
)
import
Paths
(
normalise
)
import
System.Directory.Extra
(
copyFile
,
createDirectoryIfMissing
)
import
System.Directory.Extra
(
copyFile
,
createDirectoryIfMissing
)
import
System.Exit
(
ExitCode
(
..
))
import
System.FilePath
(
takeDirectory
)
import
System.FilePath
(
takeDirectory
)
import
qualified
System.FilePath
as
FP
import
qualified
System.FilePath
as
FP
import
System.FilePath.Posix
((
</>
))
import
System.FilePath.Posix
((
</>
))
import
Types
(
Dep
(
Local
))
import
Types
(
Dep
(
Local
))
writeAdjustedRepository
::
FilePath
->
FilePath
->
DirResult
->
IO
()
writeAdjustedRepository
::
FilePath
->
FilePath
->
DirResult
->
IO
ExitCode
writeAdjustedRepository
inPath
outPath
result
writeAdjustedRepository
inPath
outPath
result
|
resultIsFatal
result
=
pure
()
|
resultIsFatal
result
=
do
putStrLn
"FATAL: Repository has missing assets; cannot write to outPath"
pure
(
ExitFailure
1
)
|
otherwise
=
do
|
otherwise
=
do
createDirectoryIfMissing
True
outPath
createDirectoryIfMissing
True
outPath
...
@@ -41,7 +44,7 @@ writeAdjustedRepository inPath outPath result
...
@@ -41,7 +44,7 @@ writeAdjustedRepository inPath outPath result
let
mapdir
=
takeDirectory
mappath
in
let
mapdir
=
takeDirectory
mappath
in
mapMaybe
(
\
case
mapMaybe
(
\
case
Local
path
->
Just
.
normalise
mapdir
$
path
Local
path
->
Just
.
normalise
mapdir
$
path
_
->
Nothing
)
_
->
Nothing
)
$
mapresultDepends
mapresult
)
$
mapresultDepends
mapresult
)
.
toList
$
dirresultMaps
result
.
toList
$
dirresultMaps
result
...
@@ -53,3 +56,5 @@ writeAdjustedRepository inPath outPath result
...
@@ -53,3 +56,5 @@ writeAdjustedRepository inPath outPath result
in
do
in
do
putStrLn
$
"copying "
<>
assetPath
<>
" → "
<>
newPath
putStrLn
$
"copying "
<>
assetPath
<>
" → "
<>
newPath
copyFile
assetPath
newPath
copyFile
assetPath
newPath
pure
ExitSuccess
This diff is collapsed.
Click to expand it.
src/Main.hs
+
6
−
4
View file @
0b29a7e8
...
@@ -17,6 +17,7 @@ import CheckDir (recursiveCheckDir)
...
@@ -17,6 +17,7 @@ import CheckDir (recursiveCheckDir)
import
WriteRepo
(
writeAdjustedRepository
)
import
WriteRepo
(
writeAdjustedRepository
)
import
Types
(
Level
(
..
))
import
Types
(
Level
(
..
))
import
Util
(
printPretty
)
import
Util
(
printPretty
)
import
System.Exit
(
exitWith
)
-- | the options this cli tool can take
-- | the options this cli tool can take
data
Options
=
Options
data
Options
=
Options
...
@@ -47,15 +48,16 @@ run options = do
...
@@ -47,15 +48,16 @@ run options = do
lints
<-
recursiveCheckDir
repo
entry
lints
<-
recursiveCheckDir
repo
entry
case
out
options
of
Just
outpath
->
writeAdjustedRepository
repo
outpath
lints
Nothing
->
pure
()
if
json
options
if
json
options
then
printLB
then
printLB
$
if
pretty
options
then
encodePretty
lints
else
encode
lints
$
if
pretty
options
then
encodePretty
lints
else
encode
lints
else
printPretty
(
level
,
lints
)
else
printPretty
(
level
,
lints
)
case
out
options
of
Just
outpath
->
writeAdjustedRepository
repo
outpath
lints
>>=
exitWith
Nothing
->
pure
()
-- | haskell's many string types are FUN …
-- | haskell's many string types are FUN …
printLB
::
LB
.
ByteString
->
IO
()
printLB
::
LB
.
ByteString
->
IO
()
printLB
a
=
putStrLn
$
C8
.
unpack
$
LB
.
toStrict
a
printLB
a
=
putStrLn
$
C8
.
unpack
$
LB
.
toStrict
a
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