Subject: bug#46195: closed (Re: bug#46195: [PATCH] Add julia-http with dependencies)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 20 Mar 2021 21:33:02 +0000

Your bug report

#46195: [PATCH] Add julia-http with dependencies

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
46195: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=46195
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#46195: [PATCH] Add julia-http with dependencies
From: Ludovic Courtès <[email-masked]>
To: Nicolò Balzarotti <[email-masked]>
Cc: [email-masked]
Date: Sat, 20 Mar 2021 22:32:50 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Nicolò,

Nicolò Balzarotti <[email-masked]> skribis:

> This time one package (julia-mbedtls-jll) requires a shared library
> (mbedtls-apache).  The most recent way (threre has been a few during the
> years) Julia packages use to ship binaries is by using jllwrappers
> [fn:1], which generates package_jll (e.g. mbedtls-jll [fn:2]), a Julia
> package which is then included by the real Julia package (e.g. mbedtls
> [fn:3]).  Jllwrappers usually downloads prebuild binaries.  There's an
> override mechanism (creating a folder named "override" under the julia
> module dir).

So JLL is a “foreign function interface” (FFI), right?

> They recently added an easiesr way to override this behaviour
> (https://github.com/JuliaPackaging/JLLWrappers.jl/pull/27), but this
> will be available on julia 1.6+.
>
> In the meanwhile I see two ways around this:
> - symlinking deps into
>   /gnu/store/...julia-packagename-jll/[...]/override
> - patching both jllwrappers to support a custom override path, and then
>   patching the jllwrapper call inside each package-jll so that the
>   library/binary is searched in the correct directory.
>
> I do like this second approach more (but I don't have a strong opinion
> on this), so in this patchset I patched @generate_wrapper_header macro,
> so that it takes an optional parameter with the overidden library path.
> While we wait for julia 1.6, the way to use this is (like I'm doing in
> mbedtls-jll) to add the path to the library the generate_wrapper_header
> call, and everything works fine.  I also added the relative
> documentation.  If you think symlinking is a better approach, let me
> know so that I can update this patch set.

Sounds reasonable to me.

I pushed the whole series, tweaking one or two commit logs; I also took
the liberty to adjust this example:

> +The package @code{MbetTLS} can be taken as an example:
> +@lisp
> +(add-after 'unpack 'override-binary-path
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (map
> +              (lambda (wrapper)
> +                (substitute* wrapper
> +                  (("generate_wrapper_header.*")
> +                   (string-append
> +                    "generate_wrapper_header(\"MbedTLS\", \""
> +                    (assoc-ref inputs "mbedtls-apache") "\")\n"))))
> +              ;; There's a Julia file for each platform, override them all
> +              (find-files "src/wrappers/" "\\.jl$"))
> +             #t))
> +@end lisp

… where I “fixed” indentation, used ‘for-each’ instead of ‘map’, and
removed the trailing #t (it’s obsolescent).

Thank you, and apologies for the delay!

Ludo’.

Subject: [PATCH] Add julia-http with dependencies
From: Nicolò Balzarotti <[email-masked]>
To: [email-masked]
Date: Sat, 30 Jan 2021 22:21:04 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi guix!
Here's my second set of patches adding Julia packages.

This time one package (julia-mbedtls-jll) requires a shared library
(mbedtls-apache).  The most recent way (threre has been a few during the
years) Julia packages use to ship binaries is by using jllwrappers
[fn:1], which generates package_jll (e.g. mbedtls-jll [fn:2]), a Julia
package which is then included by the real Julia package (e.g. mbedtls
[fn:3]).  Jllwrappers usually downloads prebuild binaries.  There's an
override mechanism (creating a folder named "override" under the julia
module dir).

They recently added an easiesr way to override this behaviour
(https://github.com/JuliaPackaging/JLLWrappers.jl/pull/27), but this
will be available on julia 1.6+.

In the meanwhile I see two ways around this:
- symlinking deps into
  /gnu/store/...julia-packagename-jll/[...]/override
- patching both jllwrappers to support a custom override path, and then
  patching the jllwrapper call inside each package-jll so that the
  library/binary is searched in the correct directory.

I do like this second approach more (but I don't have a strong opinion
on this), so in this patchset I patched @generate_wrapper_header macro,
so that it takes an optional parameter with the overidden library path.
While we wait for julia 1.6, the way to use this is (like I'm doing in
mbedtls-jll) to add the path to the library the generate_wrapper_header
call, and everything works fine.  I also added the relative
documentation.  If you think symlinking is a better approach, let me
know so that I can update this patch set.

(Also, somehow I managed to add to errors in previous patches (wrong
arugment name in build system, wrong file name in julia-adapt, which I
fixed now.  I'm really sorry)

Thanks again!

Nicolò

[fn:1] https://github.com/JuliaPackaging/JLLWrappers.jl
[fn:2] https://github.com/JuliaBinaryWrappers/MbedTLS_jll.jl
[fn:3]
https://github.com/JuliaLang/MbedTLS.jl/blob/ec0d189551406b883259872611d913defb5cd423/Project.toml#L8

>From cd5c540f3bd238fa21d351b5f405aff600fad5a0 Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Sat, 30 Jan 2021 21:58:01 +0100
Subject: [PATCH 01/10] doc/guix.texi: Fix typo in julia-build-system.

* doc/guix.texi (julia-build-system): replace argument wrongly named
  julia-file-name with the correct julia-package-name.
---
 doc/guix.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 405b218289..bb777707f0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7619,7 +7619,7 @@ julia} packages, which essentially is similar to running @samp{julia -e
 Tests are run by calling @code{/test/runtests.jl}.
 
 The Julia package name is read from the file @file{Project.toml}.  This
-value can be overridden by passing the argument @code{#:julia-file-name}
+value can be overridden by passing the argument @code{#:julia-package-name}
 (which must be correctly capitalized).
 
 For packages requiring shared library dependencies, you may need to write the
-- 
2.30.0

>From fa665647736fb759646e1b53094690677c432a96 Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Sat, 30 Jan 2021 15:47:06 +0100
Subject: [PATCH 02/10] gnu: julia-xyz (julia-adapt): Set file-name according
 to standards.

---
 gnu/packages/julia-xyz.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index 34dba958ce..c9e1d0df8c 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -32,7 +32,7 @@
        (uri (git-reference
              (url "https://github.com/JuliaGPU/Adapt.jl")
              (commit (string-append "v" version))))
-       (file-name "Adapt")
+       (file-name (git-file-name name version))
        (sha256
         (base32 "1lks6k3a1gvwlplld47nh6xfy3nnlpc0vhkzg6zg0qn33qdmavrg"))))
     (build-system julia-build-system)
-- 
2.30.0

>From e7dcd1746d1cd9877928d867f516c81ff0e90034 Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Sat, 30 Jan 2021 15:47:29 +0100
Subject: [PATCH 03/10] gnu: Add julia-benchmarktools.

* gnu/packages/julia-xyz.scm (julia-benchmarktools): New variable.
---
 gnu/packages/julia-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index c9e1d0df8c..09043c593b 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -44,6 +44,28 @@ acts like @code{convert(T, x)}, but without the restriction of returning a
 be GPU compatible without throwing away the wrapper.")
     (license license:expat)))
 
+(define-public julia-benchmarktools
+  (package
+    (name "julia-benchmarktools")
+    (version "0.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/JuliaCI/BenchmarkTools.jl")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0nsx21m3i5h22lkgyrmfj6r085va6ag40khwssqs8y7l0wz98lvp"))))
+    (build-system julia-build-system)
+    (propagated-inputs `(("julia-json" ,julia-json)))
+    (home-page "https://github.com/JuliaCI/BenchmarkTools.jl")
+    (synopsis "Benchmarking framework for the Julia language")
+    (description "@code{BenchmarkTools.jl} makes performance tracking of Julia
+code easy by supplying a framework for writing and running groups of
+benchmarks as well as comparing benchmark results.")
+    (license license:expat)))
+
 (define-public julia-compat
   (package
     (name "julia-compat")
-- 
2.30.0

>From 4e7ce2bb7f21f0b423407a298868b7561390053f Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Tue, 19 Jan 2021 11:23:10 +0100
Subject: [PATCH 04/10] gnu: Add julia-jllwrappers.

* gnu/packages/julia-xyz.scm (julia-jllwrappers): New variable.
* doc/guix.texi (julia-build-system): Document how to use jllwrappers to use
  to guix binary packages.
---
 doc/guix.texi              | 28 +++++++++++++++++++++----
 gnu/packages/julia-xyz.scm | 43 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index bb777707f0..eea1a1e0c9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7622,10 +7622,30 @@ The Julia package name is read from the file @file{Project.toml}.  This
 value can be overridden by passing the argument @code{#:julia-package-name}
 (which must be correctly capitalized).
 
-For packages requiring shared library dependencies, you may need to write the
-@file{/deps/deps.jl} file manually.  It's usually a line of @code{const
-variable = /gnu/store/library.so} for each dependency, plus a void function
-@code{check_deps() = nothing}.
+Julia packages usually manage they binary dependencies via
+@code{JLLWrappers.jl}, a Julia package that creates a module (named
+after the wrapped library followed by @code{_jll.jl}.
+
+To add the binary path @code{_jll.jl} packages, you need to patch the
+files under @file{src/wrappers/}, replacing the call to the macro
+@code{JLLWrappers.@@generate_wrapper_header}, adding as a secound
+argument containing the store path the binary.
+
+The package @code{MbetTLS} can be taken as an example:
+@lisp
+(add-after 'unpack 'override-binary-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             (map
+              (lambda (wrapper)
+                (substitute* wrapper
+                  (("generate_wrapper_header.*")
+                   (string-append
+                    "generate_wrapper_header(\"MbedTLS\", \""
+                    (assoc-ref inputs "mbedtls-apache") "\")\n"))))
+              ;; There's a Julia file for each platform, override them all
+              (find-files "src/wrappers/" "\\.jl$"))
+             #t))
+@end lisp
 
 Some older packages that aren't using @file{Package.toml} yet, will require
 this file to be created, too.  The function @code{julia-create-package-toml}
diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index 09043c593b..b89733c412 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -147,6 +147,49 @@ scaled by a constant factor.  Consequently, they have a fixed number of
 digits (bits) after the decimal (radix) point.")
     (license license:expat)))
 
+(define-public julia-jllwrappers
+  (package
+    (name "julia-jllwrappers")
+    (version "1.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/JuliaPackaging/JLLWrappers.jl")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1sj3mi2dcc13apqfpy401wic5n0pgbck1p98b2g3zw0mln9s83m4"))))
+    (arguments
+     ;; Wants to download stuff
+     '(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'custom-override-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Make @generate_wrapper_header take an optional argument that
+             ;; guix packagers can pass to override the default "override"
+             ;; binary path.  This won't be needed when something like
+             ;; https://github.com/JuliaPackaging/JLLWrappers.jl/pull/27
+             ;; will be merged.
+             (substitute* "src/wrapper_generators.jl"
+               (("generate_wrapper_header.*")
+                "generate_wrapper_header(src_name, override_path = nothing)\n")
+               (("pkg_dir = .*" all)
+                (string-append
+                 all "\n" "override = something(override_path,"
+                 "joinpath(dirname(pkg_dir), \"override\"))\n"))
+               (("@static if isdir.*") "@static if isdir($override)\n")
+               (("return joinpath.*") "return $override\n"))
+             #t)))))
+    (build-system julia-build-system)
+    (home-page "https://github.com/JuliaPackaging/JLLWrappers.jl")
+    (synopsis "Julia macros used by JLL packages")
+    (description "This package contains Julia macros that enable JLL packages
+to generate themselves.  It is not intended to be used by users, but rather is
+used in autogenerated packages via @code{BinaryBuilder.jl}.")
+    (license license:expat)))
+
 (define-public julia-json
   (package
     (name "julia-json")
-- 
2.30.0

>From ee716b2a52933154b3fb5f0c12dc9cd5f5e965d6 Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Tue, 19 Jan 2021 11:23:37 +0100
Subject: [PATCH 05/10] gnu: Add julia-mbedtls-jll.

* gnu/packages/julia-xyz.scm (julia-mbedtls-jll): New variable.
---
 gnu/packages/julia-xyz.scm | 43 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index b89733c412..ab3497700a 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -20,7 +20,8 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix git-download)
-  #:use-module (guix build-system julia))
+  #:use-module (guix build-system julia)
+  #:use-module (gnu packages tls))
 
 (define-public julia-adapt
   (package
@@ -215,6 +216,46 @@ used in autogenerated packages via @code{BinaryBuilder.jl}.")
 and printing JSON documents.")
     (license license:expat)))
 
+(define-public julia-mbedtls-jll
+  (package
+    (name "julia-mbedtls-jll")
+    ;; version 2.25.0+0 is not compatible with current mbedtls 2.23.0,
+    ;; upgrade this when mbedtls is updated in guix
+    (version "2.24.0+1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/JuliaBinaryWrappers/MbedTLS_jll.jl")
+             (commit (string-append "MbedTLS-v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0kk9dlxdh7yms21npgrdfmjbj8q8ng6kdhrzw3jr2d7rp696kp99"))))
+    (build-system julia-build-system)
+    (arguments
+     '(#:tests? #f                      ; No runtests.jl
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'override-binary-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             (map
+              (lambda (wrapper)
+                (substitute* wrapper
+                  (("generate_wrapper_header.*")
+                   (string-append
+                    "generate_wrapper_header(\"MbedTLS\", \""
+                    (assoc-ref inputs "mbedtls-apache") "\")\n"))))
+              ;; There's a Julia file for each platform, override them all
+              (find-files "src/wrappers/" "\\.jl$"))
+             #t)))))
+    (inputs `(("mbedtls-apache" ,mbedtls-apache)))
+    (propagated-inputs `(("julia-jllwrappers" ,julia-jllwrappers)))
+    (home-page "https://github.com/JuliaBinaryWrappers/MbedTLS_jll.jl")
+    (synopsis "Apache's mbed TLS binary wrappers")
+    (description "This Julia module provides @code{mbed TLS} libraries and
+wrappers.")
+    (license license:expat)))
+
 (define-public julia-orderedcollections
   (package
     (name "julia-orderedcollections")
-- 
2.30.0

>From 05641a0e30b041ba819e2dec18483cc5baf80c98 Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Wed, 27 Jan 2021 00:35:20 +0100
Subject: [PATCH 06/10] gnu: Add julia-mbedtls.

* gnu/packages/julia-xyz.scm (julia-mbedtls): New variable.
---
 gnu/packages/julia-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index ab3497700a..9e0e41c844 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -216,6 +216,36 @@ used in autogenerated packages via @code{BinaryBuilder.jl}.")
 and printing JSON documents.")
     (license license:expat)))
 
+(define-public julia-mbedtls
+  (package
+    (name "julia-mbedtls")
+    (version "1.0.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/JuliaLang/MbedTLS.jl")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0zjzf2r57l24n3k0gcqkvx3izwn5827iv9ak0lqix0aa5967wvfb"))))
+    (build-system julia-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'install 'disable-network-tests
+           ;; Tries to connect to httpbin.org
+           (lambda _
+             (substitute* "test/runtests.jl"
+               (("testhost =") "return #"))
+             #t)))))
+    (propagated-inputs `(("julia-mbedtls-jll" ,julia-mbedtls-jll)))
+    (home-page "https://github.com/JuliaLang/MbedTLS.jl")
+    (synopsis "Apache's mbed TLS library wrapper")
+    (description "@code{MbedTLS.jl} provides a wrapper around the @code{mbed
+TLS} and cryptography C libary for Julia.")
+    (license license:expat)))
+
 (define-public julia-mbedtls-jll
   (package
     (name "julia-mbedtls-jll")
-- 
2.30.0

>From efbf8fe2a9b6cf24afebd2c9927341305b2403b7 Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Tue, 19 Jan 2021 11:44:51 +0100
Subject: [PATCH 07/10] gnu: Add julia-uris.

* gnu/packages/julia-xyz.scm (julia-uris): New variable.
---
 gnu/packages/julia-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index 9e0e41c844..6021a6ff7a 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -352,3 +352,37 @@ languages like Fortran.")
     (description "@code{Parsers.jl} is a collection of type parsers and
 utilities for Julia.")
     (license license:expat)))
+
+(define-public julia-uris
+  (package
+    (name "julia-uris")
+    (version "1.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/JuliaWeb/URIs.jl")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0fqyagsqks5za7m0czafr34m2xh5501f689k9cn5x3npajdnh2r3"))))
+    (build-system julia-build-system)
+    (arguments
+     '(#:julia-package-name "URIs"      ;required to run tests
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'change-dir
+           ;; Tests must be run from the testdir
+           (lambda* (#:key source outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (chdir
+                (string-append out "/share/julia/packages/URIs/test")))
+             #t)))))
+    ;; required for tests
+    (inputs `(("julia-json" ,julia-json)))
+    (home-page "https://github.com/JuliaWeb/URIs.jl")
+    (synopsis "URI parsing in Julia")
+    (description "@code{URIs.jl} is a Julia package that allows parsing and
+working with @acronym{URIs,Uniform Resource Identifiers}, as defined in RFC
+3986.")
+    (license license:expat)))
-- 
2.30.0

>From 6e08c819ed47d2ae8807bbb8979e77093f537e1d Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Tue, 19 Jan 2021 12:02:38 +0100
Subject: [PATCH 08/10] gnu: Add julia-inifile.

* gnu/packages/julia-xyz.scm (julia-inifile): New variable.
---
 gnu/packages/julia-xyz.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index 6021a6ff7a..738060f865 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -148,6 +148,26 @@ scaled by a constant factor.  Consequently, they have a fixed number of
 digits (bits) after the decimal (radix) point.")
     (license license:expat)))
 
+(define-public julia-inifile
+  (package
+    (name "julia-inifile")
+    (version "0.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/JuliaIO/IniFile.jl")
+             (commit "8ba59958495fa276d6489d2c3903e765d75e0bc0")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "11h6f99jpbg729lplw841m68jprka7q3n8yw390bndlmcdsjabpd"))))
+    (build-system julia-build-system)
+    (home-page "https://github.com/JuliaIO/IniFile.jl")
+    (synopsis "Reading Windows-style INI files")
+    (description "This is a Julia package that defines an IniFile type that
+allows to interface with @file{.ini} files.")
+    (license license:expat)))
+
 (define-public julia-jllwrappers
   (package
     (name "julia-jllwrappers")
-- 
2.30.0

>From ed48a42be449e43e785b45ba296e4abbd7ac4d89 Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Tue, 19 Jan 2021 12:08:27 +0100
Subject: [PATCH 09/10] gnu: Add julia-bufferedstreams.

* gnu/packages/julia-xyz.scm (julia-bufferedstreams): New variable.
---
 gnu/packages/julia-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index 738060f865..a3c5c55a86 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -67,6 +67,34 @@ code easy by supplying a framework for writing and running groups of
 benchmarks as well as comparing benchmark results.")
     (license license:expat)))
 
+(define-public julia-bufferedstreams
+  (package
+    (name "julia-bufferedstreams")
+    (version "1.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/BioJulia/BufferedStreams.jl")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sf4sxbq55mg2pwxyxf0c839z1lk0yxg8nmb7617bfbvw31cp88z"))))
+    (build-system julia-build-system)
+    ;; The package is old and tests are using undefined functions.  They also
+    ;; freeze, see
+    ;; https://travis-ci.org/BioJulia/BufferedStreams.jl/jobs/491050182
+    (arguments
+     '(#:tests? #f
+       #:julia-package-name "BufferedStreams"))
+    (propagated-inputs `(("julia-compat" ,julia-compat)))
+    (home-page "https://github.com/BioJulia/BufferedStreams.jl")
+    (synopsis "Fast composable IO streams")
+    (description "@code{BufferedStreams.jl} provides buffering for IO
+operations.  It can wrap any @code{IO} type automatically making incremental
+reading and writing faster.")
+    (license license:expat)))
+
 (define-public julia-compat
   (package
     (name "julia-compat")
-- 
2.30.0

>From 5131c1274f7b30e7e04a831533b9bee193df429a Mon Sep 17 00:00:00 2001
From: nixo <[email-masked]>
Date: Tue, 19 Jan 2021 13:29:00 +0100
Subject: [PATCH 10/10] gnu: Add julia-http.

* gnu/packages/julia-xyz.scm (julia-http): New variable.
---
 gnu/packages/julia-xyz.scm | 58 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index a3c5c55a86..0d35cbde57 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -176,6 +176,64 @@ scaled by a constant factor.  Consequently, they have a fixed number of
 digits (bits) after the decimal (radix) point.")
     (license license:expat)))
 
+(define-public julia-http
+  (package
+    (name "julia-http")
+    (version "0.9.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/JuliaWeb/HTTP.jl")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ij0yci13c46p92m4zywvcs02nn8pm0abyfffiyhxvva6hq48lyl"))))
+    (build-system julia-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'install 'disable-network-tests
+           (lambda _
+             (substitute* "test/runtests.jl"
+               (("\"async.jl") "# \"async.jl")
+               (("\"client.jl") "# \"client.jl"))
+             (substitute* "test/aws4.jl"
+               (("@testset.*HTTP.request with AWS authentication.*" all)
+                (string-append all "return\n")))
+             (substitute* "test/insert_layers.jl"
+               (("@testset.*Inserted final layer runs handler.*" all)
+                (string-append all "return\n")))
+             (substitute* "test/multipart.jl"
+               (("@testset \"Setting of Content-Type.*" all)
+                (string-append all "return\n"))
+               (("@testset \"Deprecation of .*" all)
+                (string-append all "return\n")))
+             (substitute* "test/websockets.jl"
+               (("@testset.*External Host.*" all)
+                (string-append all "return\n")))
+             (substitute* "test/messages.jl"
+               (("@testset.*Read methods.*" all)
+                (string-append all "return\n"))
+               (("@testset.*Body - .*" all)
+                (string-append all "return\n"))
+               (("@testset.*Write to file.*" all)
+                (string-append all "return\n")))
+             #t)))))
+    (propagated-inputs
+     `(("julia-inifile" ,julia-inifile)
+       ("julia-mbedtls" ,julia-mbedtls)
+       ("julia-uris" ,julia-uris)))
+    ;; required for tests
+    (inputs
+     `(("julia-json" ,julia-json)
+       ("julia-bufferedstreams" ,julia-bufferedstreams)))
+    (home-page "https://juliaweb.github.io/HTTP.jl/")
+    (synopsis "HTTP support for Julia")
+    (description "@code{HTTP.jl} is a Julia library for HTTP Messages,
+implementing both a client and a server.")
+    (license license:expat)))
+
 (define-public julia-inifile
   (package
     (name "julia-inifile")
-- 
2.30.0