[PATCH v2 15/23] DRAFT import: juliahub: Add support for versions for juliahub-fetch.

  • Done
  • quality assurance status badge
Details
One participant
  • Simon Tournier
Owner
unassigned
Submitted by
Simon Tournier
Severity
normal
Merged with

Debbugs page

Simon Tournier wrote 1 years ago
(address . 62202@debbugs.gnu.org)
1fef7a18856fd9670be3746e6f3579a8be39163e.1695060058.git.zimon.toutoune@gmail.com
From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org>

Signed-off-by: Simon Tournier <zimon.toutoune@gmail.com>
---
guix/import/juliahub.scm | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

Toggle diff (57 lines)
diff --git a/guix/import/juliahub.scm b/guix/import/juliahub.scm
index b646f9329562..6ce0487dba38 100644
--- a/guix/import/juliahub.scm
+++ b/guix/import/juliahub.scm
@@ -122,7 +122,7 @@ (define %julia-stdlibs
"Pkg"
"LazyArtifacts"))
-(define (juliahub-uri name)
+(define (juliahub-redirect-uri name)
(let* ((url (string-append "https://docs.juliahub.com/" name "/"))
(port (http-fetch url #:text? #t))
(_ (get-line port))
@@ -134,11 +134,11 @@ (define (juliahub-uri name)
(define (juliahub-url name)
(let* ((url (string-append "https://docs.juliahub.com/" name "/"))
- (uri (juliahub-uri name)))
+ (uri (juliahub-redirect-uri name)))
(string-append url uri "/")))
-(define (juliahub-slug-version name)
- (let* ((uri (juliahub-uri name))
+(define (juliahub-slug+version name)
+ (let* ((uri (juliahub-redirect-uri name))
(slug (string-take uri 5))
(latest-version (string-drop uri 6)))
`(,slug ,latest-version)))
@@ -203,8 +203,12 @@ (define (julia-name->guix-name name)
(define* (juliahub-fetch name #:key (version #f))
"Return a <juliahub-package> record for package NAME, or #f on failure."
- (and=> (json-fetch (string-append (juliahub-url name) "pkg.json"))
- json->juliahub-package))
+ (let ((url (if version
+ (string-append "https://docs.juliahub.com/" name "/"
+ (car (juliahub-slug+version name)) "/"
+ version "/pkg.json")
+ (string-append (juliahub-url name) "pkg.json"))))
+ (and=> (json-fetch url) json->juliahub-package)))
(define (make-julia-sexp name source home-page synopsis description
direct-dependencies test-dependencies-names licenses)
@@ -242,9 +246,9 @@ (define* (juliahub->guix-package package-name
(subdir (assoc-ref package-toml 'subdir))
(tag (latest-git-tag (assoc-ref package-toml 'repo)))
(package (if version
- (juliahub-fetch package-name version)
+ (juliahub-fetch package-name #:version version)
(if tag
- (juliahub-fetch package-name tag)
+ (juliahub-fetch package-name #:version tag)
(juliahub-fetch package-name)))))
(if package
(let-values (((source directory)
--
2.38.1
Simon Tournier wrote 1 years ago
control message for bug #66082
(address . control@debbugs.gnu.org)
86ttrrmc87.fsf@gmail.com
close 66082
quit
Simon Tournier wrote 1 years ago
control message for bug #66075
(address . control@debbugs.gnu.org)
86a5tjmc4o.fsf@gmail.com
merge 66075 66089 66088 66087 66086 66085 66084 66083 66082
quit
Simon Tournier wrote 1 years ago
(address . control@debbugs.gnu.org)
868r93mc3w.fsf@gmail.com
merge 66075 66092 66091 66090
quit
?
Your comment

This issue is archived.

To comment on this conversation send an email to 66082@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 66082
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help