From 01eb863a14be2270b8bb02d7f9f8e5e7ea6175b7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 22 Jun 2020 11:21:25 -0400 Subject: [PATCH] Build with the git-lfs library when available Otherwise use the vendored copy as before. The library is in Debian testing but not stable. Once it reaches stable, the vendored copy can be removed. Did not add it to debian/control because IIRC that's used to build git-annex on stable too, possibly. However, the Debian maintainer will probably want to make the package depend on libghc-git-lfs-dev. This commit was sponsored by Ilya Shlyakhter on Patreon. --- CHANGELOG | 2 ++ Remote/GitLFS.hs | 8 +++++++- Utility/GitLFS.hs | 3 +++ git-annex.cabal | 12 +++++++++++- stack-lts-12.14.yaml | 1 + stack.yaml | 1 + 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 673e75001b..df0c6cb687 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,8 @@ git-annex (8.20200618) UNRELEASED; urgency=medium * Fix a deadlock that could occur after git-annex got an unlocked file, causing the command to hang indefinitely. Known to happen on vfat filesystems, possibly others. + * Build with the git-lfs library when available, otherwise use the + vendored copy as before. -- Joey Hess Thu, 18 Jun 2020 12:21:14 -0400 diff --git a/Remote/GitLFS.hs b/Remote/GitLFS.hs index 1d2444b050..a829bd39e8 100644 --- a/Remote/GitLFS.hs +++ b/Remote/GitLFS.hs @@ -6,6 +6,7 @@ -} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE CPP #-} module Remote.GitLFS (remote, gen, configKnownUrl) where @@ -39,9 +40,14 @@ import Utility.SshHost import Utility.Url import Logs.Remote import Logs.RemoteState -import qualified Utility.GitLFS as LFS import qualified Git.Config +#ifdef WITH_GIT_LFS +import qualified Network.GitLFS as LFS +#else +import qualified Utility.GitLFS as LFS +#endif + import Control.Concurrent.STM import Data.String import Network.HTTP.Types diff --git a/Utility/GitLFS.hs b/Utility/GitLFS.hs index 82c4808e39..831423502a 100644 --- a/Utility/GitLFS.hs +++ b/Utility/GitLFS.hs @@ -21,6 +21,9 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE LambdaCase #-} +-- This is a vendored copy of Network.GitLFS from the git-lfs package, +-- and will be removed once that package is available in all build +-- environments. module Utility.GitLFS ( -- * Transfer requests TransferRequest(..), diff --git a/git-annex.cabal b/git-annex.cabal index 670f711173..35dd3ef3c5 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -289,6 +289,10 @@ Flag NetworkBSD Description: Build with network-3.0 which split out network-bsd Default: True +Flag GitLfs + Description: Build with git-lfs library (rather than vendored copy) + Default: True + source-repository head type: git location: git://git-annex.branchable.com/ @@ -407,6 +411,12 @@ Executable git-annex else Build-Depends: network (< 3.0.0.0), network (>= 2.6.3.0) + if flag(GitLfs) + Build-Depends: git-lfs (>= 1.1.0) + CPP-Options: -DWITH_GIT_LFS + else + Other-Modules: Utility.GitLFS + if flag(S3) Build-Depends: aws (>= 0.20) CPP-Options: -DWITH_S3 @@ -418,6 +428,7 @@ Executable git-annex Other-Modules: Remote.WebDAV Remote.WebDAV.DavLocation + if flag(S3) || flag(WebDAV) Other-Modules: Remote.Helper.Http @@ -1059,7 +1070,6 @@ Executable git-annex Utility.FileSystemEncoding Utility.Format Utility.FreeDesktop - Utility.GitLFS Utility.Glob Utility.Gpg Utility.Hash diff --git a/stack-lts-12.14.yaml b/stack-lts-12.14.yaml index 93ee338fa7..918a042c6c 100644 --- a/stack-lts-12.14.yaml +++ b/stack-lts-12.14.yaml @@ -12,6 +12,7 @@ flags: debuglocks: false benchmark: false networkbsd: false + gitlfs: true packages: - '.' extra-deps: diff --git a/stack.yaml b/stack.yaml index 487ccfad2d..d2ee985a14 100644 --- a/stack.yaml +++ b/stack.yaml @@ -12,6 +12,7 @@ flags: debuglocks: false benchmark: false networkbsd: false + gitlfs: true packages: - '.' extra-deps: