From d0fa82fb721cdc85438287e29a94cb796b7bc464 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 11 May 2013 15:03:00 -0500 Subject: git-annex now builds on Windows (doesn't work) --- Command/Add.hs | 2 ++ Command/Fix.hs | 2 ++ Command/FromKey.hs | 2 ++ Command/Fsck.hs | 16 +++++++++++++--- Command/Import.hs | 2 ++ Command/Indirect.hs | 2 ++ Command/ReKey.hs | 2 ++ Command/RecvKey.hs | 2 ++ Command/Status.hs | 1 + Command/TransferKeys.hs | 2 ++ Command/Unannex.hs | 6 ++++++ 11 files changed, 36 insertions(+), 3 deletions(-) mode change 100644 => 100755 Command/Add.hs mode change 100644 => 100755 Command/Fix.hs mode change 100644 => 100755 Command/FromKey.hs mode change 100644 => 100755 Command/Import.hs mode change 100644 => 100755 Command/Indirect.hs mode change 100644 => 100755 Command/ReKey.hs mode change 100644 => 100755 Command/RecvKey.hs mode change 100644 => 100755 Command/Status.hs mode change 100644 => 100755 Command/TransferKeys.hs mode change 100644 => 100755 Command/Unannex.hs (limited to 'Command') diff --git a/Command/Add.hs b/Command/Add.hs old mode 100644 new mode 100755 index 68a894d30..95af72a6f --- a/Command/Add.hs +++ b/Command/Add.hs @@ -9,6 +9,8 @@ module Command.Add where +import System.PosixCompat.Files + import Common.Annex import Annex.Exception import Command diff --git a/Command/Fix.hs b/Command/Fix.hs old mode 100644 new mode 100755 index 6aedbad6e..c6b4df257 --- a/Command/Fix.hs +++ b/Command/Fix.hs @@ -7,6 +7,8 @@ module Command.Fix where +import System.PosixCompat.Files + import Common.Annex import Command import qualified Annex.Queue diff --git a/Command/FromKey.hs b/Command/FromKey.hs old mode 100644 new mode 100755 index 30b491478..c3d2daafe --- a/Command/FromKey.hs +++ b/Command/FromKey.hs @@ -7,6 +7,8 @@ module Command.FromKey where +import System.PosixCompat.Files + import Common.Annex import Command import qualified Annex.Queue diff --git a/Command/Fsck.hs b/Command/Fsck.hs index c63bc3ea0..fe1d35162 100755 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -9,6 +9,8 @@ module Command.Fsck where +import System.PosixCompat.Files + import Common.Annex import Command import qualified Annex @@ -30,8 +32,10 @@ import qualified Option import Types.Key import Utility.HumanTime -#ifndef mingw32_HOST_OS +#ifndef __WINDOWS__ import System.Posix.Process (getProcessID) +#else +import System.Random (getStdRandom, random) #endif import Data.Time.Clock.POSIX import Data.Time @@ -142,10 +146,14 @@ performRemote key file backend numcopies remote = , checkKeyNumCopies key file numcopies ] withtmp a = do - pid <- liftIO getProcessID +#ifndef __WINDOWS__ + v <- liftIO getProcessID +#else + v <- liftIO (getStdRandom random :: IO Int) +#endif t <- fromRepo gitAnnexTmpDir createAnnexDirectory t - let tmp = t "fsck" ++ show pid ++ "." ++ keyFile key + let tmp = t "fsck" ++ show v ++ "." ++ keyFile key let cleanup = liftIO $ catchIO (removeFile tmp) (const noop) cleanup cleanup `after` a tmp @@ -453,7 +461,9 @@ recordFsckTime key = do parent <- parentDir <$> calcRepo (gitAnnexLocation key) liftIO $ void $ tryIO $ do touchFile parent +#ifndef __WINDOWS__ setSticky parent +#endif getFsckTime :: Key -> Annex (Maybe EpochTime) getFsckTime key = do diff --git a/Command/Import.hs b/Command/Import.hs old mode 100644 new mode 100755 index d86b44b80..cadf8fa2e --- a/Command/Import.hs +++ b/Command/Import.hs @@ -7,6 +7,8 @@ module Command.Import where +import System.PosixCompat.Files + import Common.Annex import Command import qualified Annex diff --git a/Command/Indirect.hs b/Command/Indirect.hs old mode 100644 new mode 100755 index 668bebefb..bf1509944 --- a/Command/Indirect.hs +++ b/Command/Indirect.hs @@ -7,6 +7,8 @@ module Command.Indirect where +import System.PosixCompat.Files + import Common.Annex import Command import qualified Git diff --git a/Command/ReKey.hs b/Command/ReKey.hs old mode 100644 new mode 100755 index bc4a9fac9..05fd73f1b --- a/Command/ReKey.hs +++ b/Command/ReKey.hs @@ -7,6 +7,8 @@ module Command.ReKey where +import System.PosixCompat.Files + import Common.Annex import Command import qualified Annex diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs old mode 100644 new mode 100755 index 840fd34cb..c316e2ca5 --- a/Command/RecvKey.hs +++ b/Command/RecvKey.hs @@ -7,6 +7,8 @@ module Command.RecvKey where +import System.PosixCompat.Files + import Common.Annex import Command import CmdLine diff --git a/Command/Status.hs b/Command/Status.hs old mode 100644 new mode 100755 index 0009ff075..6a50c1ab5 --- a/Command/Status.hs +++ b/Command/Status.hs @@ -13,6 +13,7 @@ import "mtl" Control.Monad.State.Strict import qualified Data.Map as M import Text.JSON import Data.Tuple +import System.PosixCompat.Files import Common.Annex import qualified Types.Backend as B diff --git a/Command/TransferKeys.hs b/Command/TransferKeys.hs old mode 100644 new mode 100755 index 2f5ea1fe4..d83170bbc --- a/Command/TransferKeys.hs +++ b/Command/TransferKeys.hs @@ -9,6 +9,8 @@ module Command.TransferKeys where +import System.PosixCompat.Files + import Common.Annex import Command import Annex.Content diff --git a/Command/Unannex.hs b/Command/Unannex.hs old mode 100644 new mode 100755 index 53b593f20..6674b37d2 --- a/Command/Unannex.hs +++ b/Command/Unannex.hs @@ -5,6 +5,8 @@ - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE CPP #-} + module Command.Unannex where import Common.Annex @@ -58,6 +60,9 @@ cleanup file key = do return True where +#ifdef __WINDOWS__ + goFast = go +#else goFast = do -- fast mode: hard link to content in annex src <- calcRepo $ gitAnnexLocation key @@ -66,6 +71,7 @@ cleanup file key = do ( thawContent file , go ) +#endif go = do fromAnnex key file logStatus key InfoMissing -- cgit v1.2.3