Support building without persistent database on for systems that lack TH. This removes support for incremental fsck.

This commit is contained in:
Joey Hess 2015-07-25 17:37:09 -04:00
parent ca17e1483b
commit 1fb9ab342b
5 changed files with 48 additions and 9 deletions

View file

@ -83,8 +83,11 @@ buildFlags = filter (not . null)
#endif
#ifdef WITH_TORRENTPARSER
, "TorrentParser"
#endif
#ifdef WITH_DATABASE
, "Database"
#else
#warning Building without Database support
#endif
#ifdef WITH_EKG
, "EKG"

View file

@ -30,12 +30,15 @@ import Annex.UUID
import Utility.DataUnits
import Config
import Types.Key
import Types.CleanupActions
import Utility.HumanTime
import Utility.CopyFile
import Git.FilePath
import Utility.PID
#ifdef WITH_DATABASE
import qualified Database.Fsck as FsckDb
import Types.CleanupActions
#endif
import Data.Time.Clock.POSIX
import System.Posix.Types (EpochTime)
@ -91,7 +94,7 @@ seek o = do
(\k -> startKey i k =<< getNumCopies)
(withFilesInGit $ whenAnnexed $ start from i)
(fsckFiles o)
withFsckDb i FsckDb.closeDb
cleanupIncremental i
void $ tryIO $ recordActivity Fsck u
start :: Maybe Remote -> Incremental -> FilePath -> Key -> CommandStart
@ -454,16 +457,24 @@ runFsck inc file key a = ifM (needFsck inc key)
{- Check if a key needs to be fscked, with support for incremental fscks. -}
needFsck :: Incremental -> Key -> Annex Bool
#ifdef WITH_DATABASE
needFsck (ContIncremental h) key = liftIO $ not <$> FsckDb.inDb h key
#endif
needFsck _ _ = return True
#ifdef WITH_DATABASE
withFsckDb :: Incremental -> (FsckDb.FsckHandle -> Annex ()) -> Annex ()
withFsckDb (ContIncremental h) a = a h
withFsckDb (StartIncremental h) a = a h
withFsckDb NonIncremental _ = noop
#endif
recordFsckTime :: Incremental -> Key -> Annex ()
#ifdef WITH_DATABASE
recordFsckTime inc key = withFsckDb inc $ \h -> liftIO $ FsckDb.addDb h key
#else
recordFsckTime _ _ = return ()
#endif
{- Records the start time of an incremental fsck.
-
@ -512,10 +523,16 @@ getStartTime u = do
fromfile >= fromstatus
#endif
data Incremental = StartIncremental FsckDb.FsckHandle | ContIncremental FsckDb.FsckHandle | NonIncremental
data Incremental
= NonIncremental
#ifdef WITH_DATABASE
| StartIncremental FsckDb.FsckHandle
| ContIncremental FsckDb.FsckHandle
#endif
prepIncremental :: UUID -> Maybe IncrementalOpt -> Annex Incremental
prepIncremental _ Nothing = pure NonIncremental
#ifdef WITH_DATABASE
prepIncremental u (Just StartIncrementalO) = do
recordStartTime u
ifM (FsckDb.newPass u)
@ -537,3 +554,13 @@ prepIncremental u (Just (ScheduleIncrementalO delta)) = do
prepIncremental u $ Just $ case started of
Nothing -> StartIncrementalO
Just _ -> MoreIncrementalO
#else
prepIncremental _ _ = error "This git-annex was not built with database support; incremental fsck not supported"
#endif
cleanupIncremental :: Incremental -> Annex ()
#ifdef WITH_DATABASE
cleanupIncremental i = withFsckDb i FsckDb.closeDb
#else
cleanupIncremental _ = return ()
#endif

2
debian/changelog vendored
View file

@ -30,6 +30,8 @@ git-annex (5.20150714) UNRELEASED; urgency=medium
* Adjust debian build deps: The webapp can now build on arm64, s390x
and hurd-i386. WebDAV support is also available on those architectures.
* Debian package now maintained by Richard Hartmann.
* Support building without persistent database on for systems that
lack TH. This removes support for incremental fsck.
-- Joey Hess <id@joeyh.name> Fri, 10 Jul 2015 16:36:42 -0400

8
debian/control vendored
View file

@ -43,6 +43,10 @@ Build-Depends:
libghc-wai-dev [i386 amd64 armel armhf armhf kfreebsd-i386 kfreebsd-amd64 powerpc ppc64el s390x hurd-i386],
libghc-wai-extra-dev [i386 amd64 armel armhf armhf kfreebsd-i386 kfreebsd-amd64 powerpc ppc64el s390x hurd-i386],
libghc-dav-dev (>= 1.0) [i386 amd64 arm64 armel armhf kfreebsd-i386 kfreebsd-amd64 powerpc ppc64el s390x hurd-i386],
libghc-persistent-dev [i386 amd64 arm64 armel armhf kfreebsd-i386 kfreebsd-amd64 powerpc ppc64el s390x hurd-i386],
libghc-persistent-template-dev [i386 amd64 arm64 armel armhf kfreebsd-i386 kfreebsd-amd64 powerpc ppc64el s390x hurd-i386],
libghc-persistent-sqlite-dev [i386 amd64 arm64 armel armhf kfreebsd-i386 kfreebsd-amd64 powerpc ppc64el s390x hurd-i386],
libghc-esqueleto-dev [i386 amd64 arm64 armel armhf kfreebsd-i386 kfreebsd-amd64 powerpc ppc64el s390x hurd-i386],
libghc-securemem-dev,
libghc-byteable-dev,
libghc-dns-dev,
@ -58,10 +62,6 @@ Build-Depends:
libghc-gnutls-dev (>= 0.1.4),
libghc-xml-types-dev,
libghc-async-dev,
libghc-persistent-dev,
libghc-persistent-template-dev,
libghc-persistent-sqlite-dev,
libghc-esqueleto-dev,
libghc-monad-logger-dev,
libghc-feed-dev (>= 0.3.9.2),
libghc-regex-tdfa-dev,

View file

@ -105,6 +105,10 @@ Flag network-uri
Description: Get Network.URI from the network-uri package
Default: True
Flag Database
Description: Enable building with persistent for database use (disable to build on platforms not supporting TH)
Default: True
Executable git-annex
Main-Is: git-annex.hs
Build-Depends:
@ -123,7 +127,6 @@ Executable git-annex
monad-control, transformers,
bloomfilter, edit-distance,
resourcet, http-conduit, http-types,
esqueleto, persistent-sqlite, persistent, persistent-template,
time, old-locale
CC-Options: -Wall
GHC-Options: -Wall -fno-warn-tabs
@ -262,6 +265,10 @@ Executable git-annex
Build-Depends: torrent (>= 10000.0.0)
CPP-Options: -DWITH_TORRENTPARSER
if flag(Database)
Build-Depends: esqueleto, persistent-sqlite, persistent, persistent-template
CPP-Options: -DWITH_DATABASE
if flag(AsciiProgress)
Build-Depends: ascii-progress (<= 0.2.1.2), terminal-size
CPP-Options: -DWITH_ASCIIPROGRESS