remove many old version ifdefs
Drop support for building with ghc older than 8.4.4, and with older versions of serveral haskell libraries than will be included in Debian 10. The only remaining version ifdefs in the entire code base are now a couple for aws! This commit should only be merged after the Debian 10 release. And perhaps it will need to wait longer than that; it would make backporting new versions of git-annex to Debian 9 (stretch) which has been actively happening as recently as this year. This commit was sponsored by Ilya Shlyakhter.
This commit is contained in:
parent
b8ef1bf3be
commit
9a5ddda511
29 changed files with 42 additions and 319 deletions
10
Remote/S3.hs
10
Remote/S3.hs
|
@ -247,7 +247,6 @@ storeHelper info h magic f object p = liftIO $ case partSize info of
|
|||
return (Nothing, vid)
|
||||
#endif
|
||||
multipartupload fsz partsz = runResourceT $ do
|
||||
#if MIN_VERSION_aws(0,16,0)
|
||||
contenttype <- liftIO getcontenttype
|
||||
let startreq = (S3.postInitiateMultipartUpload (bucket info) object)
|
||||
{ S3.imuStorageClass = Just (storageClass info)
|
||||
|
@ -287,10 +286,6 @@ storeHelper info h magic f object p = liftIO $ case partSize info of
|
|||
resp <- sendS3Handle h $ S3.postCompleteMultipartUpload
|
||||
(bucket info) object uploadid (zip [1..] etags)
|
||||
return (Just (S3.cmurETag resp), mkS3VersionID object (S3.cmurVersionId resp))
|
||||
#else
|
||||
warningIO $ "Cannot do multipart upload (partsize " ++ show partsz ++ ") of large file (" ++ show fsz ++ "); built with too old a version of the aws library."
|
||||
singlepartupload
|
||||
#endif
|
||||
getcontenttype = maybe (pure Nothing) (flip getMagicMimeType f) magic
|
||||
|
||||
{- Implemented as a fileRetriever, that uses conduit to stream the chunks
|
||||
|
@ -735,10 +730,7 @@ mkS3HandleVar c gc u = liftIO $ newTVarIO $ Left $ do
|
|||
case mcreds of
|
||||
Just creds -> do
|
||||
awscreds <- liftIO $ genCredentials creds
|
||||
let awscfg = AWS.Configuration AWS.Timestamp awscreds debugMapper
|
||||
#if MIN_VERSION_aws(0,17,0)
|
||||
Nothing
|
||||
#endif
|
||||
let awscfg = AWS.Configuration AWS.Timestamp awscreds debugMapper Nothing
|
||||
ou <- getUrlOptions
|
||||
return $ Just $ S3Handle (httpManager ou) awscfg s3cfg
|
||||
Nothing -> return Nothing
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
module Remote.WebDAV (remote, davCreds, configUrl) where
|
||||
|
@ -16,9 +15,8 @@ import qualified Data.ByteString.Lazy as L
|
|||
import qualified Data.ByteString.UTF8 as B8
|
||||
import qualified Data.ByteString.Lazy.UTF8 as L8
|
||||
import Network.HTTP.Client (HttpException(..), RequestBody)
|
||||
#if MIN_VERSION_http_client(0,5,0)
|
||||
import qualified Network.HTTP.Client as HTTP
|
||||
#endif
|
||||
import Network.HTTP.Client (HttpExceptionContent(..), responseStatus)
|
||||
import Network.HTTP.Types
|
||||
import System.IO.Error
|
||||
import Control.Monad.Catch
|
||||
|
@ -42,10 +40,6 @@ import Utility.Url (URLString, matchStatusCodeException, matchHttpExceptionConte
|
|||
import Annex.UUID
|
||||
import Remote.WebDAV.DavLocation
|
||||
|
||||
#if MIN_VERSION_http_client(0,5,0)
|
||||
import Network.HTTP.Client (HttpExceptionContent(..), responseStatus)
|
||||
#endif
|
||||
|
||||
remote :: RemoteType
|
||||
remote = RemoteType
|
||||
{ typename = "webdav"
|
||||
|
@ -415,7 +409,6 @@ goDAV (DavHandle ctx user pass _) a = choke $ run $ prettifyExceptions $ do
|
|||
{- Catch StatusCodeException and trim it to only the statusMessage part,
|
||||
- eliminating a lot of noise, which can include the whole request that
|
||||
- failed. The rethrown exception is no longer a StatusCodeException. -}
|
||||
#if MIN_VERSION_http_client(0,5,0)
|
||||
prettifyExceptions :: DAVT IO a -> DAVT IO a
|
||||
prettifyExceptions a = catchJust (matchStatusCodeException (const True)) a go
|
||||
where
|
||||
|
@ -428,17 +421,6 @@ prettifyExceptions a = catchJust (matchStatusCodeException (const True)) a go
|
|||
, show (HTTP.path req)
|
||||
]
|
||||
go e = throwM e
|
||||
#else
|
||||
prettifyExceptions :: DAVT IO a -> DAVT IO a
|
||||
prettifyExceptions a = catchJust (matchStatusCodeException (const True)) a go
|
||||
where
|
||||
go (StatusCodeException status _ _) = giveup $ unwords
|
||||
[ "DAV failure:"
|
||||
, show (statusCode status)
|
||||
, show (statusMessage status)
|
||||
]
|
||||
go e = throwM e
|
||||
#endif
|
||||
|
||||
prepDAV :: DavUser -> DavPass -> DAVT IO ()
|
||||
prepDAV user pass = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue