on master help sign in
V2 upload by default, --server-url option when building
d0138faMichael Snoyman
ChangeLog.md+4
@@ -1,3 +1,7 @@
1+## 0.6.1
2+
3+* Switch to V2 upload by default
4+
1## 0.6.0
5## 0.6.0
2
6
3* Upload bundle V2 stuff
7* Upload bundle V2 stuff
Stackage/CompleteBuild.hs+11−5
@@ -40,7 +40,8 @@ data BuildFlags = BuildFlags
40 , bfEnableExecDyn :: !Bool
40 , bfEnableExecDyn :: !Bool
41 , bfVerbose :: !Bool
41 , bfVerbose :: !Bool
42 , bfSkipCheck :: !Bool
42 , bfSkipCheck :: !Bool
43− , bfUploadV2 :: !Bool
43+ , bfUploadV1 :: !Bool
44+ , bfServer :: !StackageServer
44 } deriving (Show)
45 } deriving (Show)
45
46
46data BuildType = Nightly | LTS BumpType
47data BuildType = Nightly | LTS BumpType
@@ -253,7 +254,11 @@ completeBuild buildType buildFlags = withManager tlsManagerSettings $ \man -> do
253 }
254 }
254
255
255 when (bfDoUpload buildFlags) $
256 when (bfDoUpload buildFlags) $
256− finallyUpload (bfUploadV2 buildFlags) settings man
257+ finallyUpload
258+ (not $ bfUploadV1 buildFlags)
259+ (bfServer buildFlags)
260+ settings
261+ man
257
262
258justUploadNightly
263justUploadNightly
259 :: Text -- ^ nightly date
264 :: Text -- ^ nightly date
@@ -261,7 +266,7 @@ justUploadNightly
261justUploadNightly day = do
266justUploadNightly day = do
262 plan <- decodeFileEither (fpToString $ nightlyPlanFile day)
267 plan <- decodeFileEither (fpToString $ nightlyPlanFile day)
263 >>= either throwM return
268 >>= either throwM return
264− withManager tlsManagerSettings $ finallyUpload False $ nightlySettings day plan
269+ withManager tlsManagerSettings $ finallyUpload False def $ nightlySettings day plan
265
270
266getStackageAuthToken :: IO Text
271getStackageAuthToken :: IO Text
267getStackageAuthToken = do
272getStackageAuthToken = do
@@ -273,8 +278,9 @@ getStackageAuthToken = do
273-- | The final part of the complete build process: uploading a bundle,
278-- | The final part of the complete build process: uploading a bundle,
274-- docs and a distro to hackage.
279-- docs and a distro to hackage.
275finallyUpload :: Bool -- ^ use v2 upload
280finallyUpload :: Bool -- ^ use v2 upload
281+ -> StackageServer
276 -> Settings -> Manager -> IO ()
282 -> Settings -> Manager -> IO ()
277−finallyUpload useV2 settings@Settings{..} man = do
283+finallyUpload useV2 server settings@Settings{..} man = do
278 putStrLn "Uploading bundle to Stackage Server"
284 putStrLn "Uploading bundle to Stackage Server"
279
285
280 token <- getStackageAuthToken
286 token <- getStackageAuthToken
@@ -282,7 +288,7 @@ finallyUpload useV2 settings@Settings{..} man = do
282 if useV2
288 if useV2
283 then do
289 then do
284 res <- flip uploadBundleV2 man UploadBundleV2
290 res <- flip uploadBundleV2 man UploadBundleV2
285− { ub2Server = def
291+ { ub2Server = server
286 , ub2AuthToken = token
292 , ub2AuthToken = token
287 , ub2Bundle = bundleDest
293 , ub2Bundle = bundleDest
288 }
294 }
Stackage/Upload.hs+1
@@ -17,6 +17,7 @@ module Stackage.Upload
17 , uploadBundleV2
17 , uploadBundleV2
18 , UploadBundleV2 (..)
18 , UploadBundleV2 (..)
19 , def
19 , def
20+ , StackageServer
20 , unStackageServer
21 , unStackageServer
21 ) where
22 ) where
22
23
app/stackage.hs+7−2
@@ -110,8 +110,13 @@ main =
110 (long "skip-check" <>
110 (long "skip-check" <>
111 help "Skip the check phase, and pass --allow-newer to cabal configure") <*>
111 help "Skip the check phase, and pass --allow-newer to cabal configure") <*>
112 switch
112 switch
113− (long "upload-v2" <>
113+ (long "upload-v1" <>
114− help "Use the V2 upload code")
114+ help "Use the V1 upload code") <*>
115+ (fmap fromString (strOption
116+ (long "server-url" <>
117+ metavar "SERVER-URL" <>
118+ showDefault <> value (T.unpack $ unStackageServer def) <>
119+ help "Server to upload bundle to")))
115
120
116 nightlyUploadFlags = fromString <$> strArgument
121 nightlyUploadFlags = fromString <$> strArgument
117 (metavar "DATE" <>
122 (metavar "DATE" <>