fixup #if 0 stubs to use #ifndef mingw32_HOST_OS
That's needed in files used to build the configure program. For the other files, I'm keeping my __WINDOWS__ define, as I find that much easier to type. I may search and replace it to use the mingw32_HOST_OS thing later.
This commit is contained in:
parent
6c74a42cc6
commit
763cbda14f
23 changed files with 48 additions and 48 deletions
|
@ -24,7 +24,7 @@ module Annex.Branch (
|
|||
) where
|
||||
|
||||
import qualified Data.ByteString.Lazy.Char8 as L
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Env
|
||||
#endif
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import Common.Annex
|
|||
import Utility.UserInfo
|
||||
import qualified Git.Config
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Env
|
||||
#endif
|
||||
import Network.BSD
|
||||
|
|
|
@ -14,7 +14,7 @@ module Annex.Ssh (
|
|||
) where
|
||||
|
||||
import qualified Data.Map as M
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Env
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import Assistant.Install.Menu
|
|||
import Control.Applicative
|
||||
import System.Directory
|
||||
import System.Environment
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.User
|
||||
import System.Posix.Files
|
||||
#endif
|
||||
|
@ -30,7 +30,7 @@ import System.FilePath
|
|||
import Data.Maybe
|
||||
|
||||
systemwideInstall :: IO Bool
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
systemwideInstall = isroot <||> destdirset
|
||||
where
|
||||
isroot = do
|
||||
|
|
|
@ -17,7 +17,7 @@ import qualified Control.Exception as E
|
|||
import qualified Data.Map as M
|
||||
import Control.Exception (throw)
|
||||
import System.Console.GetOpt
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Signals
|
||||
#endif
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import qualified Option
|
|||
import Types.Key
|
||||
import Utility.HumanTime
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Process (getProcessID)
|
||||
#endif
|
||||
import Data.Time.Clock.POSIX
|
||||
|
|
|
@ -16,7 +16,7 @@ import "MissingH" System.Path as X
|
|||
import System.FilePath as X
|
||||
import System.Directory as X
|
||||
import System.IO as X hiding (FilePath)
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Files as X
|
||||
import System.Posix.IO as X
|
||||
#endif
|
||||
|
|
2
Creds.hs
2
Creds.hs
|
@ -17,7 +17,7 @@ import Types.Remote (RemoteConfig, RemoteConfigKey)
|
|||
import Remote.Helper.Encryptable (remoteCipher, embedCreds)
|
||||
|
||||
import System.Environment
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Env (setEnv)
|
||||
#endif
|
||||
import qualified Data.ByteString.Lazy.Char8 as L
|
||||
|
|
2
Git.hs
2
Git.hs
|
@ -32,7 +32,7 @@ module Git (
|
|||
) where
|
||||
|
||||
import Network.URI (uriPath, uriScheme, unEscapeString)
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Files
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ module Git.Construct (
|
|||
checkForRepo,
|
||||
) where
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.User
|
||||
#endif
|
||||
import qualified Data.Map as M hiding (map, split)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
module Git.CurrentRepo where
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Directory (changeWorkingDirectory)
|
||||
import System.Posix.Env (getEnv, unsetEnv)
|
||||
#endif
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
module GitAnnexShell where
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Env
|
||||
#endif
|
||||
import System.Console.GetOpt
|
||||
|
|
|
@ -11,7 +11,7 @@ module Remote.Rsync (remote) where
|
|||
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
import qualified Data.Map as M
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Process (getProcessID)
|
||||
#endif
|
||||
|
||||
|
|
2
Test.hs
2
Test.hs
|
@ -13,7 +13,7 @@ import Test.HUnit
|
|||
import Test.QuickCheck
|
||||
import Test.QuickCheck.Test
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Directory (changeWorkingDirectory)
|
||||
import System.Posix.Files
|
||||
import System.Posix.Env
|
||||
|
|
|
@ -12,7 +12,7 @@ module Utility.Daemon where
|
|||
import Common
|
||||
import Utility.LogFile
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
module Utility.Directory where
|
||||
|
||||
import System.IO.Error
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Files
|
||||
#endif
|
||||
import System.Directory
|
||||
|
@ -61,7 +61,7 @@ dirContentsRecursive' (dir:dirs) = unsafeInterleaveIO $ do
|
|||
{- Moves one filename to another.
|
||||
- First tries a rename, but falls back to moving across devices if needed. -}
|
||||
moveFile :: FilePath -> FilePath -> IO ()
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
moveFile src dest = tryIO (rename src dest) >>= onrename
|
||||
where
|
||||
onrename (Right _) = noop
|
||||
|
|
|
@ -19,7 +19,7 @@ import Foreign (complement)
|
|||
{- Applies a conversion function to a file's mode. -}
|
||||
modifyFileMode :: FilePath -> (FileMode -> FileMode) -> IO ()
|
||||
modifyFileMode f convert = void $ modifyFileMode' f convert
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
modifyFileMode' :: FilePath -> (FileMode -> FileMode) -> IO FileMode
|
||||
modifyFileMode' f convert = do
|
||||
s <- getFileStatus f
|
||||
|
@ -39,7 +39,7 @@ addModes ms m = combineModes (m:ms)
|
|||
|
||||
{- Removes the specified FileModes from the input mode. -}
|
||||
removeModes :: [FileMode] -> FileMode -> FileMode
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
removeModes ms m = m `intersectFileModes` complement (combineModes ms)
|
||||
#else
|
||||
removeModes = error "removeModes TODO"
|
||||
|
@ -54,21 +54,21 @@ withModifiedFileMode file convert a = bracket setup cleanup go
|
|||
go _ = a
|
||||
|
||||
writeModes :: [FileMode]
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
writeModes = [ownerWriteMode, groupWriteMode, otherWriteMode]
|
||||
#else
|
||||
writeModes = []
|
||||
#endif
|
||||
|
||||
readModes :: [FileMode]
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
readModes = [ownerReadMode, groupReadMode, otherReadMode]
|
||||
#else
|
||||
readModes = []
|
||||
#endif
|
||||
|
||||
executeModes :: [FileMode]
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
executeModes = [ownerExecuteMode, groupExecuteMode, otherExecuteMode]
|
||||
#else
|
||||
executeModes = []
|
||||
|
@ -76,7 +76,7 @@ executeModes = []
|
|||
|
||||
{- Removes the write bits from a file. -}
|
||||
preventWrite :: FilePath -> IO ()
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
preventWrite f = modifyFileMode f $ removeModes writeModes
|
||||
#else
|
||||
preventWrite _ = return ()
|
||||
|
@ -84,7 +84,7 @@ preventWrite _ = return ()
|
|||
|
||||
{- Turns a file's owner write bit back on. -}
|
||||
allowWrite :: FilePath -> IO ()
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
allowWrite f = modifyFileMode f $ addModes [ownerWriteMode]
|
||||
#else
|
||||
allowWrite _ = return ()
|
||||
|
@ -92,7 +92,7 @@ allowWrite _ = return ()
|
|||
|
||||
{- Allows owner and group to read and write to a file. -}
|
||||
groupWriteRead :: FilePath -> IO ()
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
groupWriteRead f = modifyFileMode f $ addModes
|
||||
[ ownerWriteMode, groupWriteMode
|
||||
, ownerReadMode, groupReadMode
|
||||
|
@ -101,14 +101,14 @@ groupWriteRead f = modifyFileMode f $ addModes
|
|||
groupWriteRead _ = return ()
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
checkMode :: FileMode -> FileMode -> Bool
|
||||
checkMode checkfor mode = checkfor `intersectFileModes` mode == checkfor
|
||||
#endif
|
||||
|
||||
{- Checks if a file mode indicates it's a symlink. -}
|
||||
isSymLink :: FileMode -> Bool
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
isSymLink = checkMode symbolicLinkMode
|
||||
#else
|
||||
isSymLink _ = False
|
||||
|
@ -116,7 +116,7 @@ isSymLink _ = False
|
|||
|
||||
{- Checks if a file has any executable bits set. -}
|
||||
isExecutable :: FileMode -> Bool
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
isExecutable mode = combineModes executeModes `intersectFileModes` mode /= 0
|
||||
#else
|
||||
isExecutable _ = False
|
||||
|
@ -125,7 +125,7 @@ isExecutable _ = False
|
|||
{- Runs an action without that pesky umask influencing it, unless the
|
||||
- passed FileMode is the standard one. -}
|
||||
noUmask :: FileMode -> IO a -> IO a
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
noUmask mode a
|
||||
| mode == stdFileMode = a
|
||||
| otherwise = bracket setup cleanup go
|
||||
|
@ -138,7 +138,7 @@ noUmask _ a = a
|
|||
#endif
|
||||
|
||||
combineModes :: [FileMode] -> FileMode
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
combineModes [] = undefined
|
||||
combineModes [m] = m
|
||||
combineModes (m:ms) = foldl unionFileModes m ms
|
||||
|
@ -150,7 +150,7 @@ stickyMode :: FileMode
|
|||
stickyMode = 512
|
||||
|
||||
isSticky :: FileMode -> Bool
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
isSticky = checkMode stickyMode
|
||||
#else
|
||||
isSticky _ = False
|
||||
|
@ -166,7 +166,7 @@ setSticky f = modifyFileMode f $ addModes [stickyMode]
|
|||
- as writeFile.
|
||||
-}
|
||||
writeFileProtected :: FilePath -> String -> IO ()
|
||||
#if 0
|
||||
#ifndef __WINDOWS__
|
||||
writeFileProtected file content = do
|
||||
h <- openFile file WriteMode
|
||||
void $ tryIO $
|
||||
|
|
|
@ -13,7 +13,7 @@ import System.Posix.Types
|
|||
import Control.Applicative
|
||||
import Control.Concurrent
|
||||
import Control.Exception (bracket)
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Env (setEnv, unsetEnv, getEnv)
|
||||
#endif
|
||||
|
||||
|
@ -216,7 +216,7 @@ keyBlock public ls = unlines
|
|||
| public = "PUBLIC"
|
||||
| otherwise = "PRIVATE"
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
{- Runs an action using gpg in a test harness, in which gpg does
|
||||
- not use ~/.gpg/, but a directory with the test key set up to be used. -}
|
||||
testHarness :: IO a -> IO a
|
||||
|
|
|
@ -11,7 +11,7 @@ module Utility.LogFile where
|
|||
|
||||
import Common
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix
|
||||
#endif
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import Foreign
|
|||
import Data.Char
|
||||
import Data.List
|
||||
import Control.Applicative
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Process (getAnyProcessStatus)
|
||||
#endif
|
||||
|
||||
|
@ -122,7 +122,7 @@ hGetSomeString h sz = do
|
|||
peekbytes :: Int -> Ptr Word8 -> IO [Word8]
|
||||
peekbytes len buf = mapM (peekElemOff buf) [0..pred len]
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
{- Reaps any zombie git processes.
|
||||
-
|
||||
- Warning: Not thread safe. Anything that was expecting to wait
|
||||
|
|
|
@ -42,7 +42,7 @@ import Control.Concurrent
|
|||
import qualified Control.Exception as E
|
||||
import Control.Monad
|
||||
import Data.Maybe
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.IO
|
||||
#endif
|
||||
|
||||
|
@ -158,7 +158,7 @@ createBackgroundProcess p a = a =<< createProcess p
|
|||
- returns a transcript combining its stdout and stderr, and
|
||||
- whether it succeeded or failed. -}
|
||||
processTranscript :: String -> [String] -> (Maybe String) -> IO (String, Bool)
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
processTranscript cmd opts input = do
|
||||
(readf, writef) <- createPipe
|
||||
readh <- fdToHandle readf
|
||||
|
|
|
@ -11,7 +11,7 @@ module Utility.TempFile where
|
|||
|
||||
import Control.Exception (bracket)
|
||||
import System.IO
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Process
|
||||
#endif
|
||||
import System.Directory
|
||||
|
@ -24,7 +24,7 @@ import System.FilePath
|
|||
- then moving it into place. The temp file is stored in the same
|
||||
- directory as the final file to avoid cross-device renames. -}
|
||||
viaTmp :: (FilePath -> String -> IO ()) -> FilePath -> String -> IO ()
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
viaTmp a file content = do
|
||||
pid <- getProcessID
|
||||
let tmpfile = file ++ ".tmp" ++ show pid
|
||||
|
@ -52,7 +52,7 @@ withTempFile template a = bracket create remove use
|
|||
{- Runs an action with a temp directory, then removes the directory and
|
||||
- all its contents. -}
|
||||
withTempDir :: Template -> (FilePath -> IO a) -> IO a
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
withTempDir template = bracket create remove
|
||||
where
|
||||
remove = removeDirectoryRecursive
|
||||
|
|
|
@ -14,7 +14,7 @@ module Utility.UserInfo (
|
|||
) where
|
||||
|
||||
import Control.Applicative
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.User
|
||||
import System.Posix.Env
|
||||
#endif
|
||||
|
@ -23,7 +23,7 @@ import System.Posix.Env
|
|||
-
|
||||
- getpwent will fail on LDAP or NIS, so use HOME if set. -}
|
||||
myHomeDir :: IO FilePath
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
myHomeDir = myVal ["HOME"] homeDirectory
|
||||
#else
|
||||
myHomeDir = error "myHomeDir TODO"
|
||||
|
@ -31,7 +31,7 @@ myHomeDir = error "myHomeDir TODO"
|
|||
|
||||
{- Current user's user name. -}
|
||||
myUserName :: IO String
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
myUserName = myVal ["USER", "LOGNAME"] userName
|
||||
#else
|
||||
myUserName = error "myUserName TODO"
|
||||
|
@ -41,14 +41,14 @@ myUserGecos :: IO String
|
|||
#ifdef __ANDROID__
|
||||
myUserGecos = return "" -- userGecos crashes on Android
|
||||
#else
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
myUserGecos = myVal [] userGecos
|
||||
#else
|
||||
myUserGecos = error "myUserGecos TODO"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifndef mingw32_HOST_OS
|
||||
myVal :: [String] -> (UserEntry -> String) -> IO String
|
||||
myVal envvars extract = maybe (extract <$> getpwent) return =<< check envvars
|
||||
where
|
||||
|
|
Loading…
Add table
Reference in a new issue