From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id YOTtLJbwWGemkgAA62LTzQ:P1 (envelope-from ) for ; Wed, 11 Dec 2024 01:53:26 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id YOTtLJbwWGemkgAA62LTzQ (envelope-from ) for ; Wed, 11 Dec 2024 02:53:26 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=qJy30bsu; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=jVWvMvs9; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733882006; a=rsa-sha256; cv=none; b=brN8DM8JwSiPC7RMYLcg2WN8jLx90/U4Ixot/Tc4n0heKglNlKLeY2NisWHV9tGvDlbOq+ tvfdlpPE+TGsvCW7kpLcnRISgy04csB//UPc0reDlprN/ZjWjjDNVaIll0xNnUNTINkGTn czoeulZd3u2EMixHzANw+3BlW4UEyk38SgcL6WJoaraI+vEfAtngqKXRFnJa9zYbekuuqd l+kSvNNKR4D5vAp8b06wNWx2V7EMhqH/awyzQ0TfbWz8xmrC4oycASiS5zZAEUEXdqjq65 ztEuLeGRTKtF5HjrKgYs37eLUYh62bhAjCOjzYTudDYBBPVKRGHT4M6ykZUTSg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=qJy30bsu; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=jVWvMvs9; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733882006; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=yEXoZEvGgVDapw+3Fplq/rrR9rPwpQmsJgQbI3IZZ0Q=; b=WenK3PTMLt1ahzgKu9MPFNRs6eVQCgnBQyZ1UgAsGA3jSTtUTdOY9+sCuPhkfjiwbcbZYj zY02XyKHqhH9n2Pb2G8L856q0ZISk3xZ+acSbWaftaWFlHQ6Hs3ECA49Ibx8iAnrCelO55 FjFJZ2URQkNBo5jWJMtU9FY4gFfV3392IJRiJIUDaZScpENtnqSq4ibyLH/D3wuiWJnoHe Lw3A9mkUZTie7e2SLzLyXeQMX/uKVyPw4AfgVz7qtQE8BPWtpdSvWCWFkMhbXW3DYymdKO H88xPv1nvHtB+q43cfBnFLpc+6E1NxCt4hSObXJSgB8iG4KAjOJJ+D9uXrQJTg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4A3B03172 for ; Wed, 11 Dec 2024 02:53:26 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLBuf-0002qn-AK; Tue, 10 Dec 2024 20:53:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tLBuU-0002nu-Pi for guix-patches@gnu.org; Tue, 10 Dec 2024 20:53:06 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLBuQ-0007tS-IJ for guix-patches@gnu.org; Tue, 10 Dec 2024 20:53:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=yEXoZEvGgVDapw+3Fplq/rrR9rPwpQmsJgQbI3IZZ0Q=; b=qJy30bsuABT03T/lPXm+BbBN1kPlNK1z9u64n/pqXEfZLiRY6riKAP07gRCTA58sHcRU4dBYYuR3n25zI0MqLy5oP8kLSv3NuMLr/3iQc2lAGlPzc721CY/2BuXAQHFdjmi83FpnmPbrrWQzaauEUvMmqpODu71lrfkVzYcPRf9FpNHRaj81KrwtyBvfjGqQU1373ggjsg2z5Qr00AX0UvKMLnLJxvIhRg7BVwj4m5W7PKOXh2ZaoSBSr3tnxbhYxJdT+x7vxbBWjn9FtQp885LcXJiVtLAoU3uFqxsZ/wBUeOLuIBQsvgHiF7uKLAbbjcb+R2tQLQuU1A3Mcm2zmg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tLBuQ-0007EY-CC; Tue, 10 Dec 2024 20:53:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74767] [PATCH PATCH rust-team v2 03/24] build/cargo: Honor #:parallel-build? and #:parallel-tests? arguments. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, guix-patches@gnu.org Resent-Date: Wed, 11 Dec 2024 01:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74767 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74767@debbugs.gnu.org Cc: Maxim Cournoyer , Efraim Flashner X-Debbugs-Original-Xcc: Efraim Flashner Received: via spool by 74767-submit@debbugs.gnu.org id=B74767.173388192327344 (code B ref 74767); Wed, 11 Dec 2024 01:53:02 +0000 Received: (at 74767) by debbugs.gnu.org; 11 Dec 2024 01:52:03 +0000 Received: from localhost ([127.0.0.1]:60393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLBtT-00076y-6n for submit@debbugs.gnu.org; Tue, 10 Dec 2024 20:52:03 -0500 Received: from mail-pl1-f173.google.com ([209.85.214.173]:59426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLBtR-00076Y-K2 for 74767@debbugs.gnu.org; Tue, 10 Dec 2024 20:52:02 -0500 Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-21675fd60feso16508425ad.2 for <74767@debbugs.gnu.org>; Tue, 10 Dec 2024 17:52:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733881860; x=1734486660; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yEXoZEvGgVDapw+3Fplq/rrR9rPwpQmsJgQbI3IZZ0Q=; b=jVWvMvs96MO/vr+fsBfRqgD6qni/NUDQaY0IMbNjEn+xpu+iDFGZZoMDj4oravzKna nxhhukGJPXKxMrmbq8Ptz15Mby+PR2/RUVkN66KzZ5P4x9VfBt39KLDJh47k9Ih8L2pS TdNkBQcaBJRLaq1T90DZKNcNGR/Iq9I8JqKqvV/tYPYGGtcBRa0EVBT+bNY2NLsyfYnK izaf7PheXwa7Z6Z6wmh3kygXMyg4R/1rc2MYPyRyYj7slB+CvVP2HyHQ6AV20Pbwshcy CA7ggzTb4zmlLWrE/tjjGcr8wkIsjco+x5kVEbhM6TruPRgBV1etDswiPfYuae91jh2M nZuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733881860; x=1734486660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yEXoZEvGgVDapw+3Fplq/rrR9rPwpQmsJgQbI3IZZ0Q=; b=tJTZL6HufQrqGimbB0sL/MKuFcZqVpMJkdTt104fgnpzoVmlLlF9hT1GMyFEvw2cue mhWpLdB9ALFnsB6oH/s1MYQSa+ZeV3pO2sFbzEAHD5rd9iM/gO0pg1KYKbmEkZeEsAZG TEXcr87W5eSAosUcCTgd4B3vr39Olpqzt33KdyW4pXX59nLonbg/Fj6ohoY3Px6H7Xro nzp/8B6DNK8AzewWxu4A1ZMIw2Oy+YeouM5DH0bnkg/Zc5FnyqLh1WK2bDUkGoiPvyMk n/wtjj3pJ/QdnG6QrG4a+w1oEkvCgY7J8joXnz0+YyOWXJBj2MXVMwm0xHz/u73YaeGC RGlg== X-Gm-Message-State: AOJu0YzJsMScNROyZuD/wy9deX4UvgJEa9avyaLD3DCUAJcMhnu/j1Q9 omRkMVGw37dpLNBlKGY8ME1U45QDJcceCuFhNyE+wNcaMTVF3RiIPrHjqA== X-Gm-Gg: ASbGnctnDoijZKyNIUpuRrDahPzljIwzOjRE09EqFnec/oYTAgr7MjWbTErcmnxCU7Q ZONiF4C3jVEO0XyqPyZIChgNAYQcJraXe7C8QCABSyaB4QqNl17e52/gwTs7xnrICbp2nkCO5wb 4/NskYIvVRZbMg4NqAEcl+VR+zlSw5hApArWtfCDS6zglSXjJjCKM+TUXVP7HgEFwAfRGGZ8AoQ NTK10/C3hjuOmWsBQ4VTuZt7UmOFrEJr+02k7RIBhK/QcoDb/BZTyaSo7+HbHQc8d2p1y8h X-Google-Smtp-Source: AGHT+IHMX3tuMc1zT5yZsnBNyea5hosnKCLKY6QKleXaXGk7cm/ryiEcdautxJNKWsGOd6m3gu9M4g== X-Received: by 2002:a17:902:e88d:b0:216:4724:2757 with SMTP id d9443c01a7336-21778398512mr19784865ad.4.1733881860391; Tue, 10 Dec 2024 17:51:00 -0800 (PST) Received: from localhost.localdomain ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21631118cedsm61537435ad.150.2024.12.10.17.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 17:50:59 -0800 (PST) From: Maxim Cournoyer Date: Wed, 11 Dec 2024 10:48:50 +0900 Message-ID: <4597d056c9b3549734f0dd6311b59775d286e2de.1733881750.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <3751e2473a8415293f3903c0aaa34362bc0b6f30.1733881750.git.maxim.cournoyer@gmail.com> References: <3751e2473a8415293f3903c0aaa34362bc0b6f30.1733881750.git.maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 4A3B03172 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -5.49 X-Spam-Score: -5.49 X-TUID: UbtHzjFCNmJI * guix/build-system/cargo.scm (cargo-build): Add #:parallel-build? and #:parallel-tests? arguments. (cargo-cross-build): Likewise. * guix/build/cargo-build-system.scm (build): Honor them. (check): Likewise. Change-Id: Idbee7aa3a6a7cd0fc222082837390b83cc8e8c07 --- Changes in v2: - Set build number/threads to 1 when parallel build/test is disabled. guix/build-system/cargo.scm | 9 +++++++++ guix/build/cargo-build-system.scm | 23 ++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index f24ff6195e..ea841a34eb 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2019 Ivan Petkov ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2021, 2024 Efraim Flashner +;;; Copyright © 2024 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -95,6 +96,8 @@ (define* (cargo-build name inputs (cargo-package-flags ''("--no-metadata" "--no-verify")) (features ''()) (skip-build? #f) + (parallel-build? #t) + (parallel-tests? #t) (install-source? #t) (phases '%standard-phases) (outputs '("out")) @@ -122,6 +125,8 @@ (define* (cargo-build name inputs #:cargo-target #$(cargo-triplet system) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? + #:parallel-build? #$parallel-build? + #:parallel-tests? #$parallel-tests? #:install-source? #$install-source? #:tests? #$(and tests? (not skip-build?)) #:phases #$(if (pair? phases) @@ -152,6 +157,8 @@ (define* (cargo-cross-build name (cargo-target (cargo-triplet (or target system))) (features ''()) (skip-build? #f) + (parallel-build? #t) + (parallel-tests? #t) (install-source? (not (target-mingw? target))) (phases '%standard-phases) (outputs '("out")) @@ -181,6 +188,8 @@ (define* (cargo-cross-build name #:cargo-target #$(cargo-triplet (or target system)) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? + #:parallel-build? #$parallel-build? + #:parallel-tests? #$parallel-tests? #:install-source? #$install-source? #:tests? #$(and tests? (not skip-build?)) #:phases #$(if (pair? phases) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 84897393d9..37a64b07e8 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2019-2024 Efraim Flashner ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2020 Marius Bakke +;;; Copyright © 2024 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -239,19 +240,35 @@ (define* (build #:key (or skip-build? (apply invoke `("cargo" "build" + ,@(if parallel-build? + (list "-j" (number->string (parallel-job-count))) + (list "-j" "1")) ,@(if (null? features) '() `("--features" ,(string-join features))) ,@cargo-build-flags)))) (define* (check #:key + parallel-build? + parallel-tests? tests? (cargo-test-flags '("--release")) #:allow-other-keys) "Run tests for a given Cargo package." - (if tests? - (apply invoke "cargo" "test" cargo-test-flags) - #t)) + (when tests? + (apply invoke + `("cargo" "test" + ,@(if parallel-build? + (list "-j" (number->string (parallel-job-count))) + (list "-j" "1")) + ,@cargo-test-flags + ,@(if (member "--" cargo-test-flags) + '() + '("--")) + ,@(if parallel-tests? + (list "--test-threads" + (number->string (parallel-job-count))) + (list "--test-threads" "1")))))) (define* (package #:key source -- 2.46.0