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
GHC
Commits
481caa85
Commit
481caa85
authored
Jan 11, 2015
by
Andrey Mokhov
Browse files
Remove postProcessPackageData from Util.
parent
21e48fc5
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Package/Data.hs
View file @
481caa85
...
...
@@ -43,6 +43,18 @@ configureArgs stage settings =
<>
when
CrossCompiling
(
argConf
"--host"
TargetPlatformFull
)
<>
argConf
"--with-cc"
Gcc
-- Prepare a given 'packaga-data.mk' file for parsing by readConfigFile:
-- 1) Drop lines containing '$'
-- 2) Replace '/' and '\' with '_' before '='
postProcessPackageData
::
FilePath
->
Action
()
postProcessPackageData
file
=
do
pkgData
<-
(
filter
(
'$'
`
notElem
`)
.
lines
)
<$>
liftIO
(
readFile
file
)
length
pkgData
`
seq
`
writeFileLines
file
$
map
processLine
pkgData
where
processLine
line
=
replaceSeparators
'_'
prefix
++
suffix
where
(
prefix
,
suffix
)
=
break
(
==
'='
)
line
buildPackageData
::
Package
->
TodoItem
->
Rules
()
buildPackageData
(
Package
name
path
_
)
(
stage
,
dist
,
settings
)
=
let
pathDist
=
path
</>
dist
...
...
src/Util.hs
View file @
481caa85
module
Util
(
module
Data
.
Char
,
replaceIf
,
replaceEq
,
replaceSeparators
,
postProcessPackageData
replaceIf
,
replaceEq
,
replaceSeparators
)
where
import
Base
...
...
@@ -16,14 +15,3 @@ replaceEq from = replaceIf (== from)
replaceSeparators
::
Char
->
String
->
String
replaceSeparators
=
replaceIf
isPathSeparator
-- Prepare a given 'packaga-data.mk' file for parsing by readConfigFile:
-- 1) Drop lines containing '$'
-- 2) Replace '/' and '\' with '_' before '='
postProcessPackageData
::
FilePath
->
Action
()
postProcessPackageData
file
=
do
pkgData
<-
(
filter
(
'$'
`
notElem
`)
.
lines
)
<$>
liftIO
(
readFile
file
)
length
pkgData
`
seq
`
writeFileLines
file
$
map
processLine
pkgData
where
processLine
line
=
replaceSeparators
'_'
prefix
++
suffix
where
(
prefix
,
suffix
)
=
break
(
==
'='
)
line
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