38d691a10f
Running git-annex linux builds in termux seems to work well enough that the only reason to keep the Android app would be to support Android 4-5, which the old Android app supported, and which I don't know if the termux method works on (although I see no reason why it would not). According to [1], Android 4-5 remains on around 29% of devices, down from 51% one year ago. [1] https://www.statista.com/statistics/271774/share-of-android-platforms-on-mobile-devices-with-android-os/ This is a rather large commit, but mostly very straightfoward removal of android ifdefs and patches and associated cruft. Also, removed support for building with very old ghc < 8.0.1, and with yesod < 1.4.3, and without concurrent-output, which were only being used by the cross build. Some documentation specific to the Android app (screenshots etc) needs to be updated still. This commit was sponsored by Brett Eisenberg on Patreon.
50 lines
1.7 KiB
Haskell
50 lines
1.7 KiB
Haskell
{- git-annex environment
|
|
-
|
|
- Copyright 2012, 2013 Joey Hess <id@joeyh.name>
|
|
-
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
-}
|
|
|
|
module Annex.Environment where
|
|
|
|
import Annex.Common
|
|
import Utility.UserInfo
|
|
import qualified Git.Config
|
|
import Config
|
|
import Utility.Env.Set
|
|
|
|
{- Checks that the system's environment allows git to function.
|
|
- Git requires a GECOS username, or suitable git configuration, or
|
|
- environment variables.
|
|
-
|
|
- Git also requires the system have a hostname containing a dot.
|
|
- Otherwise, it tries various methods to find a FQDN, and will fail if it
|
|
- does not. To avoid replicating that code here, which would break if its
|
|
- methods change, this function does not check the hostname is valid.
|
|
- Instead, code that commits can use ensureCommit.
|
|
-}
|
|
checkEnvironment :: Annex ()
|
|
checkEnvironment = do
|
|
gitusername <- fromRepo $ Git.Config.getMaybe "user.name"
|
|
when (isNothing gitusername || gitusername == Just "") $
|
|
liftIO checkEnvironmentIO
|
|
|
|
checkEnvironmentIO :: IO ()
|
|
checkEnvironmentIO = whenM (isNothing <$> myUserGecos) $ do
|
|
username <- either (const "unknown") id <$> myUserName
|
|
ensureEnv "GIT_AUTHOR_NAME" username
|
|
ensureEnv "GIT_COMMITTER_NAME" username
|
|
where
|
|
-- existing environment is not overwritten
|
|
ensureEnv var val = setEnv var val False
|
|
|
|
{- Runs an action that commits to the repository, and if it fails,
|
|
- sets user.email and user.name to a dummy value and tries the action again. -}
|
|
ensureCommit :: Annex a -> Annex a
|
|
ensureCommit a = either retry return =<< tryNonAsync a
|
|
where
|
|
retry _ = do
|
|
name <- liftIO $ either (const "unknown") id <$> myUserName
|
|
setConfig (ConfigKey "user.name") name
|
|
setConfig (ConfigKey "user.email") name
|
|
a
|