on master help sign in
Work around haskell/hackage-server#141
e435e75Michael Snoyman
Stackage/BuildPlan.hs+6−1
@@ -14,6 +14,7 @@ import Stackage.Types
14import qualified System.IO.UTF8
14import qualified System.IO.UTF8
15import Data.Char (isSpace)
15import Data.Char (isSpace)
16import Stackage.Util
16import Stackage.Util
17+import Data.List (intercalate)
17
18
18readBuildPlan :: FilePath -> IO BuildPlan
19readBuildPlan :: FilePath -> IO BuildPlan
19readBuildPlan fp = do
20readBuildPlan fp = do
@@ -162,8 +163,12 @@ writeBuildPlanCsv :: FilePath -> BuildPlan -> IO ()
162writeBuildPlanCsv fp bp =
163writeBuildPlanCsv fp bp =
163 -- Obviously a proper CSV library should be used... but we're minimizing
164 -- Obviously a proper CSV library should be used... but we're minimizing
164 -- deps
165 -- deps
165− System.IO.UTF8.writeFile fp $ unlines $ map toRow $ Map.toList fullMap
166+ System.IO.UTF8.writeFile fp $ unlines' $ map toRow $ Map.toList fullMap
166 where
167 where
168+ -- Hackage server is buggy, and won't accept trailing newlines. See:
169+ -- https://github.com/haskell/hackage-server/issues/141#issuecomment-34615935
170+ unlines' = intercalate "\n"
171+
167 fullMap = Map.unions
172 fullMap = Map.unions
168 [ fmap spiVersion $ bpPackages bp
173 [ fmap spiVersion $ bpPackages bp
169 , Map.mapMaybe id $ bpCore bp
174 , Map.mapMaybe id $ bpCore bp