fix windows assistant upgrade glitch

Prevent windows assistant from trying (and failing) to upgrade itself,
which has never been supported on windows.

The new windows build is made with UPGRADE_LOCATION set, which enabled this
code path that had never run on windows before, and doesn't work. I don't
want to try to support self-upgrade on windows, or generally on other OS's
than the ones where its working, so added a check for that. This way the
build can keep setting UPGRADE_LOCATION and if some later git-annex does
learn how to upgrade itself on some OS, it won't need changing the build
setup.
This commit is contained in:
Joey Hess 2020-11-19 12:50:25 -04:00
parent 4b739fc460
commit b3c88da181
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 20 additions and 3 deletions

View file

@ -31,7 +31,7 @@ import qualified Data.Text as T
upgraderThread :: UrlRenderer -> NamedThread
upgraderThread urlrenderer = namedThread "Upgrader" $
when (isJust BuildInfo.upgradelocation) $ do
when upgradeSupported $ do
{- Check for upgrade on startup, unless it was just
- upgraded. -}
unlessM (liftIO checkSuccessfulUpgrade) $

View file

@ -338,6 +338,18 @@ distributionInfoUrl = fromJust BuildInfo.upgradelocation ++ ".info"
distributionInfoSigUrl :: String
distributionInfoSigUrl = distributionInfoUrl ++ ".sig"
{- Upgrade only supported on linux and OSX. -}
upgradeSupported :: Bool
#ifdef linux_HOST_OS
upgradeSupported = isJust BuildInfo.upgradelocation
#else
#ifdef darwin_HOST_OS
upgradeSupported = isJust BuildInfo.upgradelocation
#else
upgradeSupported = False
#endif
#endif
{- Verifies that a file from the git-annex distribution has a valid
- signature. Pass the detached .sig file; the file to be verified should
- be located next to it.

View file

@ -21,7 +21,7 @@ import Annex.NumCopies
import Utility.DataUnits
import Git.Config
import Types.Distribution
import qualified BuildInfo
import Assistant.Upgrade
import qualified Data.Text as T
import qualified System.FilePath.ByteString as P
@ -59,7 +59,7 @@ prefsAForm d = PrefsForm
, ("disabled", NoAutoUpgrade)
]
autoUpgradeLabel
| isJust BuildInfo.upgradelocation = "Auto upgrade"
| upgradeSupported = "Auto upgrade"
| otherwise = "Auto restart on upgrade"
positiveIntField = check isPositive intField