From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id aEjTMMi/EWQbOgEASxT56A (envelope-from ) for ; Wed, 15 Mar 2023 13:53:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id KAXZMMi/EWQ4CQEA9RJhRA (envelope-from ) for ; Wed, 15 Mar 2023 13:53:28 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 68ACFF8E8 for ; Wed, 15 Mar 2023 13:53:28 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678884808; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=zk6Q8IX/RIUiyoSACvoltyna4dIGIQuaEzIk6Dk4WKE=; b=dY8ZfI37lFVZkKKW4NrsdAZDwxh46m48Yqx2H0uCcPgVqAGHuJ/ngvQOQnbr/yvy8a0JAA H4xlEvPn74Fw4rWIUgU9VxksAvNExwXN0a8cnILcGbm4XfQSSu7VdLnnPetdHT7qzF4YkA Ict58YpjKI9iJOFd6AG0wpk4snmAWgSJ94wIgyQzD1karYPDARRcX08qz/Rr9I/5WWGoxu IADhs9VCbxoVS2r3QM/lnYe7skZxG7crEnLmHuPD/ay94SvtpkGwxAMqXwQFXRSQBmdsiZ KYYnrPrKCHGoV8pBH0bzQnPNkOkUhBTQX1/OR/4WAfHSpbv0LbeyBBS55FG69A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678884808; a=rsa-sha256; cv=none; b=gFQgbMMSB1VB1wgN/rv7Hu+R9QulUPn24/3XVEDhSBkUzugnrErZuDlFS/PqNA7kx646py nDhEbNKiunhePE2rzBNLU9eYB9S3w9xWB9dp3xVOisbdvYmmaprRMRt3j8VxC6iPZyKbkI PuS7rsnPRxdx7unhHG8gxk4T6Y0BG6pNcvtciZsOG7Oym/W5rQjwcd8pYPVizS31jqStCH 8dKQffhexW5wyKa9A/+jyZMquGaoYqB+eQO99ueaztIoqo6QmkrHauPXAFDLjbbu6NvPQy 6aGO2kbW9DQs4UHgOKqmdl4Lm0AL/t9yqyEeLOxMek/dcOFs6deg4auaBinFVg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pcQby-0003RB-Ax; Wed, 15 Mar 2023 08:52:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcQbs-0003Oy-C8 for guix-patches@gnu.org; Wed, 15 Mar 2023 08:52:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pcQbs-00038e-1q for guix-patches@gnu.org; Wed, 15 Mar 2023 08:52:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pcQbr-0001YY-S9 for guix-patches@gnu.org; Wed, 15 Mar 2023 08:52:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62202] [PATCH 03/21] import: juliahub: Add support for native-inputs. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Mar 2023 12:52:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62202@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 62202-submit@debbugs.gnu.org id=B62202.16788847085852 (code B ref 62202); Wed, 15 Mar 2023 12:52:03 +0000 Received: (at 62202) by debbugs.gnu.org; 15 Mar 2023 12:51:48 +0000 Received: from localhost ([127.0.0.1]:39299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcQbb-0001WI-Vz for submit@debbugs.gnu.org; Wed, 15 Mar 2023 08:51:48 -0400 Received: from 4.mo576.mail-out.ovh.net ([46.105.42.102]:37665) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcQbX-0001VP-C8 for 62202@debbugs.gnu.org; Wed, 15 Mar 2023 08:51:44 -0400 Received: from director4.ghost.mail-out.ovh.net (unknown [10.109.146.166]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id 6652926562 for <62202@debbugs.gnu.org>; Wed, 15 Mar 2023 12:51:41 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-r6rck (unknown [10.110.115.95]) by director4.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 016CD1FE9F; Wed, 15 Mar 2023 12:51:40 +0000 (UTC) Received: from ngraves.fr ([37.59.142.105]) by ghost-submission-6684bf9d7b-r6rck with ESMTPSA id YDEWBFy/EWSfBgAA9fVuhw (envelope-from ); Wed, 15 Mar 2023 12:51:40 +0000 X-OVh-ClientIp: 81.67.140.142 Date: Wed, 15 Mar 2023 13:51:12 +0100 Message-Id: <20230315125130.23041-3-ngraves@ngraves.fr> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315125130.23041-1-ngraves@ngraves.fr> References: <20230315125130.23041-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 13789177636127498978 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepleffjeetueethfefkeffffefvddukeejkefgleduiedthfekvefhiedvhfffgeegnecukfhppeduvdejrddtrddtrddupdefjedrheelrddugedvrddutdehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopeeivddvtddvseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeeipdhmohguvgepshhmthhpohhuth X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Migadu-Queue-Id: 68ACFF8E8 X-Spam-Score: -2.53 X-Migadu-Spam-Score: -2.53 X-Migadu-Scanner: scn0.migadu.com From: Nicolas Graves via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-TUID: b5rJyTFoCUA2 --- 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 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 - ;; (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 (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