diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-07-25 17:37:09 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-07-25 17:37:09 -0400 |
commit | c46b6bef8820ef3295bce3374c1afb90a6725557 (patch) | |
tree | 441fbaa382fac333529b6a77101900fd471cdb41 | |
parent | 36feacc1ea527d28bcedc87ae8a537c9990c7bb6 (diff) |
Support building without persistent database on for systems that lack TH. This removes support for incremental fsck.
-rw-r--r-- | BuildFlags.hs | 5 | ||||
-rw-r--r-- | Command/Fsck.hs | 33 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/control | 8 | ||||
-rw-r--r-- | git-annex.cabal | 9 |
5 files changed, 48 insertions, 9 deletions
diff --git a/BuildFlags.hs b/BuildFlags.hs index a0f0ac298..2e8d05ea3 100644 --- a/BuildFlags.hs +++ b/BuildFlags.hs @@ -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" diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 0e0c49d78..a201c4519 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -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 diff --git a/debian/changelog b/debian/changelog index 429e4674b..c7debba53 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/debian/control b/debian/control index e26e1dc57..860724667 100644 --- a/debian/control +++ b/debian/control @@ -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, diff --git a/git-annex.cabal b/git-annex.cabal index 5dde20bfe..13c0760e2 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -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 |