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. - Licensed under the GNU AGPL version 3 or higher.
-} -}
{-# LANGUAGE CPP #-}
module Annex.Url ( module Annex.Url (
withUrlOptions, withUrlOptions,
withUrlOptionsPromptingCreds, withUrlOptionsPromptingCreds,
@ -34,7 +36,11 @@ import Annex.Common
import qualified Annex import qualified Annex
import qualified Utility.Url as U import qualified Utility.Url as U
import Utility.IPAddress import Utility.IPAddress
#ifdef WITH_HTTP_CLIENT_RESTRICTED
import Network.HTTP.Client.Restricted
#else
import Utility.HttpManagerRestricted import Utility.HttpManagerRestricted
#endif
import Utility.Metered import Utility.Metered
import Git.Credential import Git.Credential
import qualified BuildInfo 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 * Fix a deadlock that could occur after git-annex got an unlocked
file, causing the command to hang indefinitely. Known to happen on file, causing the command to hang indefinitely. Known to happen on
vfat filesystems, possibly others. vfat filesystems, possibly others.
* Build with the git-lfs library when available, otherwise use the * Build with the http-client-restricted and git-lfs libraries when
vendored copy as before. available, otherwise use the vendored copy as before.
-- Joey Hess <id@joeyh.name> Thu, 18 Jun 2020 12:21:14 -0400 -- Joey Hess <id@joeyh.name> Thu, 18 Jun 2020 12:21:14 -0400

View file

@ -9,6 +9,9 @@
{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, LambdaCase, PatternGuards #-} {-# 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 ( module Utility.HttpManagerRestricted (
Restriction, Restriction,
checkAddressRestriction, checkAddressRestriction,

View file

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

View file

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

View file

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

View file

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