From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id WE9nHu1OWGduhAEA62LTzQ:P1 (envelope-from ) for ; Tue, 10 Dec 2024 14:23:41 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id WE9nHu1OWGduhAEA62LTzQ (envelope-from ) for ; Tue, 10 Dec 2024 15:23:41 +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=ApwD0XJj; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=DMdyyLrM; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733840621; 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=q035eYlfdfxg+mEhD99rxL4RSIh+fQYxN4rUAI0NuDY=; b=Is06LCOvfuTpEmGFnVMjJLjBHDYqsGnlgHzRCoPrVO0zuPzq/zg1QFG7R62K6ERfHB/Hlr dzwhk0q7h0hsG0aQHjmA0MCFuO+HqhXwZOfgaPGrXzUPompHpu8YdGRCXRHDnd68LT1ZAB HcbbOxIOfXuv4XKCwDtb9tBK25V4oYlhMxuhAm0NBFDWSegg6r4eSbfCorMna/7jhY9/v+ vbsko80aTxZNtBCX5TQY74sGX22Q7UOqck493pvzNPQvmt1pBcAhNhdlpiGf/yby9zyMyz ZtEQMoltYALAMihcptCLaaqFhYfkvWKFk8z9zs+HUznZBPx11brwDDH2zplGLg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=ApwD0XJj; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=DMdyyLrM; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733840621; a=rsa-sha256; cv=none; b=YrEO3hgG6VoAKgm0BCQhGKM1kT8jzoqTeYPWLQBKUjBMo8T1FPm/fUadw9MBUB6aUEfsVl nvKNLTkPBwSMdoQr+W1HRnQIpMH9pUTCaOrvPsXy9/KYkMSHnT44ikxTPldzr1X6w2a9xV Kb3HWy1q0foJekzR6Jv8RgQ0bc/JoBqb0HW1GNvROR9Tdozw5F++AH5ur3M40LppPlq9JG bRsLhvt706PnvID5HyQmJNnD3qYmcsnfToyZygu95QnezEMUUftVZng0C8rToBXpvyelza Uje7BZNg+O/1pmqJcqZPHGeyNJa+AjPs5kKc75HP78yKnrO6CtjtTycsdfZESw== 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 D887488244 for ; Tue, 10 Dec 2024 15:23:40 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL191-0003ny-Uv; Tue, 10 Dec 2024 09:23:27 -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 1tL18j-0003lC-GK for guix-patches@gnu.org; Tue, 10 Dec 2024 09:23:05 -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 1tL18j-0001Ow-8S for guix-patches@gnu.org; Tue, 10 Dec 2024 09:23:05 -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=q035eYlfdfxg+mEhD99rxL4RSIh+fQYxN4rUAI0NuDY=; b=ApwD0XJjI2t671f4ZL/5x9+xLgHpiPTELVD6ChpUiyPvEFB57ZWFT2vEMCHUeYTCNE+FOD5uUqsUw8usOdUvwnPisZ5DwQKjZwbh2byjONdV48O+icyJ1mDgDBSxS9YHlSBpY9s/CwNovsKY555s1wsXOEFtWoxPnOulfuCPr9xYxdcuTyKkmJl0EAl/an5BCfYvHZsVGy9fdkI4LbCyHeRZZRBzvqClB6x7C2DgZPtMNb/K2qfXd5PrQY1B+MSST/71RDpgoyVnyPGq55jHvVBzMduN6Tc11DfeRsj9SnbJNrwSjgU9sXtCjqNCsf15LS5669ltMkyucTbcz9kkXA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tL18j-0001aZ-2d; Tue, 10 Dec 2024 09:23:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74767] [PATCH rust-team 02/23] 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: Tue, 10 Dec 2024 14:23:05 +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.17338405775990 (code B ref 74767); Tue, 10 Dec 2024 14:23:05 +0000 Received: (at 74767) by debbugs.gnu.org; 10 Dec 2024 14:22:57 +0000 Received: from localhost ([127.0.0.1]:57491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL18a-0001YR-1O for submit@debbugs.gnu.org; Tue, 10 Dec 2024 09:22:56 -0500 Received: from mail-pj1-f47.google.com ([209.85.216.47]:53510) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL18X-0001XN-Ve for 74767@debbugs.gnu.org; Tue, 10 Dec 2024 09:22:54 -0500 Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2eec9b3a1bbso4123296a91.3 for <74767@debbugs.gnu.org>; Tue, 10 Dec 2024 06:22:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733840508; x=1734445308; 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=q035eYlfdfxg+mEhD99rxL4RSIh+fQYxN4rUAI0NuDY=; b=DMdyyLrMkEUrcH0i2bXAwcf0djr+hwVGg0laixwIDkBzgr60KK1gccJxUb120qRwhc blyCuK7rqmTC68BmmqLZOmsgcSIlSYK7uhpYX2rF867aSFZDw1khU+2RLJg19oOqpnbA KBVIhQYGLowPM98N3jb9zrrzsIFpubiMoa/KgWZkMSwHJWi8L/hPiLuKp2KSKYSkAfAe Eb4l5WsBWesYH3zxSIm+AMpaI5FTiQhpyNL4/Klc/GfX6hmLbua+r7RngC1yESYNTWML K29RLn+Oj63zcEHHkmJkFCaU+eWy9MIAPBNLKu7hKvxzXFxsoolWZHT3vTt0z+zAIg4I yKwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733840508; x=1734445308; 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=q035eYlfdfxg+mEhD99rxL4RSIh+fQYxN4rUAI0NuDY=; b=hlrLH7neeGmrsqfLwoDZbFRIbBEdG5f7WwFcnR6fERQkd7z/YHNRdyw98v7mjXl6Td WgpRUZCliLOPZrutcRLzFDwX1UIX+EhsDx2bMfN933zCzN3lX8C+9jEB2Ta/IWCoDUKT 7L8SMVRBSwkRkI7UJAbQD/M+ogl3GOXMOqsmlQMfljVX0B6zp2alQe1ulI+zObnAG0ey EKRbxt91kFrO9/m2J25EDRaguaI4SAYSAfCKKjyGf3jC4j/7yvyiqHGf0moT8e0BDdAJ XsfwRv1Un62ot/7nesqWU0ep5YWEKkRsVnL47O+2UQAOfKz5ndW/APuepSXpGaaANeMV wJIQ== X-Gm-Message-State: AOJu0YwBUHEnSxBqGG7TN+oYXSZQ7QtS6U4jtzU1PC5Oh5ptx4aVB9rF PvE+8zg2R6FWak+qpvtYgSOGcBrCtDA+9m0gvIyN7c8G8wbNoHLAJG0xgA== X-Gm-Gg: ASbGncvq0CfQCBlQ3Ze+YNZGG8JNI2ya3S+ULBtTrU2ntkMmwlmItfHOysCUuo7qX6o 0SXkOJGPjALChgi5e3M6VMLKAnEJuuIplzBnIQ9rcCa0ivbAsPtNdG9xGblx1G8drHPhlphFlTF vS4D3NrI5+N31VnzUVyPt2MiCEAow2zcsYM2Dy6Ztm2xW53xzcmFqw/tRinZWYna5XM3RQT9cxr 0tkBfuJ/7yIXz0Xc0c0qD/xBkbWE7BlklAt7cQGCDV7AjUXWdEmuv+CotIFh1e1Nzj1UeBI X-Google-Smtp-Source: AGHT+IEtL/xBmWXejXrZOy9aaIfc6Voax4FhTQCFc3C8FgqRakLDTIqx8ZRyJ4qltubbOYRYsfh8/w== X-Received: by 2002:a17:90b:3c45:b0:2ee:bbe0:98cd with SMTP id 98e67ed59e1d1-2efcf10d835mr6994067a91.7.1733840506331; Tue, 10 Dec 2024 06:21:46 -0800 (PST) Received: from localhost.localdomain ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ef45fa64e0sm9767669a91.26.2024.12.10.06.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 06:21:45 -0800 (PST) From: Maxim Cournoyer Date: Tue, 10 Dec 2024 23:21:05 +0900 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 2.72 X-Spam-Score: 2.72 X-Migadu-Queue-Id: D887488244 X-TUID: TBBAQ5EW1TVG * 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 --- 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..d125ff20ca 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))) + '()) ,@(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))) + '()) + ,@cargo-test-flags + ,@(if parallel-tests? + (append (if (member "--" cargo-test-flags) + '() + '("--")) + (list "--test-threads" + (number->string (parallel-job-count)))) + '()))))) (define* (package #:key source -- 2.46.0