So these special remotes are always supported.
IIRC these build flags were added because the dep chains were a bit too
long, or perhaps because the libraries were not available in Debian stable,
or something like that. That was long ago, those reasons no longer apply,
and users get confused when builtin special remotes are not available, so
it seems best to remove the build flags now.
If this does cause a problem it can be reverted of course..
This commit was sponsored by Jochen Bartl on Patreon.
- Licensed under the GNU AGPL version 3 or higher.
-}
-{-# LANGUAGE CPP, QuasiQuotes, TemplateHaskell, OverloadedStrings #-}
+{-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedStrings #-}
module Assistant.WebApp.Configurators.AWS where
import Assistant.WebApp.Common
import Assistant.WebApp.MakeRemote
-#ifdef WITH_S3
import qualified Remote.S3 as S3
import Logs.Remote
import qualified Remote
import qualified Types.Remote as Remote
-#endif
import qualified Remote.Glacier as Glacier
import qualified Remote.Helper.AWS as AWS
import Types.Remote (RemoteConfig)
getAddS3R = postAddS3R
postAddS3R :: Handler Html
-#ifdef WITH_S3
postAddS3R = awsConfigurator $ do
defcreds <- liftAnnex previouslyUsedAWSCreds
((result, form), enctype) <- liftH $
, (Proposed "chunk", Proposed "1MiB")
]
_ -> $(widgetFile "configurators/adds3")
-#else
-postAddS3R = giveup "S3 not supported by this build"
-#endif
getAddGlacierR :: Handler Html
getAddGlacierR = postAddGlacierR
postAddGlacierR :: Handler Html
-#ifdef WITH_S3
postAddGlacierR = glacierConfigurator $ do
defcreds <- liftAnnex previouslyUsedAWSCreds
((result, form), enctype) <- liftH $
, (Proposed "datacenter", Proposed $ T.unpack $ datacenter input)
]
_ -> $(widgetFile "configurators/addglacier")
-#else
-postAddGlacierR = giveup "S3 not supported by this build"
-#endif
getEnableS3R :: UUID -> Handler Html
-#ifdef WITH_S3
getEnableS3R uuid = do
m <- liftAnnex readRemoteLog
isia <- case M.lookup uuid m of
if isia
then redirect $ EnableIAR uuid
else postEnableS3R uuid
-#else
-getEnableS3R = postEnableS3R
-#endif
postEnableS3R :: UUID -> Handler Html
-#ifdef WITH_S3
postEnableS3R uuid = awsConfigurator $ enableAWSRemote S3.remote uuid
-#else
-postEnableS3R _ = giveup "S3 not supported by this build"
-#endif
getEnableGlacierR :: UUID -> Handler Html
getEnableGlacierR = postEnableGlacierR
postEnableGlacierR = glacierConfigurator . enableAWSRemote Glacier.remote
enableAWSRemote :: RemoteType -> UUID -> Widget
-#ifdef WITH_S3
enableAWSRemote remotetype uuid = do
defcreds <- liftAnnex previouslyUsedAWSCreds
((result, form), enctype) <- liftH $
description <- liftAnnex $
T.pack <$> Remote.prettyUUID uuid
$(widgetFile "configurators/enableaws")
-#else
-enableAWSRemote _ _ = giveup "S3 not supported by this build"
-#endif
makeAWSRemote :: SpecialRemoteMaker -> RemoteType -> StandardGroup -> AWSCreds -> RemoteName -> RemoteConfig -> Handler ()
makeAWSRemote maker remotetype defaultgroup (AWSCreds ak sk) name config =
where
bucket = maybe "" fromProposedAccepted $ M.lookup (Accepted "bucket") c
-#ifdef WITH_S3
previouslyUsedAWSCreds :: Annex (Maybe CredPair)
previouslyUsedAWSCreds = getM gettype [S3.remote, Glacier.remote]
where
gettype t = previouslyUsedCredPair AWS.creds t $
not . S3.configIA . Remote.config
-#endif
- Licensed under the GNU AGPL version 3 or higher.
-}
-{-# LANGUAGE CPP, QuasiQuotes, TemplateHaskell, OverloadedStrings #-}
+{-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
module Assistant.WebApp.Configurators.Edit where
import Assistant.Sync
import Assistant.Alert
import qualified Assistant.WebApp.Configurators.AWS as AWS
-#ifdef WITH_S3
import qualified Assistant.WebApp.Configurators.IA as IA
import qualified Remote.S3 as S3
-#endif
import qualified Remote
import qualified Types.Remote as Remote
import Remote.List.Util
getRepoInfo :: Maybe Remote.Remote -> Remote.RemoteConfig -> Widget
getRepoInfo (Just r) c = case fromProposedAccepted <$> M.lookup typeField c of
Just "S3" -> do
-#ifdef WITH_S3
pc <- liftAnnex $ parsedRemoteConfig S3.remote c
if S3.configIA pc
then IA.getRepoInfo c
else AWS.getRepoInfo c
-#else
- AWS.getRepoInfo c
-#endif
Just t
| t /= "git" -> [whamlet|#{t} remote|]
_ -> getGitRepoInfo =<< liftAnnex (Remote.getRepo r)
- Licensed under the GNU AGPL version 3 or higher.
-}
-{-# LANGUAGE CPP, QuasiQuotes, TemplateHaskell, OverloadedStrings #-}
+{-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedStrings #-}
module Assistant.WebApp.Configurators.IA where
import Assistant.WebApp.Common
import qualified Assistant.WebApp.Configurators.AWS as AWS
-#ifdef WITH_S3
import qualified Remote.S3 as S3
import qualified Remote.Helper.AWS as AWS
import Assistant.WebApp.MakeRemote
import Types.StandardGroups
import Logs.Remote
import Assistant.Gpg
-#endif
import Types.Remote (RemoteConfig)
import qualified Annex.Url as Url
import Creds
<$> accessKeyIDFieldWithHelp (T.pack . fst <$> defcreds)
<*> AWS.secretAccessKeyField (T.pack . snd <$> defcreds)
-#ifdef WITH_S3
previouslyUsedIACreds :: Annex (Maybe CredPair)
previouslyUsedIACreds = previouslyUsedCredPair AWS.creds S3.remote $
S3.configIA . Remote.config
-#endif
accessKeyIDFieldWithHelp :: Maybe Text -> MkAForm Text
accessKeyIDFieldWithHelp = AWS.accessKeyIDField help
getAddIAR = postAddIAR
postAddIAR :: Handler Html
-#ifdef WITH_S3
postAddIAR = iaConfigurator $ do
defcreds <- liftAnnex previouslyUsedIACreds
((result, form), enctype) <- liftH $
AWS.makeAWSRemote initSpecialRemote S3.remote PublicGroup (extractCreds input) name $
M.fromList $ configureEncryption NoEncryption : c
_ -> $(widgetFile "configurators/addia")
-#else
-postAddIAR = giveup "S3 not supported by this build"
-#endif
getEnableIAR :: UUID -> Handler Html
getEnableIAR = postEnableIAR
postEnableIAR :: UUID -> Handler Html
-#ifdef WITH_S3
postEnableIAR = iaConfigurator . enableIARemote
-#else
-postEnableIAR _ = giveup "S3 not supported by this build"
-#endif
-#ifdef WITH_S3
enableIARemote :: UUID -> Widget
enableIARemote uuid = do
defcreds <- liftAnnex previouslyUsedIACreds
description <- liftAnnex $
T.pack <$> Remote.prettyUUID uuid
$(widgetFile "configurators/enableia")
-#endif
{- Convert a description into a bucket item name, which will also be
- used as the repository name, and the preferreddir.
|]
where
bucket = maybe "" fromProposedAccepted $ M.lookup (Accepted "bucket") c
-#ifdef WITH_S3
url = S3.iaItemUrl bucket
-#else
- url = case bucket of
- _ -> ""
-#endif
- Licensed under the GNU AGPL version 3 or higher.
-}
-{-# LANGUAGE CPP, TemplateHaskell, OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell, OverloadedStrings #-}
module Assistant.WebApp.Configurators.WebDAV where
import Assistant.WebApp.Common
import Creds
-#ifdef WITH_WEBDAV
import qualified Remote.WebDAV as WebDAV
import Assistant.WebApp.MakeRemote
import qualified Remote
import Types.ProposedAccepted
import qualified Data.Map as M
-#endif
import qualified Data.Text as T
import Network.URI
getEnableWebDAVR :: UUID -> Handler Html
getEnableWebDAVR = postEnableWebDAVR
postEnableWebDAVR :: UUID -> Handler Html
-#ifdef WITH_WEBDAV
postEnableWebDAVR uuid = do
m <- liftAnnex readRemoteLog
let c = fromJust $ M.lookup uuid m
description <- liftAnnex $
T.pack <$> Remote.prettyUUID uuid
$(widgetFile "configurators/enablewebdav")
-#else
-postEnableWebDAVR _ = giveup "WebDAV not supported by this build"
-#endif
-#ifdef WITH_WEBDAV
makeWebDavRemote :: SpecialRemoteMaker -> RemoteName -> CredPair -> RemoteConfig -> Handler ()
makeWebDavRemote maker name creds c =
setupCloudRemote TransferGroup Nothing $
samehost r = case urlHost =<< WebDAV.configUrl (config r) of
Nothing -> False
Just h -> h == hostname
-#endif
urlHost :: String -> Maybe String
urlHost url = uriRegName <$> (uriAuthority =<< parseURI url)
- Licensed under the GNU AGPL version 3 or higher.
-}
-{-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedStrings, CPP #-}
+{-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedStrings #-}
module Assistant.WebApp.RepoList where
findinfo m g u = case fromProposedAccepted <$> getconfig (Accepted "type") of
Just "rsync" -> val True EnableRsyncR
Just "directory" -> val False EnableDirectoryR
-#ifdef WITH_S3
Just "S3" -> val True EnableS3R
-#endif
Just "glacier" -> val True EnableGlacierR
-#ifdef WITH_WEBDAV
Just "webdav" -> val True EnableWebDAVR
-#endif
Just "gcrypt" ->
-- Skip gcrypt repos on removable drives;
-- handled separately.
#else
#warning Building without local pairing.
#endif
-#ifdef WITH_S3
- , "S3"
-#else
-#warning Building without S3.
-#endif
-#ifdef WITH_WEBDAV
- , "WebDAV"
-#else
-#warning Building without WebDAV.
-#endif
#ifdef WITH_INOTIFY
, "Inotify"
#endif
-- listed.
, "Feeds"
, "Testsuite"
+ , "S3"
+ , "WebDAV"
]
-- Not a complete list, let alone a listing transitive deps, but only
, ("http-client", VERSION_http_client)
, ("persistent-sqlite", VERSION_persistent_sqlite)
, ("cryptonite", VERSION_cryptonite)
-#ifdef WITH_S3
, ("aws", VERSION_aws)
-#endif
-#ifdef WITH_WEBDAV
, ("DAV", VERSION_DAV)
-#endif
#ifdef WITH_TORRENTPARSER
, ("torrent", VERSION_torrent)
#endif
(This is not done when automatic merge conflict resolution is disabled.)
* resolvemerge: Improve cleanup of cruft left in the working tree
by a conflicted merge.
+ * Removed the S3 and WebDAV build flags so these special remotes are
+ always supported.
-- Joey Hess <id@joeyh.name> Fri, 14 Aug 2020 14:57:45 -0400
- Licensed under the GNU AGPL version 3 or higher.
-}
-{-# LANGUAGE CPP #-}
-
module Remote.List where
import qualified Data.Map as M
import qualified Remote.Git
import qualified Remote.GCrypt
import qualified Remote.P2P
-#ifdef WITH_S3
import qualified Remote.S3
-#endif
import qualified Remote.Bup
import qualified Remote.Directory
import qualified Remote.Rsync
import qualified Remote.Web
import qualified Remote.BitTorrent
-#ifdef WITH_WEBDAV
import qualified Remote.WebDAV
-#endif
import qualified Remote.Adb
import qualified Remote.Tahoe
import qualified Remote.Glacier
[ Remote.Git.remote
, Remote.GCrypt.remote
, Remote.P2P.remote
-#ifdef WITH_S3
, Remote.S3.remote
-#endif
, Remote.Bup.remote
, Remote.Directory.remote
, Remote.Rsync.remote
, Remote.Web.remote
, Remote.BitTorrent.remote
-#ifdef WITH_WEBDAV
, Remote.WebDAV.remote
-#endif
, Remote.Adb.remote
, Remote.Tahoe.remote
, Remote.Glacier.remote
Probably guix needs to package the [DAV library](http://hackage.haskell.org/package/DAV)
or add it to the dependencies of the package such that it's available
to build with.
+
+Actually, I've gone ahead and removed the build flag in the next git-annex
+version, so it will always be required to build.
"""]]
templates/controlmenu.hamlet
templates/notifications/longpolling.julius
-Flag S3
- Description: Enable S3 support
-
-Flag WebDAV
- Description: Enable WebDAV support
-
Flag Assistant
Description: Enable git-annex assistant and watch command
tasty (>= 0.7),
tasty-hunit,
tasty-quickcheck,
- tasty-rerun
+ tasty-rerun,
+ aws (>= 0.20),
+ DAV (>= 1.0)
CC-Options: -Wall
GHC-Options: -Wall -fno-warn-tabs -Wincomplete-uni-patterns
Default-Language: Haskell98
else
Other-Modules: Utility.HttpManagerRestricted
- if flag(S3)
- Build-Depends: aws (>= 0.20)
- CPP-Options: -DWITH_S3
- Other-Modules: Remote.S3
-
- if flag(WebDAV)
- Build-Depends: DAV (>= 1.0)
- CPP-Options: -DWITH_WEBDAV
- Other-Modules:
- Remote.WebDAV
- Remote.WebDAV.DavLocation
-
- if flag(S3) || flag(WebDAV)
- Other-Modules:
- Remote.Helper.Http
-
if flag(Assistant) && ! os(solaris) && ! os(gnu)
Build-Depends: mountpoints
CPP-Options: -DWITH_ASSISTANT
Remote.Helper.ExportImport
Remote.Helper.Git
Remote.Helper.Hooks
+ Remote.Helper.Http
Remote.Helper.Messages
Remote.Helper.P2P
Remote.Helper.ReadOnly
Remote.P2P
Remote.Rsync
Remote.Rsync.RsyncUrl
+ Remote.S3
Remote.Tahoe
Remote.Web
+ Remote.WebDAV
+ Remote.WebDAV.DavLocation
RemoteDaemon.Common
RemoteDaemon.Core
RemoteDaemon.Transport
production: true
assistant: true
pairing: true
- s3: true
- webdav: true
torrentparser: true
webapp: true
magicmime: false
production: true
assistant: true
pairing: true
- s3: true
- webdav: true
torrentparser: true
webapp: true
magicmime: false
production: true
assistant: true
pairing: true
- s3: true
- webdav: true
torrentparser: true
webapp: true
magicmime: true