diff options
-rw-r--r-- | Assistant/Threads/Committer.hs | 23 | ||||
-rw-r--r-- | Utility/ThreadScheduler.hs | 7 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/design/assistant/gpgkeys.mdwn | 3 | ||||
-rw-r--r-- | doc/devblog/day_71__that_was_unexpected.mdwn | 30 | ||||
-rw-r--r-- | doc/todo/windows_support.mdwn | 15 | ||||
-rw-r--r-- | git-annex.cabal | 2 | ||||
-rw-r--r-- | standalone/windows/build.sh | 5 |
8 files changed, 64 insertions, 22 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs index bebe6f634..f736530e4 100644 --- a/Assistant/Threads/Committer.hs +++ b/Assistant/Threads/Committer.hs @@ -46,11 +46,12 @@ import Control.Concurrent {- This thread makes git commits at appropriate times. -} commitThread :: NamedThread commitThread = namedThread "Committer" $ do + havelsof <- liftIO $ inPath "lsof" delayadd <- liftAnnex $ maybe delayaddDefault (return . Just . Seconds) =<< annexDelayAdd <$> Annex.getGitConfig waitChangeTime $ \(changes, time) -> do - readychanges <- handleAdds delayadd changes + readychanges <- handleAdds havelsof delayadd changes if shouldCommit time (length readychanges) readychanges then do debug @@ -252,14 +253,14 @@ delayaddDefault = return Nothing - Any pending adds that are not ready yet are put back into the ChangeChan, - where they will be retried later. -} -handleAdds :: Maybe Seconds -> [Change] -> Assistant [Change] -handleAdds delayadd cs = returnWhen (null incomplete) $ do +handleAdds :: Bool -> Maybe Seconds -> [Change] -> Assistant [Change] +handleAdds havelsof delayadd cs = returnWhen (null incomplete) $ do let (pending, inprocess) = partition isPendingAddChange incomplete direct <- liftAnnex isDirect (pending', cleanup) <- if direct then return (pending, noop) else findnew pending - (postponed, toadd) <- partitionEithers <$> safeToAdd delayadd pending' inprocess + (postponed, toadd) <- partitionEithers <$> safeToAdd havelsof delayadd pending' inprocess cleanup unless (null postponed) $ @@ -273,7 +274,7 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do if DirWatcher.eventsCoalesce || null added || direct then return $ added ++ otherchanges else do - r <- handleAdds delayadd =<< getChanges + r <- handleAdds havelsof delayadd =<< getChanges return $ r ++ added ++ otherchanges where (incomplete, otherchanges) = partition (\c -> isPendingAddChange c || isInProcessAddChange c) cs @@ -386,15 +387,17 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do - - Check by running lsof on the repository. -} -safeToAdd :: Maybe Seconds -> [Change] -> [Change] -> Assistant [Either Change Change] -safeToAdd _ [] [] = return [] -safeToAdd delayadd pending inprocess = do +safeToAdd :: Bool -> Maybe Seconds -> [Change] -> [Change] -> Assistant [Either Change Change] +safeToAdd _ _ [] [] = return [] +safeToAdd havelsof delayadd pending inprocess = do maybe noop (liftIO . threadDelaySeconds) delayadd liftAnnex $ do keysources <- forM pending $ Command.Add.lockDown . changeFile let inprocess' = inprocess ++ mapMaybe mkinprocess (zip pending keysources) - openfiles <- S.fromList . map fst3 . filter openwrite <$> - findopenfiles (map keySource inprocess') + openfiles <- if havelsof + then S.fromList . map fst3 . filter openwrite <$> + findopenfiles (map keySource inprocess') + else pure S.empty let checked = map (check openfiles) inprocess' {- If new events are received when files are closed, diff --git a/Utility/ThreadScheduler.hs b/Utility/ThreadScheduler.hs index c3e871cde..dbb6cb317 100644 --- a/Utility/ThreadScheduler.hs +++ b/Utility/ThreadScheduler.hs @@ -53,8 +53,11 @@ unboundDelay time = do {- Pauses the main thread, letting children run until program termination. -} waitForTermination :: IO () waitForTermination = do +#ifdef mingw32_HOST_OS + runEvery (Seconds 600) $ + void getLine +#else lock <- newEmptyMVar -#ifndef mingw32_HOST_OS let check sig = void $ installHandler sig (CatchOnce $ putMVar lock ()) Nothing check softwareTermination @@ -62,8 +65,8 @@ waitForTermination = do whenM (queryTerminal stdInput) $ check keyboardSignal #endif -#endif takeMVar lock +#endif oneSecond :: Microseconds oneSecond = 1000000 diff --git a/debian/changelog b/debian/changelog index d5b1cc8de..a6aa40341 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,7 @@ git-annex (5.20131131) UNRELEASED; urgency=low * Android: Fix SRV record lookups for XMPP to use android getprop command to find DNS server, since there is no resolv.conf. * import: Add --skip-duplicates option. + * Windows: watch and assistant work! (very experimental) -- Joey Hess <joeyh@debian.org> Sun, 01 Dec 2013 13:57:58 -0400 diff --git a/doc/design/assistant/gpgkeys.mdwn b/doc/design/assistant/gpgkeys.mdwn index 647d65083..9d1254eb9 100644 --- a/doc/design/assistant/gpgkeys.mdwn +++ b/doc/design/assistant/gpgkeys.mdwn @@ -24,6 +24,9 @@ To support using gpg keys in the assistant, we need some things: with many subkeys may not). Debian has command-line utilities that can generate and read such a QR code. + Another way would be to use shamir secret sharing to split the key into + N peices and send each one to one of the user's repos. + 3. Help user learn the gpg keys of people they want to share their repo with, and give them access. If the public key was recorded in the git-annex branch, this could be easily determined when sharing repositories with diff --git a/doc/devblog/day_71__that_was_unexpected.mdwn b/doc/devblog/day_71__that_was_unexpected.mdwn new file mode 100644 index 000000000..94faed557 --- /dev/null +++ b/doc/devblog/day_71__that_was_unexpected.mdwn @@ -0,0 +1,30 @@ +Had planned to spend all day not working on git-annex and instead getting +caught up on conference videos. However, got a little bit multitasky while +watching those, and started investigating why, last time I worked on +Windows port, git-annex was failing to link. + +A good thing to do while watching conference videos since it involved lots of +test builds with different flags. Eventially solved it. +Building w/o WebDAV avoids crashing the compiler anyhow. + +Thought I'd try the resulting binary and see if perhaps I had forgotten to +use the threaded RTS when I was running ghc by hand to link it last time, +and perhaps that was why threads +[[seemed to have hung|day 56 git-annex user survey]] back then. + +It was. This became clear when I saw a "deadlocked indefinitely in MVar" +error message, which tells me that it's at least using the threaded RTS. +So, I fixed that, and a few other minor things, and ran this command +in a DOS prompt box: + + git annex watch --force --foreground --debug + +And I've been making changes to files in that repository, and amazingly, +the watcher is noticing them, and committing them! + +So, I was almost entirely there to a windows port of the watcher a month +ago, and didn't know. It has some rough edges, including not doing anything +to check if a newly created file is open for write when adding it, and +getting the full assistant ported will be more work, and the full webapp +may be a whole other set of problems, but this is a quite nice milestone +for the Windows port. diff --git a/doc/todo/windows_support.mdwn b/doc/todo/windows_support.mdwn index a8cbd6db8..be418d416 100644 --- a/doc/todo/windows_support.mdwn +++ b/doc/todo/windows_support.mdwn @@ -13,11 +13,10 @@ now! --[[Joey]] has to connect twice to the remote system over ssh per file, which is much slower than on systems supporting connection caching. * Webapp doesn't build yet. -* `git annex watch` builds, but does not quite work. -* `git annex assistant` builds, but has not been tested, and is known - to not download any files. (transferrer doesn't built yet) -* watch and assistant cannot be built with cabal. Possibly due to too many - files overflowing command line length limit at link stage. - To build a binary with them: - `ghc --make git-annex.hs -threaded -XPackageImports -DWITH_ASSISTANT=1 -DWITH_WIN32NOTIFY=1` - (should add all the other flags cabal uses) +* `git annex watch` works, but does not detect when files are still open + for write as they're being added (no lsof) +* Startup scan neglects to send add events for all files in the repo, + so pre-existing files are not added by watch/assistant. (Should be easily + fixed.) +* `git annex assistant` has not been tested, is probably quite incomplete. + Is known to not download any files. (transferrer doesn't built yet) diff --git a/git-annex.cabal b/git-annex.cabal index fa9ea062c..862847179 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -124,7 +124,7 @@ Executable git-annex Build-Depends: hS3 CPP-Options: -DWITH_S3 - if flag(WebDAV) + if flag(WebDAV) && (! os(windows)) Build-Depends: DAV (>= 0.3), http-conduit, xml-conduit, http-types CPP-Options: -DWITH_WEBDAV diff --git a/standalone/windows/build.sh b/standalone/windows/build.sh index 74148dfe5..3e4f6bde1 100644 --- a/standalone/windows/build.sh +++ b/standalone/windows/build.sh @@ -7,7 +7,9 @@ set -x set -e HP="/c/Program Files (x86)/Haskell Platform/2012.4.0.0" -FLAGS="-Webapp -Assistant -XMPP" + +# Any cabal build flags go here. +FLAGS="" PATH="$HP/bin:$HP/lib/extralibs/bin:/c/Program Files (x86)/NSIS:$PATH" @@ -52,5 +54,6 @@ withcyg Build/NullSoftInstaller.exe rm -f last-incremental-failed # Test git-annex +# (doesn't currently work well on autobuilder, reason unknown) rm -rf .t withcyg dist/build/git-annex/git-annex.exe test || true |