Support building without persistent database on for systems that lack TH. This removes support for incremental fsck.
This commit is contained in:
parent
ca17e1483b
commit
1fb9ab342b
5 changed files with 48 additions and 9 deletions
|
@ -83,8 +83,11 @@ buildFlags = filter (not . null)
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_TORRENTPARSER
|
#ifdef WITH_TORRENTPARSER
|
||||||
, "TorrentParser"
|
, "TorrentParser"
|
||||||
|
#endif
|
||||||
|
#ifdef WITH_DATABASE
|
||||||
|
, "Database"
|
||||||
#else
|
#else
|
||||||
|
#warning Building without Database support
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_EKG
|
#ifdef WITH_EKG
|
||||||
, "EKG"
|
, "EKG"
|
||||||
|
|
|
@ -30,12 +30,15 @@ import Annex.UUID
|
||||||
import Utility.DataUnits
|
import Utility.DataUnits
|
||||||
import Config
|
import Config
|
||||||
import Types.Key
|
import Types.Key
|
||||||
import Types.CleanupActions
|
|
||||||
import Utility.HumanTime
|
import Utility.HumanTime
|
||||||
import Utility.CopyFile
|
import Utility.CopyFile
|
||||||
import Git.FilePath
|
import Git.FilePath
|
||||||
import Utility.PID
|
import Utility.PID
|
||||||
|
|
||||||
|
#ifdef WITH_DATABASE
|
||||||
import qualified Database.Fsck as FsckDb
|
import qualified Database.Fsck as FsckDb
|
||||||
|
import Types.CleanupActions
|
||||||
|
#endif
|
||||||
|
|
||||||
import Data.Time.Clock.POSIX
|
import Data.Time.Clock.POSIX
|
||||||
import System.Posix.Types (EpochTime)
|
import System.Posix.Types (EpochTime)
|
||||||
|
@ -91,7 +94,7 @@ seek o = do
|
||||||
(\k -> startKey i k =<< getNumCopies)
|
(\k -> startKey i k =<< getNumCopies)
|
||||||
(withFilesInGit $ whenAnnexed $ start from i)
|
(withFilesInGit $ whenAnnexed $ start from i)
|
||||||
(fsckFiles o)
|
(fsckFiles o)
|
||||||
withFsckDb i FsckDb.closeDb
|
cleanupIncremental i
|
||||||
void $ tryIO $ recordActivity Fsck u
|
void $ tryIO $ recordActivity Fsck u
|
||||||
|
|
||||||
start :: Maybe Remote -> Incremental -> FilePath -> Key -> CommandStart
|
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. -}
|
{- Check if a key needs to be fscked, with support for incremental fscks. -}
|
||||||
needFsck :: Incremental -> Key -> Annex Bool
|
needFsck :: Incremental -> Key -> Annex Bool
|
||||||
|
#ifdef WITH_DATABASE
|
||||||
needFsck (ContIncremental h) key = liftIO $ not <$> FsckDb.inDb h key
|
needFsck (ContIncremental h) key = liftIO $ not <$> FsckDb.inDb h key
|
||||||
|
#endif
|
||||||
needFsck _ _ = return True
|
needFsck _ _ = return True
|
||||||
|
|
||||||
|
#ifdef WITH_DATABASE
|
||||||
withFsckDb :: Incremental -> (FsckDb.FsckHandle -> Annex ()) -> Annex ()
|
withFsckDb :: Incremental -> (FsckDb.FsckHandle -> Annex ()) -> Annex ()
|
||||||
withFsckDb (ContIncremental h) a = a h
|
withFsckDb (ContIncremental h) a = a h
|
||||||
withFsckDb (StartIncremental h) a = a h
|
withFsckDb (StartIncremental h) a = a h
|
||||||
withFsckDb NonIncremental _ = noop
|
withFsckDb NonIncremental _ = noop
|
||||||
|
#endif
|
||||||
|
|
||||||
recordFsckTime :: Incremental -> Key -> Annex ()
|
recordFsckTime :: Incremental -> Key -> Annex ()
|
||||||
|
#ifdef WITH_DATABASE
|
||||||
recordFsckTime inc key = withFsckDb inc $ \h -> liftIO $ FsckDb.addDb h key
|
recordFsckTime inc key = withFsckDb inc $ \h -> liftIO $ FsckDb.addDb h key
|
||||||
|
#else
|
||||||
|
recordFsckTime _ _ = return ()
|
||||||
|
#endif
|
||||||
|
|
||||||
{- Records the start time of an incremental fsck.
|
{- Records the start time of an incremental fsck.
|
||||||
-
|
-
|
||||||
|
@ -512,10 +523,16 @@ getStartTime u = do
|
||||||
fromfile >= fromstatus
|
fromfile >= fromstatus
|
||||||
#endif
|
#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 :: UUID -> Maybe IncrementalOpt -> Annex Incremental
|
||||||
prepIncremental _ Nothing = pure NonIncremental
|
prepIncremental _ Nothing = pure NonIncremental
|
||||||
|
#ifdef WITH_DATABASE
|
||||||
prepIncremental u (Just StartIncrementalO) = do
|
prepIncremental u (Just StartIncrementalO) = do
|
||||||
recordStartTime u
|
recordStartTime u
|
||||||
ifM (FsckDb.newPass u)
|
ifM (FsckDb.newPass u)
|
||||||
|
@ -537,3 +554,13 @@ prepIncremental u (Just (ScheduleIncrementalO delta)) = do
|
||||||
prepIncremental u $ Just $ case started of
|
prepIncremental u $ Just $ case started of
|
||||||
Nothing -> StartIncrementalO
|
Nothing -> StartIncrementalO
|
||||||
Just _ -> MoreIncrementalO
|
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
2
debian/changelog
vendored
|
@ -30,6 +30,8 @@ git-annex (5.20150714) UNRELEASED; urgency=medium
|
||||||
* Adjust debian build deps: The webapp can now build on arm64, s390x
|
* Adjust debian build deps: The webapp can now build on arm64, s390x
|
||||||
and hurd-i386. WebDAV support is also available on those architectures.
|
and hurd-i386. WebDAV support is also available on those architectures.
|
||||||
* Debian package now maintained by Richard Hartmann.
|
* 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
|
-- Joey Hess <id@joeyh.name> Fri, 10 Jul 2015 16:36:42 -0400
|
||||||
|
|
||||||
|
|
8
debian/control
vendored
8
debian/control
vendored
|
@ -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-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-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-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-securemem-dev,
|
||||||
libghc-byteable-dev,
|
libghc-byteable-dev,
|
||||||
libghc-dns-dev,
|
libghc-dns-dev,
|
||||||
|
@ -58,10 +62,6 @@ Build-Depends:
|
||||||
libghc-gnutls-dev (>= 0.1.4),
|
libghc-gnutls-dev (>= 0.1.4),
|
||||||
libghc-xml-types-dev,
|
libghc-xml-types-dev,
|
||||||
libghc-async-dev,
|
libghc-async-dev,
|
||||||
libghc-persistent-dev,
|
|
||||||
libghc-persistent-template-dev,
|
|
||||||
libghc-persistent-sqlite-dev,
|
|
||||||
libghc-esqueleto-dev,
|
|
||||||
libghc-monad-logger-dev,
|
libghc-monad-logger-dev,
|
||||||
libghc-feed-dev (>= 0.3.9.2),
|
libghc-feed-dev (>= 0.3.9.2),
|
||||||
libghc-regex-tdfa-dev,
|
libghc-regex-tdfa-dev,
|
||||||
|
|
|
@ -105,6 +105,10 @@ Flag network-uri
|
||||||
Description: Get Network.URI from the network-uri package
|
Description: Get Network.URI from the network-uri package
|
||||||
Default: True
|
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
|
Executable git-annex
|
||||||
Main-Is: git-annex.hs
|
Main-Is: git-annex.hs
|
||||||
Build-Depends:
|
Build-Depends:
|
||||||
|
@ -123,7 +127,6 @@ Executable git-annex
|
||||||
monad-control, transformers,
|
monad-control, transformers,
|
||||||
bloomfilter, edit-distance,
|
bloomfilter, edit-distance,
|
||||||
resourcet, http-conduit, http-types,
|
resourcet, http-conduit, http-types,
|
||||||
esqueleto, persistent-sqlite, persistent, persistent-template,
|
|
||||||
time, old-locale
|
time, old-locale
|
||||||
CC-Options: -Wall
|
CC-Options: -Wall
|
||||||
GHC-Options: -Wall -fno-warn-tabs
|
GHC-Options: -Wall -fno-warn-tabs
|
||||||
|
@ -262,6 +265,10 @@ Executable git-annex
|
||||||
Build-Depends: torrent (>= 10000.0.0)
|
Build-Depends: torrent (>= 10000.0.0)
|
||||||
CPP-Options: -DWITH_TORRENTPARSER
|
CPP-Options: -DWITH_TORRENTPARSER
|
||||||
|
|
||||||
|
if flag(Database)
|
||||||
|
Build-Depends: esqueleto, persistent-sqlite, persistent, persistent-template
|
||||||
|
CPP-Options: -DWITH_DATABASE
|
||||||
|
|
||||||
if flag(AsciiProgress)
|
if flag(AsciiProgress)
|
||||||
Build-Depends: ascii-progress (<= 0.2.1.2), terminal-size
|
Build-Depends: ascii-progress (<= 0.2.1.2), terminal-size
|
||||||
CPP-Options: -DWITH_ASCIIPROGRESS
|
CPP-Options: -DWITH_ASCIIPROGRESS
|
||||||
|
|
Loading…
Add table
Reference in a new issue