From patchwork Wed Aug 9 07:38:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 52684 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 8753927BBE9; Wed, 9 Aug 2023 08:40:27 +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=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 7B92727BBE2 for ; Wed, 9 Aug 2023 08:40:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTdnb-0005gD-BI; Wed, 09 Aug 2023 03:40: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 1qTdnW-0005ey-PZ for guix-patches@gnu.org; Wed, 09 Aug 2023 03:40:04 -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 1qTdnW-00084C-CH for guix-patches@gnu.org; Wed, 09 Aug 2023 03:40:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qTdnV-0007J9-UQ for guix-patches@gnu.org; Wed, 09 Aug 2023 03:40:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64763] [PATCH] gnu: commencement: Use system in %final-inputs. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Aug 2023 07:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64763 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines Cc: Josselin Poiret , 64763@debbugs.gnu.org Received: via spool by 64763-submit@debbugs.gnu.org id=B64763.169156676228028 (code B ref 64763); Wed, 09 Aug 2023 07:40:01 +0000 Received: (at 64763) by debbugs.gnu.org; 9 Aug 2023 07:39:22 +0000 Received: from localhost ([127.0.0.1]:38173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qTdms-0007Hz-22 for submit@debbugs.gnu.org; Wed, 09 Aug 2023 03:39:22 -0400 Received: from jpoiret.xyz ([206.189.101.64]:49040) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qTdmq-0007Ho-Ah for 64763@debbugs.gnu.org; Wed, 09 Aug 2023 03:39:21 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id E55A5184D6B; Wed, 9 Aug 2023 07:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1691566758; 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=hMu0gFif0yWfiOPcUW7S9JLTV1WeLXrA6LEw2DCfzUI=; b=uW0ziXCF/8Q+FdSm4khxELgZnsA3KtIJOAzoz/rwfmeZ2h0chLeHNOVw00zPR+yafmKe7a oFFtsrUooY0Ae8bs3RPGz8e0liJdJWgAc1gl1qK2fe4qOdYzFrZRdakZBXHYlcdTUYOj26 aGzjSlkuCoVFGp7McXjbnDMgtBAlXsEzwLKNAQTjWzjc2xtTbHVgYdzmUx/fWuxmAxyOzV +ooMaF0TwWlaNatIGsdrywLAYo1XLMLMFsx7LKyvHkIBaeZV3HbnAqYi97JBkDgSUP45ap tG3l3F4CnoWfbhRnpkQ1qDtr8GhuFEuQlj/B/VVWtGJxYL0YU++e6pwl3EJJRg== Date: Wed, 9 Aug 2023 09:38:31 +0200 Message-ID: In-Reply-To: <87h6pasxof.fsf@gnu.org> References: <87h6pasxof.fsf@gnu.org> MIME-Version: 1.0 X-Spamd-Bar: ++++ Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches X-Patchwork-Original-From: Josselin Poiret via Guix-patches via From: Josselin Poiret 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: Christopher Baines Otherwise this causes odd issues, I presume arising from when %current-system differs from the system argument passed to %final-inputs. * gnu/packages/commencement.scm (%final-inputs): Set %current-system to system. * gnu/packages/base.scm (%final-inputs): Add optional system parameter. * gnu/ci.scm (base-packages): New procedure to memoize the base packages depending on system. (package->job): Pass system to base-packages. Co-authored-by: Josselin Poiret Signed-off-by: Josselin Poiret --- Hi everyone, I think the patch itself looks good but it will probably be missing some additional stuff for CI, see the modified patch here. Best, gnu/ci.scm | 46 ++++++++++++++++--------------- gnu/packages/base.scm | 7 ++--- gnu/packages/commencement.scm | 51 ++++++++++++++++++----------------- 3 files changed, 55 insertions(+), 49 deletions(-) diff --git a/gnu/ci.scm b/gnu/ci.scm index 7acd88ed29..df98c8af97 100644 --- a/gnu/ci.scm +++ b/gnu/ci.scm @@ -24,6 +24,7 @@ (define-module (gnu ci) #:use-module (guix build-system channel) #:use-module (guix config) #:autoload (guix describe) (package-channels) + #:use-module (guix memoization) #:use-module (guix store) #:use-module (guix profiles) #:use-module (guix packages) @@ -342,29 +343,32 @@ (define job-name ;; Return the name of a package's job. package-name) +(define base-packages + (mlambda (system) + "Return the set of packages considered to be part of the base for SYSTEM." + (delete-duplicates + (append-map (match-lambda + ((_ package _ ...) + (match (package-transitive-inputs package) + (((_ inputs _ ...) ...) + inputs)))) + (%final-inputs system))))) + (define package->job - (let ((base-packages - (delete-duplicates - (append-map (match-lambda - ((_ package _ ...) - (match (package-transitive-inputs package) - (((_ inputs _ ...) ...) - inputs)))) - (%final-inputs))))) - (lambda* (store package system #:key (suffix "")) - "Return a job for PACKAGE on SYSTEM, or #f if this combination is not + (lambda* (store package system #:key (suffix "")) + "Return a job for PACKAGE on SYSTEM, or #f if this combination is not valid. Append SUFFIX to the job name." - (cond ((member package base-packages) - (package-job store (string-append "base." (job-name package)) - package system #:suffix suffix)) - ((supported-package? package system) - (let ((drv (package-derivation store package system - #:graft? #f))) - (and (substitutable-derivation? drv) - (package-job store (job-name package) - package system #:suffix suffix)))) - (else - #f))))) + (cond ((member package (base-packages system)) + (package-job store (string-append "base." (job-name package)) + package system #:suffix suffix)) + ((supported-package? package system) + (let ((drv (package-derivation store package system + #:graft? #f))) + (and (substitutable-derivation? drv) + (package-job store (job-name package) + package system #:suffix suffix)))) + (else + #f)))) (define %x86-64-micro-architectures ;; Micro-architectures for which we build tuned variants. diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 1fdfaf8a57..32bc69e2c4 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -78,7 +78,8 @@ (define-module (gnu packages base) #:export (glibc libc-for-target make-ld-wrapper - libiconv-if-needed)) + libiconv-if-needed + %final-inputs)) ;;; Commentary: ;;; @@ -1648,10 +1649,10 @@ (define-public (canonical-package package) (proc (module-ref iface 'canonical-package))) (proc package))) -(define-public (%final-inputs) +(define* (%final-inputs #:optional (system (%current-system))) "Return the list of \"final inputs\"." ;; Avoid circular dependency by lazily resolving 'commencement'. (let ((iface (resolve-interface '(gnu packages commencement)))) - ((module-ref iface '%final-inputs) (%current-system)))) + ((module-ref iface '%final-inputs) system))) ;;; base.scm ends here diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index fe6f025257..e522e70444 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3459,31 +3459,32 @@ (define-public %final-inputs ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are ;; used for origins that have patches, thereby avoiding circular ;; dependencies. - (let ((finalize (compose with-boot6 - package-with-bootstrap-guile))) - `(,@(map (match-lambda - ((name package) - (list name (finalize package)))) - `(("tar" ,tar) - ("gzip" ,gzip) - ("bzip2" ,bzip2) - ("file" ,file) - ("diffutils" ,diffutils) - ("patch" ,patch) - ("findutils" ,findutils) - ("gawk" ,gawk))) - ("sed" ,sed-final) - ("grep" ,grep-final) - ("xz" ,xz-final) - ("coreutils" ,coreutils-final) - ("make" ,gnu-make-final) - ("bash" ,bash-final) - ("ld-wrapper" ,ld-wrapper) - ("binutils" ,binutils-final) - ("gcc" ,gcc-final) - ("libc" ,glibc-final) - ("libc:static" ,glibc-final "static") - ("locales" ,glibc-utf8-locales-final))))) + (parameterize ((%current-system system)) + (let ((finalize (compose with-boot6 + package-with-bootstrap-guile))) + `(,@(map (match-lambda + ((name package) + (list name (finalize package)))) + `(("tar" ,tar) + ("gzip" ,gzip) + ("bzip2" ,bzip2) + ("file" ,file) + ("diffutils" ,diffutils) + ("patch" ,patch) + ("findutils" ,findutils) + ("gawk" ,gawk))) + ("sed" ,sed-final) + ("grep" ,grep-final) + ("xz" ,xz-final) + ("coreutils" ,coreutils-final) + ("make" ,gnu-make-final) + ("bash" ,bash-final) + ("ld-wrapper" ,ld-wrapper) + ("binutils" ,binutils-final) + ("gcc" ,gcc-final) + ("libc" ,glibc-final) + ("libc:static" ,glibc-final "static") + ("locales" ,glibc-utf8-locales-final)))))) (define-public canonical-package (let ((name->package (mlambda (system)