From cc82f812272990870f90432882b245bfae8eb5da Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 24 Sep 2018 11:25:51 -0400 Subject: [PATCH] More FreeBSD build fixes. Untested, on FreeBSD but enough to fix the listed build errors. Seems that System.Posix.Files must have used to export this stuff and it was split. This commit was sponsored by Peter on Patreon. --- CHANGELOG | 1 + Utility/DirWatcher/Kqueue.hs | 15 ++++++++------- ...BSD__58____Issues_with_System.Posix.Files.mdwn | 2 ++ ...nt_1_c8d41357ea9d0ac4601e066982058545._comment | 7 +++++++ 4 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 doc/bugs/Can__39__t_compile_on_FreeBSD__58____Issues_with_System.Posix.Files/comment_1_c8d41357ea9d0ac4601e066982058545._comment diff --git a/CHANGELOG b/CHANGELOG index 9c059ce259..02cdfafb3d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,7 @@ git-annex (6.20180914) UNRELEASED; urgency=medium as the rest of git's interface is used in newline-safe ways. * Added -z option to git-annex commands that use --batch, useful for supporting filenames containing newlines. + * More FreeBSD build fixes. [ Yaroslav Halchenko ] * debian/control diff --git a/Utility/DirWatcher/Kqueue.hs b/Utility/DirWatcher/Kqueue.hs index a0077d7b92..4a1c55ae91 100644 --- a/Utility/DirWatcher/Kqueue.hs +++ b/Utility/DirWatcher/Kqueue.hs @@ -27,7 +27,8 @@ import Foreign.Ptr import Foreign.Marshal import qualified Data.Map.Strict as M import qualified Data.Set as S -import qualified System.Posix.Files as Files +import qualified System.Posix.Files as Posix +import qualified System.Posix.IO as Posix import Control.Concurrent data Change @@ -109,7 +110,7 @@ scanRecursive topdir prune = M.fromList <$> walk [] [topdir] Nothing -> walk c rest Just info -> do mfd <- catchMaybeIO $ - Files.openFd dir Files.ReadOnly Nothing Files.defaultFileFlags + Posix.openFd dir Posix.ReadOnly Nothing Posix.defaultFileFlags case mfd of Nothing -> walk c rest Just fd -> do @@ -129,7 +130,7 @@ addSubDirs dirmap prune dirs = do {- Removes a subdirectory (and all its children) from a directory map. -} removeSubDir :: DirMap -> FilePath -> IO DirMap removeSubDir dirmap dir = do - mapM_ Files.closeFd $ M.keys toremove + mapM_ Posix.closeFd $ M.keys toremove return rest where (toremove, rest) = M.partition (dirContains dir . dirName) dirmap @@ -167,7 +168,7 @@ updateKqueue (Kqueue h _ dirmap _) = {- Stops a Kqueue. Note: Does not directly close the Fds in the dirmap, - so it can be reused. -} stopKqueue :: Kqueue -> IO () -stopKqueue = Files.closeFd . kqueueFd +stopKqueue = Posix.closeFd . kqueueFd {- Waits for a change on a Kqueue. - May update the Kqueue. @@ -249,9 +250,9 @@ runHooks kq hooks = do withstatus change $ dispatchadd dirmap dispatchadd dirmap change s - | Files.isSymbolicLink s = callhook addSymlinkHook (Just s) change - | Files.isDirectory s = recursiveadd dirmap change - | Files.isRegularFile s = callhook addHook (Just s) change + | Posix.isSymbolicLink s = callhook addSymlinkHook (Just s) change + | Posix.isDirectory s = recursiveadd dirmap change + | Posix.isRegularFile s = callhook addHook (Just s) change | otherwise = noop recursiveadd dirmap change = do diff --git a/doc/bugs/Can__39__t_compile_on_FreeBSD__58____Issues_with_System.Posix.Files.mdwn b/doc/bugs/Can__39__t_compile_on_FreeBSD__58____Issues_with_System.Posix.Files.mdwn index 9357a84c13..79880b65e4 100644 --- a/doc/bugs/Can__39__t_compile_on_FreeBSD__58____Issues_with_System.Posix.Files.mdwn +++ b/doc/bugs/Can__39__t_compile_on_FreeBSD__58____Issues_with_System.Posix.Files.mdwn @@ -51,3 +51,5 @@ Compilation failure is as follows: /usr/home/duncan/code/git-annex/.stack-work/dist/x86_64-freebsd/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-freebsd/Cabal-1.24.2.0 build exe:git -annex --ghc-options " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure 1 + +> [[done]] --[[Joey]] diff --git a/doc/bugs/Can__39__t_compile_on_FreeBSD__58____Issues_with_System.Posix.Files/comment_1_c8d41357ea9d0ac4601e066982058545._comment b/doc/bugs/Can__39__t_compile_on_FreeBSD__58____Issues_with_System.Posix.Files/comment_1_c8d41357ea9d0ac4601e066982058545._comment new file mode 100644 index 0000000000..b10cc24762 --- /dev/null +++ b/doc/bugs/Can__39__t_compile_on_FreeBSD__58____Issues_with_System.Posix.Files/comment_1_c8d41357ea9d0ac4601e066982058545._comment @@ -0,0 +1,7 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2018-09-24T15:24:30Z" + content=""" +Seems it also needs to import System.Posix.IO, which I've now committed. +"""]]