provided by external commands git-annex-p2p-<netname>
* Added git-remote-p2p-annex, which allows git pull and push to
P2P networks provided by commands git-annex-p2p-<netname>
- * stack.yaml: Update to lts-24.2.
* S3: Default to signature=v4 when using an AWS endpoint, since some
AWS regions need v4 and all support it. When host= is used to specify
a different S3 host, the default remains signature=v2.
* S3: When initremote is given the name of a bucket that already exists,
automatically set datacenter to the right value, rather than needing it
to be explicitly set. (This needs aws-0.23)
+ * Bump aws build dependency to 0.24.1.
+ * stack.yaml: Update to lts-24.2.
-- Joey Hess <id@joeyh.name> Wed, 30 Jul 2025 13:45:42 -0400
giveup "cannot download content"
Right us -> unlessM (withUrlOptions Nothing $ downloadUrl False k p iv us f) $
giveup "failed to download content"
- Left S3HandleAnonymousOldAws -> giveupS3HandleProblem S3HandleAnonymousOldAws (uuid r)
retrieveHelper :: S3Info -> S3Handle -> (Either S3.Object S3VersionID) -> OsPath -> MeterUpdate -> Maybe IncrementalVerifier -> Annex ()
retrieveHelper info h loc f p iv = retrieveHelper' h f p iv $
let check u = withUrlOptions Nothing $
Url.checkBoth u (fromKey keySize k)
anyM check us
- Left S3HandleAnonymousOldAws -> giveupS3HandleProblem S3HandleAnonymousOldAws (uuid r)
checkKeyHelper :: S3Info -> S3Handle -> (Either S3.Object S3VersionID) -> Annex Bool
checkKeyHelper info h loc = checkKeyHelper' info h o limit
withUrlOptions Nothing
(Url.download' p iv (geturl exportloc) f)
Nothing -> giveup $ needS3Creds (uuid r)
- Left S3HandleAnonymousOldAws -> giveupS3HandleProblem S3HandleAnonymousOldAws (uuid r)
where
exportloc = bucketExportLocation info loc
Just geturl -> withUrlOptions Nothing $
Url.checkBoth (geturl $ bucketExportLocation info loc) (fromKey keySize k)
Nothing -> giveupS3HandleProblem S3HandleNeedCreds (uuid r)
- Left S3HandleAnonymousOldAws -> giveupS3HandleProblem S3HandleAnonymousOldAws (uuid r)
-- S3 has no move primitive; copy and delete.
renameExportS3 :: S3HandleVar -> Remote -> RemoteStateHandle -> S3Info -> Key -> ExportLocation -> ExportLocation -> Annex (Maybe ())
getBucketLocation :: ParsedRemoteConfig -> RemoteGitConfig -> UUID -> Annex (Maybe S3.LocationConstraint)
getBucketLocation c gc u = do
-#if MIN_VERSION_aws(0,23,0)
info <- extractS3Info c
let info' = info { region = Nothing, host = Nothing }
-- Force anonymous access, because this API call does not work
r <- liftIO $ tryNonAsync $ runResourceT $
sendS3Handle h (S3.getBucketLocation $ bucket info')
return $ either (const Nothing) (Just . S3.gblrLocationConstraint) r
-#else
- return Nothing
-#endif
{- Generate the bucket if it does not already exist, including creating the
- UUID file within the bucket.
type S3HandleVar = TVar (Either (Annex (Either S3HandleProblem S3Handle)) (Either S3HandleProblem S3Handle))
-data S3HandleProblem
- = S3HandleNeedCreds
- | S3HandleAnonymousOldAws
+data S3HandleProblem = S3HandleNeedCreds
giveupS3HandleProblem :: S3HandleProblem -> UUID -> Annex a
giveupS3HandleProblem S3HandleNeedCreds u = do
warning $ UnquotedString $ needS3Creds u
giveup "No S3 credentials configured"
-giveupS3HandleProblem S3HandleAnonymousOldAws _ =
- giveup "This S3 special remote is configured with signature=anonymous, but git-annex is built with too old a version of the aws library to support that."
{- Prepares a S3Handle for later use. Does not connect to S3 or do anything
- else expensive. -}
mkS3HandleVar :: Bool -> ParsedRemoteConfig -> RemoteGitConfig -> UUID -> Annex S3HandleVar
mkS3HandleVar forceanonymous c gc u = liftIO $ newTVarIO $ Left $
if forceanonymous || isAnonymous c
- then
-#if MIN_VERSION_aws(0,23,0)
- go =<< liftIO AWS.anonymousCredentials
-#else
- return (Left S3HandleAnonymousOldAws)
-#endif
+ then go =<< liftIO AWS.anonymousCredentials
else do
mcreds <- getRemoteCredPair c gc (AWS.creds u)
case mcreds of
| otherwise -> AWS.HTTP
cfg = if usev4 $ getRemoteConfigValue signatureField c
then (S3.s3v4 proto endpoint False S3.SignWithEffort)
-#if MIN_VERSION_aws(0,24,0)
{ S3.s3Region = r }
-#endif
else (S3.s3 proto endpoint False)
-#if MIN_VERSION_aws(0,24,0)
{ S3.s3Region = r }
-- Use signature v4 for all AWS hosts by default, but don't use it by
usev4 Nothing = False
r = encodeBS <$> getRemoteConfigValue regionField c
-#endif
data S3Info = S3Info
{ bucket :: S3.Bucket
s3Info c info = catMaybes
[ Just ("bucket", fromMaybe "unknown" (getBucketName c))
, Just ("endpoint", decodeBS (S3.s3Endpoint s3c))
-#if MIN_VERSION_aws(0,24,0)
, case S3.s3Region s3c of
Nothing -> Nothing
Just r -> Just ("region", decodeBS r)
-#endif
, Just ("port", show (S3.s3Port s3c))
, Just ("protocol", map toLower (show (S3.s3Protocol s3c)))
, Just ("storage class", showstorageclass (getStorageClass c))
When using Amazon S3,
if the remote will be used for backup or archival,
and so its files are Infrequently Accessed, `STANDARD_IA` is a
- good choice to save money (requires a git-annex built with aws-0.13.0).
+ good choice to save money.
If you have configured git-annex to preserve
multiple [[copies]], also consider setting this to `ONEZONE_IA`
to save even more money.
use the [[glacier]] special remote, rather than this one.
When using Google Cloud Storage, to make a nearline bucket, set this to
- `NEARLINE`. (Requires a git-annex built with aws-0.13.0)
+ `NEARLINE`.
Note that changing the storage class of an existing S3 remote will
affect new objects sent to the remote, but not objects already
* `region` - Specify the region to use. Only makes sense to use when
you also set `host`.
- (Requires a git-annex built with aws-0.24.)
* `protocol` - Either "http" (the default) or "https". Setting
protocol=https implies port=443.