Drop support for building with aws older than 0.14.

debian stable has 0.14 so lose the complexity for old versions
This commit is contained in:
Joey Hess 2019-04-19 14:27:59 -04:00
parent 55a5d9679a
commit 9dc7a10448
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 3 additions and 38 deletions

View file

@ -77,9 +77,7 @@ s3InputAForm defcreds = AWSInput
storageclasses =
[ ("Standard redundancy", StandardRedundancy)
#ifdef WITH_S3
#if MIN_VERSION_aws(0,13,0)
, ("Infrequent access (cheaper for backups and archives)", StandardInfrequentAccess)
#endif
#endif
, ("Reduced redundancy (costs less)", ReducedRedundancy)
]

View file

@ -33,12 +33,6 @@ buildFlags = filter (not . null)
#endif
#ifdef WITH_S3
, "S3"
#if MIN_VERSION_aws(0,10,6)
++ "(multipartupload)"
#endif
#if MIN_VERSION_aws(0,13,0)
++ "(storageclasses)"
#endif
#else
#warning Building without S3.
#endif

View file

@ -14,6 +14,7 @@ git-annex (7.20190323) UNRELEASED; urgency=medium
* renameremote: New command, changes the name that is used to enable
a special remote. Especially useful when you want to reuse the name
of an old remote for something new.
* Drop support for building with aws older than 0.14.
-- Joey Hess <id@joeyh.name> Tue, 09 Apr 2019 14:07:53 -0400

View file

@ -344,34 +344,14 @@ checkKey hv r c info k = withS3Handle hv $ \case
checkKeyHelper :: S3Info -> S3Handle -> (Either S3.Object S3VersionID) -> Annex Bool
checkKeyHelper info h loc = liftIO $ runResourceT $ do
#if MIN_VERSION_aws(0,10,0)
rsp <- go
rsp <- sendS3Handle h req
return (isJust $ S3.horMetadata rsp)
#else
catchMissingException $ do
void go
return True
#endif
where
go = sendS3Handle h req
req = case loc of
Left o -> S3.headObject (bucket info) o
Right (S3VersionID o vid) -> (S3.headObject (bucket info) o)
{ S3.hoVersionId = Just vid }
#if ! MIN_VERSION_aws(0,10,0)
{- Catch exception headObject returns when an object is not present
- in the bucket, and returns False. All other exceptions indicate a
- check error and are let through. -}
catchMissingException :: Annex Bool -> Annex Bool
catchMissingException a = catchJust missing a (const $ return False)
where
missing :: AWS.HeaderException -> Maybe ()
missing e
| AWS.headerErrorMessage e == "ETag missing" = Just ()
| otherwise = Nothing
#endif
storeExportS3 :: S3HandleVar -> Remote -> S3Info -> Maybe Magic -> FilePath -> Key -> ExportLocation -> MeterUpdate -> Annex Bool
storeExportS3 hv r info magic f k loc p = fst
<$> storeExportS3' hv r info magic f k loc p
@ -614,21 +594,17 @@ genBucket c gc u = do
(S3.putBucket (bucket info))
{ S3.pbCannedAcl = acl info
, S3.pbLocationConstraint = locconstraint
#if MIN_VERSION_aws(0,13,0)
, S3.pbXStorageClass = storageclass
#endif
}
writeUUIDFile c u info h
locconstraint = mkLocationConstraint $ T.pack datacenter
datacenter = fromJust $ M.lookup "datacenter" c
#if MIN_VERSION_aws(0,13,0)
-- "NEARLINE" as a storage class when creating a bucket is a
-- nonstandard extension of Google Cloud Storage.
storageclass = case getStorageClass c of
sc@(S3.OtherStorageClass "NEARLINE") -> Just sc
_ -> Nothing
#endif
{- Writes the UUID to an annex-uuid file within the bucket.
-
@ -830,9 +806,7 @@ getBucketName = map toLower <$$> M.lookup "bucket"
getStorageClass :: RemoteConfig -> S3.StorageClass
getStorageClass c = case M.lookup "storageclass" c of
Just "REDUCED_REDUNDANCY" -> S3.ReducedRedundancy
#if MIN_VERSION_aws(0,13,0)
Just s -> S3.OtherStorageClass (T.pack s)
#endif
_ -> S3.Standard
getPartSize :: RemoteConfig -> Maybe Integer
@ -946,9 +920,7 @@ s3Info c info = catMaybes
]
where
s3c = s3Configuration c
#if MIN_VERSION_aws(0,13,0)
showstorageclass (S3.OtherStorageClass t) = T.unpack t
#endif
showstorageclass sc = show sc
getPublicWebUrls :: UUID -> S3Info -> RemoteConfig -> Key -> Annex [URLString]

View file

@ -402,7 +402,7 @@ Executable git-annex
Build-Depends: network (< 3.0.0.0), network (>= 2.6.3.0)
if flag(S3)
Build-Depends: aws (>= 0.9.2)
Build-Depends: aws (>= 0.14)
CPP-Options: -DWITH_S3
Other-Modules: Remote.S3