From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 6PdaBolMV2fw5wAA62LTzQ:P1 (envelope-from ) for ; Mon, 09 Dec 2024 20:01:13 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 6PdaBolMV2fw5wAA62LTzQ (envelope-from ) for ; Mon, 09 Dec 2024 21:01:13 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=fbpzLdGE; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=g5CbU97U; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733774472; 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-type:content-type: 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:dkim-signature; bh=siEzEy2+sOm2s5tzCgbAlxWx4lbB2CU8F4juSsxsuTo=; b=Hi2wsSbr9K9VPmdKBt0ChlwNYdCjGTNqNMu6GLeSTvVgzKs8mc8hkENuTRk0VWfBOpU93a QdUPf0qM+ggDw4mR5BhZ3ciXvYTyIubznAFex42PjGie1sGLHhXdra6zBk2a5iSSb1gK+I CcbbtYKQCpLdlmZYVGK364H5amuQ1eJkPgahfPcOlF2aEG4NMb5HzMFIOqsypFOZX0+8jF vYpr59HLqh4mX7/hVcs4VgARb4lsLDE3MlI4Yxdxo6531UohiSJmcd/gf8WIbHEUSIdOWf EZSCvYkJdBM6RvVoioenpW9A/zsKa7sMmIr9FIlUOZ3KgShL3T9tNAWO5zHkgg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=fbpzLdGE; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=g5CbU97U; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733774472; a=rsa-sha256; cv=none; b=HgHxpOmyWqfMwvFN7Cjb6re6QhdqO960RQds0bJrrOIWe9jVXE2CfceGnOfZXGb3pGddYQ 7h1ZyUs86J0qcf0dGBQwc/DH/bfM1VncRRdkJIFgO06FjX+vTiSQARzilSpmYJ0WogyZ/Z HA9MN1rd5LPaSeIUwGN4r7Gp8cm6PyRmFShNF07d6iQ4DP3zZQJCSL7hIfrf44j6nOBHEN GMxTwGKOliZ8brA8h8bMOOomOSHCl6C4fAHRXu7PniIO0NE1chlo/xOf8SxHmlDf72mHXD Aj+wJNRr5McjOcs8dNa5CBLvDUvn8CuP31YYfZ5vt4NakMDKDyx9NTLXCj608g== 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 6AC5F795F0 for ; Mon, 09 Dec 2024 21:01:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKjvM-0005BA-Ij; Mon, 09 Dec 2024 15:00:08 -0500 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 1tKjvL-0005Aa-2G for guix-patches@gnu.org; Mon, 09 Dec 2024 15:00:07 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKjvK-0007YB-PC for guix-patches@gnu.org; Mon, 09 Dec 2024 15:00:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=siEzEy2+sOm2s5tzCgbAlxWx4lbB2CU8F4juSsxsuTo=; b=fbpzLdGEk6Et1DFDfIMCx4JuG98OlVUc4INirq+dUSmP2ZS1ccUg30bsOzPe89p3Tul3NSqKw+L678kcQgDUc/sBSk3SueMEI8oZXA9ZWNYbiORv0VovDmvSU8SnN+4H6/HmcQo1qQOP5X2d+Tlc7SoslLghlKJ8MS3myDvao4CLPRa+3AG2jGy4tkSbZgpkDhGO86QuMA49zojBnvvmYr8AQIoIfDx7+Xv72+6pGQZ10yALCAH3J0Qq8RR6qMRhQndy0Isbtj/hmbSbil4nzR3x7V6E8zqXkZpAA1gU1CXFBU1FybOMdc2rZAlCx50Vg0dYpXWZwj0pwKSwUdyTCg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKjvK-0002Dl-Aa; Mon, 09 Dec 2024 15:00:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#70923] [PATCH v4 03/11] import: crate: Emit new-style package inputs. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, guix-patches@gnu.org Resent-Date: Mon, 09 Dec 2024 20:00:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70923 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70923@debbugs.gnu.org Cc: Sarah Morgensen , Efraim Flashner X-Debbugs-Original-Xcc: Efraim Flashner Received: via spool by 70923-submit@debbugs.gnu.org id=B70923.17337743738278 (code B ref 70923); Mon, 09 Dec 2024 20:00:06 +0000 Received: (at 70923) by debbugs.gnu.org; 9 Dec 2024 19:59:33 +0000 Received: from localhost ([127.0.0.1]:55741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKjul-00029H-QA for submit@debbugs.gnu.org; Mon, 09 Dec 2024 14:59:32 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:60445 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKjuc-00027f-VO for 70923@debbugs.gnu.org; Mon, 09 Dec 2024 14:59:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1733774350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=siEzEy2+sOm2s5tzCgbAlxWx4lbB2CU8F4juSsxsuTo=; b=g5CbU97UsmVimCKX/r4E6gQjN99cM3fF54hVgUqu8V26fW8x3KCJ+uQfSek/zkSZ5olNOZ 2rCBu9ZWwPbpAU/e+Yyr1kXfQbt6TwzSr0ojUKooYYkoX0UR3GMYPHYDdmvjYHZnI3CcFB 8P4m/ZRjR0RZHUzjajgceTve2tDxugZm4h8eaSLg9hRjjqk4Y7zHPTKHfT7wS82Q2skL6x S0JIIiY5qHyjoRtzAw2slW715guuIUJuR1dcUhjpVSskj/cluf8jlcHiXQIZ8sxKMEEYTC yF98ieXuW38YwBzx7DVqLfsjhmHhsxjNFEHf1KhddTOMqmsRDuW0aMT3X/maaA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id c97487a3 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Mon, 9 Dec 2024 19:59:10 +0000 (UTC) Date: Mon, 9 Dec 2024 20:58:07 +0100 Message-ID: <019ad22bc42e58a41beb87b89237f8457874682d.1733774143.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <4b8cde409e17e4b9ab7ef591eff605b88235fb0a.1733774143.git.herman@rimm.ee> References: <4b8cde409e17e4b9ab7ef591eff605b88235fb0a.1733774143.git.herman@rimm.ee> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches From: Herman Rimm 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-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -2.66 X-Spam-Score: -2.66 X-Migadu-Queue-Id: 6AC5F795F0 X-TUID: R+9c/WFVI3D1 From: Sarah Morgensen * guix/import/crate.scm (maybe-cargo-inputs, maybe-cargo-development-inputs, maybe-arguments): Delete procedures. (make-crate-sexp): Add 'unwrap' procedure, use with maybe-packages-field and fix indentation. * tests/crate.scm: Adjust accordingly. Change-Id: Ie8debd2553a338c3c623162b843e0a9827314074 --- guix/import/crate.scm | 51 ++++++------------ tests/crate.scm | 119 +++++++++++++++++------------------------- 2 files changed, 65 insertions(+), 105 deletions(-) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 5996571cda..962159f16e 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2023 Simon Tournier ;;; Copyright © 2023, 2024 Efraim Flashner ;;; Copyright © 2023, 2024 David Elsing +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -158,27 +159,6 @@ (define* (package-names->package-inputs names #:optional (output #f)) (input (make-input input #f))) names)) -(define (maybe-cargo-inputs package-names) - (match (package-names->package-inputs package-names) - (() - '()) - ((package-inputs ...) - `(#:cargo-inputs ,package-inputs)))) - -(define (maybe-cargo-development-inputs package-names) - (match (package-names->package-inputs package-names) - (() - '()) - ((package-inputs ...) - `(#:cargo-development-inputs ,package-inputs)))) - -(define (maybe-arguments arguments) - (match arguments - (() - '()) - ((args ...) - `((arguments (,'quasiquote ,args)))))) - (define (version->semver-prefix version) "Return the version up to and including the first non-zero part" (first @@ -202,8 +182,14 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu (let* ((port (http-fetch (crate-uri name version))) (guix-name (crate-name->package-name name)) - (cargo-inputs (format-inputs cargo-inputs)) - (cargo-development-inputs (format-inputs cargo-development-inputs)) + (unwrap (match-lambda + ((lst) lst) + (() '()))) + (cargo-inputs (maybe-packages-field '#:cargo-inputs + (format-inputs cargo-inputs))) + (cargo-development-inputs + (maybe-packages-field '#:cargo-development-inputs + (format-inputs cargo-development-inputs))) (description (beautify-description description)) (pkg `(package (name ,guix-name) @@ -222,12 +208,10 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu `((properties '((crate-version-yanked? . #t)))) '()) (build-system cargo-build-system) - ,@(maybe-arguments (append (if build? - '() - '(#:skip-build? #t)) - (maybe-cargo-inputs cargo-inputs) - (maybe-cargo-development-inputs - cargo-development-inputs))) + ,@(maybe-list-field 'arguments + (append (if build? '() '(#:skip-build? #t)) + (unwrap cargo-inputs) + (unwrap cargo-development-inputs))) (home-page ,home-page) (synopsis ,(beautify-synopsis synopsis)) (description ,(if (string-prefix? "This" description) @@ -239,11 +223,10 @@ (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inpu (#f #f) ((license) license) (_ `(list ,@license))))))) - (close-port port) - (package->definition pkg - (if yanked? - (string-append version "-yanked") - (version->semver-prefix version))))) + (close-port port) + (package->definition pkg (if yanked? + (string-append version "-yanked") + (version->semver-prefix version))))) (define (string->license string) (filter-map (lambda (license) diff --git a/tests/crate.scm b/tests/crate.scm index 5b4ad08c3c..8e3da2e72c 100644 --- a/tests/crate.scm +++ b/tests/crate.scm @@ -5,6 +5,8 @@ ;;; Copyright © 2020 Martin Becze ;;; Copyright © 2023 Efraim Flashner ;;; Copyright © 2023 David Elsing +;;; Copyright © 2021 Sarah Morgensen +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -497,10 +499,10 @@ (define have-guile-semver? (? string? hash))))) (build-system 'cargo-build-system) (arguments - ('quasiquote - (#:skip-build? #t + (list + #:skip-build? #t #:cargo-inputs - (("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7)))))) + (list rust-leaf-alice-0.7))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -589,7 +591,7 @@ (define have-guile-semver? (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:skip-build? #t))) + (list #:skip-build? #t)) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -608,7 +610,7 @@ (define have-guile-semver? (base32 (? string? hash))))) (build-system cargo-build-system) - (arguments ('quasiquote (#:skip-build? #t))) + (arguments (list #:skip-build? #t)) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -627,7 +629,7 @@ (define have-guile-semver? (base32 (? string? hash))))) (build-system cargo-build-system) - (arguments ('quasiquote (#:skip-build? #t))) + (arguments (list #:skip-build? #t)) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -647,10 +649,9 @@ (define have-guile-semver? (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:skip-build? #t - #:cargo-inputs - (("rust-leaf-bob" - ('unquote rust-leaf-bob-3)))))) + (list #:skip-build? #t + #:cargo-inputs + (list rust-leaf-bob-3))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -670,14 +671,11 @@ (define have-guile-semver? (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:skip-build? #t - #:cargo-inputs - (("rust-intermediate-b" - ('unquote rust-intermediate-b-1)) - ("rust-leaf-alice" - ('unquote 'rust-leaf-alice-0.7)) - ("rust-leaf-bob" - ('unquote rust-leaf-bob-3)))))) + (list #:skip-build? #t + #:cargo-inputs + (list rust-intermediate-b-1 + rust-leaf-alice-0.7 + rust-leaf-bob-3))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -697,18 +695,13 @@ (define have-guile-semver? (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:cargo-inputs - (("rust-intermediate-a" - ('unquote rust-intermediate-a-1)) - ("rust-intermediate-b" - ('unquote rust-intermediate-b-1)) - ("rust-leaf-alice" - ('unquote 'rust-leaf-alice-0.7)) - ("rust-leaf-bob" - ('unquote rust-leaf-bob-3))) - #:cargo-development-inputs - (("rust-intermediate-c" - ('unquote rust-intermediate-c-1)))))) + (list #:cargo-inputs + (list rust-intermediate-a-1 + rust-intermediate-b-1 + rust-leaf-alice-0.7 + rust-leaf-bob-3) + #:cargo-development-inputs + ((list rust-intermediate-c-1)))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -735,9 +728,8 @@ (define have-guile-semver? (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:cargo-development-inputs - (("rust-leaf-alice" - ('unquote rust-leaf-alice-0.7)))))) + (list #:cargo-development-inputs + (list rust-leaf-alice-0.7))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -793,9 +785,8 @@ (define have-guile-semver? (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:cargo-inputs - (("rust-leaf-bob" - ('unquote rust-leaf-bob-3)))))) + (list #:cargo-inputs + (list rust-leaf-bob-3))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -815,13 +806,10 @@ (define have-guile-semver? (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:cargo-inputs - (("rust-intermediate-b" - ('unquote rust-intermediate-b-1)) - ("rust-leaf-alice" - ('unquote 'rust-leaf-alice-0.7)) - ("rust-leaf-bob" - ('unquote rust-leaf-bob-3)))))) + (list #:cargo-inputs + (list rust-intermediate-b-1 + rust-leaf-alice-0.7 + rust-leaf-bob-3))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -841,18 +829,13 @@ (define have-guile-semver? (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:cargo-inputs - (("rust-intermediate-a" - ('unquote rust-intermediate-a-1)) - ("rust-intermediate-b" - ('unquote rust-intermediate-b-1)) - ("rust-leaf-alice" - ('unquote 'rust-leaf-alice-0.7)) - ("rust-leaf-bob" - ('unquote rust-leaf-bob-3))) - #:cargo-development-inputs - (("rust-intermediate-c" - ('unquote rust-intermediate-c-1)))))) + (list #:cargo-inputs + (list rust-intermediate-a-1 + rust-intermediate-b-1 + rust-leaf-alice-0.7 + rust-leaf-bob-3) + #:cargo-development-inputs + (list rust-intermediate-c-1))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -962,14 +945,11 @@ (define rust-leaf-bob-3.0.2-yanked (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:cargo-inputs - (("rust-leaf-bob" - ('unquote 'rust-leaf-bob-3))) - #:cargo-development-inputs - (("rust-leaf-bob" - ('unquote 'rust-leaf-bob-3.0.2-yanked)) - ("rust-leaf-bob" - ('unquote 'rust-leaf-bob-4.0.0-yanked)))))) + (list #:cargo-inputs + (list rust-leaf-bob-3) + #:cargo-development-inputs + (list rust-leaf-bob-3.0.2-yanked + rust-leaf-bob-4.0.0-yanked))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") @@ -1093,14 +1073,11 @@ (define rust-leaf-bob-3.0.2-yanked (? string? hash))))) (build-system cargo-build-system) (arguments - ('quasiquote (#:cargo-inputs - (("rust-leaf-bob" - ('unquote 'rust-leaf-bob-3))) - #:cargo-development-inputs - (("rust-leaf-bob" - ('unquote 'rust-leaf-bob-3.0.2-yanked)) - ("rust-leaf-bob" - ('unquote 'rust-leaf-bob-4.0.0-yanked)))))) + (list #:cargo-inputs + (list rust-leaf-bob-3) + #:cargo-development-inputs + (list rust-leaf-bob-3.0.2-yanked + rust-leaf-bob-4.0.0-yanked))) (home-page "http://example.com") (synopsis "summary") (description "This package provides summary.") -- 2.45.2