From patchwork Mon Apr 28 16:22:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42107 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BDF7E27BC4A; Mon, 28 Apr 2025 17:33:02 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 942DB27BC49 for ; Mon, 28 Apr 2025 17:33:02 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPV-0007gI-SM; Mon, 28 Apr 2025 12:32:50 -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 1u9ROs-0007aN-0H for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:11 -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 1u9ROq-0004N9-Ea; Mon, 28 Apr 2025 12:32:08 -0400 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=Pd9CF4JpsnVXQZFYIAM2YKfSrloC+nkUkDyeHbPPNkQ=; b=cw6JFNT9nZkaMmrzRjcO1jppTui4Bcg6y4zf0eqUTkEE3DBxbbIu6lZ1Nxy6CfrFxomLMlHXAIA+ebFla9xOZI6DtVtf8DYWFJcvG3ClT0eoYqT9Qwd6cYCg4FYxGmk/i7KLlbPNUjBMW0VHkYdMlFtWg2PZgtXdDu9Pl6LNQUVVwWf2w5fMRRdWM8oA7qRwyWOb3MBpZ8pmVqstegm9FMmcmWR/l/kNRuAy+97bWvkofqWvCrSILOrlylEE61eHv74w/A/G415nL5TcnxosltAoiMUezlvAt3oozZPoDabuJ8E7p6Rgh89FOC/vsfqwCGXiT/GKDfiqgC+aQ5IRXQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROm-0003G6-0L; Mon, 28 Apr 2025 12:32:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 01/22] scripts: import: Correct behavior for =?utf-8?b?4oCYLS1pbnNlcnTigJk=?= option. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585788312063 (code B ref 77093); Mon, 28 Apr 2025 16:32:03 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:23 +0000 Received: from localhost ([127.0.0.1]:32812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9RO7-00038R-BR for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:23 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:42942) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9RO1-00037V-M3 for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:19 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857875; 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=Pd9CF4JpsnVXQZFYIAM2YKfSrloC+nkUkDyeHbPPNkQ=; b=LYBMiEqBviQBuFC4vdTUYkgWn9Z8AHG7CjFGncAjgH9/SpsOD7maB8PWkgm2kE5ThxBwch pgG7HKQLDfvdEClSsuiGZPUSiGSm6jj4IaWJmEU4SSztOm+5QJCfgxbSQQhNmCfHUUeyEx JvGAiILNAlT5ow3cEQJBHStJvrSTCePc/2l6tp8V+6JiUfHujmqQg+Dp7feXU8xYmIqrhQ ndbVa/V0uWyc3EHdnu8doslKHZ3LZdIguC6F8wBd7vtOP8rcNGeeSTs+87Yr6JCR4UZ9u0 wFP/eHUxrVQ6IQD7CcT5J9819xdBNNcI58tllb3zpxJDI6qmrhFYcAOs0hvOng== Date: Tue, 29 Apr 2025 00:22:58 +0800 Message-ID: <8648da361beea558734c285e763d925dc7c97bc2.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches The info manual documents ‘--insert=FILE’, but it wasn't actually supported. * guix/scripts/import.scm (show-help): Add missing ‘FILE’. (guix-import): Accept ‘--insert=FILE’. Change-Id: I540d5feae3fe49c00e9bd6f7a8649ffe0d6e006d --- guix/scripts/import.scm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index bbf31baa15..a85f6c6c49 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -69,7 +69,7 @@ (define (show-help) (display (G_ " -h, --help display this help and exit")) (display (G_ " - -i, --insert insert packages into file alphabetically")) + -i, --insert=FILE insert packages into FILE alphabetically")) (display (G_ " -V, --version display version information and exit")) (newline) @@ -106,7 +106,18 @@ (define-command (guix-import . args) (category packaging) (synopsis "import a package definition from an external repository") - (match args + (define (process-args args) + (match args + ;; Workaround to accpet ‘--insert=FILE’, for the consistency of + ;; command-line interface. + ((arg . rest) + (if (string-prefix? "--insert=" arg) + (append (string-split arg #\=) + rest) + args)) + (_ args))) + + (match (process-args args) (() (format (current-error-port) (G_ "guix import: missing importer name~%"))) From patchwork Mon Apr 28 16:22:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42109 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7A1EB27BC4B; Mon, 28 Apr 2025 17:33:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4C64027BC49 for ; Mon, 28 Apr 2025 17:33:11 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPj-0007o6-MB; Mon, 28 Apr 2025 12:33:03 -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 1u9ROv-0007ax-IA for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:15 -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 1u9ROu-0004O7-Rq; Mon, 28 Apr 2025 12:32:12 -0400 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=XiTXkUFVeChmXq5jOpfq798zpZBw32rsZsjXsAuq0H4=; b=XOo8cKLIDkDOmElT/YuDcfsw1TUgYuTXvyw8aIi5sm0Ny6Se4oSkq+S40vzwuKVfhJYldsBeZMsTue3N5ODrzQMxviNI1rB0blPrbN+jgFSFX94wdJi78dzOXt55kYVpIuJU/of1/qXSGvt6PVFwGnV/UT0e1Ej+oNavZ97+DltZPjyEL909ZaAz4ieI8e095HLl+SGBrYR2ktyuHvktSysbjxNlQsBZ7uFHgSDi5iRc0IqMmSCYVq9wfW8rd2WX4TsKLBIk+w1CdKyias9UPsUL5QvUoD9JwM0gBZ8YDWWP8S1fSMC6hxkjWzdpXra8+6m6kfwkVx9rPLfun2y6Mg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROs-0003HS-5F; Mon, 28 Apr 2025 12:32:10 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 02/22] scripts: import: Add two newlines for =?utf-8?b?4oCYLS1pbnNlcnTigJk=?= option. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585788412079 (code B ref 77093); Mon, 28 Apr 2025 16:32:10 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:24 +0000 Received: from localhost ([127.0.0.1]:32816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9RO8-00038k-DL for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:24 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:42950) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9RO3-00037q-1q for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:19 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857877; 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=XiTXkUFVeChmXq5jOpfq798zpZBw32rsZsjXsAuq0H4=; b=fZxYbXMBoiOIlOVIxjcfaHPM15mrSWV1e4FBp1CmdNhLMUFpIV3ApI9u/nWgDD1KVCv1AQ dST3Hsy3WUMwyKXkY9dVLqhW/Y2BQf6V9VDkh6LpIMtpdZ3ULAadUv3lkpE49xiClnssFH 1iu3i+7WOlGNmdlp3RtWwi15KF4ETWkMtfik8a30mM6dZU/tXCYueXLBAvjP8FpQGITf6S +PPwO9fETKtVjpsosqGy50Jn9QbV8cQ5+o1DKx6PyeN2HojqUTXBeX/DeLrixWY9yYuO76 VHQX5CuvLoTST62miIwnfGgzpbGXN9A/bgJXuTSCTvytcoPJog4lZIzAw2mYQA== Date: Tue, 29 Apr 2025 00:22:59 +0800 Message-ID: <50bd7f6c4f3e65a4c51f1e3e5b2d18e414eee43a.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches For consistency with ‘insert-expression’. * guix/scripts/import.scm (guix-import): Add two newlines after inserting. Change-Id: I55b45ca137d175fdf6ee5c0bb2b6b1ca8385750d --- guix/scripts/import.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index a85f6c6c49..4ce31b17ff 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -140,6 +140,7 @@ (define-command (guix-import . args) (let ((port (open-file file "a"))) (pretty-print-with-comments port expr) (newline port) + (newline port) (close-port port))))))))) (import-as-definitions importer args find-and-insert))) ((importer args ...) From patchwork Mon Apr 28 16:23:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42106 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 86A5227BC49; Mon, 28 Apr 2025 17:32:58 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0AC1D27BC4A for ; Mon, 28 Apr 2025 17:32:57 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RP2-0007cj-MR; Mon, 28 Apr 2025 12:32:20 -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 1u9ROt-0007aZ-KZ for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:11 -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 1u9ROt-0004Nh-7T; Mon, 28 Apr 2025 12:32:11 -0400 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=leNYuUbh2dHqCWubloxuqOKf0u1TKUsS6dsQvzicHWw=; b=nairqmkwGkESyYKOEdfZe6xDXHoca3LHDl8yWjRCMElY7j6zb5XocVUwW3BeoDjroEQ2Ee2205iw3953fmQwmzf39mF5aS3SD6sPHhVH5KPv10DigF1LDUaNcqkuC9mjpVq9mIR7DAUWF6FdZn7fAoog0+ecNcalh+QTNU+DXdoO1H3mUhaV7SMkUSxK5LSZF0sd7IqQ7T5adW/0zNsgOdVmdoRv8HbqyNrZSMK60A8jth4HgI5/j+5y5aqlNUkbki9xP1hRx3fLoWRA5Sbf+cyf40nTR9GB8yf1IWX2jXHufLrZhA5QoV3yR2zOTJSkK6ObNOg5OIRkZVpilAkFLg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROs-0003Hh-Mk; Mon, 28 Apr 2025 12:32:10 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 03/22] scripts: import: Support expressions defined by 'define. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585788512086 (code B ref 77093); Mon, 28 Apr 2025 16:32:10 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:25 +0000 Received: from localhost ([127.0.0.1]:32819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9RO8-00038s-To for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:25 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:38402) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9RO4-00038E-Ns for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:21 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s8Bp/PYiFL+PBeio1GQRm0Ib6bNFxX1G22fphsuVvro=; b=EdSTT/xFaosn8qQ21Wiqn5SZSjT9uiNXI6RFerdjFlsmuhfd/zOLDT6/DdwaYoVZIeNy8A DbfDUX6AHj4bRsi5rlYKpym/zVcZir3s+52qoJ6pQtSDXkJF3IRDl/tmknaZHm08JReJD/ udJT0q39hmqPmIruGxYP8c8W/u1zSOOMx28KzSmSZ8+e3a/YxUw0OnWJDejOyTwHGQyKmj PW0JfWE0xAVApd8GJdy8zdaGE3g5nLLL8JUNjY0gLkBnZyhoA5+hNDZ+fn10oLb7R5scyn FseqJCPzIqnxlwBdCTiBXNUC4IzTuG03PiMYrH3OIV7PDKAouPjFZMr/HSM8rw== Date: Tue, 29 Apr 2025 00:23:00 +0800 Message-ID: <4c3ba796320969be10723558974aaf7e40ef30a0.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/utils.scm (find-definition-location): New procedure. (find-definition-insertion-location): Define with it. * guix/scripts/import.scm (import-as-definitions, guix-import): Support expressions defined by 'define. Change-Id: I03118e1a3372028b4f0530964aba871b4a1a4d25 --- guix/scripts/import.scm | 21 +++++++++++++++------ guix/utils.scm | 29 +++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index 4ce31b17ff..1242fb0b66 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -30,6 +30,7 @@ (define-module (guix scripts import) #:use-module (guix read-print) #:use-module (guix utils) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:use-module (ice-9 format) #:use-module (ice-9 match) #:export (%standard-import-options @@ -83,7 +84,8 @@ (define (import-as-definitions importer args proc) ((and expr (or ('package _ ...) ('let _ ...))) (proc (package->definition expr))) - ((and expr ('define-public _ ...)) + ((and expr (or ('define-public _ ...) + ('define _ ...))) (proc expr)) ((expressions ...) (for-each (lambda (expr) @@ -91,7 +93,8 @@ (define (import-as-definitions importer args proc) ((and expr (or ('package _ ...) ('let _ ...))) (proc (package->definition expr))) - ((and expr ('define-public _ ...)) + ((and expr (or ('define-public _ ...) + ('define _ ...))) (proc expr)))) expressions)) (x @@ -128,13 +131,19 @@ (define-command (guix-import . args) (show-version-and-exit "guix import")) ((or ("-i" file importer args ...) ("--insert" file importer args ...)) - (let ((find-and-insert + (let* ((define-prefixes + `(,@(if (member importer '("crate")) + '(define) + '()) + define-public)) + (define-prefix? (cut member <> define-prefixes)) + (find-and-insert (lambda (expr) (match expr - (('define-public term _ ...) + (((? define-prefix? define-prefix) term _ ...) (let ((source-properties - (find-definition-insertion-location - file term))) + (find-definition-insertion-location + file term #:define-prefix define-prefix))) (if source-properties (insert-expression source-properties expr) (let ((port (open-file file "a"))) diff --git a/guix/utils.scm b/guix/utils.scm index 7ae98096c2..7f555e57f9 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -154,6 +154,7 @@ (define-module (guix utils) edit-expression delete-expression insert-expression + find-definition-location find-definition-insertion-location filtered-port @@ -520,24 +521,36 @@ (define (insert-expression source-properties expr) (string-append expr "\n\n" str)))) (edit-expression source-properties insert))) -(define (find-definition-insertion-location file term) - "Search in FILE for a top-level public definition whose defined term -alphabetically succeeds TERM. Return the location if found, or #f -otherwise." - (let ((search-term (symbol->string term))) +(define* (find-definition-location file term + #:key (define-prefix 'define-public) + (pred string=)) + "Search in FILE for a top-level definition created using DEFINE-PREFIX, with +the defined term compared to TERM through PRED. Return the location if PRED +returns #t, or #f otherwise." + (let ((search-term (symbol->string term)) + (define-prefix? (cut eq? define-prefix <>))) (call-with-input-file file (lambda (port) (do ((syntax (read-syntax port) (read-syntax port))) ((match (syntax->datum syntax) - (('define-public current-term _ ...) - (string> (symbol->string current-term) - search-term)) + (((? define-prefix?) current-term _ ...) + (pred (symbol->string current-term) + search-term)) ((? eof-object?) #t) (_ #f)) (and (not (eof-object? syntax)) (syntax-source syntax)))))))) +(define* (find-definition-insertion-location file term + #:key + (define-prefix 'define-public)) + "Search in FILE for a top-level definition created using DEFINE-PREFIX, with +the defined term alphabetically succeeds TERM. Return the location if found, +or #f otherwise." + (find-definition-location + file term #:define-prefix define-prefix #:pred string>)) + ;;; ;;; Keyword arguments. From patchwork Mon Apr 28 16:23:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42114 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2BC8F27BC49; Mon, 28 Apr 2025 17:33:53 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C97D227BC4A for ; Mon, 28 Apr 2025 17:33:51 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPk-0007qj-AN; Mon, 28 Apr 2025 12:33:04 -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 1u9ROx-0007b3-5a for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:16 -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 1u9ROv-0004OR-H6; Mon, 28 Apr 2025 12:32:14 -0400 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=lJnRrnFaiY5jXSN0km3mx1CAOIuh7tR5wqLgJ+wKbVA=; b=uWdbB2SQonioMb/ZjdI6aqZouASqek9dexP7U/DbF1sDAuDrCp5z05Vn5m2+/bSgbAqsL4gVMK1NPfvQv7UKIR+DfpT1FhO6Pzil5Xkd0sQ4+9SVu6G7lEHNmU0obxqMUo4cJ2n3Ra5P+Yujxa6PgxaVPBJN37oqLrjGu3ZKLZFsJ0Y8mRHRU+l9XZlHQvWUAuNVKPLa9c45HLXaYeWKx4PkC6MolMEb1KAYB1aU1nkucglQ8E2tcCbb48MfgLc8aYtPECGm1QU9rz0uJ3alRvtRhWa9hLrG5WU5hCJ5QofkXJyH0rjzEgelEsky8Ghx+N519Muy3wINkLajzHJyiA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROt-0003Ht-51; Mon, 28 Apr 2025 12:32:11 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 04/22] scripts: import: Pass "--insert" to importers. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:11 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585788612101 (code B ref 77093); Mon, 28 Apr 2025 16:32:11 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:26 +0000 Received: from localhost ([127.0.0.1]:32823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROA-000396-GP for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:26 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:38414) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9RO6-00038I-RG for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:23 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857881; 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=5GEsfFOr78z58i5/gVbrTubp5uOTjB/en2s+rLpth4M=; b=jhRytA0nZZ8O3SQhkZYtcO7NK0W+RMzXfJq0+MRY4g7WPrHj4qUx5nbvHZs2frCYjfi8Ma JJeOlZSfyL3/RfwX/6p2xahxsOhzvD3I0vD/olrtzev9LOwwhZWDWgzfFFxAMY1bJEjc0m /31mAWAeVuWvx4509axrzTIGQJN+8tFe9ZfNa3zpofbyiGnn2R0AvONvvHrBUjanK8x4Ur SSF/1s+mKQcq4AB9vMDRsQl5FWBXQK/UeO00i8TQHekSokFOOWO7ScT5sgaFE4AyWtxG+W eukiIBDTrawI6/ZW+VsYK1b8lgZZR5Kyb1VqCck3irX39jX/nvq2TZ5YHRaKRA== Date: Tue, 29 Apr 2025 00:23:01 +0800 Message-ID: <193c85a4094b2a8a68136bd98a1665a54140933a.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches So that importers can adjust the file before inserting. * guix/scripts/import.scm (%standard-import-options): Add ‘--file-to-insert’. (guix-import): Pass it to importers when ‘--insert’ is set. Change-Id: I8e7a18ee8e0f96d7fc5688a207a7a5390ad2fa30 --- guix/scripts/import.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index 1242fb0b66..c620911893 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -31,6 +31,7 @@ (define-module (guix scripts import) #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) + #:use-module (srfi srfi-37) #:use-module (ice-9 format) #:use-module (ice-9 match) #:export (%standard-import-options @@ -41,7 +42,12 @@ (define-module (guix scripts import) ;;; Command line options. ;;; -(define %standard-import-options '()) +(define %standard-import-options + (list + ;; Hidden option for importer-specific file preprocessing. + (option '("file-to-insert") #f #t + (lambda (opt name arg result) + (alist-cons 'file-to-insert arg result))))) ;;; @@ -151,7 +157,10 @@ (define-command (guix-import . args) (newline port) (newline port) (close-port port))))))))) - (import-as-definitions importer args find-and-insert))) + (import-as-definitions importer + (cons (string-append "--file-to-insert=" file) + args) + find-and-insert))) ((importer args ...) (let ((print (lambda (expr) (leave-on-EPIPE From patchwork Mon Apr 28 16:23:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42120 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9671427BC4A; Mon, 28 Apr 2025 17:34:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7081827BC49 for ; Mon, 28 Apr 2025 17:34:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPl-0007tJ-9z; Mon, 28 Apr 2025 12:33:05 -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 1u9ROw-0007b1-FI for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:14 -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 1u9ROu-0004OA-Vs; Mon, 28 Apr 2025 12:32:13 -0400 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=vz0BB2zDWaXfFQtsQEoFu6+jA9vZY8RfyoKzYSzTNVk=; b=EangmPc18oKh3z8245yXunpJ6YbRIDHGPtYz7Qhj0cE2FxgIaBvXmSkjW3UTjECeprWehRutM2UzmxWcdGhyzltZJtqLKz/Loa/cw5am4mr9s5vN+ltW4Fa4XoPIxhRGhZdj5tH7O21gaKYOzgpjG7988xZTmq5Q9kHAhwsNQOW5SMqZg3xofqbTnKdXP5sdmDVkBYdafM0ZqkXCRLSEliGxkLh+5gVhIGT7ydbYbwAu4WkxPdm8/WjtfGFHQsrEsLNryb3ifDabRsmc5/kPE/lQOPq29LsQZfwLWjNHppIl8sANw1jf98myJaFH/C6M0bjZ6RCGuuQHONDvooHqgQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROt-0003I6-K5; Mon, 28 Apr 2025 12:32:11 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 05/22] scripts: import: Skip existing definition for =?utf-8?b?4oCYLS1pbnNlcnTigJk=?= option. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:11 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585789512209 (code B ref 77093); Mon, 28 Apr 2025 16:32:11 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:35 +0000 Received: from localhost ([127.0.0.1]:32830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROG-0003AC-2g for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:34 -0400 Received: from mail.boiledscript.com ([2a01:4f8:242:4aeb::42]:50944) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9RO9-00038c-4Q for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:25 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857883; 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=vz0BB2zDWaXfFQtsQEoFu6+jA9vZY8RfyoKzYSzTNVk=; b=H201kyuYdZkHY8YzgmifHbZ4LYlD8EHTuCd330UTw+h445hYx/LJl0jHXwal5cy4SxpnuT UG4/cKdd5AWaB3cgd2u+Rz7YGq3EqVE/WgxUmCbykZEVA7qMqgV3CMuEguKwNzI79Pv9zb eTyKpa8q9YrD9WIhY9w3NLG5eWrxZHdDUBk196lVmw8Cvb/ciALO5hLZyZFC2oKafq/enO MsLSp8OMQ8thLAv2UsWfHyRz5J4gGjh9H58O4i8q79AYy1CidrCt/mKvDJ+uja+Y/Fwg44 WrznhwI9jHP6NW3jjh6ziUagDn8E87ht7ZIHV3099dlxqw9gzW4bkMwe05I0vw== Date: Tue, 29 Apr 2025 00:23:02 +0800 Message-ID: <734ad3e1be29a9ba7fd87152746de3db29154dcb.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/import.scm (guix-import): Skip existing definition for ‘--insert’ option. Change-Id: I2c4242669f974b263a018ab0cf56538bd7c81d06 --- guix/scripts/import.scm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index c620911893..a80893ce5f 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -147,16 +147,19 @@ (define-command (guix-import . args) (lambda (expr) (match expr (((? define-prefix? define-prefix) term _ ...) - (let ((source-properties - (find-definition-insertion-location - file term #:define-prefix define-prefix))) - (if source-properties - (insert-expression source-properties expr) - (let ((port (open-file file "a"))) - (pretty-print-with-comments port expr) - (newline port) - (newline port) - (close-port port))))))))) + ;; Skip existing definition. + (unless (find-definition-location + file term #:define-prefix define-prefix) + (let ((source-properties + (find-definition-insertion-location + file term #:define-prefix define-prefix))) + (if source-properties + (insert-expression source-properties expr) + (let ((port (open-file file "a"))) + (pretty-print-with-comments port expr) + (newline port) + (newline port) + (close-port port)))))))))) (import-as-definitions importer (cons (string-append "--file-to-insert=" file) args) From patchwork Mon Apr 28 16:23:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42108 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3848B27BC4A; Mon, 28 Apr 2025 17:33:08 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B701027BC49 for ; Mon, 28 Apr 2025 17:33:07 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPO-0007eI-8E; Mon, 28 Apr 2025 12:32:44 -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 1u9ROv-0007ay-ML for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:14 -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 1u9ROv-0004OO-At for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:13 -0400 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=QAxpnChm2JQ4iqe4xDL4FBxmR/z+rlOe04Zt7AFhLHk=; b=CKysnoqz8+dJlmtp+ZWacLR9rPYFeFRbzPSiVeOTNdpkTD4hiTdv5HnplC/v1UYoO3y9DPEf3Tc6VhUEblwMTbLvdDquxYhiR/t0XwEZ4Nhd12gQVtKeci56d5TIxfYFHbTM750wcRUTqYIvf3iLv5B+xiRUZVKuAF2AOPfalHUNX/lGyDnTKV2WOS4DkNS9hrRTGFbuH4oqYsGFT8TPWfOfMDhaTjJlEiUqJj3jaVhGp+NZWoXl/1u0QswcjIoxhGEiiVnOKG50J2sLohi/R6pW45nkpMWML2H2CruNQqRqn5mnyWa3wj+DsWMfhoCAcJ2Sh29ezxDtHT1Eq52YbQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROu-0003IO-6q; Mon, 28 Apr 2025 12:32:12 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 06/22] import: crate: crate-name->package-name: Move to (guix build-system cargo). Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:12 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585789812236 (code B ref 77093); Mon, 28 Apr 2025 16:32:12 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:38 +0000 Received: from localhost ([127.0.0.1]:32833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROJ-0003Ar-1y for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:37 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:38426) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROB-000395-6B for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:27 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nE+TiUjpbomOn4WuvKx7SjXbtAaPuA4qOcRwbH1Mbgs=; b=Gpe5Zf4hGTIKrpBhhIPlDGDOk11p2oFmPBSphsDFhakTCaizXGxmzCrX30lQ5HDSOfL8LQ Tbc+pltArbd2xjiOVbz0gZQ7pYGW9HQsRNuVnk8b2NS/NjATh8Y5JouEvIArnWUgqerey3 VkCYTaZsFEpG/2LrllD1OVFKCNF7/cgbQx83mdZPiirdnwu2hyFQspjA4cvt11gezkE1Ku aMBK7l5T/32uhmi5nPv/soyt50QARNx/Xn9e+f4C1v6CdeKXSntljUoj8lPrIBO/kdXPq3 7cDfNGxqx8sptmlH8NkkeLX14uM25Zow2xPyeXospW7VhzKcb6RoHPTiuqeN5Q== Date: Tue, 29 Apr 2025 00:23:03 +0800 Message-ID: <03977cccf03709eeba4f5aff79ed19bb1beb3a48.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/import/crate.scm (crate-name->package-name): Move to... * guix/build-system/cargo.scm (crate-name->package-name): ...here and export. Change-Id: Ie9813179d6c40d159956cc1e2ae59a74dea0a42d --- guix/build-system/cargo.scm | 6 +++++- guix/import/crate.scm | 5 ----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 452f7f78d0..f2ffc67879 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -44,7 +44,8 @@ (define-module (guix build-system cargo) %crate-base-url crate-url crate-url? - crate-uri)) + crate-uri + crate-name->package-name)) (define %crate-base-url (make-parameter "https://crates.io")) @@ -58,6 +59,9 @@ (define (crate-uri name version) to NAME and VERSION." (string-append crate-url name "/" version "/download")) +(define (crate-name->package-name name) + (downstream-package-name "rust-" name)) + (define (default-rust target) "Return the default Rust package." ;; Lazily resolve the binding to avoid a circular dependency. diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 5a8caeb3e1..14e6e28c5b 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -481,10 +481,6 @@ (define (guix-package->crate-name package) (match parts ((name _ ...) name)))) -(define (crate-name->package-name name) - (downstream-package-name "rust-" name)) - - ;;; ;;; Updater @@ -528,4 +524,3 @@ (define %crate-updater (description "Updater for crates.io packages") (pred crate-package?) (import import-release))) - From patchwork Mon Apr 28 16:23:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42124 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A603727BC4D; Mon, 28 Apr 2025 17:34:49 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 01EAE27BC4A for ; Mon, 28 Apr 2025 17:34:49 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPs-0007xh-Py; Mon, 28 Apr 2025 12:33:12 -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 1u9RPF-0007ex-7E for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:38 -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 1u9RP5-0004RH-7q for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:30 -0400 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=II/0aICbto6f5AzvulfBj9UzCwqQYB8mkTvtqOdcotM=; b=drR4tkFt0jjmtqWfALuTuaw61VjfbprV4+yLJhpFP52DSDI4YrT/VtEj9jYafQvUU/rdiAEtI5k3R/nBi/C/lU8IGUYuUD33bGN/gMEnzfL/W/270+MtKv7dqiMwXVslJ9c110PY96gz1FwmjkXjFKkhGgWszwxrR3erbs+vlk6I7wLyO6T/4aTH8vjVM16D7cIkpjamBrfHOisZQbgrt398JEuoHzTvYbsgUHm4l88YDevGbs2mq38D7l6g0NAGVxuMsujnYfrUG6zCNBWze7J5SnDRMk7vz6m0m59O6hvkAhwz2t09DNkPvR93CfuFhOTN4zQSFAepY8oA1LQRoA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROu-0003Ih-SL; Mon, 28 Apr 2025 12:32:12 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 07/22] build/cargo: Pass =?utf-8?b?4oCYLS1vZmZsaW5l4oCZ?= to cargo. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:12 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585789812260 (code B ref 77093); Mon, 28 Apr 2025 16:32:12 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:38 +0000 Received: from localhost ([127.0.0.1]:32837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROL-0003BJ-Od for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:38 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:38432) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROC-00039K-PS for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:29 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857887; 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=II/0aICbto6f5AzvulfBj9UzCwqQYB8mkTvtqOdcotM=; b=Astqu4Tqeyyo9lL1whXRbHpRlkuQss5kKaYWajiNTu9fdhWt0iWLovpd8sxbJP4Aa86dUt VDonQ6klNatDnCWBhfp3uQjrpj59UQWCrTop6z/cSYTTn4NOv6upPekZLc5uFSnTvoYCfi BHqQHyXPxsgj4awi1rjA1mjV/Jvt2sAKfqAwU944yOtiEvM92FN+Q5b4IqVC0QQS5/G3wZ YEKVNdMCE0C4Dv+DHYBE4zRfmvWYGAHs9OClctQhlmzviaAMy8JHbutV4yFW1pvpWmmiDF cPo3Ihbl8BXTBuo5MJCrcYup3SkemOYDik7aHXDKIecvTq1VF+NVQE7lEe+EYA== Date: Tue, 29 Apr 2025 00:23:04 +0800 Message-ID: <500c1663df6bc2a8431b9c84e8656f49a4ce8214.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This will make error messages more helpful. * guix/build/cargo-build-system.scm (build, check, package, install): Pass ‘--offline’ to cargo. Change-Id: Ic95f603b793319f99c9c1fbce43f773bfc8126c0 --- guix/build/cargo-build-system.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 5ef6b23abd..41f54f42b7 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -246,7 +246,7 @@ (define* (build #:key "Build a given Cargo package." (or skip-build? (apply invoke - `("cargo" "build" + `("cargo" "build" "--offline" ,@(if parallel-build? (list "-j" (number->string (parallel-job-count))) (list "-j" "1")) @@ -264,7 +264,7 @@ (define* (check #:key "Run tests for a given Cargo package." (when tests? (apply invoke - `("cargo" "test" + `("cargo" "test" "--offline" ,@(if parallel-build? (list "-j" (number->string (parallel-job-count))) (list "-j" "1")) @@ -303,7 +303,7 @@ (define* (package #:key ;;error: invalid inclusion of reserved file name Cargo.toml.orig in package source (when (file-exists? "Cargo.toml.orig") (delete-file "Cargo.toml.orig")) - (apply invoke `("cargo" "package" ,@cargo-package-flags)) + (apply invoke `("cargo" "package" "--offline" ,@cargo-package-flags)) ;; Then unpack the crate, reset the timestamp of all contained files, and ;; repack them. This is necessary to ensure that they are reproducible. @@ -356,7 +356,8 @@ (define* (install #:key ;; otherwise cargo will raise an error. (or skip-build? (not (has-executable-target?)) - (invoke "cargo" "install" "--no-track" "--path" "." "--root" out + (invoke "cargo" "install" "--offline" "--no-track" + "--path" "." "--root" out "--features" (string-join features))) (when install-source? From patchwork Mon Apr 28 16:23:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42121 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8639427BC4A; Mon, 28 Apr 2025 17:34:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F224127BC49 for ; Mon, 28 Apr 2025 17:34:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RQo-0008PR-48; Mon, 28 Apr 2025 12:34:11 -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 1u9ROz-0007be-7S for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:18 -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 1u9ROy-0004PR-PL for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:16 -0400 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=Vt4y6CTOGVonuoCeKQ+8eMOJHJzylPrUcABgm21cTU8=; b=Hba/hem2tI9/G7VkcdkiSIrLv+MiIHdvPDcU9OLwo7kAo0ImRxZ7GVApLRRGGpRRb9ZO8URtmbbi3B+GRTbfgeuKdzRm6X4kVeRTFZ4VXKrE8RnopQTpmYjwVbNgCQ3wZGhBPXX3faR/v+oDGBKc6e3VCs8n8kU2cCsUeSqwFd9eAuwP0LjciZZIPtEhA4gnCygb5aX48ugN07Qufhyv8utkOXPBWSSYvRH31h4oYbzwNLEvAGO1AsUZyYEXLTeb0pA6zRV2W6FQseS1yCJw7XQrOd7FBQsmZioxT344yuFcv3akLczsKTwIex0RYSY3CPeAJnp3bxkVckxGhq7JFg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROv-0003Iz-Fw; Mon, 28 Apr 2025 12:32:13 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 08/22] build/cargo: Print out all non-empty binary files. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:13 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585791812435 (code B ref 77093); Mon, 28 Apr 2025 16:32:13 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:58 +0000 Received: from localhost ([127.0.0.1]:32852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROg-0003EV-3f for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:58 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:50386) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROF-00039n-3k for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:35 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857889; 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=Vt4y6CTOGVonuoCeKQ+8eMOJHJzylPrUcABgm21cTU8=; b=A7o4xRk7iNZumGFfokDX0HLiQLk5WABBgjkSQ1TQCsBZVcS8shBXN/Wqa6DhOEyCEoPArc 40Xhc2COztvgbe5YBGNjp65APua7CMXzof1i+6pkTtGhlQVJ6z4ai8OPcsKE/B+jbi0whF 2m3dkcQJZEnen4u4Sci5IVhf+BpWkVRb5fLfH41h2puH2JGTkegpIoPpIrh+CZHqmOFmwR zo4Xuv1rQR5qYT9JcmiSWadHGFluEc3ucZ1KETmYj9XVxyiH78Dq5Sp2js5JBglJSxg+RG Ref9+DvMdCPkf7DLPsXE9bBk46TU9pA6GKbKDbYhTuL7oqwMnJZxsFvR3xROfw== Date: Tue, 29 Apr 2025 00:23:05 +0800 Message-ID: <52b9d6c4f3904adee4b960ae327236c3814da139.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build/cargo-build-system.scm (%standard-phases): Move ‘unpack-rust-crates’ after ‘unpack’. Move ‘check-for-pregenerated-files’ after ‘configure’. (check-for-pregenerated-files): Only check non-empty files. Print out binary files. Run in parallel. Don't fail to keep compatibility for phase order change. Change-Id: I0a332fe843e97687324bd908fa111422a63e475d --- guix/build/cargo-build-system.scm | 33 +++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 41f54f42b7..c37fd70418 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -27,11 +27,14 @@ (define-module (guix build cargo-build-system) #:use-module ((guix build gnu-build-system) #:prefix gnu:) #:use-module (guix build json) #:use-module ((guix build utils) #:hide (delete)) + #:use-module (ice-9 binary-ports) #:use-module (ice-9 popen) #:use-module (ice-9 rdelim) + #:use-module (ice-9 regex) #:use-module (ice-9 ftw) #:use-module (ice-9 format) #:use-module (ice-9 match) + #:use-module (ice-9 threads) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%standard-phases @@ -111,12 +114,30 @@ (define* (unpack-rust-crates #:key inputs vendor-dir #:allow-other-keys) (define (rust-package? name) (string-prefix? "rust-" name)) -(define* (check-for-pregenerated-files #:rest _) +(define* (check-for-pregenerated-files #:key parallel-build? #:allow-other-keys) "Check the source code for files which are known to generally be bundled libraries or executables." - (let ((pregenerated-files (find-files "." "\\.(a|dll|dylib|exe|lib)$"))) - (when (not (null-list? pregenerated-files)) - (error "Possible pre-generated files found:" pregenerated-files)))) + (format #t "Searching for binary files...~%") + (let ((known-pattern (make-regexp "\\.(a|dll|dylib|exe|lib)$")) + (empty-file? + (lambda (file stat) + (let ((size (stat:size stat))) + (or (zero? size) + (and (eqv? 1 size) + (eqv? #\newline + (call-with-ascii-input-file file read-char)))))))) + (n-par-for-each + (if parallel-build? + (parallel-job-count) + 1) + (lambda (file) + ;; Print out binary files. + (false-if-exception (invoke "grep" "-IL" "." file)) + ;; Warn about known pre-generated files. + ;; Not failing here for compatibility with existing packages. + (when (regexp-exec known-pattern file) + (format #t "error: Possible pre-generated file found: ~a~%" file))) + (find-files "." (negate empty-file?))))) (define* (configure #:key inputs target system @@ -380,8 +401,8 @@ (define %standard-phases (replace 'check check) (replace 'install install) (add-after 'build 'package package) - (add-after 'unpack 'check-for-pregenerated-files check-for-pregenerated-files) - (add-after 'check-for-pregenerated-files 'unpack-rust-crates unpack-rust-crates) + (add-after 'unpack 'unpack-rust-crates unpack-rust-crates) + (add-after 'configure 'check-for-pregenerated-files check-for-pregenerated-files) (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums patch-cargo-checksums))) (define* (cargo-build #:key inputs (phases %standard-phases) From patchwork Mon Apr 28 16:23:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42119 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0F68627BC4B; Mon, 28 Apr 2025 17:34:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 68CBE27BC49 for ; Mon, 28 Apr 2025 17:34:16 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RQJ-00085Q-Hb; Mon, 28 Apr 2025 12:33:41 -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 1u9RPG-0007f0-Ab for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:40 -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 1u9RP6-0004RK-GY; Mon, 28 Apr 2025 12:32:30 -0400 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=xq8aZZS4z1iXsAw8Yh8ghtjt4KEmjBBBr2IR0G0tl30=; b=ULFktsQS2qfLuI6RC90ipl6CtApI7SHUmq0/Oro+kc4ux17Sk0sxyKEAsCCdtmoKsavwFEISIQxjETOIiDbPTlg64jPz94ecluysGp/1kSUM3XlUi31bsxrjuj+0oOhCLnHSxrkB81Cpq4C5bJ1gbiMJF6ZQpkeWy7R4qxSFBPEIo51cx/Z3tmkpRu3UVxjU+MVc+iHiqP573UZG6Oa2SwsntmYV6RzUZ1SzSp7KyKhi8QDe6BthMQC+y64B3qHul7hjfKQW2GctVZLQrN81dupQVWxvF+nPYX0E43EBhQNbFtVF8arbuozicLV/mL84laHJxx6TkHidFIgQTwze1Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROw-0003JI-JS; Mon, 28 Apr 2025 12:32:14 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 09/22] build-system: cargo: Support packaging Cargo workspace. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, ludo@gnu.org, maxim.cournoyer@gmail.com, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:14 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585792012457 (code B ref 77093); Mon, 28 Apr 2025 16:32:14 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:00 +0000 Received: from localhost ([127.0.0.1]:32857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROh-0003Ek-6U for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:59 -0400 Received: from mail.boiledscript.com ([2a01:4f8:242:4aeb::42]:45812) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROH-0003AD-1U for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:37 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xq8aZZS4z1iXsAw8Yh8ghtjt4KEmjBBBr2IR0G0tl30=; b=gBHsRPV2Zdwhsb0gUcvb2FM7XunDh7NZD5jZ0vmJqn/Z4+x8cKhYji6CpbTmkDLB05Xc8Q nhoJSerSeLQ3AoWf9QldgKpKPnTz2GsiijLMyLi858cKU+c19/PhUz5iCTYFEjToiunnKe tF0UbNpjeQ6LmVyoRd2WGN/EvJP1Bkx4kdTHuU+8kjcx29rmfmuN/PqhhiIbEYKfw9Kjhy 4gXVZVTZAdJ+7Garqz/IaLL/zjAtLzlyOM3TYiak9byfQWt6jtS+ykD2rrXbb3fPtvdovR CBDqV03jb/5qZBcIinrZwGqgXRqAhqPwaafpnykhDP9lyBnKdzKzEkwR3acLbg== Date: Tue, 29 Apr 2025 00:23:06 +0800 Message-ID: <079eff3a62ed1319c6d8a0c3d84b244bf1479a2e.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build-system/cargo.scm (cargo-build, cargo-cross-build) [#:cargo-package-crates]: New argument. * guix/build/cargo-build-system.scm (package): Use it. * doc/guix.texi (Build Systems)[cargo-build-system]: Document it. Change-Id: I45ccd95e90827d47127015cb0bda2d41f792335b --- doc/guix.texi | 7 +++++++ guix/build-system/cargo.scm | 4 ++++ guix/build/cargo-build-system.scm | 21 +++++++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 7b418a4089..771547fafb 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9493,6 +9493,13 @@ Build Systems the binaries defined by the crate. Unless @code{install-source? #f} is defined it will also install a source crate repository of itself and unpacked sources, to ease in future hacking on rust packages. + +This build system supports cargo workspaces. Parameter +@code{#:cargo-package-crates} (default: @code{''()}) allows specifying names of +library crates to package in the @code{package} phase. Specified crates are +packaged from left to right, in case there's dependency among them. For +example, specifying @code{''("pcre2-sys" "pcre2")} will package +@code{"pcre2-sys"} first and then @code{"pcre2"}. @end defvar @defvar chicken-build-system diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index f2ffc67879..2c47c1feaf 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -98,6 +98,7 @@ (define* (cargo-build name inputs (vendor-dir "guix-vendor") (cargo-build-flags ''("--release")) (cargo-test-flags ''()) + (cargo-package-crates ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) (features ''()) (skip-build? #f) @@ -126,6 +127,7 @@ (define* (cargo-build name inputs #:vendor-dir #$vendor-dir #:cargo-build-flags #$(sexp->gexp cargo-build-flags) #:cargo-test-flags #$(sexp->gexp cargo-test-flags) + #:cargo-package-crates #$(sexp->gexp cargo-package-crates) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) #:cargo-target #$(cargo-triplet system) #:features #$(sexp->gexp features) @@ -158,6 +160,7 @@ (define* (cargo-cross-build name (vendor-dir "guix-vendor") (cargo-build-flags ''("--release")) (cargo-test-flags ''()) + (cargo-package-crates ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) (cargo-target (cargo-triplet (or target system))) (features ''()) @@ -189,6 +192,7 @@ (define* (cargo-cross-build name #:vendor-dir #$vendor-dir #:cargo-build-flags #$(sexp->gexp cargo-build-flags) #:cargo-test-flags #$(sexp->gexp cargo-test-flags) + #:cargo-package-crates #$(sexp->gexp cargo-package-crates) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) #:cargo-target #$(cargo-triplet (or target system)) #:features #$(sexp->gexp features) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index c37fd70418..85745d4d91 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -302,11 +302,16 @@ (define* (package #:key source skip-build? install-source? + (cargo-package-crates '()) (cargo-package-flags '("--no-metadata" "--no-verify")) + (vendor-dir "guix-vendor") #:allow-other-keys) "Run 'cargo-package' for a given Cargo package." (if install-source? - (if skip-build? + ;; NOTE: Cargo workspace packaging support: + ;; #:install-source? #t + #:cargo-package-crates. + (if (and (null? cargo-package-crates) + skip-build?) (begin (install-file source "target/package") (with-directory-excursion "target/package" @@ -324,7 +329,19 @@ (define* (package #:key ;;error: invalid inclusion of reserved file name Cargo.toml.orig in package source (when (file-exists? "Cargo.toml.orig") (delete-file "Cargo.toml.orig")) - (apply invoke `("cargo" "package" "--offline" ,@cargo-package-flags)) + + (if (null? cargo-package-crates) + (apply invoke `("cargo" "package" "--offline" ,@cargo-package-flags)) + (for-each + (lambda (pkg) + (apply invoke "cargo" "package" "--offline" "--package" pkg + cargo-package-flags) + (for-each + (lambda (crate) + (invoke "tar" "xzf" crate "-C" vendor-dir)) + (find-files "target/package" "\\.crate$")) + (patch-cargo-checksums #:vendor-dir vendor-dir)) + cargo-package-crates)) ;; Then unpack the crate, reset the timestamp of all contained files, and ;; repack them. This is necessary to ensure that they are reproducible. From patchwork Mon Apr 28 16:23:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42113 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 84BF327BC49; Mon, 28 Apr 2025 17:33:43 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0132527BC4A for ; Mon, 28 Apr 2025 17:33:43 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPp-0007wJ-1h; Mon, 28 Apr 2025 12:33:11 -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 1u9RP0-0007bg-Bp for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:18 -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 1u9ROz-0004PX-3Y; Mon, 28 Apr 2025 12:32:17 -0400 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=dkwouDzfCRTry/CvP1OPiGofQPfusfWvgbK3xNO7lxI=; b=krj+es+HY8UWajewDW0Cw7iBUcsKGgHnpWIH/wARVOBgRc9JGBSJPrniIYVGMOhTYRBDtDPRbaJG1vywUOrJO+/mGdljKJDbNVMug1eOd7EUBOtboh+q7hPy7+cN5iQ8pfE/uJUl2xIQHWWmSqzRe7ZkCoNsF/haSeycBhrLaWaonp+IaYQH7ZI5W7IHKTWK9R7YIAZZmPaNq88SBTPcFnpb7uHuIqHDmthMgdXd1t/ngjwLhsurxjIJOM05bFA61i38q2Vt8oY+W1L7U3LiXzqTkEQPlOJSKUWdVHsErZ0AuhqWcswREYboZ1Mwfbrm+O2bNcRAbdjf9DQoITJK2Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROx-0003JR-7p; Mon, 28 Apr 2025 12:32:15 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 10/22] build-system: cargo: Support installing Cargo workspace. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, ludo@gnu.org, maxim.cournoyer@gmail.com, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:15 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585792012468 (code B ref 77093); Mon, 28 Apr 2025 16:32:15 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:00 +0000 Received: from localhost ([127.0.0.1]:32861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROh-0003Ex-Sl for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:00 -0400 Received: from mail.boiledscript.com ([2a01:4f8:242:4aeb::42]:45818) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROJ-0003Ae-1w for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:38 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dkwouDzfCRTry/CvP1OPiGofQPfusfWvgbK3xNO7lxI=; b=CkMeB1QZ6VrTrYnanw6xfRLoUnRY/T6abzl5NhQLOdcmfxTWFwMOXdRbz/k/ga6Iiw6r8F JY4UnAEKVXN0Pfk4wHnOXsCHNNNxjjudVaJq6pSLGweOEgoJQPhUW5d+RLHirhVh3z0AM3 g/jUuvZjMpmd+xbSZTMcOx5cX2lqt9ibGGPnE/6RuLWWbQIt71lUWbhSkHd6J4I+QNpOm8 3NU5dOCe0xzCStiP+Vm1keliaiqFHM/PkkzAfp5FboEnWknexeifHF203UKrOVI0EzbvkL bkxTc8pLEsS3CdpelpQqfQTTSKcmoAk22ts7uRm9lDhnpcj4rhEGxZWvoIw7LA== Date: Tue, 29 Apr 2025 00:23:07 +0800 Message-ID: <963f1990b2747090361c014e370355fde368b9e1.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches *guix/build-system/cargo.scm (cargo-build, cargo-cross-build) [#:cargo-install-paths]: New argument. * guix/build/cargo-build-system.scm (install): Use it. * doc/guix.texi (Build Systems)[cargo-build-system]: Document it. Change-Id: I74ed1972a5716da05afeac8edb2b0e4b6834bf40 --- doc/guix.texi | 5 ++++- guix/build-system/cargo.scm | 4 ++++ guix/build/cargo-build-system.scm | 17 +++++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 771547fafb..6388f7b28f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9499,7 +9499,10 @@ Build Systems library crates to package in the @code{package} phase. Specified crates are packaged from left to right, in case there's dependency among them. For example, specifying @code{''("pcre2-sys" "pcre2")} will package -@code{"pcre2-sys"} first and then @code{"pcre2"}. +@code{"pcre2-sys"} first and then @code{"pcre2"}. Parameter +@code{#:cargo-install-paths} (default: @code{''()}) allows specifying paths of +binary crates to install in the @code{install} phase, @code{''("crates/atuin")}, +for example. @end defvar @defvar chicken-build-system diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 2c47c1feaf..7a07003262 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -100,6 +100,7 @@ (define* (cargo-build name inputs (cargo-test-flags ''()) (cargo-package-crates ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) + (cargo-install-paths ''()) (features ''()) (skip-build? #f) (parallel-build? #t) @@ -129,6 +130,7 @@ (define* (cargo-build name inputs #:cargo-test-flags #$(sexp->gexp cargo-test-flags) #:cargo-package-crates #$(sexp->gexp cargo-package-crates) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) + #:cargo-install-paths #$(sexp->gexp cargo-install-paths) #:cargo-target #$(cargo-triplet system) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? @@ -162,6 +164,7 @@ (define* (cargo-cross-build name (cargo-test-flags ''()) (cargo-package-crates ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) + (cargo-install-paths ''()) (cargo-target (cargo-triplet (or target system))) (features ''()) (skip-build? #f) @@ -194,6 +197,7 @@ (define* (cargo-cross-build name #:cargo-test-flags #$(sexp->gexp cargo-test-flags) #:cargo-package-crates #$(sexp->gexp cargo-package-crates) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) + #:cargo-install-paths #$(sexp->gexp cargo-install-paths) #:cargo-target #$(cargo-triplet (or target system)) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 85745d4d91..be96ab309f 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -379,6 +379,7 @@ (define* (install #:key skip-build? install-source? features + (cargo-install-paths '()) #:allow-other-keys) "Install a given Cargo package." (let* ((out (assoc-ref outputs "out")) @@ -393,10 +394,18 @@ (define* (install #:key ;; Only install crates which include binary targets, ;; otherwise cargo will raise an error. (or skip-build? - (not (has-executable-target?)) - (invoke "cargo" "install" "--offline" "--no-track" - "--path" "." "--root" out - "--features" (string-join features))) + ;; NOTE: Cargo workspace installation support: + ;; #:skip-build? #f + #:cargo-install-paths. + (and (null? cargo-install-paths) + (not (has-executable-target?))) + (for-each + (lambda (path) + (invoke "cargo" "install" "--offline" "--no-track" + "--path" path "--root" out + "--features" (string-join features))) + (if (null? cargo-install-paths) + '(".") + cargo-install-paths))) (when install-source? ;; Install crate tarballs and unpacked sources for later use. From patchwork Mon Apr 28 16:23:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42111 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C854827BC4A; Mon, 28 Apr 2025 17:33:31 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8D0D627BC49 for ; Mon, 28 Apr 2025 17:33:31 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPu-0007xd-3Y; Mon, 28 Apr 2025 12:33:14 -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 1u9RPF-0007ew-71 for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:38 -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 1u9RP6-0004RQ-41 for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:30 -0400 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=E8orD5fkoLynauQpj2d1xWf3SVvVuqHu8HSQ2hsw6Cw=; b=EoHrszNg+eBuAoPosI0MJPMWLwUEjHS5YeSfhz8UGOCrtJvuCFvuqGuyb/jqLLTePxbYuSQdSSFRgbR0UYkfbnDf6sbsRsdz6lhr7kLvUgt+izIMpaJkc/rozS5fpGU9ZQRph67LTSkL7m37KRYY5vDa6Piqc95qCBfl9NM38wHQRRET2t2DQWjCuiKVeQcaLBpGLmpm+UAHmf+I3zwtKLrR90pLz4lJ+gULu7ghMRKClMaYtM8mT0+Rw8zw4p+3uvyb40l2O+pAQmdkmlfCKX0jopOcl8HnyT47DqtfkZCD/TEhYWT26K4mdvbBhIC+sqbDVfQ+xJp760c4yNaU7g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROw-0003J9-11; Mon, 28 Apr 2025 12:32:14 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 11/22] build/cargo: Set default value of arguments for build phases. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:13 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585791912444 (code B ref 77093); Mon, 28 Apr 2025 16:32:13 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:59 +0000 Received: from localhost ([127.0.0.1]:32855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROg-0003Ec-N2 for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:59 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:50400) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROL-0003BB-44 for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:38 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8orD5fkoLynauQpj2d1xWf3SVvVuqHu8HSQ2hsw6Cw=; b=Ai329bcGsAxnt3/9PsYzLJz9mspPW/g1V8HLoL77+EPfrfpJbXO/s0CcL+4jSpG972eU3j KhuwUoL0f1n+QjL3IHGBn+myhF0zr+1se9+PpD0maKu+pJPd5cpiqKHyTWiJJZPG/MEkbo zwjypXmZN2uO+2rNq/u7bcWjrLpwQ0hhfQhwO+m3VVZFRMSpDdEa/pNZiZ/HfMWXd7rPxd 85lL/YQyCvdR+IKte+i6B0d6pP/Jue3Y0MMlmWUMjjxiCpDriOL3ZwxEoZiyz5dZ5P90am PYPTbl19ZNvOo0sr2Xms37zL1tKKMFR8tkEe05a9MKAoumHENGQKDNgEv6hlqg== Date: Tue, 29 Apr 2025 00:23:08 +0800 Message-ID: <4f5f2b0684da8ffc8629a2a6e9630e194b6103cc.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This will make it easier to use these phases in other bulid systems. * guix/build/cargo-build-system.scm (unpack-rust-crates, configure, build) (package, install): Set default value for arguments specific to this build system. Change-Id: I1dde1b063d8eee57967903abd2fce94574211a0a --- guix/build/cargo-build-system.scm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index be96ab309f..d8433e1acd 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -77,7 +77,8 @@ (define (crate-src? path) " | cut -d/ -f2" " | grep -q '^Cargo.toml$'"))))) -(define* (unpack-rust-crates #:key inputs vendor-dir #:allow-other-keys) +(define* (unpack-rust-crates #:key inputs (vendor-dir "guix-vendor") + #:allow-other-keys) (define (inputs->rust-inputs inputs) "Filter using the label part from INPUTS." (filter (lambda (input) @@ -141,7 +142,7 @@ (define* (check-for-pregenerated-files #:key parallel-build? #:allow-other-keys) (define* (configure #:key inputs target system - cargo-target + (cargo-target #f) (vendor-dir "guix-vendor") #:allow-other-keys) "Vendor Cargo.toml dependencies as guix inputs." @@ -260,7 +261,7 @@ (define* (patch-cargo-checksums #:key (define* (build #:key parallel-build? - skip-build? + (skip-build? #f) (features '()) (cargo-build-flags '("--release")) #:allow-other-keys) @@ -300,8 +301,8 @@ (define* (check #:key (define* (package #:key source - skip-build? - install-source? + (skip-build? #f) + (install-source? #t) (cargo-package-crates '()) (cargo-package-flags '("--no-metadata" "--no-verify")) (vendor-dir "guix-vendor") @@ -376,9 +377,9 @@ (define* (package #:key (define* (install #:key inputs outputs - skip-build? - install-source? - features + (skip-build? #f) + (install-source? #t) + (features '()) (cargo-install-paths '()) #:allow-other-keys) "Install a given Cargo package." From patchwork Mon Apr 28 16:23:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42112 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 20B9427BC4A; Mon, 28 Apr 2025 17:33:41 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E063727BC49 for ; Mon, 28 Apr 2025 17:33:40 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPk-0007rm-Dm; Mon, 28 Apr 2025 12:33:04 -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 1u9RP2-0007cw-4j for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:20 -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 1u9RP0-0004Q8-TX for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:19 -0400 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=1iRYpkJI3W/WjUmTO3Z1nwa4tiyGJqZ1APG3jJmxHTs=; b=e8KeXiZJ+Es2J5cE4dm4/YsfqfY2XOC2vY2ZmHCNpdEVpb/ZJlL94Kc17qnXLGScI51UX1nwAFVtWsghiyWjcPo7wFUSH4EMAXQxoGk7XNEpmSKxoXOwSnSFG7pfZpHcPk7yEbQu3KMSI7ZkqMNJ0ePyzBrhl99yjHZSNABwzkSR205JdLcHwtsefC43g0j01BeazyfiCpQZ2YGzytxQ6f4+nFk1OJH7aVzr8cIog8yikwr6thnsyPz/5er5efatZ0OodF+27PIHrvcR+bpQBAQPv9BfkvuLzDFCMhWTWhUzSu2aODtyVe82OjVKh2ysX/+sNJQv+AvN95XZabNKqw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROx-0003Ja-Ok; Mon, 28 Apr 2025 12:32:15 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 12/22] build/cargo: Don't try to unpack sanity-check.py. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:15 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Efraim Flashner , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585792112482 (code B ref 77093); Mon, 28 Apr 2025 16:32:15 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:01 +0000 Received: from localhost ([127.0.0.1]:32864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROi-0003F4-LR for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:01 -0400 Received: from mail.boiledscript.com ([2a01:4f8:242:4aeb::42]:45824) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9RON-0003Bc-3v for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:39 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1iRYpkJI3W/WjUmTO3Z1nwa4tiyGJqZ1APG3jJmxHTs=; b=XWhJmL00EJYtJAXTwp3mdKP2CBac5T9vO82ERqKKM/hSX3w1CfsfiBWbyBaqp0NWn+PH+S yq2ltD5HyaVOjyeerG0PieirZYXAxVFhZfHqZNJwCgVZXSz3Mfl62nBqqAamMrN7Vmh7k3 n9UXDKyzhcghjCLsSP9UCfFhKgpAJrR0leaxMVcsB/GyMP597TEgrJn3ps/6ervAyTYsqV 2iVtRYd3FsyUIkxJcftWwZ6ukmY8bCjicDR6hK2SUx6nZ4lQVpWWZrBtyvAAQ8zhbbpIH+ 2rGt3P1yUN3xqSCjulsMsPC3UUglgi1ZrXz2bWf0f1YwiNChz4iwjMwr8P6Qvw== Date: Tue, 29 Apr 2025 00:23:09 +0800 Message-ID: <3d9bf59b2e7dc0052ec9ad6580b40c4f29e4ec0f.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Efraim Flashner * guix/build/cargo-build-system.scm (crate-src?): Also don't try to check python scripts for Cargo.toml. Change-Id: I001a89b83d2e472706b1263007be45d1153c140f --- guix/build/cargo-build-system.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index d8433e1acd..7b519607f2 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -65,6 +65,7 @@ (define (crate-src? path) "Check if PATH refers to a crate source, namely a gzipped tarball with a Cargo.toml file present at its root." (and (not (directory-exists? path)) ; not a tarball + (not (string-suffix? "py" path)) ; sanity-check.py ;; First we print out all file names within the tarball to see if it ;; looks like the source of a crate. However, the tarball will include ;; an extra path component which we would like to ignore (since we're From patchwork Mon Apr 28 16:23:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42116 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6DD0227BC49; Mon, 28 Apr 2025 17:34:00 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B714A27BC4A for ; Mon, 28 Apr 2025 17:33:59 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPm-0007uh-Vz; Mon, 28 Apr 2025 12:33:07 -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 1u9ROy-0007bY-TP for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:18 -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 1u9ROy-0004PS-GN for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:16 -0400 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=KCfXh2249U4FkOFmWEqEMKMijHNF6pqFWoUQgmfGRdQ=; b=ufn1uAskKeyR6O6nKBm0ZvJ6ry70s9QnfsL0wGyXrUqxYRXFRbZO5kS4AB6bVUWxcbneYay32hLKf9Gya3gr34U1qGpivjFdeayMeiy4Hgki2cyUJfcwF007ib61Bca90UZXM5Ky4hMj2Rl3j0kgbHuAG/FG2xQDK03MaD3F++e4gH6OqyUS8UKp3mraLavA2DlR6crpyh1YQynoqrU+IsD4G4qTp7tfXyFryrng09BzT8fFQfurruxBnRphzmvJh6fGhAt4JQiTCtG4U6Atg+k97TgDbw2u7nFkRKL/4obxoA0LGSklfXXQfseGAMJTweRW6CthwTDTkHgwSpbFiQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROy-0003Jk-7h; Mon, 28 Apr 2025 12:32:16 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 13/22] build/cargo: Support non-workspace directory source inputs. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:16 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585792412527 (code B ref 77093); Mon, 28 Apr 2025 16:32:16 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:04 +0000 Received: from localhost ([127.0.0.1]:32866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROj-0003FL-7W for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:03 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:51456) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROO-0003Bv-SW for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:41 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KCfXh2249U4FkOFmWEqEMKMijHNF6pqFWoUQgmfGRdQ=; b=APJz2dIMM29WWcJbdGlzZUXyeQEe+gURCfde3HP/Mwg/HK/VqneU8Y5xcLHyZs51m0JEhU APrMHX9iTpmr+rFjTvVeEevA9t06uRCuLizrKBB2BoIaW95zJ7MI7Jk7Z00WwDb5a3HaRg Q16/ifR6p+rS89e5mtCl5HMQRYOgNIJ8UU3MeoNbRXoA4SVAh7xPN/BIxJyle//DaUiI8B jhQpd5PU6NFGZucdDAeT7/fCoW1vmrR1q46Tq5bC2C4J6iV2ZSj5i1kicSYye/SPjWp/LL juTYnOX/FAihVRN3m8wOOfmHc++jTQXSwZ/kHxNAYBSRslHuRNkN2CmbuGJVhw== Date: Tue, 29 Apr 2025 00:23:10 +0800 Message-ID: <7c5da4a4056a622dc8490bc9b8e894f5f273048a.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build/cargo-build-system.scm (single-crate?): New procedure. (crate-src?): Support non-workspace directory source inputs. (configure): Likewise. Change-Id: If2bd318b44ed765baec69309f25d320edceee116 --- guix/build/cargo-build-system.scm | 60 ++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 7b519607f2..d1020bab52 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -34,6 +34,7 @@ (define-module (guix build cargo-build-system) #:use-module (ice-9 ftw) #:use-module (ice-9 format) #:use-module (ice-9 match) + #:use-module (ice-9 textual-ports) #:use-module (ice-9 threads) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) @@ -61,22 +62,35 @@ (define (has-executable-target?) (bin-dep? (lambda (dep) (find bin? (get-kinds dep))))) (find bin-dep? (manifest-targets)))) +(define (single-crate? dir) + "Check if directory DIR contains 'Cargo.toml' and is not a workspace." + (let ((manifest-file (in-vicinity dir "Cargo.toml"))) + (and (file-exists? manifest-file) + (not (string-contains + (call-with-input-file manifest-file get-string-all) + "[workspace]"))))) + (define (crate-src? path) "Check if PATH refers to a crate source, namely a gzipped tarball with a Cargo.toml file present at its root." - (and (not (directory-exists? path)) ; not a tarball - (not (string-suffix? "py" path)) ; sanity-check.py - ;; First we print out all file names within the tarball to see if it - ;; looks like the source of a crate. However, the tarball will include - ;; an extra path component which we would like to ignore (since we're - ;; interested in checking if a Cargo.toml exists at the root of the - ;; archive, but not nested anywhere else). We do this by cutting up - ;; each output line and only looking at the second component. We then - ;; check if it matches Cargo.toml exactly and short circuit if it does. - (apply invoke (list "sh" "-c" - (string-append "tar -tf " path - " | cut -d/ -f2" - " | grep -q '^Cargo.toml$'"))))) + (if (directory-exists? path) + ;; The build system only handles sources containing single crate. + ;; Workspaces should be packaged into crates (via 'package phase) + ;; and used in inputs. + (single-crate? path) + (and (not (string-suffix? "py" path)) ;sanity-check.py + ;; First we print out all file names within the tarball to see + ;; if it looks like the source of a crate. However, the tarball + ;; will include an extra path component which we would like to + ;; ignore (since we're interested in checking if a Cargo.toml + ;; exists at the root of the archive, but not nested anywhere + ;; else). We do this by cutting up each output line and only + ;; looking at the second component. We then check if it matches + ;; Cargo.toml exactly and short circuit if it does. + (invoke "sh" "-c" + (string-append "tar -tf " path + " | cut -d/ -f2" + " | grep -q '^Cargo.toml$'"))))) (define* (unpack-rust-crates #:key inputs (vendor-dir "guix-vendor") #:allow-other-keys) @@ -161,14 +175,18 @@ (define* (configure #:key inputs (and (crate-src? path) ;; Gracefully handle duplicate inputs (not (file-exists? crate-dir)) - (mkdir-p crate-dir) - ;; Cargo crates are simply gzipped tarballs but with a .crate - ;; extension. We expand the source to a directory name we control - ;; so that we can generate any cargo checksums. - ;; The --strip-components argument is needed to prevent creating - ;; an extra directory within `crate-dir`. - (format #t "Unpacking ~a~%" name) - (invoke "tar" "xf" path "-C" crate-dir "--strip-components" "1"))))) + (if (directory-exists? path) + (copy-recursively path crate-dir) + (begin + (mkdir-p crate-dir) + ;; Cargo crates are simply gzipped tarballs but with a + ;; .crate extension. We expand the source to a directory + ;; name we control so that we can generate any cargo + ;; checksums. The --strip-components argument is needed to + ;; prevent creating an extra directory within `crate-dir`. + (format #t "Unpacking ~a~%" name) + (invoke "tar" "xf" path "-C" crate-dir + "--strip-components" "1"))))))) inputs) ;; For cross-building From patchwork Mon Apr 28 16:23:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42115 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E134027BC49; Mon, 28 Apr 2025 17:33:59 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5CAE227BC49 for ; Mon, 28 Apr 2025 17:33:59 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPo-0007vp-Hq; Mon, 28 Apr 2025 12:33:09 -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 1u9RP4-0007dp-LQ for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:24 -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 1u9RP3-0004Qv-FH for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:22 -0400 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=V4BgEMxp3y5LHH/13Zfc78i++Hv7Z668p3Kd4fIxMjY=; b=SI6DjBsyNbH1kWbVhACi0EB4WkCONRt/TSssqj2yEkn6q901lZH/NBiG64Y+r1yhk1kJjvQuP4yWw8ub+/FB5R6oa/g8GgJOhqhad6POR41j0wn2MkHPASihWjrDIrj/uWSTl37hiey+rxuQfEJg4k2PL0JIc2fQk9NkeeeeZzaKoyHl3VsHKmNXEjl7bxs0t/iY230RjLb9iLP1yr3n5WpQdd7S0xy0LfewAjSl/k9hjacBRxSzTQlrqxa+sHjKathpwRllLVVE8w16rg+R+qfInOMc6JTDi1PPM2KcpARSDEO+li4S5DpR328m2qEUS8JD3/miVjFny40nv4Gw4Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROz-0003K9-5Q; Mon, 28 Apr 2025 12:32:17 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 14/22] build/cargo: Don't vendor self. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, lars@6xq.net, liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, me@bonfacemunyoki.com, noelopez@free.fr, sharlatanus@gmail.com, steve@futurile.net, tanguy@bioneland.org, vivien@planete-kraus.eu, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:17 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Lars-Dominik Braun , Liliana Marie Prikler , Maxim Cournoyer , Munyoki Kilyungi , =?utf-8?q?No=C3=A9?= Lopez , Sharlatan Hellseher , Steve George , Tanguy Le Carrour , Vivien Kraus X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Lars-Dominik Braun , Liliana Marie Prikler , Maxim Cournoyer , Munyoki Kilyungi , =?utf-8?q?No=C3=A9?= Lopez , Sharlatan Hellseher , Steve George , Tanguy Le Carrour , Vivien Kraus Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585792912608 (code B ref 77093); Mon, 28 Apr 2025 16:32:17 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:09 +0000 Received: from localhost ([127.0.0.1]:32868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROl-0003Fy-JW for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:09 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:51460) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROQ-0003C2-P2 for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:43 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857901; 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=V4BgEMxp3y5LHH/13Zfc78i++Hv7Z668p3Kd4fIxMjY=; b=bSOSEl2pwX2UM+fGhkZXYNIgqvj3zvi1ZwYsFvmJoUXDq9AhOq3Qz2zlsKIhN/Fp4imAed R/C4pwpGV2c6CE669trsBDS8EuvyIlfpTyANnCYltzzciZ2EUlYSv6W7NYIhtiPwSQTgV0 lnuup2YnPgMe1s4VWNrUbx2UcoWo8hwkUngj+uTq1HTJCqqm2lXg+rs69fvOKQ8KDt+cUX 7+wmcnGr0mKKgypOlBIUmXBr1xCXSSywEKMY4Wxr5GHvGyH3ldRZ7Z01md1RCmOH2frxEk V7iVXUpSK8G3ebM5ei3LHW0hmjLYjMaz64Hj4I3Qovpd24S7alfdvHeLhSgukQ== Date: Tue, 29 Apr 2025 00:23:11 +0800 Message-ID: In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build/cargo-build-system.scm (crate-src?, configure): Exclude self. * gnu/packages/gnome.scm (librsvg)[#:phases]: Remove ‘dont-vendor-self’. * gnu/packages/python-crypto.scm (python-cryptography)[#:arguments]: Likewise. * gnu/packages/python-xyz.scm (python-libcst)[#:arguments]: Likewise. * gnu/packages/syndication.scm (newsboat)[#:arguments]: Likewise. * gnu/packages/antivirus.scm (clamav)[#:arguments]: Likewise. Change-Id: I5e01721fb705937f5fcf858c21b6d7e27ade6c10 --- gnu/packages/antivirus.scm | 5 +--- gnu/packages/gnome.scm | 5 ---- gnu/packages/python-crypto.scm | 5 ---- gnu/packages/python-xyz.scm | 5 ---- gnu/packages/syndication.scm | 5 ---- guix/build/cargo-build-system.scm | 43 ++++++++++++++++--------------- 6 files changed, 23 insertions(+), 45 deletions(-) diff --git a/gnu/packages/antivirus.scm b/gnu/packages/antivirus.scm index 4a01115abd..d2060fa385 100644 --- a/gnu/packages/antivirus.scm +++ b/gnu/packages/antivirus.scm @@ -116,10 +116,7 @@ (define-public clamav (add-after 'configure 'fix-cargo-inputs-vendoring (lambda _ ;; Reproduce the original layout, fails with config. - (rename-file ".cargo/config" ".cargo/config.toml") - ;; Wrongly placed by configure - (delete-file-recursively - (string-append ".cargo/vendor/clamav-" #$version ".tar.zst")))) + (rename-file ".cargo/config" ".cargo/config.toml"))) (add-after 'patch-cargo-checksums 'cmake-configure (lambda* (#:key outputs #:allow-other-keys) ((assoc-ref cmake:%standard-phases 'configure) diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm index 26416df155..3de0dfb293 100644 --- a/gnu/packages/gnome.scm +++ b/gnu/packages/gnome.scm @@ -3780,11 +3780,6 @@ (define-public librsvg "--host=" #$(%current-target-system))) #~("--enable-vala"))) args))) - (add-after 'configure 'dont-vendor-self - (lambda* (#:key vendor-dir #:allow-other-keys) - ;; Don't keep the whole tarball in the vendor directory - (delete-file-recursively - (string-append vendor-dir "/" #$name "-" #$version ".tar.xz")))) (replace 'build (assoc-ref gnu:%standard-phases 'build)) (replace 'check diff --git a/gnu/packages/python-crypto.scm b/gnu/packages/python-crypto.scm index d004f6a69e..f7b6609315 100644 --- a/gnu/packages/python-crypto.scm +++ b/gnu/packages/python-crypto.scm @@ -561,11 +561,6 @@ (define-public python-cryptography #:install-source? #false #:phases #~(modify-phases %standard-phases - (add-after 'configure 'dont-vendor-self - (lambda* (#:key vendor-dir #:allow-other-keys) - ;; Don't keep the whole tarball in the vendor directory - (delete-file-recursively - (string-append vendor-dir "/cryptography-" #$version ".tar.zst")))) (replace 'build (assoc-ref py:%standard-phases 'build)) (delete 'check) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index c63a0a7708..b56d15f202 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -23694,11 +23694,6 @@ (define-public python-libcst (add-after 'unpack 'prepare-source (lambda _ (delete-file "native/Cargo.lock"))) - (add-after 'configure 'dont-vendor-self - (lambda* (#:key vendor-dir #:allow-other-keys) - ;; Don't keep the whole tarball in the vendor directory - (delete-file-recursively - (string-append vendor-dir "/libcst-" #$version ".tar.zst")))) (replace 'build (assoc-ref py:%standard-phases 'build)) (add-after 'install 'wrap diff --git a/gnu/packages/syndication.scm b/gnu/packages/syndication.scm index 61220bb9fe..b597bf9004 100644 --- a/gnu/packages/syndication.scm +++ b/gnu/packages/syndication.scm @@ -311,11 +311,6 @@ (define-public newsboat (("if curl-config") (string-append "if " (search-input-file inputs "/bin/curl-config")))))) - (add-after 'configure 'dont-vendor-self - (lambda* (#:key vendor-dir #:allow-other-keys) - ;; Don't keep the whole tarball in the vendor directory - (delete-file-recursively - (string-append vendor-dir "/" #$name "-" #$version ".tar.xz")))) (add-after 'unpack 'patch-source (lambda* (#:key outputs #:allow-other-keys) (substitute* "Makefile" diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index d1020bab52..c6865e6e81 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -70,27 +70,28 @@ (define (single-crate? dir) (call-with-input-file manifest-file get-string-all) "[workspace]"))))) -(define (crate-src? path) +(define* (crate-src? path #:key source) "Check if PATH refers to a crate source, namely a gzipped tarball with a Cargo.toml file present at its root." - (if (directory-exists? path) - ;; The build system only handles sources containing single crate. - ;; Workspaces should be packaged into crates (via 'package phase) - ;; and used in inputs. - (single-crate? path) - (and (not (string-suffix? "py" path)) ;sanity-check.py - ;; First we print out all file names within the tarball to see - ;; if it looks like the source of a crate. However, the tarball - ;; will include an extra path component which we would like to - ;; ignore (since we're interested in checking if a Cargo.toml - ;; exists at the root of the archive, but not nested anywhere - ;; else). We do this by cutting up each output line and only - ;; looking at the second component. We then check if it matches - ;; Cargo.toml exactly and short circuit if it does. - (invoke "sh" "-c" - (string-append "tar -tf " path - " | cut -d/ -f2" - " | grep -q '^Cargo.toml$'"))))) + (and (not (string=? path source)) ;Exclude self. + (if (directory-exists? path) + ;; The build system only handles sources containing single crate. + ;; Workspaces should be packaged into crates (via 'package phase) + ;; and used in inputs. + (single-crate? path) + (and (not (string-suffix? "py" path)) ;sanity-check.py + ;; First we print out all file names within the tarball to see + ;; if it looks like the source of a crate. However, the tarball + ;; will include an extra path component which we would like to + ;; ignore (since we're interested in checking if a Cargo.toml + ;; exists at the root of the archive, but not nested anywhere + ;; else). We do this by cutting up each output line and only + ;; looking at the second component. We then check if it matches + ;; Cargo.toml exactly and short circuit if it does. + (invoke "sh" "-c" + (string-append "tar -tf " path + " | cut -d/ -f2" + " | grep -q '^Cargo.toml$'")))))) (define* (unpack-rust-crates #:key inputs (vendor-dir "guix-vendor") #:allow-other-keys) @@ -155,7 +156,7 @@ (define* (check-for-pregenerated-files #:key parallel-build? #:allow-other-keys) (format #t "error: Possible pre-generated file found: ~a~%" file))) (find-files "." (negate empty-file?))))) -(define* (configure #:key inputs +(define* (configure #:key source inputs target system (cargo-target #f) (vendor-dir "guix-vendor") @@ -172,7 +173,7 @@ (define* (configure #:key inputs ((name . path) (let* ((basepath (strip-store-file-name path)) (crate-dir (string-append vendor-dir "/" basepath))) - (and (crate-src? path) + (and (crate-src? path #:source source) ;; Gracefully handle duplicate inputs (not (file-exists? crate-dir)) (if (directory-exists? path) From patchwork Mon Apr 28 16:23:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42122 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C27EE27BC4B; Mon, 28 Apr 2025 17:34:29 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8439F27BC49 for ; Mon, 28 Apr 2025 17:34:29 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPu-0007zI-Ga; Mon, 28 Apr 2025 12:33:14 -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 1u9RP2-0007cq-0z for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:20 -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 1u9RP0-0004Pr-6R for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:18 -0400 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=rjpmEvZuPrEBthbm466sRmDGpORrtAQbo64PRkNYRvQ=; b=lW5Khb/h354ijHdJ7JOK/9Keqrqi97kOJ5N4StPZ9y4WDTOzKUBPfAOE//U7i9Kd/Vk8yYjV6k5fbXFXAY4QLcr1pVgWcySL/jQWSjXYGdODHWZdCtC8uy/LS/TGfTyYogNpjt4kGwiXN1hYEWfVu10s0DYg3hKfjgJSLYNetLitJ6ipl3WAzWun76GZgNmEbNRz1bJqyVICgWvP9LGdsHHsAjsbtnCf/3p02xFK8KNOMYwi6f3BVOW9kzDOIJgTe+ydjTV4b0AydKgksaWWEBsVqLWzLJnNF7QWs1L3rC/mVAmK6ZXq4MrcbSi36gbGTADvRoKT9y7YHSlfB/zQ/g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROz-0003KR-Ud; Mon, 28 Apr 2025 12:32:17 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 15/22] build/cargo: Use system libsqlite3. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:17 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585793012621 (code B ref 77093); Mon, 28 Apr 2025 16:32:17 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:10 +0000 Received: from localhost ([127.0.0.1]:32875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROr-0003HK-ER for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:10 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:51466) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROT-0003CA-1R for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:46 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rjpmEvZuPrEBthbm466sRmDGpORrtAQbo64PRkNYRvQ=; b=BDXH4HEM+3aZE/ZUIuR88qz95zaubsDlbYQftABVNCg6Szczg/WjZTq07kdLSrke/MYM3o V/NcfPg+JAydIqYlXHrhLxaUWZLVFPp5H6x56pvevWNJoqN5Hi6PPdQuK/xJaimgw9d71W t+pzoln4ukg9UE7h6q1jAh64CipF2DXTRANylSysb9YnkX4Z94dHLNFKik2eybD7GH9hE6 1xao8oEOc+wMBtvLJ907eq4xYRLII0zW1e0PWDUCXWU6QGONsMJGCVg600mpBgL52Fuk+b jdUxkCsS3HKIU68xhjxFqrllq0NuRKp+ha80fJOl6W/B1rV61u+F8bH7H6AqaQ== Date: Tue, 29 Apr 2025 00:23:12 +0800 Message-ID: In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build/cargo-build-system.scm (configure): Set LIBSQLITE3_SYS_USE_PKG_CONFIG. Change-Id: I9a8a5818992ee687ec67abadffef67ce1533c6d3 --- guix/build/cargo-build-system.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index c6865e6e81..c25c26fa76 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -248,6 +248,7 @@ (define* (configure #:key source inputs (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))) (setenv "LIBGIT2_SYS_USE_PKG_CONFIG" "1") + (setenv "LIBSQLITE3_SYS_USE_PKG_CONFIG" "1") (setenv "LIBSSH2_SYS_USE_PKG_CONFIG" "1") (setenv "SODIUM_USE_PKG_CONFIG" "1") (setenv "ZSTD_SYS_USE_PKG_CONFIG" "1") From patchwork Mon Apr 28 16:23:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42123 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4009527BC4C; Mon, 28 Apr 2025 17:34:49 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F06C427BC49 for ; Mon, 28 Apr 2025 17:34:48 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RR5-0000DJ-8M; Mon, 28 Apr 2025 12:34:32 -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 1u9RP2-0007cv-3k for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:20 -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 1u9RP0-0004Q4-QO for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:19 -0400 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=eYdyAiwa9KfFGL3WvX9squQ6YXuMArg3m/vXWbq/eUc=; b=FnObKGlV786+gMxr0PmpLmZDCn0X1/W0Gae6cqxIXuBQ8j1FVwJp5VXoFUDK6UEy4G+wAMVt/0WSSV0ZGInDK420GdixqWC9hGpOX8Mv8d5zUPr1d/KwFIYdPDOAJND8fXPI0IOJPxPiGwsIycE32Rd+CsbS4Up6UEtCHqs7/PNAViir4NnOqNmya2mJtdyypIoeLAo12FPJUbZo31pDgco2qAyNDe89k6KMXG70n4y9G7XQb0rrFd/4pqmYXIjVayuvOHgAY4sF024oWy+Np6jvFTVNZNWfDrx6n6C51qHLyKN/Im3YZw0I/6J+cblDJr0QP9Qg9MqrfvB2tWk+ow==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9RP0-0003Kc-E6; Mon, 28 Apr 2025 12:32:18 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 16/22] build/cargo: Use sytsem oniguruma. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:18 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585793012637 (code B ref 77093); Mon, 28 Apr 2025 16:32:18 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:10 +0000 Received: from localhost ([127.0.0.1]:32877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROs-0003HV-79 for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:10 -0400 Received: from mail.boiledscript.com ([2a01:4f8:242:4aeb::42]:60536) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROV-0003Ca-2D for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:49 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eYdyAiwa9KfFGL3WvX9squQ6YXuMArg3m/vXWbq/eUc=; b=QtIXH66JdwGy00H0eFDlscR/wBaoz2NcR7OwlsUsud3YazHiNnGeAb6QPz/9aTxr+LZcHc AeDe90kl9977HlK4Qm3eMGU1/6RUsIup0r6IZ6KXpjiyUx2o94nqIVwk8wx+/8yU/+rcFY LuRIWxjhfIo9x8E7Oczu9+JBmY4bGzkyhUzcTqonUCsCOIHKKd44OtXi7U2pruZZ6DUUDH Q0uZyLzS9FdBTiGaaGhrarIFIUG99IigNq8FyP15thrpixLCUCb1GenTXdxjAd/R+HbyCj uTO0T5HXrqMKIRpkCRxuH2bScc81AEo6auqk3bImfGojpYejaR/WA9+2cgMZDA== Date: Tue, 29 Apr 2025 00:23:13 +0800 Message-ID: <648794e2c9e3c96a5abcfe770ecb53619129a8c2.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build/cargo-build-system.scm (configure): Set RUSTONIG_SYSTEM_LIBONIG. Change-Id: I02624d98ade15d65965f46555e5a210a7630dd5d --- guix/build/cargo-build-system.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index c25c26fa76..39a9487841 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -250,6 +250,7 @@ (define* (configure #:key source inputs (setenv "LIBGIT2_SYS_USE_PKG_CONFIG" "1") (setenv "LIBSQLITE3_SYS_USE_PKG_CONFIG" "1") (setenv "LIBSSH2_SYS_USE_PKG_CONFIG" "1") + (setenv "RUSTONIG_SYSTEM_LIBONIG" "1") (setenv "SODIUM_USE_PKG_CONFIG" "1") (setenv "ZSTD_SYS_USE_PKG_CONFIG" "1") (when (assoc-ref inputs "openssl") From patchwork Mon Apr 28 16:23:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42118 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B7E4327BC4B; Mon, 28 Apr 2025 17:34:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4AFB827BC4A for ; Mon, 28 Apr 2025 17:34:13 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RQ6-00083R-6D; Mon, 28 Apr 2025 12:33:33 -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 1u9RPG-0007f7-Hv for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:40 -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 1u9RP6-0004Rf-Qc for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:31 -0400 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=OxqCuJLAlkge6OapiDdxrL62v4N47pf05yIft2lu4EA=; b=Yc3eNeYhjlFF0T2uo/iqvHcb7Fnkp4A4VqVj63HiiWqaY2xGUsEF3EY1aXxH26SpvfFtkSHzJN2dzlawKB6a0oTEpSbFSIZBA2YVcrgg7+bcHKj4LpOixlHvtqtInq7kJ1dPhv2T6GMmRZ6HqkZJY8Jl1K5VaWw8uJX+a0f+D/vWYc8uN8ggm55sDK7OGiXyOMnTjgvzjZVoFCSqrMcbirJR8D1kFIFxewE5FpHv7n6ULfkl1ndmZpX313WPFirKjK4dj7ru+jrPLd8v8i4p0R6BAXCQQZ6sGIyeK4zyhFaUvFYJle9Zzp9mszHCGImewt0Cu0GHUCJ0wt+uZti9JA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9RP0-0003Kp-TG; Mon, 28 Apr 2025 12:32:18 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 17/22] build/cargo: Unconditionally use system gettext. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:18 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585793112661 (code B ref 77093); Mon, 28 Apr 2025 16:32:18 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:11 +0000 Received: from localhost ([127.0.0.1]:32883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROt-0003Hz-8B for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:11 -0400 Received: from mail.boiledscript.com ([2a01:4f8:242:4aeb::42]:60542) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROX-0003D2-0K for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:51 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OxqCuJLAlkge6OapiDdxrL62v4N47pf05yIft2lu4EA=; b=hVm2LBF8khWoTJCVUprxQ7HuN/oEjUrC3Ccr9oax9a5BuG6ZWYvc7By9lV2fz/MGc1GiHr 81ZTqAA9l3xBEJI9/o3MiODONti1rj//9ZIgtbRYSYvFLEdadXAyczBX6aT1x2z/a9qAWS 856QunuTF9ckrSHx2HBt9pXmPjeNDl/lAFkL2eNbDNaOn99moaMaWmbiysaHj8LPyHmRql bhzehGxiGDBxVXDPQ41ppdOXyz5eCEIOm9+Ndg3vHceb64YoG08FgkKtVxFx2jF22uuEWW GifbVIiiS1G8iIjclbFtMHOTAZYWt6tv17URIa7m8dfY/fbFvR14qjalloZSog== Date: Tue, 29 Apr 2025 00:23:14 +0800 Message-ID: In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches No special value is required for this environment variable. * guix/build/cargo-build-system.scm (configure): Set GETTEXT_SYSTEM unconditionally. Change-Id: Id40fecaf75fa76c7b7f1404db226fa1ca6a45a5e --- guix/build/cargo-build-system.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 39a9487841..edc4e0d836 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -247,6 +247,7 @@ (define* (configure #:key source inputs (setenv "TARGET_PKG_CONFIG" (string-append target "-pkg-config"))) (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))) + (setenv "GETTEXT_SYSTEM" "1") (setenv "LIBGIT2_SYS_USE_PKG_CONFIG" "1") (setenv "LIBSQLITE3_SYS_USE_PKG_CONFIG" "1") (setenv "LIBSSH2_SYS_USE_PKG_CONFIG" "1") @@ -255,8 +256,6 @@ (define* (configure #:key source inputs (setenv "ZSTD_SYS_USE_PKG_CONFIG" "1") (when (assoc-ref inputs "openssl") (setenv "OPENSSL_DIR" (assoc-ref inputs "openssl"))) - (when (assoc-ref inputs "gettext") - (setenv "GETTEXT_SYSTEM" (assoc-ref inputs "gettext"))) (when (assoc-ref inputs "clang") (setenv "LIBCLANG_PATH" (string-append (assoc-ref inputs "clang") "/lib"))) From patchwork Mon Apr 28 16:23:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42126 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4D42A27BC4B; Mon, 28 Apr 2025 17:35:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 67BEE27BC49 for ; Mon, 28 Apr 2025 17:35:25 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RRw-0000iq-Kg; Mon, 28 Apr 2025 12:35:21 -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 1u9RPG-0007f4-Fx for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:40 -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 1u9RP7-0004Rk-JM for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:31 -0400 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=4dOltDErW8w9b5cCO6Tsfvk+Q+HwUkFuJaMDDKPG4NU=; b=IIZpCSfHlHrRsMzs7q58QZ6ICCfzrhf9OLV54ry1YcXLvGZwS1Z9oHolStJmLs3oLp0i7QtV2GwQCEjN2repyEaoXh1Rdk4kiWxpX3F4vtMplVfKLCWS93WvgA2jZ2WaEZbBMAVRyaYAvjBnaLPhPr/pFNB3SNQhqwUcVY8B9HHcTyDL4RUo/9ph1/k16K99CzP2ll2d0VZnfRT1vWSdqet2/WcgVRn5x8ombIYUw8j49Se7of8mJNWVtacQ8cOqadQfufQfd6efUhlq9kGqSD2qoGyNS9hGy41fxrHEqjeFsNhP0GD5Bn48BxpENSqq13Q601Xe6o27llPSnvmAZA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9RP7-0003Mg-3A; Mon, 28 Apr 2025 12:32:25 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 18/22] build-system: cargo: Add =?utf-8?b?4oCYY2FyZ28taW5wdXRz4oCZLg==?= Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:24 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585793712775 (code B ref 77093); Mon, 28 Apr 2025 16:32:24 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:17 +0000 Received: from localhost ([127.0.0.1]:32901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROu-0003Ic-N9 for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:16 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:51860) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROY-0003DU-TG for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:55 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857909; 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=JQ3Omu14dEkErKXoH+/KoXcdAVtBDHePzGKsA3ZtN1A=; b=EKB4QzRHi7EuACK1Z5RMyxYt6g5bq6t7HfSnVIVTNimOR3wlHqM28Xt9VvA7C071J+zQhQ NdWvEVSBHa7f2IyFQS7QuK6nyKr/hMEYSQLFgReG4SYtIK/ZDxyMNvRRQDzN0lBgLYW2xz MCkFT1imbr8dOa4zrOiWuzJ4V5NELjVthksSmo6ccwbQTl6ovX8hlng9a2vaFfStPjPdzK 9xghudWxWuXoHdWipzVNAboThAt6Jrolt/d9Drcqt7t3OsSo3FjXAVqMAVV7ixnCKeF1wt w7Ii39NgPAKTYe5exKhbtn2+DdgKkUGw1BPq4Vc4xyQ3ZmrqL8qrPIchw2Ma/Q== Date: Tue, 29 Apr 2025 00:23:15 +0800 Message-ID: <6c08a9385bdc1fb8fcdfa980a5aa3af08066c215.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/rust-crates.scm: New file. * gnu/packages/rust-sources.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Regisiter them. * guix/build-system/cargo.scm (define-cargo-inputs): New macro. (crate-source, cargo-inputs): New procedures. * guix/import/crate.scm: Hide ‘crate-source’ from (guix build-system cargo). * etc/teams/rust/audit-rust-crates: New file. * etc/teams/rust/cleanup-crates.sh: New file. * etc/teams/rust/rust-crates.tmpl: New file. * etc/teams/rust/unpack-new-crates.sh: New file. Change-Id: I2f2d705a3e376ed3c646f31b824052a2278d4fb3 --- etc/teams/rust/audit-rust-crates | 70 +++++++++++++++++++++++++++++ etc/teams/rust/cleanup-crates.sh | 37 +++++++++++++++ etc/teams/rust/rust-crates.tmpl | 44 ++++++++++++++++++ etc/teams/rust/unpack-new-crates.sh | 45 +++++++++++++++++++ gnu/local.mk | 2 + gnu/packages/rust-crates.scm | 44 ++++++++++++++++++ gnu/packages/rust-sources.scm | 29 ++++++++++++ guix/build-system/cargo.scm | 46 ++++++++++++++++++- guix/import/crate.scm | 2 +- 9 files changed, 317 insertions(+), 2 deletions(-) create mode 100755 etc/teams/rust/audit-rust-crates create mode 100755 etc/teams/rust/cleanup-crates.sh create mode 100644 etc/teams/rust/rust-crates.tmpl create mode 100755 etc/teams/rust/unpack-new-crates.sh create mode 100644 gnu/packages/rust-crates.scm create mode 100644 gnu/packages/rust-sources.scm diff --git a/etc/teams/rust/audit-rust-crates b/etc/teams/rust/audit-rust-crates new file mode 100755 index 0000000000..d5546fd1e1 --- /dev/null +++ b/etc/teams/rust/audit-rust-crates @@ -0,0 +1,70 @@ +#!/usr/bin/env -S gawk -f +# GNU Guix --- Functional package management for GNU +# Copyright © 2025 Efraim Flashner +# +# This file is part of GNU Guix. +# +# GNU Guix is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Guix is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Guix. If not, see . + +# To run: +# ./etc/teams/rust/audit-rust-crates ./path/to/file.scm +# Prints the output of cargo-audit to the shell. + +# Make sure we have cargo-audit in our PATH +BEGIN { + if (system("which cargo-audit 1> /dev/null")) + exit 1; + # Parse a record at a time. + RS = "\n\n" + cargoAudit = "cargo-audit audit --file -" +} + +# Check the crate-source origin-only inputs +/crate-source/ { + for(i=3; i <= NF-2; i++) { + if($i == "(crate-source") { + cargoLock = cargoLock "[[package]]\nname = " $(i+1) "\nversion = " $(i+2) "\n" + next + } + } +} + +# Check the crates packaged from crates.io tarballs +/crate-uri/ { + for(i=3; i <= NF; i++) { + if($i == "(version") + crateVersion = $(i+1) + if($i == "(crate-uri") + crateName = $(i+1) + } + gsub(/)/, "", crateVersion) + cargoLock = cargoLock "[[package]]\nname = " crateName "\nversion = " crateVersion "\n" +} + +# The xxxx-cargo-input variables have a set style +# TODO: Replace the last dash between the name and the version with a space! +# This doesn't take into account swapping between "-" and "_" so we skip it. +#( $2 ~ /-cargo-inputs/ ) { +# sub(/-cargo-inputs/, "", $2) +# gsub(/)/, "", $0) +# gsub(/rust-/, "", $0) +# #gensub(/([[:alpha:]])-([[:digit:]]+)/, "\\1 \\2", "g", $i) +# print "[[package]]\nname = \"" $2 "\"\nversion = \"1.0.0\"\ndependencies = [" +# for (i = 4; i <= NF; i++) { +# print "\"" $i "\"," +# } +# print "]" +#} + +END { print cargoLock | cargoAudit } diff --git a/etc/teams/rust/cleanup-crates.sh b/etc/teams/rust/cleanup-crates.sh new file mode 100755 index 0000000000..eca37ca00c --- /dev/null +++ b/etc/teams/rust/cleanup-crates.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# GNU Guix --- Functional package management for GNU +# Copyright © 2025 Hilton Chain +# +# This file is part of GNU Guix. +# +# GNU Guix is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Guix is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Guix. If not, see . + +FILE=gnu/packages/rust-crates.scm +PATTERN='^(define rust-' + +grep "$PATTERN" $FILE | cut -d' ' -f2 | while IFS= read -r crate +do + if [ "$(grep -wc "$crate" $FILE)" -eq 1 ]; then + echo "\ +(begin + (use-modules (guix utils)) + (let ((source-properties + (find-definition-location \"$FILE\" '$crate #:define-prefix 'define))) + (and=> source-properties delete-expression)))" | + guix repl -t machine + fi +done + +# Delete extra newlines. +sed --in-place ':a;N;$!ba;s/\n\n\+/\n\n/g' $FILE diff --git a/etc/teams/rust/rust-crates.tmpl b/etc/teams/rust/rust-crates.tmpl new file mode 100644 index 0000000000..a2c7fcd27d --- /dev/null +++ b/etc/teams/rust/rust-crates.tmpl @@ -0,0 +1,44 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2025 Hilton Chain +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages rust-crates) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix git-download) + #:use-module (guix build-system cargo) + #:use-module (gnu packages rust-sources) + #:export (lookup-cargo-inputs)) + +;;; +;;; This file is managed by ‘guix import’. Do NOT add definitions manually. +;;; + +;;; +;;; Rust libraries fetched from crates.io and non-workspace development +;;; snapshots. +;;; + +(define qqqq-separator 'begin-of-crates) + +(define ssss-separator 'end-of-crates) + + +;;; +;;; Cargo inputs. +;;; diff --git a/etc/teams/rust/unpack-new-crates.sh b/etc/teams/rust/unpack-new-crates.sh new file mode 100755 index 0000000000..7ff1080655 --- /dev/null +++ b/etc/teams/rust/unpack-new-crates.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# GNU Guix --- Functional package management for GNU +# Copyright © 2025 Hilton Chain +# +# This file is part of GNU Guix. +# +# GNU Guix is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Guix is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Guix. If not, see . + +# Usage: ./etc/teams/rust/unpack-new-crates.sh +# Then inspect DIR with your tool of choice. +# +# For example: +# ./etc/teams/rust/unpack-new-crates.sh tmp-rust-crates && +# emacs --eval '(find-dired "tmp-rust-crates" "")' +# +# Note this uses ‘git diff’, only unstaged one are unpacked. + +UNPACK_DIR="$1" +CHANGES="$(git diff gnu/packages/rust-crates.scm | grep -E '^\+\(define rust-' | cut -f2 -d' ')" + +rm -rf "$UNPACK_DIR" +mkdir -p "$UNPACK_DIR" + +for crate in $CHANGES +do + built="$(./pre-inst-env guix build -e "(@@ (gnu packages rust-crates) "$crate")" -v0 2>/dev/null)" + if [[ -n $built ]]; then + if [[ -d $built ]]; then + cp -r "$built" "$UNPACK_DIR" + else + tar xf "$built" -C "$UNPACK_DIR" + fi + fi +done diff --git a/gnu/local.mk b/gnu/local.mk index 4854e2fe92..c60c7f1fc7 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -616,6 +616,8 @@ GNU_SYSTEM_MODULES = \ %D%/packages/rush.scm \ %D%/packages/rust.scm \ %D%/packages/rust-apps.scm \ + %D%/packages/rust-crates.scm \ + %D%/packages/rust-sources.scm \ %D%/packages/samba.scm \ %D%/packages/sagemath.scm \ %D%/packages/sawfish.scm \ diff --git a/gnu/packages/rust-crates.scm b/gnu/packages/rust-crates.scm new file mode 100644 index 0000000000..a2c7fcd27d --- /dev/null +++ b/gnu/packages/rust-crates.scm @@ -0,0 +1,44 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2025 Hilton Chain +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages rust-crates) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix git-download) + #:use-module (guix build-system cargo) + #:use-module (gnu packages rust-sources) + #:export (lookup-cargo-inputs)) + +;;; +;;; This file is managed by ‘guix import’. Do NOT add definitions manually. +;;; + +;;; +;;; Rust libraries fetched from crates.io and non-workspace development +;;; snapshots. +;;; + +(define qqqq-separator 'begin-of-crates) + +(define ssss-separator 'end-of-crates) + + +;;; +;;; Cargo inputs. +;;; diff --git a/gnu/packages/rust-sources.scm b/gnu/packages/rust-sources.scm new file mode 100644 index 0000000000..f8d25bbc2c --- /dev/null +++ b/gnu/packages/rust-sources.scm @@ -0,0 +1,29 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2025 Hilton Chain +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages rust-sources) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix git-download) + #:use-module (guix build-system cargo)) + +;;; +;;; Cargo workspaces and Rust libraries requiring external inputs to unbundle. +;;; These packages are hidden, as they are not interesting to users. +;;; diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 7a07003262..659ad95a35 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -25,12 +25,15 @@ ;;; along with GNU Guix. If not, see . (define-module (guix build-system cargo) + #:use-module (guix diagnostics) + #:use-module (guix i18n) #:use-module (guix search-paths) #:use-module (guix store) #:use-module (guix utils) #:use-module (guix gexp) #:use-module (guix monads) #:use-module (guix packages) + #:use-module (guix download) #:use-module (guix platform) #:use-module (guix build-system) #:use-module (guix build-system gnu) @@ -45,7 +48,10 @@ (define-module (guix build-system cargo) crate-url crate-url? crate-uri - crate-name->package-name)) + crate-name->package-name + crate-source + define-cargo-inputs + cargo-inputs)) (define %crate-base-url (make-parameter "https://crates.io")) @@ -62,6 +68,44 @@ (define (crate-uri name version) (define (crate-name->package-name name) (downstream-package-name "rust-" name)) +;; NOTE: Only use this procedure in (gnu packages rust-crates). +(define* (crate-source name version hash #:key (patches '()) (snippet #f)) + (origin + (method url-fetch) + (uri (crate-uri name version)) + (file-name + (string-append (crate-name->package-name name) "-" version ".tar.gz")) + (sha256 (base32 hash)) + (modules '((guix build utils))) + (patches patches) + (snippet snippet))) + +(define-syntax define-cargo-inputs + (syntax-rules (=>) + ((_ lookup inputs ...) + (define lookup + (let ((table (make-hash-table))) + (letrec-syntax ((record + (syntax-rules (=>) + ((_) #t) + ((_ (name => lst) rest (... ...)) + (begin + (hashq-set! table 'name (filter identity lst)) + (record rest (... ...))))))) + (record inputs ...) + (lambda (name) + "Return the inputs for NAME." + (hashq-ref table name)))))))) + +(define* (cargo-inputs name #:key (module '(gnu packages rust-crates))) + "Lookup Cargo inputs for NAME defined in MODULE, return an empty list if +unavailable." + (let ((lookup (module-ref (resolve-interface module) 'lookup-cargo-inputs))) + (or (lookup name) + (begin + (warning (G_ "no Cargo inputs available for '~a'~%") name) + '())))) + (define (default-rust target) "Return the default Rust package." ;; Lazily resolve the binding to avoid a circular dependency. diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 14e6e28c5b..a6f247bbae 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -27,7 +27,7 @@ (define-module (guix import crate) #:use-module (guix base32) - #:use-module (guix build-system cargo) + #:use-module ((guix build-system cargo) #:hide (crate-source)) #:use-module (guix diagnostics) #:use-module (gcrypt hash) #:use-module (guix http-client) From patchwork Mon Apr 28 16:23:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42110 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 156A127BC4A; Mon, 28 Apr 2025 17:33:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DBDB927BC49 for ; Mon, 28 Apr 2025 17:33:13 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPl-0007tY-Cf; Mon, 28 Apr 2025 12:33:05 -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 1u9RP4-0007dq-M2 for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:24 -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 1u9RP3-0004R0-UJ for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:22 -0400 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=qbNfyt8wr878LBWdqrD9+NsbymEfh0yLiLN9cbgcgvE=; b=ZIh3LZj8Go6ddDCml5PbQ1yatIb4kMyyU+uVSroOmAVSuM4T7+nLLjFeY+mdYqY4pPqhDMhmd5JoSyTPX73pdELpvkJxi0Rttq2ifMwokqT/H7i8pWH9L2q30jpuWDtn/v+7hU6mmZ/EjEztCGKnBvGdhxVpGoWYXn5W2Hg6IgqtdkXZ0PYtPnWvNSU1SUyzDUy7b+T+ss58R4IuHDgeIlf3AxsebK04XAsfpxdjYJdJo8QM2gCRRddbJJ9oN1NGhY2o14KLS5mz4hnUSBlXu6jC85Trr5kjkTsDFR6e6DKVq+ALK4GpMwLM0/eEKHDeBoG51yy1tzXZF7ko/hjImQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9RP3-0003Lb-BJ; Mon, 28 Apr 2025 12:32:21 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 19/22] build-system: cargo: Export =?utf-8?b?4oCYY2FyZ28tdHJpcGxldOKAmS4=?= Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:20 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585793212689 (code B ref 77093); Mon, 28 Apr 2025 16:32:20 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:12 +0000 Received: from localhost ([127.0.0.1]:32893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROt-0003IL-TI for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:12 -0400 Received: from mail.boiledscript.com ([2a01:4f8:242:4aeb::42]:33644) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROb-0003Du-2k for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:54 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857911; 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=qbNfyt8wr878LBWdqrD9+NsbymEfh0yLiLN9cbgcgvE=; b=d3DPhJaJkJPwUM3BEEAHW6rjLrTkCU3WBnjwCD61jVkKxxcRduyuIWTGB8VNEwknI9aYb0 K7T2dzq9rBl/acoOhgIfTYQSVkOKmlsdvEKwhd+XHWFbc5/3e3ubrh+17eWOz0CTbStYuU Ks+W/uXF0Cl9dFpAEAU2G3AJ3N+gyB5vHDWnRkeylKtsd7KDtLxuMRAXnpXxJgVzNJmAYR M8+YEs6XO17BdPGbDow23AsGOOQEPqLgN1RgTanmh7HjACwQ3ZDfGIQFHsOA+qEI4/AqNC j2Pm6MoRq1sFZgLC57Kk3GkJji/9GGcmit3A3oGMcDgis70f1piT7az89wzFXA== Date: Tue, 29 Apr 2025 00:23:16 +0800 Message-ID: In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This will make Rust cross compilation support in other build systems easier. * guix/build-system/cargo.scm (cargo-triplet): Export. Make ‘target’ argument optional. Change-Id: I226bf4a7d8065eb7911da148d0cdf3352a47bde6 --- guix/build-system/cargo.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 659ad95a35..045809874c 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -51,7 +51,8 @@ (define-module (guix build-system cargo) crate-name->package-name crate-source define-cargo-inputs - cargo-inputs)) + cargo-inputs + cargo-triplet)) (define %crate-base-url (make-parameter "https://crates.io")) @@ -118,7 +119,9 @@ (define (default-rust-sysroot target) (let ((module (resolve-interface '(gnu packages rust)))) (module-ref module 'make-rust-sysroot))) -(define (cargo-triplet target) +(define* (cargo-triplet #:optional + (target (or (%current-target-system) + (%current-system)))) (false-if-exception (platform-rust-target (lookup-platform-by-target-or-system target)))) From patchwork Mon Apr 28 16:23:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42117 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BBBED27BC4B; Mon, 28 Apr 2025 17:34:06 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7078027BC49 for ; Mon, 28 Apr 2025 17:34:06 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPs-0007wL-01; Mon, 28 Apr 2025 12:33:12 -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 1u9RPG-0007f5-Gk for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:40 -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 1u9RPB-0004SH-CH for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:30 -0400 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=K+GMPUslI8JVXY3GgZ84SbrXXz+H35rj4shnrcvSzFU=; b=ZP8jCPLbA5b7DsUoHpYtXNTbTLH8Ww6OQHWrdRIisoV9+Q+4Z4/McHlgwTVGlpzaVfwhWP2LKhdhTA+gsgECcyNpTZhof9FKpmL39uB8cvLhckMDsyiS2x3rNttlw8QeI6FxLPDxpI/ONXv7tIegA3Jbec9GkmO4y0QBJGthkKPjCrhfL/cPayzawyVJdPSeiTW5vN39i5ZII56aTzZsuRXWNJSRFc+r8VXGS+0VvHyWhNvQiA5FfWqC2Z2Th6RyAVLX2/jReAhQ65y2nier8vACGcZ4BCmUv3sBAGrxh48qGLrPhqyRg1TjoMO/qXO4ooWDL2WYR0coSXbe+RF+Dg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9RP8-0003N3-S4; Mon, 28 Apr 2025 12:32:26 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 20/22] build/cargo: Accept rust-sysroot from native-inputs. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:26 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585793712794 (code B ref 77093); Mon, 28 Apr 2025 16:32:26 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:17 +0000 Received: from localhost ([127.0.0.1]:32939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROy-0003K0-SQ for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:17 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:51876) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROd-0003E7-0q for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:55 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K+GMPUslI8JVXY3GgZ84SbrXXz+H35rj4shnrcvSzFU=; b=McsLSwIpZNPfwY6H+toY8jWb5Gc4JTR1RvPXECtzQ11mdx36tV2JfWgqYEYFq4kxWj7hb3 NbjYknBnefoKP3tS6DxzwKE/uexo26GWdcmhf1yEZQSrOJey8m8O3upTGQcgOanZn4mEHX 1Mulb5ie0bqAl5xsDDMOM51gtG9DuYlOeqNvr5c1lqNWu0Kwt3PUQG9PimXVtqaKHGh/Iy YbVMpKeXw5aZfT+XIkdb1DBNruNuXCnc5TMpwwcL/BxV+2j1t8eqoMn9W3Ftbu711itVRT J9LlIkCLXfnzMNM974YSiKi2UsZEEpSy+/hq8QP9pLV4Ov070mKq8PRaWWa/bA== Date: Tue, 29 Apr 2025 00:23:17 +0800 Message-ID: <6a0e3149cc9bb548174abb513cab0339b00a6c7f.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This is a workaround to support Rust cross-compilation in build systems other than cargo-build-system. Since there's no interface for target-inputs, using native-inputs makes most sense. * guix/build-system/cargo.scm (lower)[bag]: Label rust-sysroot with its package name. * guix/build/cargo-build-system.scm (configure): Use it. When cross-compiling, accept rust-sysroot from native-inputs if there's none in inputs. Change-Id: I5cb63c8c815d3a2c9f0ece01857254f6d0090dd1 --- guix/build-system/cargo.scm | 3 ++- guix/build/cargo-build-system.scm | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 045809874c..d2d9a075b9 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -430,7 +430,8 @@ (define* (lower name ;; This provides a separate sysroot for the regular rustc ,@(if target - `(("rust-sysroot" ,(rust-sysroot target))) + `((,(string-append "rust-sysroot-for-" target) + ,(rust-sysroot target))) '()))) (outputs outputs) (build (if target cargo-cross-build cargo-build)) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index edc4e0d836..45b17df6ff 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -156,7 +156,7 @@ (define* (check-for-pregenerated-files #:key parallel-build? #:allow-other-keys) (format #t "error: Possible pre-generated file found: ~a~%" file))) (find-files "." (negate empty-file?))))) -(define* (configure #:key source inputs +(define* (configure #:key source inputs native-inputs target system (cargo-target #f) (vendor-dir "guix-vendor") @@ -193,9 +193,16 @@ (define* (configure #:key source inputs ;; For cross-building (when target (setenv "CARGO_BUILD_TARGET" cargo-target) - (setenv "RUSTFLAGS" (string-append - (or (getenv "RUSTFLAGS") "") - " --sysroot " (assoc-ref inputs "rust-sysroot"))) + (setenv "RUSTFLAGS" + (string-append + (or (getenv "RUSTFLAGS") "") + " --sysroot " + (assoc-ref + (append inputs + ;; Workaround for other build systems, as no interface + ;; is available for target-inputs. + (or native-inputs '())) + (string-append "rust-sysroot-for-" target)))) (setenv "PKG_CONFIG" (string-append target "-pkg-config")) From patchwork Mon Apr 28 16:23:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42127 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 619C027BC4B; Mon, 28 Apr 2025 17:35:43 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C45B927BC4A for ; Mon, 28 Apr 2025 17:35:42 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RRz-0000pV-7u; Mon, 28 Apr 2025 12:35:23 -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 1u9RPp-0007wN-DL for guix-patches@gnu.org; Mon, 28 Apr 2025 12:33:11 -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 1u9RPp-0004Z9-0J for guix-patches@gnu.org; Mon, 28 Apr 2025 12:33:09 -0400 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=ryCh7/g2YXBW8xxJGtG9+dzMI+Fs4oYyn1TWScXUkqM=; b=utnBYuIcVI15Yf0Aqul6ZA1QffCTxfmYXgIAcGJ6VkFgJ+LrOKeKi+THCkvDF+cgT63FmuGWAefmAOREI7gqRuSJhVzS6MhJ5hxEJY3F/qf0UvgxDbbEsDDYI6uGmveG6hHQ6ai4odaHfIWT9SluI+vDlONcjdmNrx5hEbkLOdCCBCbzzpy95pP91Bg/1/6R2nn2Q+Zr+1rOKV1wzWWZnqGeflni0JqsJkMHH9cIoMGbtvwrmLoPZry8cQDuY+IEi0iBcY4MPUXXtqLrzi3vXUM3K2oQdmEmqB8l6e8wXVpKub8GSDEWFgwA91WHw1wgAnnwRwgC1HOQXEeGQi4Chw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9RPi-0003RU-FJ; Mon, 28 Apr 2025 12:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 21/22] import: crate: Add Cargo.lock parser. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Murilo , Hilton Chain , Luis Guilherme Coelho , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585795012998 (code B ref 77093); Mon, 28 Apr 2025 16:33:02 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:30 +0000 Received: from localhost ([127.0.0.1]:33001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9RPA-0003NT-Rq for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:29 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:51880) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROf-0003ET-J0 for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:59 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857916; 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=JdxwkswUO8Ht8w8Tu146P8LLUjhJUWR33fhR6FW0efk=; b=hBuYV774elfD35v5nTgHkQzJbFyqXYqS7Lcors9nu4UsDZbb7cL4nl+ifWnaEOftDvNuR6 sUKjzWs3CQBk+ODTXCIIfVca98FtUaYa6c3s2NxhEbnumLX0vBRm3fuscZuupzgpnb6lD7 JE0IS+RI5qOQdxAUXwZGZNb2Lo94UjMjbgyQdWb5r2S5CYhfucf+gvUNgPop2NMVuSbXLZ 4qfRf4oPZNptxwBiEbHkwbaFJNvbTUyELgZEfMfPJPcZjD2VWu2kqnaYX6EFXPVoDdwvh/ L4BcLyHSO7/LW9nPMbxmHgHHQ9w5wt35QrPpcEviBOM4+Y0EOqRjC9fehgDn5g== Date: Tue, 29 Apr 2025 00:23:18 +0800 Message-ID: In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/import/crate/cargo-lock.scm: New file. * Makefile.am (MODULES): Regisiter it. * etc/teams.scm (rust)[#:scope]: Add it. * guix/import/crate.scm (cargo-lock->expressions): New procedure. * tests/crate.scm (temp-file): New variable. ("crate-lockfile-import"): New test. Co-authored-by: Murilo Co-authored-by: Luis Guilherme Coelho Change-Id: I95421e9e2ba11a671b4bc4e1323c6d31a1b012c5 --- Makefile.am | 1 + etc/teams.scm | 1 + guix/import/crate.scm | 78 +++++++++++++++++++++++ guix/import/crate/cargo-lock.scm | 105 +++++++++++++++++++++++++++++++ tests/crate.scm | 87 +++++++++++++++++++++++++ 5 files changed, 272 insertions(+) create mode 100644 guix/import/crate/cargo-lock.scm diff --git a/Makefile.am b/Makefile.am index 0c12754050..8a32be3ef9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -295,6 +295,7 @@ MODULES = \ guix/import/cpan.scm \ guix/import/cran.scm \ guix/import/crate.scm \ + guix/import/crate/cargo-lock.scm \ guix/import/egg.scm \ guix/import/elm.scm \ guix/import/elpa.scm \ diff --git a/etc/teams.scm b/etc/teams.scm index 6f10941c72..4fe121e63f 100755 --- a/etc/teams.scm +++ b/etc/teams.scm @@ -390,6 +390,7 @@ (define-team rust "guix/build/cargo-utils.scm" "guix/build-system/cargo.scm" "guix/import/crate.scm" + "guix/import/crate/cargo-lock.scm" "guix/scripts/import/crate.scm" "tests/crate.scm"))) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index a6f247bbae..39da867805 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -9,6 +9,9 @@ ;;; Copyright © 2023, 2024 David Elsing ;;; Copyright © 2024 Maxim Cournoyer ;;; Copyright © 2025 Herman Rimm +;;; Copyright © 2024 Murilo +;;; Copyright © 2024-2025 Luis Guilherme Coelho +;;; Copyright © 2025 Hilton Chain ;;; ;;; This file is part of GNU Guix. ;;; @@ -26,12 +29,14 @@ ;;; along with GNU Guix. If not, see . (define-module (guix import crate) + #:use-module (guix base16) #:use-module (guix base32) #:use-module ((guix build-system cargo) #:hide (crate-source)) #:use-module (guix diagnostics) #:use-module (gcrypt hash) #:use-module (guix http-client) #:use-module (guix i18n) + #:use-module (guix import crate cargo-lock) #:use-module (guix import json) #:use-module (guix import utils) #:use-module (guix memoization) @@ -39,9 +44,11 @@ (define-module (guix import crate) #:use-module (guix read-print) #:use-module (guix upstream) #:use-module (guix utils) + #:use-module (guix scripts download) #:use-module (gnu packages) #:use-module (ice-9 match) #:use-module (ice-9 regex) + #:use-module (ice-9 textual-ports) #:use-module (json) #:use-module (srfi srfi-1) #:use-module (srfi srfi-2) @@ -52,6 +59,7 @@ (define-module (guix import crate) guix-package->crate-name string->license crate-recursive-import + cargo-lock->expressions %crate-updater)) @@ -481,6 +489,76 @@ (define (guix-package->crate-name package) (match parts ((name _ ...) name)))) + +;;; +;;; Convert ‘Cargo.lock’ to Guix sources. +;;; + +(define (cargo-lock->expressions lockfile package-name) + "Given LOCKFILE, a 'Cargo.lock' file, import its content as source +expressions. Return a source list and a Cargo inputs entry for PACKAGE-NAME +referencing all imported sources." + (define (crate->guix-source crate) + (match crate + (('crate + ('crate-name name) + ('crate-version version) + ('crate-source _) + ('crate-checksum checksum)) + `(define + ,(string->symbol + (string-append (crate-name->package-name name) "-" version)) + ,@(if (or (string-suffix? "src" name) + (string-suffix? "sys" name)) + (list (comment ";; TODO: Check bundled sources.\n" #f)) + '()) + (crate-source ,name ,version + ,(bytevector->nix-base32-string + (base16-string->bytevector checksum))))) + ;; Git snapshot. + (('crate + ('crate-name name) + ('crate-version version) + ('crate-source source)) + (begin + (let* ((src (string-split source (char-set #\+ #\? #\#))) + (url (second src)) + (commit (last src)) + (version (string-append version "." (string-take commit 7))) + (checksum + (second + (string-split + (with-output-to-string + (lambda _ + (guix-download "-g" url + (string-append "--commit=" commit)))) + #\newline)))) + `(define + ,(string->symbol + (string-append (crate-name->package-name name) "-" version)) + ,(comment + ";; TODO: Define standalone package if this is a workspace.\n" + #f) + (origin + (method git-fetch) + (uri (git-reference + (url ,url) + (commit ,commit))) + (file-name + (git-file-name ,(crate-name->package-name name) ,version)) + (sha256 (base32 ,checksum))))))) + ;; Cargo workspace member. + (else #f))) + + (let* ((source-expressions + (filter-map crate->guix-source + (cargo-lock-string->scm + (call-with-input-file lockfile get-string-all)))) + (cargo-inputs-entry + `(,(string->symbol package-name) => + (list ,@(map second source-expressions))))) + (values source-expressions cargo-inputs-entry))) + ;;; ;;; Updater diff --git a/guix/import/crate/cargo-lock.scm b/guix/import/crate/cargo-lock.scm new file mode 100644 index 0000000000..b8a6ab20c0 --- /dev/null +++ b/guix/import/crate/cargo-lock.scm @@ -0,0 +1,105 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2024 Murilo +;;; Copyright © 2024 Luis Guilherme Coelho +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix import crate cargo-lock) + #:use-module (ice-9 peg) + #:export (cargo-lock-string->scm + + crate-name + crate-version + crate-source + crate-checksum + crate-dependencies + cargo-lock)) + +;;; +;;; PEG parser for ‘Cargo.lock’. +;;; + +(define (cargo-lock-string->scm str) + (peg:tree (search-for-pattern cargo-lock str))) + +;; Auxiliar peg patterns +(define-peg-pattern numeric-char body + (range #\0 #\9)) + +(define-peg-pattern lowercase-char body + (range #\a #\z)) + +(define-peg-pattern uppercase-char body + (range #\A #\Z)) + +(define-peg-pattern alphabetic-char body + (or lowercase-char uppercase-char)) + +(define-peg-pattern alphanumeric-char body + (or alphabetic-char numeric-char)) + +;; name +(define-peg-pattern crate-name all + (+ (or "-" alphabetic-char + "_" numeric-char))) + +;; version +(define-peg-pattern non-negative-integer body + (+ numeric-char)) + +(define-peg-pattern crate-version all + (and non-negative-integer "." + non-negative-integer "." + non-negative-integer + (? (+ (or "-" lowercase-char + "." uppercase-char + "+" numeric-char "_"))))) + +;; source +(define-peg-pattern crate-source all + (and (or "registry" "git") + "+https://" + (+ (or "/" "." "?" "=" "-" "#" "_" + alphanumeric-char)))) + +;; checksum +(define-peg-pattern crate-checksum all + (+ (or lowercase-char numeric-char))) + +;; dependency specification +(define-peg-pattern dependency-specification all + (and crate-name (? (and (ignore " ") crate-version)))) + +;; dependencies +(define-peg-pattern crate-dependencies all + (and (ignore "[\n") + (+ (and (ignore " \"") + (capture dependency-specification) + (ignore "\",\n"))) + (ignore "]"))) + +;; crates +(define-peg-pattern crate all + (and (ignore "[[package]]\n") + (ignore "name = \"") (capture crate-name) (ignore "\"\n") + (ignore "version = \"") (capture crate-version) (ignore "\"\n") + (? (and (ignore "source = \"") (capture crate-source) (ignore "\"\n"))) + (? (and (ignore "checksum = \"") (capture crate-checksum) (ignore "\"\n"))) + (? (ignore (and "dependencies = " crate-dependencies "\n"))))) + +;; Cargo.lock +(define-peg-pattern cargo-lock all + (+ (and (ignore "\n") crate))) diff --git a/tests/crate.scm b/tests/crate.scm index d0dc779cd2..8c1f6e738d 100644 --- a/tests/crate.scm +++ b/tests/crate.scm @@ -34,6 +34,7 @@ (define-module (test-crate) #:use-module (gnu packages) #:use-module (ice-9 iconv) #:use-module (ice-9 match) + #:use-module (srfi srfi-11) #:use-module (srfi srfi-64)) @@ -476,6 +477,9 @@ (define rust-leaf-bob-3.0.2-yanked (description #f) (license #f))) +(define temp-file + (string-append "t-crate-" (number->string (getpid)))) + (test-begin "crate") @@ -1178,4 +1182,87 @@ (define rust-leaf-bob-3.0.2-yanked (x (pk 'fail (pretty-print-with-comments (current-output-port) x) #f))))) + +(test-assert "crate-lockfile-import" + (begin + (call-with-output-file temp-file + (lambda (port) + (display "\ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = \"adler2\" +version = \"2.0.0\" +source = \"registry+https://github.com/rust-lang/crates.io-index\" +checksum = \"512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627\" + +[[package]] +name = \"aho-corasick\" +version = \"1.1.3\" +source = \"registry+https://github.com/rust-lang/crates.io-index\" +checksum = \"8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916\" +dependencies = [ + \"memchr\", +] + +[[package]] +name = \"smithay\" +version = \"0.4.0\" +source = \"git+https://github.com/Smithay/smithay.git?rev=\ +0cd3345c59f7cb139521f267956a1a4e33248393#\ +0cd3345c59f7cb139521f267956a1a4e33248393\" +dependencies = [ + \"appendlist\", +] + +[[package]] +name = \"test\" +version = \"25.2.0\"\n" port))) + (mock + ((guix scripts download) guix-download + (lambda _ + (format #t "~a~%~a~%" + "/gnu/store/in056fyrz6nvy3jpxrxglgj30g0lwniv-smithay-0cd3345" + "191h87bpzg0l1ihfb4hmx00b86pfb5mwwc6s8i49al0vigc14l37"))) + (let-values + (((source-expressions cargo-inputs-entry) + (cargo-lock->expressions temp-file "test"))) + (and + (match source-expressions + (`((define rust-adler2-2.0.0 + (crate-source + "adler2" "2.0.0" + "09r6drylvgy8vv8k20lnbvwq8gp09h7smfn6h1rxsy15pgh629si")) + (define rust-aho-corasick-1.1.3 + (crate-source + "aho-corasick" "1.1.3" + "05mrpkvdgp5d20y2p989f187ry9diliijgwrs254fs9s1m1x6q4f")) + (define rust-smithay-0.4.0.0cd3345 + ,($ + ";; TODO: Define standalone package if this is a workspace.\n" + #f) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Smithay/smithay.git") + (commit "0cd3345c59f7cb139521f267956a1a4e33248393"))) + (file-name (git-file-name "rust-smithay" "0.4.0.0cd3345")) + (sha256 + (base32 + "191h87bpzg0l1ihfb4hmx00b86pfb5mwwc6s8i49al0vigc14l37"))))) + #t) + (x + (pk 'fail (pretty-print-with-comments (current-output-port) x) #f))) + (match cargo-inputs-entry + (`(test => (list rust-adler2-2.0.0 + rust-aho-corasick-1.1.3 + rust-smithay-0.4.0.0cd3345)) + #t) + (x + (pk 'fail x #f)))))))) + (test-end "crate") + +(false-if-exception (delete-file temp-file)) From patchwork Mon Apr 28 16:23:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42125 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BB2CA27BC49; Mon, 28 Apr 2025 17:35:23 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B3C0E27BC4A for ; Mon, 28 Apr 2025 17:35:21 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RRo-0000Ww-Dr; Mon, 28 Apr 2025 12:35:15 -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 1u9RPk-0007sx-NH for guix-patches@gnu.org; Mon, 28 Apr 2025 12:33:05 -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 1u9RPk-0004Xh-AS; Mon, 28 Apr 2025 12:33:04 -0400 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=F+FOZr7P7tJgPbvzsGVz2VGpAY/OjCoUWwyYTpRthRw=; b=RtO6XlYaMsFAq6QdAO1SQTEwq+XAoAIDhmT60MWm3LXQwGFwuYM6tZ2VkaXtigJybz3UBbzJ7WfBBXsAVJLydBw3Z4Dtjek+CrlQmQj6YoEFNr7XNNKLrLEtUHF6P5zD7kMaEz8ir70bGvchejx5/TONicWfs7ABoqXY++gLS2GJNkkltQCPhcP3ad7cEFu8I5OvRQs8wvFrECHt4J37bzHZQr2R4zGYWb5SHZWqwHpxUjb3UENAWJAjrW38JOasdw2v3fSoK+d85pbdf1QkrQJFJmibsss5BWgB+9BOQ22AX0pUJnO69cBauPIVp1rFu58IewWnV5Ye4RX+kiYVgw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9RPi-0003Re-VR; Mon, 28 Apr 2025 12:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 22/22] import: crate: Add =?utf-8?b?4oCYLS1sb2NrZmlsZeKAmQ==?= option. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, maxim.cournoyer@gmail.com, zimon.toutoune@gmail.com, steve@futurile.net, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Christopher Baines , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Steve George , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Steve George , Tobias Geerinckx-Rice Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585795013009 (code B ref 77093); Mon, 28 Apr 2025 16:33:02 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:30 +0000 Received: from localhost ([127.0.0.1]:33006 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9RPB-0003Nc-TQ for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:30 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:51894) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROh-0003Eb-F1 for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:00 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857918; 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=DnAX0EtTZ6atX3aIfwBUNdiGnLbnTspSvjuHy+IeeKw=; b=GD5npVRD/nkRGvudANlW1Ixv5T6Y0n36IOrUJqaHh3o4D8oRBuW7bjv9DgrRETQJuPzjNy CjiKPkhDKaYf1E4LUYc3QJRaSBdqmWy9muzotv10pXw33N7vpOd6pUsNCbJadBAG/bdav9 y9AJtxujwPJZi3q/SvSJRjMe9m6V4YFRiKv7XvlZwMXVNdaKQImN2pfRZOebdL1P9c3SS1 zWEb5VO1NLOrTXt9P0Qu9l9hLbAbz8cxYmAPXt1calPU+eLik5nw+q7l7E4RN2NbBE/BGu dv6fghbMk58ZKZr6UC5onibWxJcL8A8JVRsnWRy+0sruTKUQmH9sGMAE0ak0Gg== Date: Tue, 29 Apr 2025 00:23:19 +0800 Message-ID: <0d02c65ab3209a1a8c4ba0f754937d4f4cba54ae.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/import/crate.scm (cargo-inputs-from-lockfile) find-cargo-inputs-location, extract-cargo-inputs): New procedures. * guix/scripts/import/crate.scm (%options): Add ‘--lockfile’ option. (show-help): Add it. (guix-import-crate): Use it. * doc/guix.texi (Invoking guix import): Document it. Change-Id: I291478e04adf9f2df0bf216425a5e8aeba0bedd9 --- doc/guix.texi | 5 +++ guix/import/crate.scm | 47 +++++++++++++++++++++++++++++ guix/scripts/import/crate.scm | 57 +++++++++++++++++++++++++++++------ 3 files changed, 99 insertions(+), 10 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 6388f7b28f..7aa36b347a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14833,6 +14833,11 @@ Invoking guix import If a crate dependency is not (yet) packaged, make the corresponding input in @code{#:cargo-inputs} or @code{#:cargo-development-inputs} into a comment. +@item --lockfile=@var{file} +@itemx -f @var{file} +When @option{--lockfile} is specified, the importer will ignore other options +and won't output package expressions, instead importing source expressions +from @var{file}, a @file{Cargo.lock} file. @end table @item elm diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 39da867805..d425e07b48 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -52,6 +52,7 @@ (define-module (guix import crate) #:use-module (json) #:use-module (srfi srfi-1) #:use-module (srfi srfi-2) + #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (srfi srfi-69) #:use-module (srfi srfi-71) @@ -60,6 +61,9 @@ (define-module (guix import crate) string->license crate-recursive-import cargo-lock->expressions + cargo-inputs-from-lockfile + find-cargo-inputs-location + extract-cargo-inputs %crate-updater)) @@ -559,6 +563,49 @@ (define (cargo-lock->expressions lockfile package-name) (list ,@(map second source-expressions))))) (values source-expressions cargo-inputs-entry))) +(define* (cargo-inputs-from-lockfile #:optional (lockfile "Cargo.lock")) + "Given LOCKFILE (default to \"Cargo.lock\" in current directory), return a +source list imported from it, to be used as package inputs. This procedure +can be used for adding a manifest file within the source tree of a Rust +application." + (let-values + (((source-expressions cargo-inputs-entry) + (cargo-lock->expressions lockfile "cargo-inputs-temporary"))) + (eval-string + (call-with-output-string + (lambda (port) + (for-each + (cut pretty-print-with-comments port <>) + `((use-modules (guix build-system cargo)) + ,@source-expressions + (define-cargo-inputs lookup-cargo-inputs ,cargo-inputs-entry) + (lookup-cargo-inputs 'cargo-inputs-temporary)))))))) + +(define (find-cargo-inputs-location file) + "Search in FILE for a top-level definition of Cargo inputs. Return the +location if found, or #f otherwise." + (find-definition-location file 'lookup-cargo-inputs + #:define-prefix 'define-cargo-inputs)) + +(define* (extract-cargo-inputs file #:key exclude) + "Search in FILE for a top-level definition of Cargo inputs. If found, +return its entries excluding EXCLUDE, or an empty list otherwise." + (call-with-input-file file + (lambda (port) + (do ((syntax (read-syntax port) + (read-syntax port))) + ((match (syntax->datum syntax) + (('define-cargo-inputs 'lookup-cargo-inputs _ ...) #t) + ((? eof-object?) #t) + (_ #f)) + (or (and (not (eof-object? syntax)) + (match (syntax->datum syntax) + (('define-cargo-inputs 'lookup-cargo-inputs inputs ...) + (remove (lambda (cargo-input-entry) + (eq? exclude (first cargo-input-entry))) + inputs)))) + '())))))) + ;;; ;;; Updater diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm index 723cbb3665..a251cd9538 100644 --- a/guix/scripts/import/crate.scm +++ b/guix/scripts/import/crate.scm @@ -25,11 +25,13 @@ (define-module (guix scripts import crate) #:use-module (guix ui) #:use-module (guix utils) + #:use-module (guix read-print) #:use-module (guix scripts) #:use-module (guix import crate) #:use-module (guix scripts import) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-37) #:use-module (ice-9 match) #:use-module (ice-9 format) @@ -60,6 +62,9 @@ (define (show-help) sufficient package exists for it")) (newline) (display (G_ " + -f, --lockfile=FILE import dependencies from FILE, a 'Cargo.lock' file")) + (newline) + (display (G_ " -h, --help display this help and exit")) (display (G_ " -V, --version display version information and exit")) @@ -87,6 +92,9 @@ (define %options (option '("mark-missing") #f #f (lambda (opt name arg result) (alist-cons 'mark-missing #t result))) + (option '(#\f "lockfile") #f #t + (lambda (opt name arg result) + (alist-cons 'lockfile arg result))) %standard-import-options)) @@ -101,6 +109,8 @@ (define (guix-import-crate . args) #:build-options? #f)) (let* ((opts (parse-options)) + (lockfile (assoc-ref opts 'lockfile)) + (file-to-insert (assoc-ref opts 'file-to-insert)) (args (filter-map (match-lambda (('argument . value) value) @@ -111,16 +121,43 @@ (define (guix-import-crate . args) (define-values (name version) (package-name->name+version spec)) - (match (if (assoc-ref opts 'recursive) - (crate-recursive-import - name #:version version - #:recursive-dev-dependencies? - (assoc-ref opts 'recursive-dev-dependencies) - #:allow-yanked? (assoc-ref opts 'allow-yanked)) - (crate->guix-package - name #:version version #:include-dev-deps? #t - #:allow-yanked? (assoc-ref opts 'allow-yanked) - #:mark-missing? (assoc-ref opts 'mark-missing))) + (match (cond + ((and=> lockfile + (lambda (file) + (or (file-exists? file) + (leave (G_ "file '~a' does not exist~%") file)))) + (let-values (((source-expressions cargo-inputs-entry) + (cargo-lock->expressions lockfile name))) + (when file-to-insert + (let* ((term (first cargo-inputs-entry)) + (cargo-inputs + `(define-cargo-inputs lookup-cargo-inputs + ,@(sort + (cons cargo-inputs-entry + (extract-cargo-inputs + file-to-insert #:exclude term)) + (lambda (a b) + (string< (symbol->string (first a)) + (symbol->string (first b))))))) + (_ + (and=> (find-cargo-inputs-location file-to-insert) + delete-expression)) + (port (open-file file-to-insert "a"))) + (pretty-print-with-comments port cargo-inputs) + (newline port) + (close-port port))) + source-expressions)) + ((assoc-ref opts 'recursive) + (crate-recursive-import + name #:version version + #:recursive-dev-dependencies? + (assoc-ref opts 'recursive-dev-dependencies) + #:allow-yanked? (assoc-ref opts 'allow-yanked))) + (else + (crate->guix-package + name #:version version #:include-dev-deps? #t + #:allow-yanked? (assoc-ref opts 'allow-yanked) + #:mark-missing? (assoc-ref opts 'mark-missing)))) ((or #f '()) (leave (G_ "failed to download meta-data for package '~a'~%") (if version