Build with the http-client-restricted 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-http-client-restricted-dev

This commit was sponsored by Ilya Shlyakhter on Patreon.
This commit is contained in:
Joey Hess 2020-06-22 11:30:33 -04:00
parent 01eb863a14
commit 104b3a9c6a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 28 additions and 3 deletions

View file

@ -6,6 +6,8 @@
- Licensed under the GNU AGPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
module Annex.Url (
withUrlOptions,
withUrlOptionsPromptingCreds,
@ -34,7 +36,11 @@ import Annex.Common
import qualified Annex
import qualified Utility.Url as U
import Utility.IPAddress
#ifdef WITH_HTTP_CLIENT_RESTRICTED
import Network.HTTP.Client.Restricted
#else
import Utility.HttpManagerRestricted
#endif
import Utility.Metered
import Git.Credential
import qualified BuildInfo

View file

@ -3,8 +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.
* Build with the http-client-restricted and git-lfs libraries when
available, otherwise use the vendored copy as before.
-- Joey Hess <id@joeyh.name> Thu, 18 Jun 2020 12:21:14 -0400

View file

@ -9,6 +9,9 @@
{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, LambdaCase, PatternGuards #-}
-- This is a vendored copy of Network.HTTP.Client.Restricted from the
-- http-client-restricted package, and will be removed once that package
-- is available in all build environments.
module Utility.HttpManagerRestricted (
Restriction,
checkAddressRestriction,

View file

@ -9,6 +9,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
module Utility.Url (
newManager,
@ -44,7 +45,11 @@ module Utility.Url (
import Common
import Utility.Metered
#ifdef WITH_HTTP_CLIENT_RESTRICTED
import Network.HTTP.Client.Restricted
#else
import Utility.HttpManagerRestricted
#endif
import Utility.IPAddress
import Network.URI

View file

@ -293,6 +293,10 @@ Flag GitLfs
Description: Build with git-lfs library (rather than vendored copy)
Default: True
Flag HttpClientRestricted
Description: Build with http-client-restricted library (rather than vendored copy)
Default: True
source-repository head
type: git
location: git://git-annex.branchable.com/
@ -416,6 +420,12 @@ Executable git-annex
CPP-Options: -DWITH_GIT_LFS
else
Other-Modules: Utility.GitLFS
if flag(HttpClientRestricted)
Build-Depends: http-client-restricted (>= 0.0.2)
CPP-Options: -DWITH_HTTP_CLIENT_RESTRICTED
else
Other-Modules: Utility.HttpManagerRestricted
if flag(S3)
Build-Depends: aws (>= 0.20)
@ -1074,7 +1084,6 @@ Executable git-annex
Utility.Gpg
Utility.Hash
Utility.HtmlDetect
Utility.HttpManagerRestricted
Utility.HumanNumber
Utility.HumanTime
Utility.InodeCache

View file

@ -13,6 +13,7 @@ flags:
benchmark: false
networkbsd: false
gitlfs: true
httpclientrestricted: true
packages:
- '.'
extra-deps:

View file

@ -13,6 +13,7 @@ flags:
benchmark: false
networkbsd: false
gitlfs: true
httpclientrestricted: true
packages:
- '.'
extra-deps: