From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org>
To: 62202@debbugs.gnu.org
Cc: ngraves@ngraves.fr
Subject: [bug#62202] [PATCH 03/21] import: juliahub: Add support for native-inputs.
Date: Wed, 15 Mar 2023 13:51:12 +0100 [thread overview]
Message-ID: <20230315125130.23041-3-ngraves@ngraves.fr> (raw)
In-Reply-To: <20230315125130.23041-1-ngraves@ngraves.fr>
---
guix/import/juliahub.scm | 105 ++++++++++++++++++++++++---------------
1 file changed, 64 insertions(+), 41 deletions(-)
diff --git a/guix/import/juliahub.scm b/guix/import/juliahub.scm
index efe6abbb24..4544dee980 100644
--- a/guix/import/juliahub.scm
+++ b/guix/import/juliahub.scm
@@ -20,13 +20,14 @@ (define-module (guix import juliahub)
#:use-module (ice-9 textual-ports)
#:use-module (ice-9 regex)
#:use-module (ice-9 match)
+ #:use-module (ice-9 streams)
#:use-module (ice-9 string-fun)
- #:use-module (srfi srfi-9)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-11)
#:use-module (guix http-client)
#:use-module (guix import utils)
#:use-module (guix import json)
- #:use-module (guix base16)
#:use-module (guix base32)
#:use-module (guix packages)
#:use-module (guix upstream)
@@ -66,19 +67,42 @@ (define (json->juliahub-direct-dependencies vector)
#f)))
(vector->list vector))))
+(define (ini-list->extra-dependencies lst)
+ (match lst
+ (('(extras) ooo ...)
+ (extra-list->extra-dependencies ooo))
+ (((tag) ooo ...)
+ (ini-list->extra-dependencies ooo))
+ ((attribute '= value ooo ...)
+ (ini-list->extra-dependencies ooo))
+ ('()
+ '())))
+
+(define (extra-list->extra-dependencies lst)
+ (match lst
+ ((attribute '= value ooo ...)
+ `(,(symbol->string attribute) ,@(extra-list->extra-dependencies ooo)))
+ (((tag) ooo ...)
+ '())
+ ('()
+ '())))
+
+(define (parse-extra-dependencies directory)
+ (let* ((port (open-input-file (string-append directory "/Project.toml")))
+ (ini-list (stream->list (port->stream port read))))
+ (close-port port)
+ (ini-list->extra-dependencies ini-list)))
+
;; Julia package.
(define-json-mapping <juliahub-package> make-juliahub-package juliahub-package?
json->juliahub-package
(homepage juliahub-package-homepage) ;string
(readme juliahub-package-readme) ;string
- ;; (slug juliahub-package-slug) ;string
(version juliahub-package-version) ;string
(description juliahub-package-description) ;string
- (dependencies
- juliahub-package-dependencies "deps"
+ (direct-dependencies
+ juliahub-package-direct-dependencies "deps"
json->juliahub-direct-dependencies) ;list of <juliahub-dependency>
- ;; (lambda (vector)
- ;; (map json->juliahub-dependency (vector->list vector))))
(url juliahub-package-url) ;string
(uuid juliahub-package-uuid) ;string
(license juliahub-package-license)) ;string
@@ -90,7 +114,6 @@ (define-json-mapping <juliahub-dependency>
(name juliahub-dependency-name) ;string
(uuid juliahub-dependency-uuid) ;string
(versions juliahub-dependency-versions "versions" vector->list)) ;list of strings
- ;; (slug juliahub-dependency-slug) ;string
(define (julia-name->guix-name name)
(string-append "julia-" (snake-case name)))
@@ -100,27 +123,25 @@ (define* (juliahub-fetch name #:key (version #f))
(and=> (json-fetch (string-append (juliahub-url name) "pkg.json"))
json->juliahub-package))
-(define (make-julia-sexp name version uri hash home-page synopsis description
- dependencies licenses)
+(define (make-julia-sexp name source home-page synopsis description
+ direct-dependencies test-dependencies-names licenses)
"Return the `package' s-expression for a Julia package with the given NAME,
-VERSION, URI, HASH, HOME-PAGE, DESCRIPTION, DEPENDENCIES, and LICENSES."
+VERSION, URI, HASH, HOME-PAGE, DESCRIPTION, DEPENDENCIES,
+TEST-DEPENDENCIES-NAMES and LICENSES."
`(package
(name ,(julia-name->guix-name name))
(version ,version)
- (source (origin
- (method url-fetch)
- (uri ,uri)
- (sha256
- (base32
- "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5"
- ;; ,(bytevector->nix-base32-string hash)
- ))))
+ (source ,source)
(build-system julia-build-system)
- ,@(if (null? dependencies)
+ ,@(if (null? direct-dependencies)
'()
- `((inputs
+ `((propagated-inputs
(list ,@(map (compose julia-name->guix-name juliahub-dependency-name)
- dependencies)))))
+ direct-dependencies)))))
+ ,@(if (null? test-dependencies-names)
+ '()
+ `((native-inputs
+ (list ,@(map julia-name->guix-name test-dependencies-names)))))
(synopsis ,synopsis)
(description ,description)
(home-page ,home-page)
@@ -135,26 +156,28 @@ (define* (juliahub->guix-package package-name
`package' s-expression corresponding to that package, or #f on failure.
Optionally include a VERSION string to fetch a specific version juliahub."
(let ((package (if version
- (juliahub-fetch package-name version)
- (juliahub-fetch package-name))))
+ (juliahub-fetch package-name version)
+ (juliahub-fetch package-name))))
(if package
- (let* ((dependencies-names
- (map juliahub-dependency-name
- (juliahub-package-dependencies package)))
- (licenses
- (map spdx-string->license
- (list (juliahub-package-license package)))))
- (values (make-julia-sexp
- package-name
- (juliahub-package-version package)
- (juliahub-package-url package)
- "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5"
- (juliahub-package-homepage package)
- (juliahub-package-description package)
- (beautify-description (juliahub-package-readme package))
- (juliahub-package-dependencies package)
- licenses)
- dependencies-names))
+ (let-values (((source directory)
+ (git->origin+dir url `(tag-or-commit . ,package-version))))
+ (let* ((dependencies-names
+ (map juliahub-dependency-name
+ (juliahub-package-direct-dependencies package)))
+ (licenses
+ (map spdx-string->license
+ (list (juliahub-package-license package))))
+ (test-dependencies-names (parse-extra-dependencies directory)))
+ (values (make-julia-sexp
+ package-name
+ source
+ (juliahub-package-homepage package)
+ (juliahub-package-description package)
+ (beautify-description (juliahub-package-readme package))
+ (juliahub-package-direct-dependencies package)
+ test-dependencies-names
+ licenses)
+ (append dependencies-names test-dependencies))))
(values #f '()))))
(define* (import-release package #:key (version #f))
--
2.39.2
next prev parent reply other threads:[~2023-03-15 12:53 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 12:47 [bug#62202] [PATCH 0/21] Juliahub import script Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 01/21] import: juliahub: first script draft Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 02/21] import: utils: Change git->origin function to git->origin+version Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` Nicolas Graves via Guix-patches via [this message]
2023-03-15 12:51 ` [bug#62202] [PATCH 04/21] import: juliahub: Correct source parsing Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 05/21] import: juliahub: Add indirect dependencies Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 06/21] import: juliahub: Add updater and recursive-importer Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 07/21] import: juliahub: Filter out julia stdlibs Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 08/21] import: juliahub: Simplify juliahub dependency management Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 09/21] import: juliahub: Improve " Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 10/21] import: juliahub: Add functions to parse the git repo for a git tag Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 11/21] import: juliahub: Improve test dependencies parsing Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 12/21] import: juliahub: Handle the case where we have a subdirectory Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 13/21] import: juliahub: Add support for versions for juliahub-fetch Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 14/21] import: juliahub: Filter out stdlibs from test-dependencies Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 15/21] import: juliahub: More robust toml regex parser Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 16/21] import: juliahub: Beautify description Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 17/21] import: juliahub: Fix license management Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 18/21] import: juliahub: Fix version management Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 19/21] import: juliahub: Fix undefined homepages Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 20/21] import: utils: Rule out texinfo common syntax from @ escape Nicolas Graves via Guix-patches via
2023-03-15 12:51 ` [bug#62202] [PATCH 21/21] import: juliahub: output package names as symbols Nicolas Graves via Guix-patches via
2023-04-07 16:14 ` [bug#62202] [PATCH 0/21] Juliahub import script Simon Tournier
2023-04-08 22:07 ` Ludovic Courtès
2023-08-08 15:24 ` Ludovic Courtès
2023-08-16 15:43 ` Simon Tournier
2023-09-15 9:45 ` Giovanni Biscuolo
2023-09-15 13:32 ` Nicolas Graves via Guix-patches via
2023-09-15 14:01 ` Simon Tournier
2023-09-18 9:31 ` Nicolas Graves via Guix-patches via
2023-09-18 18:06 ` Simon Tournier
2023-09-19 6:23 ` Giovanni Biscuolo
2023-09-19 6:37 ` Simon Tournier
2023-09-19 6:51 ` Nicolas Graves via Guix-patches via
2023-10-02 9:34 ` Simon Tournier
2023-12-19 18:28 ` Nicolas Graves via Guix-patches via
2023-09-18 18:03 ` [bug#62202] [PATCH v2 01/23] DRAFT guix: import: go: Add optional transform-version to vcs->origin Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 02/23] DRAFT TODO guix: import: utils: Add git->origin+dir Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 03/23] DRAFT TODO: guix: import: utils: Fix corner cases beautify-descritption Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 04/23] DRAFT import: Add julia Simon Tournier
2023-09-18 18:03 ` [bug#66088] [PATCH v2 05/23] DRAFT import: juliahub: Add support for native-inputs Simon Tournier
2023-09-18 18:03 ` [bug#66077] [PATCH v2 06/23] DRAFT import: juliahub: Correct source parsing Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 07/23] DRAFT import: juliahub: Add indirect dependencies Simon Tournier
2023-09-18 18:03 ` [bug#66090] [PATCH v2 08/23] DRAFT import: juliahub: Add updater and recursive-importer Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 09/23] DRAFT import: juliahub: Filter out julia stdlibs Simon Tournier
2023-09-18 18:03 ` [bug#66087] " Simon Tournier
2023-09-18 18:03 ` [bug#66076] [PATCH v2 10/23] DRAFT import: juliahub: Simplify juliahub dependency management Simon Tournier
2023-09-18 18:03 ` [bug#66092] [PATCH v2 11/23] DRAFT import: juliahub: Improve " Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 12/23] DRAFT import: juliahub: Add functions to parse the git repo for a git tag Simon Tournier
2023-09-18 18:03 ` [bug#66089] [PATCH v2 13/23] DRAFT import: juliahub: Improve test dependencies parsing Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 14/23] DRAFT import: juliahub: Handle the case where we have a subdirectory Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 15/23] DRAFT import: juliahub: Add support for versions for juliahub-fetch Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 16/23] DRAFT import: juliahub: Filter out stdlibs from test-dependencies Simon Tournier
2023-09-18 18:03 ` [bug#66086] [PATCH v2 17/23] DRAFT import: juliahub: More robust toml regex parser Simon Tournier
2023-09-18 18:03 ` [bug#66079] [PATCH v2 18/23] DRAFT import: juliahub: Beautify description Simon Tournier
2023-09-18 18:03 ` [bug#66080] [PATCH v2 19/23] DRAFT import: juliahub: Fix license management Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 20/23] DRAFT import: juliahub: Fix version management Simon Tournier
2023-09-18 18:03 ` [bug#66085] [PATCH v2 21/23] DRAFT import: juliahub: Fix undefined homepages Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 22/23] DRAFT import: juliahub: output package names as symbols Simon Tournier
2023-09-18 18:03 ` [bug#62202] [PATCH v2 23/23] DRAFT guix: import: julia: Fix beautify Simon Tournier
2023-12-21 14:01 ` [bug#62202] [PATCH v3 1/4] import: utils: Add function git->origin Nicolas Graves via Guix-patches via
2023-12-21 14:01 ` [bug#62202] [PATCH v3 2/4] import: Add juliahub importer Nicolas Graves via Guix-patches via
2023-12-21 14:01 ` [bug#62202] [PATCH v3 3/4] import: juliahub: Beautify description Nicolas Graves via Guix-patches via
2023-12-21 14:01 ` [bug#62202] [PATCH v3 4/4] import: utils: Rule out texinfo common syntax from @ escape Nicolas Graves via Guix-patches via
2024-02-03 23:07 ` [bug#62202] [PATCH v4 1/6] import: utils: Add function git->origin Nicolas Graves via Guix-patches via
2024-02-03 23:07 ` [bug#62202] [PATCH v4 2/6] import: Add juliahub importer Nicolas Graves via Guix-patches via
2024-02-03 23:07 ` [bug#62202] [PATCH v4 3/6] import: juliahub: Beautify description Nicolas Graves via Guix-patches via
2024-02-03 23:07 ` [bug#62202] [PATCH v4 4/6] import: utils: Rule out texinfo common syntax from @ escape Nicolas Graves via Guix-patches via
2024-02-03 23:07 ` [bug#62202] [PATCH v4 5/6] tests: go: Add mock-git->origin function Nicolas Graves via Guix-patches via
2024-02-03 23:07 ` [bug#62202] [PATCH v4 6/6] tests: juliahub: Add unit tests for (guix import juliahub) Nicolas Graves via Guix-patches via
2024-04-01 20:50 ` Ludovic Courtès
2024-04-02 11:52 ` Nicolas Graves via Guix-patches via
2024-04-09 7:29 ` Nicolas Graves via Guix-patches via
2024-04-11 10:56 ` Nicolas Graves via Guix-patches via
2024-04-16 16:52 ` Ludovic Courtès
2024-04-16 19:11 ` Nicolas Graves via Guix-patches via
2024-04-17 8:51 ` Ludovic Courtès
2024-04-21 16:08 ` Nicolas Graves via Guix-patches via
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230315125130.23041-3-ngraves@ngraves.fr \
--to=guix-patches@gnu.org \
--cc=62202@debbugs.gnu.org \
--cc=ngraves@ngraves.fr \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.