summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-02-03 09:14:43 +0000
committerChristopher Baines <mail@cbaines.net>2021-02-03 09:57:35 +0000
commite740cc614096e768813280c718f9e96343ba41b3 (patch)
tree25ade70a5d408be80f62f19c6511172aab7dcce5 /guix/build
parent1b9186828867e77af1f2ee6741063424f8256398 (diff)
parent63cf277bfacf282d2b19f00553745b2a9370eca0 (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/julia-build-system.scm58
-rw-r--r--guix/build/profiles.scm6
2 files changed, 47 insertions, 17 deletions
diff --git a/guix/build/julia-build-system.scm b/guix/build/julia-build-system.scm
index e8ebcf8ba0..8f57045a8c 100644
--- a/guix/build/julia-build-system.scm
+++ b/guix/build/julia-build-system.scm
@@ -21,6 +21,8 @@
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
#:use-module (guix build utils)
#:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 rdelim)
#:export (%standard-phases
julia-create-package-toml
julia-build))
@@ -37,18 +39,34 @@
;; subpath where we store the package content
(define %package-path "/share/julia/packages/")
-(define* (install #:key source inputs outputs #:allow-other-keys)
+(define (project.toml->name file)
+ "Look for Julia package name in the TOML file FILE (usually named
+Project.toml)."
+ (call-with-input-file file
+ (lambda (in)
+ (let loop ((line (read-line in 'concat)))
+ (if (eof-object? line)
+ #f
+ (let ((m (string-match "name\\s*=\\s*\"(.*)\"" line)))
+ (if m (match:substring m 1)
+ (loop (read-line in 'concat)))))))))
+
+(define* (install #:key source inputs outputs julia-package-name
+ #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(package-dir (string-append out %package-path
- (strip-store-file-name source))))
+ (or
+ julia-package-name
+ (project.toml->name "Project.toml")))))
(mkdir-p package-dir)
(copy-recursively (getcwd) package-dir))
#t)
-(define* (precompile #:key source inputs outputs #:allow-other-keys)
+(define* (precompile #:key source inputs outputs julia-package-name
+ #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(builddir (string-append out "/share/julia/"))
- (package (strip-store-file-name source)))
+ (package (or julia-package-name (project.toml->name "Project.toml"))))
(mkdir-p builddir)
;; With a patch, SOURCE_DATE_EPOCH is honored
(setenv "SOURCE_DATE_EPOCH" "1")
@@ -69,15 +87,23 @@
(string-append "pushfirst!(DEPOT_PATH, pop!(DEPOT_PATH)); using " package)))
#t)
-(define* (check #:key source inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (package (strip-store-file-name source))
- (builddir (string-append out "/share/julia/")))
- ;; With a patch, SOURCE_DATE_EPOCH is honored
- (setenv "SOURCE_DATE_EPOCH" "1")
- (setenv "JULIA_DEPOT_PATH" builddir)
- (setenv "JULIA_LOAD_PATH" (string-append builddir "packages/"))
- (invoke-julia (string-append "using Pkg;Pkg.test(\"" package "\")")))
+(define* (check #:key tests? source inputs outputs julia-package-name
+ #:allow-other-keys)
+ (when tests?
+ (let* ((out (assoc-ref outputs "out"))
+ (package (or julia-package-name (project.toml->name "Project.toml")))
+ (builddir (string-append out "/share/julia/")))
+ ;; With a patch, SOURCE_DATE_EPOCH is honored
+ (setenv "SOURCE_DATE_EPOCH" "1")
+ (setenv "JULIA_DEPOT_PATH" builddir)
+ (setenv "JULIA_LOAD_PATH"
+ (string-append builddir "packages/" ":"
+ (or (getenv "JULIA_LOAD_PATH")
+ "")))
+ (setenv "HOME" "/tmp")
+ (invoke "julia"
+ (string-append builddir "packages/"
+ package "/test/runtests.jl"))))
#t)
(define (julia-create-package-toml outputs source
@@ -112,7 +138,7 @@ version = \"" version "\"
(delete 'check) ; tests must be run after installation
(replace 'install install)
(add-after 'install 'precompile precompile)
- ;; (add-after 'install 'check check)
+ (add-after 'install 'check check)
;; TODO: In the future we could add a "system-image-generation" phase
;; where we use PackageCompiler.jl to speed up package loading times
(delete 'configure)
@@ -120,9 +146,11 @@ version = \"" version "\"
(delete 'patch-usr-bin-file)
(delete 'build)))
-(define* (julia-build #:key inputs (phases %standard-phases)
+(define* (julia-build #:key inputs julia-package-name
+ (phases %standard-phases)
#:allow-other-keys #:rest args)
"Build the given Julia package, applying all of PHASES in order."
(apply gnu:gnu-build
#:inputs inputs #:phases phases
+ #:julia-package-name julia-package-name
args))
diff --git a/guix/build/profiles.scm b/guix/build/profiles.scm
index 67ee9b665a..b42f498a80 100644
--- a/guix/build/profiles.scm
+++ b/guix/build/profiles.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -169,7 +169,9 @@ SEARCH-PATHS."
(lambda (p)
(display "\
;; This file was automatically generated and is for internal use only.
-;; It cannot be passed to the '--manifest' option.\n\n"
+;; It cannot be passed to the '--manifest' option.
+;; Run 'guix package --export-manifest' if to export a file suitable
+;; for '--manifest'.\n\n"
p)
(pretty-print manifest p)))