From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id ALXHAJ1zQmZr1gAAqHPOHw:P1 (envelope-from ) for ; Mon, 13 May 2024 22:10:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id ALXHAJ1zQmZr1gAAqHPOHw (envelope-from ) for ; Mon, 13 May 2024 22:10:05 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=bSmWVxam; 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=1715631004; a=rsa-sha256; cv=none; b=ix7lumF1hjL88fPbA3ojEdK5MDrJuZXx+i5Dxni4D+gl2hrht99j0lvDpC2aH7a2tyoSOz DEMg8hDL38h9wgc4UQZXEi8rixKPCy0kted1LyK2r7HRAH4Xj2AKcHYI9IfN45o3w5vQmW z7YhY0PM2jL+ovze9zcj8AzqaDlZVxyJ6XkmxIQGxI8ojQsueT4bGhDpnWYxqiXdLGvxYo aqJHBTRr86vzTd1rG0EyqJMF3ISEgriTsFl726zLk8j6vDvZqWRynCKiXrcBRmdhNuU0vF 0V9cBcXBw52ekGqIKHjnwdJ96i6z2EUO765iRtIdKzie+ySyvbpAk9OFJS+fDg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=bSmWVxam; 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=1715631004; 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=Ff5xJe8LhMQnTeulI9egnKlKA9FKEEOZPQSdr1khMAQ=; b=CtiAbyrCBRZN/xqFxuN1i2eiGovNCub6iHDwWKM6HVoFi8I3h7FMEW9pwkF9BwhFLwkNb/ OUWP6pBfvbAQcOBD9aoU2anN64u38tnKIcoN+fIAs1MiSQiVKYJZwgedtEtPPkFyubSDHg 2Fnj2hwOh8jTfP9if2u9VhwI3X9Rs2oid8P0B7aNHobJc7+9iL9ZjaYzTjYRUv8W1yIJ1r 0d2G9VEnXaH1jvVnhRbt0K0wzqB+r75ETSx9n/ATRsZtwHt4W0/7HqMCSz9yR3iNEybBZZ iL/FxOUBgiTYsDPJVuqkke/nC/fAYA00s1+l5eOUihUi/qrDKF0+IOYgebypnA== 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 577911727D for ; Mon, 13 May 2024 22:10:03 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6bz2-0004KG-Ow; Mon, 13 May 2024 16:09:16 -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 1s6byr-0004DY-Sh for guix-patches@gnu.org; Mon, 13 May 2024 16:09:07 -0400 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 1s6byq-0007nn-7X for guix-patches@gnu.org; Mon, 13 May 2024 16:09:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s6byq-0000IP-Nj; Mon, 13 May 2024 16:09:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70923] [PATCH 05/13] 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, 13 May 2024 20:09:04 +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.17156309291041 (code B ref 70923); Mon, 13 May 2024 20:09:04 +0000 Received: (at 70923) by debbugs.gnu.org; 13 May 2024 20:08:49 +0000 Received: from localhost ([127.0.0.1]:34602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6bya-0000Gd-PM for submit@debbugs.gnu.org; Mon, 13 May 2024 16:08:49 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:47157 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6byQ-0000Ek-TB for 70923@debbugs.gnu.org; Mon, 13 May 2024 16:08:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1715630907; 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=Ff5xJe8LhMQnTeulI9egnKlKA9FKEEOZPQSdr1khMAQ=; b=bSmWVxam2WbXRNgNagb5aoztXi9g111ehphalA8/Js8kfVnzl5ZqpZqys+yR4khujt3yII adThBGtisc/ZWfRAQZaBBDQZgf2ZUQZKQukh+HVSjQOoCT3YoyVTn/9oGSMEABJkjHh13F gnXY5Eur7XaAv2f7BJhmZ+WrwTI46sLxXf/tdbShOxh/tYmdqEapEAq8C9GjmT5OXPY6By 28njUV1gIDTNvCVjyIRm75S2lM52TtPzPgOjR7ki90P5oBTGpRyA9bCdAXsdKVBkIOPYMI INOskC4tf2foZVbyBZG0iWieJN5J8b++qBW5oap2l36IMrSG4gBCRdDgrT8z7A== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id df555c22 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Mon, 13 May 2024 20:08:27 +0000 (UTC) Date: Mon, 13 May 2024 22:08:02 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: 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-Queue-Id: 577911727D X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -6.87 X-Spam-Score: -6.87 X-TUID: ILAaq0HvBak2 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 | 54 +++++++------------ tests/crate.scm | 119 +++++++++++++++++------------------------- 2 files changed, 68 insertions(+), 105 deletions(-) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 7a25b2243c..760c5f0de4 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -7,6 +7,8 @@ ;;; Copyright © 2023 Simon Tournier ;;; Copyright © 2023, 2024 Efraim Flashner ;;; Copyright © 2023, 2024 David Elsing +;;; Copyright © 2021 Sarah Morgensen +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -141,27 +143,6 @@ (define (crate-version-dependencies version) ;;; Converting crates to Guix packages. ;;; -(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 @@ -185,8 +166,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))) (pkg `(package (name ,guix-name) (version ,version) @@ -204,12 +191,12 @@ (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 ,synopsis) (description ,(beautify-description description)) @@ -218,11 +205,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 ce2f08aade..7651a5b5bb 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 "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 "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 "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 "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 "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 "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 "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 "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 "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 "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 "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 "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 "summary") -- 2.41.0