Skip to content

Commit

Permalink
Merge pull request #4774 from commercialhaskell/proper-constraints-reuse
Browse files Browse the repository at this point in the history
Delete old constraints file befor downloading from Github
  • Loading branch information
qrilka authored Apr 24, 2019
2 parents d57c1d6 + 0683dc3 commit 7e16144
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions subs/curator/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Network.HTTP.Download (download)
import Options.Applicative.Simple hiding (action)
import qualified Pantry
import Path (toFilePath)
import Path.IO (doesFileExist, resolveFile', resolveDir')
import Path.IO (doesFileExist, removeFile, resolveFile', resolveDir')
import Paths_curator (version)
import qualified RIO.ByteString.Lazy as BL
import RIO.List (stripPrefix)
Expand Down Expand Up @@ -113,9 +113,13 @@ constraints target =
, show prev
, ".yaml"
]
logInfo $ "Reusing constraints.yaml from lts-" <> display x <> "." <> display prev
logInfo $ "Will reuse constraints.yaml from lts-" <> display x <> "." <> display prev
req <- parseUrlThrow url
constraintsPath <- resolveFile' constraintsFilename
exists <- doesFileExist constraintsPath
when exists $ do
logWarn "Local constraints file will be deleted before downloading reused constraints"
removeFile constraintsPath
downloaded <- download req constraintsPath
unless downloaded $
error $ "Could not download constraints.yaml from " <> url
Expand Down

0 comments on commit 7e16144

Please sign in to comment.