build: julia: Add 'julia-package-dependencies' as keyword.

* guix/build-system/julia.scm (link-depot): Accept julia-package-dependencies
keyword and use it for 'julia-create-package-toml' function.
(julia-create-package-toml): Use pattern matching.
(julia-build): Add 'julia-pacakge-dependencies'.
* guix/build/julia-build-system.scm (julia-build): Add
'#:julia-package-dependencies' keyword.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
This commit is contained in:
Efraim Flashner 2022-02-23 14:47:05 +01:00
parent 637e677140
commit 05d469ab9d
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351
2 changed files with 15 additions and 6 deletions

View file

@ -2,7 +2,8 @@
;;; Copyright © 2019 Nicolò Balzarotti <nicolo@nixo.xyz> ;;; Copyright © 2019 Nicolò Balzarotti <nicolo@nixo.xyz>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me> ;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com> ;;; Copyright © 2021, 2022 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -88,6 +89,7 @@ (define* (julia-build name inputs
(guile #f) (guile #f)
(julia-package-name #f) (julia-package-name #f)
(julia-package-uuid #f) (julia-package-uuid #f)
(julia-package-dependencies ''())
(imported-modules %julia-build-system-modules) (imported-modules %julia-build-system-modules)
(modules '((guix build julia-build-system) (modules '((guix build julia-build-system)
(guix build utils)))) (guix build utils))))
@ -108,7 +110,8 @@ (define builder
search-paths)) search-paths))
#:inputs #$(input-tuples->gexp inputs) #:inputs #$(input-tuples->gexp inputs)
#:julia-package-name #$julia-package-name #:julia-package-name #$julia-package-name
#:julia-package-uuid #$julia-package-uuid)))) #:julia-package-uuid #$julia-package-uuid
#:julia-package-dependencies #$julia-package-dependencies))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile)) (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f))) system #:graft? #f)))

View file

@ -2,6 +2,7 @@
;;; Copyright © 2019, 2020 Nicolò Balzarotti <nicolo@nixo.xyz> ;;; Copyright © 2019, 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me> ;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
;;; Copyright © 2021, 2022 Simon Tournier <zimon.toutoune@gmail.com> ;;; Copyright © 2021, 2022 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -136,7 +137,8 @@ (define* (check #:key tests? source inputs outputs julia-package-name
package "/test/runtests.jl")))))) package "/test/runtests.jl"))))))
(define* (link-depot #:key source inputs outputs (define* (link-depot #:key source inputs outputs
julia-package-name julia-package-uuid #:allow-other-keys) julia-package-name julia-package-uuid
julia-package-dependencies #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(name+version (strip-store-file-name out)) (name+version (strip-store-file-name out))
(version (last (string-split name+version #\-))) (version (last (string-split name+version #\-)))
@ -156,6 +158,7 @@ (define* (link-depot #:key source inputs outputs
(julia-create-package-toml (getcwd) (julia-create-package-toml (getcwd)
julia-package-name julia-package-uuid julia-package-name julia-package-uuid
version version
julia-package-dependencies
#:file "Project.toml")) #:file "Project.toml"))
;; When installing a package, julia looks first at in the JULIA_DEPOT_PATH ;; When installing a package, julia looks first at in the JULIA_DEPOT_PATH
@ -186,9 +189,10 @@ (define* (julia-create-package-toml location
") f) ") f)
(when (not (null? deps)) (when (not (null? deps))
(display "[deps]\n" f) (display "[deps]\n" f)
(for-each (lambda dep (for-each (match-lambda
(display (string-append (car (car dep)) " = \"" (cdr (car dep)) "\"\n") ((name . uuid)
f)) (display (string-append name " = \"" uuid "\"\n")
f)))
deps)) deps))
(close-port f))) (close-port f)))
@ -207,6 +211,7 @@ (define %standard-phases
(delete 'build))) (delete 'build)))
(define* (julia-build #:key inputs julia-package-name julia-package-uuid (define* (julia-build #:key inputs julia-package-name julia-package-uuid
julia-package-dependencies
(phases %standard-phases) (phases %standard-phases)
#:allow-other-keys #:rest args) #:allow-other-keys #:rest args)
"Build the given Julia package, applying all of PHASES in order." "Build the given Julia package, applying all of PHASES in order."
@ -214,4 +219,5 @@ (define* (julia-build #:key inputs julia-package-name julia-package-uuid
#:inputs inputs #:phases phases #:inputs inputs #:phases phases
#:julia-package-name julia-package-name #:julia-package-name julia-package-name
#:julia-package-uuid julia-package-uuid #:julia-package-uuid julia-package-uuid
#:julia-package-dependencies julia-package-dependencies
args)) args))