merge changes from git-annex
This commit is contained in:
parent
626f1af56f
commit
353d3e888b
|
@ -5,6 +5,8 @@
|
||||||
- License: BSD-2-clause
|
- License: BSD-2-clause
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Data where
|
module Utility.Data where
|
||||||
|
|
||||||
{- First item in the list that is not Nothing. -}
|
{- First item in the list that is not Nothing. -}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Directory where
|
module Utility.Directory where
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ import Control.Applicative
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import System.IO.Unsafe (unsafeInterleaveIO)
|
import System.IO.Unsafe (unsafeInterleaveIO)
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Prelude
|
||||||
|
|
||||||
#ifdef mingw32_HOST_OS
|
#ifdef mingw32_HOST_OS
|
||||||
import qualified System.Win32 as Win32
|
import qualified System.Win32 as Win32
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Env where
|
module Utility.Env where
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ module Utility.Env where
|
||||||
import Utility.Exception
|
import Utility.Exception
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Prelude
|
||||||
import qualified System.Environment as E
|
import qualified System.Environment as E
|
||||||
import qualified System.SetEnv
|
import qualified System.SetEnv
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Exception (
|
module Utility.Exception (
|
||||||
module X,
|
module X,
|
||||||
|
|
|
@ -22,15 +22,12 @@ import Utility.Exception
|
||||||
|
|
||||||
{- Applies a conversion function to a file's mode. -}
|
{- Applies a conversion function to a file's mode. -}
|
||||||
modifyFileMode :: FilePath -> (FileMode -> FileMode) -> IO ()
|
modifyFileMode :: FilePath -> (FileMode -> FileMode) -> IO ()
|
||||||
modifyFileMode f convert = void $ modifyFileMode' f convert
|
modifyFileMode f convert = do
|
||||||
modifyFileMode' :: FilePath -> (FileMode -> FileMode) -> IO FileMode
|
|
||||||
modifyFileMode' f convert = do
|
|
||||||
s <- getFileStatus f
|
s <- getFileStatus f
|
||||||
let old = fileMode s
|
let old = fileMode s
|
||||||
let new = convert old
|
let new = convert old
|
||||||
when (new /= old) $
|
when (new /= old) $
|
||||||
setFileMode f new
|
setFileMode f new
|
||||||
return old
|
|
||||||
|
|
||||||
{- Adds the specified FileModes to the input mode, leaving the rest
|
{- Adds the specified FileModes to the input mode, leaving the rest
|
||||||
- unchanged. -}
|
- unchanged. -}
|
||||||
|
@ -41,14 +38,6 @@ addModes ms m = combineModes (m:ms)
|
||||||
removeModes :: [FileMode] -> FileMode -> FileMode
|
removeModes :: [FileMode] -> FileMode -> FileMode
|
||||||
removeModes ms m = m `intersectFileModes` complement (combineModes ms)
|
removeModes ms m = m `intersectFileModes` complement (combineModes ms)
|
||||||
|
|
||||||
{- Runs an action after changing a file's mode, then restores the old mode. -}
|
|
||||||
withModifiedFileMode :: FilePath -> (FileMode -> FileMode) -> IO a -> IO a
|
|
||||||
withModifiedFileMode file convert a = bracket setup cleanup go
|
|
||||||
where
|
|
||||||
setup = modifyFileMode' file convert
|
|
||||||
cleanup oldmode = modifyFileMode file (const oldmode)
|
|
||||||
go _ = a
|
|
||||||
|
|
||||||
writeModes :: [FileMode]
|
writeModes :: [FileMode]
|
||||||
writeModes = [ownerWriteMode, groupWriteMode, otherWriteMode]
|
writeModes = [ownerWriteMode, groupWriteMode, otherWriteMode]
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.FileSystemEncoding (
|
module Utility.FileSystemEncoding (
|
||||||
fileEncoding,
|
fileEncoding,
|
||||||
|
|
|
@ -7,7 +7,12 @@
|
||||||
|
|
||||||
module Utility.LinuxMkLibs where
|
module Utility.LinuxMkLibs where
|
||||||
|
|
||||||
import Control.Applicative
|
import Utility.PartialPrelude
|
||||||
|
import Utility.Directory
|
||||||
|
import Utility.Process
|
||||||
|
import Utility.Monad
|
||||||
|
import Utility.Path
|
||||||
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
|
@ -15,12 +20,8 @@ import Data.List.Utils
|
||||||
import System.Posix.Files
|
import System.Posix.Files
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import Control.Monad.IfElse
|
import Control.Monad.IfElse
|
||||||
|
import Control.Applicative
|
||||||
import Utility.PartialPrelude
|
import Prelude
|
||||||
import Utility.Directory
|
|
||||||
import Utility.Process
|
|
||||||
import Utility.Monad
|
|
||||||
import Utility.Path
|
|
||||||
|
|
||||||
{- Installs a library. If the library is a symlink to another file,
|
{- Installs a library. If the library is a symlink to another file,
|
||||||
- install the file it links to, and update the symlink to be relative. -}
|
- install the file it links to, and update the symlink to be relative. -}
|
||||||
|
|
|
@ -6,23 +6,25 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Misc where
|
module Utility.Misc where
|
||||||
|
|
||||||
|
import Utility.FileSystemEncoding
|
||||||
|
import Utility.Monad
|
||||||
|
|
||||||
import System.IO
|
import System.IO
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Foreign
|
import Foreign
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import Data.List
|
import Data.List
|
||||||
import Control.Applicative
|
|
||||||
import System.Exit
|
import System.Exit
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
import System.Posix.Process (getAnyProcessStatus)
|
import System.Posix.Process (getAnyProcessStatus)
|
||||||
import Utility.Exception
|
import Utility.Exception
|
||||||
#endif
|
#endif
|
||||||
|
import Control.Applicative
|
||||||
import Utility.FileSystemEncoding
|
import Prelude
|
||||||
import Utility.Monad
|
|
||||||
|
|
||||||
{- A version of hgetContents that is not lazy. Ensures file is
|
{- A version of hgetContents that is not lazy. Ensures file is
|
||||||
- all read before it gets closed. -}
|
- all read before it gets closed. -}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
- License: BSD-2-clause
|
- License: BSD-2-clause
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Monad where
|
module Utility.Monad where
|
||||||
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
- them being accidentially used.
|
- them being accidentially used.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.PartialPrelude where
|
module Utility.PartialPrelude where
|
||||||
|
|
||||||
import qualified Data.Maybe
|
import qualified Data.Maybe
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE PackageImports, CPP #-}
|
{-# LANGUAGE PackageImports, CPP #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Path where
|
module Utility.Path where
|
||||||
|
|
||||||
|
@ -16,6 +17,7 @@ import Data.List
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
import Prelude
|
||||||
|
|
||||||
#ifdef mingw32_HOST_OS
|
#ifdef mingw32_HOST_OS
|
||||||
import qualified System.FilePath.Posix as Posix
|
import qualified System.FilePath.Posix as Posix
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.PosixFiles (
|
module Utility.PosixFiles (
|
||||||
module X,
|
module X,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP, Rank2Types #-}
|
{-# LANGUAGE CPP, Rank2Types #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Process (
|
module Utility.Process (
|
||||||
module X,
|
module X,
|
||||||
|
@ -54,6 +55,7 @@ import qualified System.Posix.IO
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
#endif
|
#endif
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Prelude
|
||||||
|
|
||||||
import Utility.Misc
|
import Utility.Misc
|
||||||
import Utility.Exception
|
import Utility.Exception
|
||||||
|
|
|
@ -19,6 +19,7 @@ import System.Posix.Types
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
import Prelude
|
||||||
|
|
||||||
instance (Arbitrary k, Arbitrary v, Eq k, Ord k) => Arbitrary (M.Map k v) where
|
instance (Arbitrary k, Arbitrary v, Eq k, Ord k) => Arbitrary (M.Map k v) where
|
||||||
arbitrary = M.fromList <$> arbitrary
|
arbitrary = M.fromList <$> arbitrary
|
||||||
|
|
|
@ -32,7 +32,6 @@ import Utility.QuickCheck
|
||||||
import Utility.PartialPrelude
|
import Utility.PartialPrelude
|
||||||
import Utility.Misc
|
import Utility.Misc
|
||||||
|
|
||||||
import Control.Applicative
|
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Time.Clock
|
import Data.Time.Clock
|
||||||
import Data.Time.LocalTime
|
import Data.Time.LocalTime
|
||||||
|
@ -41,6 +40,8 @@ import Data.Time.Calendar.WeekDate
|
||||||
import Data.Time.Calendar.OrdinalDate
|
import Data.Time.Calendar.OrdinalDate
|
||||||
import Data.Tuple.Utils
|
import Data.Tuple.Utils
|
||||||
import Data.Char
|
import Data.Char
|
||||||
|
import Control.Applicative
|
||||||
|
import Prelude
|
||||||
|
|
||||||
{- Some sort of scheduled event. -}
|
{- Some sort of scheduled event. -}
|
||||||
data Schedule = Schedule Recurrance ScheduledTime
|
data Schedule = Schedule Recurrance ScheduledTime
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Tmp where
|
module Utility.Tmp where
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.UserInfo (
|
module Utility.UserInfo (
|
||||||
myHomeDir,
|
myHomeDir,
|
||||||
|
@ -13,12 +14,13 @@ module Utility.UserInfo (
|
||||||
myUserGecos,
|
myUserGecos,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Utility.Env
|
||||||
|
|
||||||
import System.PosixCompat
|
import System.PosixCompat
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
#endif
|
#endif
|
||||||
|
import Prelude
|
||||||
import Utility.Env
|
|
||||||
|
|
||||||
{- Current user's home directory.
|
{- Current user's home directory.
|
||||||
-
|
-
|
||||||
|
|
Loading…
Reference in New Issue