From: zimoun <zimon.toutoune@gmail.com>
To: 53017@debbugs.gnu.org
Cc: efraim@flashner.co.il, zimoun <zimon.toutoune@gmail.com>
Subject: [bug#53017] [PATCH 02/17] build: julia-build-system: Create 'Project.toml' file when missing.
Date: Tue, 4 Jan 2022 23:47:40 +0100 [thread overview]
Message-ID: <20220104224755.1142897-2-zimon.toutoune@gmail.com> (raw)
In-Reply-To: <20220104224755.1142897-1-zimon.toutoune@gmail.com>
* guix/build/julia-build-system.scm (link-depot): Create 'Project.toml' file
when missing using data provided by the user.
(julia-create-package-toml): Remove from export.
* doc/guix.texi (Build Systems): Update julia-build-system section.
---
doc/guix.texi | 19 +++++++++---------
guix/build/julia-build-system.scm | 33 ++++++++++++++++++++-----------
2 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index dfb94be74e..603f8dcca3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Kyle Andrews@*
Copyright @copyright{} 2019 Alex Griffin@*
Copyright @copyright{} 2019, 2020, 2021 Guillaume Le Vaillant@*
Copyright @copyright{} 2020 Liliana Marie Prikler@*
-Copyright @copyright{} 2019, 2020, 2021 Simon Tournier@*
+Copyright @copyright{} 2019, 2020, 2021, 2022 Simon Tournier@*
Copyright @copyright{} 2020 Wiktor Żelazny@*
Copyright @copyright{} 2020 Damien Cassou@*
Copyright @copyright{} 2020 Jakub Kądziołka@*
@@ -8363,9 +8363,10 @@ julia} packages, which essentially is similar to running @samp{julia -e
@env{JULIA_LOAD_PATH} contains the paths to all Julia package inputs.
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-package-name}
-(which must be correctly capitalized).
+The Julia package name and uuid is read from the file
+@file{Project.toml}. These values can be overridden by passing the
+argument @code{#:julia-package-name} (which must be correctly
+capitalized) or @code{#:julia-package-uuid}.
Julia packages usually manage their binary dependencies via
@code{JLLWrappers.jl}, a Julia package that creates a module (named
@@ -8393,12 +8394,10 @@ MbedTLS package:
(find-files "src/wrappers/" "\\.jl$"))))
@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}
-helps creating the file. You need to pass the outputs and the source of the
-package, its name (the same as the @code{file-name} parameter), the package
-uuid, the package version, and a list of dependencies specified by their name
-and their uuid.
+Some older packages that aren't using @file{Project.toml} yet, will
+require this file to be created, too. It is internally done if the
+arguments @code{#:julia-package-name} and @code{#:julia-package-uuid}
+are provided.
@end defvr
@defvr {Scheme Variable} maven-build-system
diff --git a/guix/build/julia-build-system.scm b/guix/build/julia-build-system.scm
index b4e0044567..03d669be64 100644
--- a/guix/build/julia-build-system.scm
+++ b/guix/build/julia-build-system.scm
@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
;;; 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>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,8 +27,8 @@ (define-module (guix build julia-build-system)
#:use-module (ice-9 regex)
#:use-module (ice-9 rdelim)
#:use-module (ice-9 popen)
+ #:use-module (srfi srfi-1)
#:export (%standard-phases
- julia-create-package-toml
julia-build))
;; Commentary:
@@ -138,6 +138,8 @@ (define* (check #:key tests? source inputs outputs julia-package-name
(define* (link-depot #:key source inputs outputs
julia-package-name julia-package-uuid #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
+ (name+version (strip-store-file-name out))
+ (version (last (string-split name+version #\-)))
(package-name (or
julia-package-name
(project.toml->name "Project.toml")))
@@ -148,6 +150,14 @@ (define* (link-depot #:key source inputs outputs
println(Base.version_slug(Base.UUID(\"~a\"),
Base.SHA1(Pkg.GitTools.tree_hash(\".\"))))" uuid)))
(slug (string-trim-right (get-string-all pipe))))
+ ;; Few packages do not have the regular Project.toml file, then when they
+ ;; are propagated, dependencies do not find them and an raise error.
+ (unless (file-exists? "Project.toml")
+ (julia-create-package-toml (getcwd)
+ julia-package-name julia-package-uuid
+ version
+ #:file "Project.toml"))
+
;; When installing a package, julia looks first at in the JULIA_DEPOT_PATH
;; for a path like packages/PACKAGE/XXXX
;; Where XXXX is a slug encoding the package UUID and SHA1 of the files
@@ -157,17 +167,16 @@ (define* (link-depot #:key source inputs outputs
(symlink package-dir (string-append out "/share/julia/packages/"
package-name "/" slug))))
-(define (julia-create-package-toml outputs source
- name uuid version
- deps)
- "Some packages are not using the new Package.toml dependency specifications.
-Write this file manually, so that Julia can find its dependencies."
+(define* (julia-create-package-toml location
+ name uuid version
+ #:optional
+ (deps '())
+ #:key
+ (file "Project.toml"))
+ "Some packages are not using the new Project.toml dependency specifications.
+Write this FILE manually, so that Julia can find its dependencies."
(let ((f (open-file
- (string-append
- (assoc-ref outputs "out")
- %package-path
- (string-append
- name "/Project.toml"))
+ (string-append location "/" file)
"w")))
(display (string-append
"
--
2.33.1
next prev parent reply other threads:[~2022-01-04 22:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 22:45 [bug#53017] [PATCH 00/17] Add julia-biosequences and julia-bioalignments zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 01/17] gnu: julia-xyz: Adjust style zimoun
2022-01-04 22:47 ` zimoun [this message]
2022-01-04 22:47 ` [bug#53017] [PATCH 03/17] gnu: julia-zygote: " zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 04/17] gnu: julia-documentertools: " zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 05/17] gnu: julia-documenter: " zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 06/17] gnu: Add julia-biogenerics zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 07/17] gnu: Add julia-indexablebitvectors zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 08/17] gnu: Add julia-twiddle zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 09/17] gnu: Add julia-simd zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 10/17] gnu: Add julia-scanbyte zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 11/17] gnu: Add julia-automa zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 12/17] gnu: Add julia-stringencodings zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 13/17] gnu: Add julia-yaml zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 14/17] gnu: Add julia-biosymbols zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 15/17] gnu: Add julia-biosequences zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 16/17] gnu: Add julia-intervaltrees zimoun
2022-01-04 22:47 ` [bug#53017] [PATCH 17/17] gnu: Add julia-bioalignments zimoun
2022-01-10 13:20 ` bug#53017: [PATCH 01/17] gnu: julia-xyz: Adjust style Efraim Flashner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220104224755.1142897-2-zimon.toutoune@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=53017@debbugs.gnu.org \
--cc=efraim@flashner.co.il \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).