From 53fd746705a6f68d40c4f353bacfa78e35bf9fc7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 12 Sep 2019 14:11:19 -0400 Subject: [PATCH] avoid some build warnings on windows --- Annex/Init.hs | 2 +- Build/BundledPrograms.hs | 2 ++ Command/EnableTor.hs | 4 ++++ Remote/Git.hs | 8 ++++++-- Utility/InodeCache.hs | 2 ++ Utility/Path/Max.hs | 2 -- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Annex/Init.hs b/Annex/Init.hs index 1d4c4c8008..bcfe017757 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -48,10 +48,10 @@ import Annex.Perms import Utility.FileMode import System.Posix.User import qualified Utility.LockFile.Posix as Posix +import Data.Either #endif import qualified Data.Map as M -import Data.Either checkCanInitialize :: Annex a -> Annex a checkCanInitialize a = inRepo (noAnnexFileContent . Git.repoWorkTree) >>= \case diff --git a/Build/BundledPrograms.hs b/Build/BundledPrograms.hs index 3af2b1e9da..096eeee29f 100644 --- a/Build/BundledPrograms.hs +++ b/Build/BundledPrograms.hs @@ -83,5 +83,7 @@ preferredBundledPrograms = catMaybes -- its kernel, and avoid using them if not available. ] where +#ifndef mingw32_HOST_OS ifset True s = Just s ifset False _ = Nothing +#endif diff --git a/Command/EnableTor.hs b/Command/EnableTor.hs index f05fccea4d..1807660dd6 100644 --- a/Command/EnableTor.hs +++ b/Command/EnableTor.hs @@ -41,7 +41,11 @@ seek = withWords (commandAction . start) -- This runs as root, so avoid making any commits or initializing -- git-annex, or doing other things that create root-owned files. start :: [String] -> CommandStart +#ifndef mingw32_HOST_OS start os = do +#else +start _os = do +#endif uuid <- getUUID when (uuid == NoUUID) $ giveup "This can only be run in a git-annex repository." diff --git a/Remote/Git.hs b/Remote/Git.hs index 2b516a9442..e184aebca2 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -42,7 +42,6 @@ import qualified CmdLine.GitAnnexShell.Fields as Fields import Logs.Location import Utility.Metered import Utility.CopyFile -import Utility.FileMode import Utility.Env import Utility.Batch import Utility.SimpleProtocol @@ -61,6 +60,10 @@ import Types.NumCopies import Annex.Action import Messages.Progress +#ifndef mingw32_HOST_OS +import Utility.FileMode +#endif + import Control.Concurrent import Control.Concurrent.MSampleVar import qualified Data.Map as M @@ -719,13 +722,14 @@ newCopyCoWTried = CopyCoWTried <$> newEmptyMVar {- Copys a file. Uses copy-on-write if it is supported. Otherwise, - uses rsync, so that interrupted copies can be resumed. -} rsyncOrCopyFile :: State -> [CommandParam] -> FilePath -> FilePath -> MeterUpdate -> Annex Bool -rsyncOrCopyFile st rsyncparams src dest p = #ifdef mingw32_HOST_OS +rsyncOrCopyFile _st _rsyncparams src dest p = -- rsync is only available on Windows in some installation methods, -- and is not strictly needed here, so don't use it. docopywith copyFileExternal where #else +rsyncOrCopyFile st rsyncparams src dest p = -- If multiple threads reach this at the same time, they -- will both try CoW, which is acceptable. ifM (liftIO $ isEmptyMVar copycowtried) diff --git a/Utility/InodeCache.hs b/Utility/InodeCache.hs index af39219b3b..fca478ff87 100644 --- a/Utility/InodeCache.hs +++ b/Utility/InodeCache.hs @@ -170,7 +170,9 @@ genInodeCache f delta = catchDefaultIO Nothing $ toInodeCache :: TSDelta -> FilePath -> FileStatus -> IO (Maybe InodeCache) toInodeCache (TSDelta getdelta) f s | isRegularFile s = do +#ifndef mingw32_HOST_OS delta <- getdelta +#endif sz <- getFileSize' f s #ifdef mingw32_HOST_OS mtime <- MTimeHighRes . utcTimeToPOSIXSeconds <$> getModificationTime f diff --git a/Utility/Path/Max.hs b/Utility/Path/Max.hs index 8ae35dfba7..49e65d38b0 100644 --- a/Utility/Path/Max.hs +++ b/Utility/Path/Max.hs @@ -10,8 +10,6 @@ module Utility.Path.Max where -import System.FilePath - #ifndef mingw32_HOST_OS import Utility.Exception import System.Posix.Files