From patchwork Sun Feb 16 12:52:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 38736 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 A2F3827BBEA; Sun, 16 Feb 2025 12:54:45 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS 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 DCDFF27BBE2 for ; Sun, 16 Feb 2025 12:54:43 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tjeA1-0006J6-MJ; Sun, 16 Feb 2025 07:54:13 -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 1tje9z-0006Iu-SW for guix-patches@gnu.org; Sun, 16 Feb 2025 07:54:11 -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 1tje9z-0007fC-Ia; Sun, 16 Feb 2025 07:54:11 -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:Date:From:To:In-Reply-To:References:Subject; bh=1b2TvlH3aV6RiWMqtxeCmEVqSQGptSXQ0zJcXNbguhk=; b=b4KOqUcsbWYQxnmC47JhiMbE3ih1v/UoxnvukHFie/WjeMj3n8VCUXBTzSZBq5uQ4Hlcls4e3JIVugKYgQ3dMi89SHKFq5JrLVQr+WEVrLhCiJNdAfLGc/NCJVKcjfL4w0AajtOu3EQH3ZyqsuoxGEQ2BBp0sBZOCiTPI/43IpRDjdN8FUwnzINMl1XLzNjDWNEsP7D1DfnNS+i4HSBXVM+0LQSd58XvmMs9Tan9kk6LaFkWibocOCNja23vXMXBEW+RM1Ee+4ZeE2Q8GhYsL4mVYbOm84nYEbfKXb+NGVUO4xvpfXRd8Wx0JhbpRz4jKN6Ho/msxXIBmO0UDRb7bw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tje9p-0007GV-Sg; Sun, 16 Feb 2025 07:54:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#55231] [PATCH v6 1/4] Allow copying of out-of-tree modules to the Linux initrd. References: <87wnf3pv87.fsf@ditto.jhoto.spork.org> In-Reply-To: <87wnf3pv87.fsf@ditto.jhoto.spork.org> Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bjc@spork.org, maximedevos@telenet.be, kaelyn.alexi@protonmail.com, ludo@gnu.org, morgan.arnold@proton.me, ian@retrospec.tv, john.kehayias@protonmail.com, leo@famulari.name, felix.lechner@lease-up.com, andreas@enge.fr, bjc@spork.org, maxim.cournoyer@gmail.com, w@wmeyer.eu, guix-patches@gnu.org Resent-Date: Sun, 16 Feb 2025 12:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55231 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55231@debbugs.gnu.org Cc: Maxim Cournoyer , Brian Cully , Brian Cully , Maxime Devos , Kaelyn , Ludovic =?utf-8?q?Court=C3=A8s?= , Morgan Arnold , Ian Eure , John Kehayias , Leo Famulari , Felix Lechner , Andreas Enge , bjc@spork.org, Maxim Cournoyer , Wilko Meyer X-Debbugs-Original-Xcc: Brian Cully , Maxime Devos , Kaelyn , Ludovic =?utf-8?q?Court=C3=A8s?= , Morgan Arnold , Ian Eure , John Kehayias , Leo Famulari , Felix Lechner , Andreas Enge , bjc@spork.org, Maxim Cournoyer , Wilko Meyer Received: via spool by 55231-submit@debbugs.gnu.org id=B55231.173971041127840 (code B ref 55231); Sun, 16 Feb 2025 12:54:01 +0000 Received: (at 55231) by debbugs.gnu.org; 16 Feb 2025 12:53:31 +0000 Received: from localhost ([127.0.0.1]:60809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tje9K-0007Ew-8Q for submit@debbugs.gnu.org; Sun, 16 Feb 2025 07:53:31 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:45290) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tje9H-0007Ef-77 for 55231@debbugs.gnu.org; Sun, 16 Feb 2025 07:53:28 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-220c8f38febso62896715ad.2 for <55231@debbugs.gnu.org>; Sun, 16 Feb 2025 04:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739710400; x=1740315200; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1b2TvlH3aV6RiWMqtxeCmEVqSQGptSXQ0zJcXNbguhk=; b=LQXTGNhD0uvpfWUpS+DwIUCJkfK4hvU9uNstSFZ0dL6Z/nMX8oSMsc+PYPhUqAyEHn F5ldHUxRk2Ael395zYSnmLyBn9Jpw+jpFEuROPKKWCFLuQUxZgXHFt/oaJ8+06chx35G XT4evyLeLgVw1Noc7mzkmWrKCP5Fyhk9avbAqzVI4biNnHmzFUfAsz952caPfmpTs1pb wPlVK63xsRd05LHs5BmZpAE/l7UIzoSa+3hJTaC1z6dsPOwBgL+Xi52f1KZQm9s6wDB/ 1Jvz2gni2MU56YE1I10Gn/EtFjLZiXgWNYXHBxSvuktiqoSu5EBDEng9QaB5GX0QA3OD Bx6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739710400; x=1740315200; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1b2TvlH3aV6RiWMqtxeCmEVqSQGptSXQ0zJcXNbguhk=; b=gy5Sb5MRqXwPJ7axiAbZ/6yEWLLQRoemVmNTidp1In6zZUtUwSgZiN9tH0FILN+d97 ntkB0WLSYvF7qrUVaeBPFX0kAHYv8NLNabGjTZSJwUOM0qj6R/Brk/zdExoyk0Khk/vl DhTq/sQ1sb7W8W7Kh2E/OgEcEToRwCKu12HqKMVDUARzofyqMA97xoe+dUSxhJfoyXbV lOvlu/3q9cSUHVqeOXl2n0RO0oTsVYKYJ969CZNTHzOSV35T+tTAiZxwDjdk9ngkE10F RuAsme8JdgnZftxZFFzxenepKJoNTxYVPNutHN3LD8O6Lg/fN8Z812FsY4+53x1nqbKZ qTqA== X-Gm-Message-State: AOJu0YwPyBrX/+Dm64SrEsvrY4AeZ/1A0qG6EQJuZ6HNG8mMlbHV9sHX O5Ng2WdUl5PI0LrAXBiV1XjpEou3LUjhBRnFCm8bxqZ81IpLME05bOYf2XfZ X-Gm-Gg: ASbGncvfRDAVnGggBKO68KLJ7G0kd7nYUXYR5bUOECfWcL8v07OCyboQaVzTl5BRVkL gIBoVdS31KiVOBGngQKiBh2wt6lN7FZAK7cDJrS/2sRZ+vUomNybEymHyFKZ/41LEH/lZoIXxtz Ucn7QJNaya4eZfsLNy+G0kfprAqjJtHSVriDXV/zBe4Cq5sQ8jtCfvSDlJwhPqoENR2k1KNuNhe WHkqoM2mYn8OpavyKBvxoCOMk8ru/Pzx3I73hYhX2nmLK2jNrkpX2A1VsFtS2kiC/d/KiRLhnNp rmUhGHKtXdi8c0OGEpqktoG4IveMuTth8Q== X-Google-Smtp-Source: AGHT+IF1SloX9dEDXmpSpO5VCqY7PSskI264M6BhO3HElWERAZRKBh02f4MF2U9xOdTABH6O4WUNWw== X-Received: by 2002:a17:902:fc8f:b0:220:f7bb:842 with SMTP id d9443c01a7336-221040b1922mr90465345ad.42.1739710399699; Sun, 16 Feb 2025 04:53:19 -0800 (PST) Received: from localhost.localdomain ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-220d82e843fsm54178725ad.220.2025.02.16.04.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2025 04:53:19 -0800 (PST) From: Maxim Cournoyer Date: Sun, 16 Feb 2025 21:52:45 +0900 Message-ID: <353146a4da0938e592fa4333b601abf5b98d937d.1739710358.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.48.1 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: Brian Cully With this patch, modules for ‘initrd-modules’ will not only be searched for in the in-tree Linux modules, but also any additional modules specified in ‘kernel-loadable-modules’. * gnu/build/linux-modules.scm (find-module-file): Change DIRECTORY argument to DIRECTORIES. Now takes a list of directories to search, rather than a single one. * gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX argument to PACKAGES. Now contains a list of file-like objects to search for modules. (raw-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it to (flat-linux-module-directory) along with the selected LINUX package. (base-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it to (raw-initrd). * gnu/system.scm (operating-system-initrd-file): Pass in operating system definition's kernel-loadable-modules into (make-initrd) as LINUX-EXTRA-MODULE-DIRECTORIES. * doc/guix.texi (Initial RAM Disk): Document how out-of-tree modules can be used. Change-Id: Ic39f2abcfabc3ec34a71acce840038396bf9c82e Signed-off-by: Maxim Cournoyer Modified-by: Maxim Cournoyer --- doc/guix.texi | 15 ++++++++++++ gnu/build/linux-modules.scm | 22 +++++++++++------ gnu/system.scm | 2 ++ gnu/system/linux-initrd.scm | 49 +++++++++++++++++++++++-------------- 4 files changed, 62 insertions(+), 26 deletions(-) base-commit: af643735a546d9d3538113ebab4b5892f34c131a diff --git a/doc/guix.texi b/doc/guix.texi index 01e3a4edf0..a4c3743e50 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -43413,6 +43413,21 @@ Initial RAM Disk (initrd-modules (cons "megaraid_sas" %base-initrd-modules))) @end lisp +If a module listed in @code{initrd-modules} is not included in the +Linux-libre kernel, then its location must be provided via the +@code{kernel-loadable-modules} list. + +As an example, if you need the driver for a Realtek RTL8821CE wireless +network adapter for mounting the root file system over NFS, your +configuration might include the following: + +@lisp +(operating-system + ;; @dots{} + (initrd-modules (cons "8821ce" %base-initrd-modules)) + (kernel-loadable-modules (list (list rtl8821ce-linux-module "module")))) +@end lisp + @defvar %base-initrd-modules This is the list of kernel modules included in the initrd by default. @end defvar diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index 32baf6c525..24bbe087f5 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -246,8 +246,8 @@ (define (file-name->module-name file) '.ko[.gz|.xz|.zst]' and normalizing it." (normalize-module-name (strip-extension (basename file)))) -(define (find-module-file directory module) - "Lookup module NAME under DIRECTORY, and return its absolute file name. +(define (find-module-file directories module) + "Lookup module NAME under DIRECTORIES, and return its absolute file name. NAME can be a file name with or without '.ko', or it can be a module name. Raise an error if it could not be found. @@ -255,6 +255,9 @@ (define (find-module-file directory module) module names usually (always?) use underscores as the inter-word separator, whereas file names often, but not always, use hyphens. Examples: \"usb-storage.ko\", \"serpent_generic.ko\"." + (define directories (if (pair? directories) + directories + (list directories))) ;for backward compatibility (define names ;; List of possible file names. XXX: It would of course be cleaner to ;; have a database that maps module names to file names and vice versa, @@ -268,16 +271,19 @@ (define (find-module-file directory module) (else chr))) module)))) - (match (find-files directory - (lambda (file stat) - (member (strip-extension - (basename file)) names))) + (match (append-map (lambda (directory) + (find-files directory + (lambda (file _) + (member (strip-extension + (basename file)) + names)))) + directories) ((file) file) (() - (error "kernel module not found" module directory)) + (error "kernel module not found" module directories)) ((_ ...) - (error "several modules by that name" module directory)))) + (error "several modules by that name" module directories)))) (define* (recursive-module-dependencies files #:key (lookup-module dot-ko)) diff --git a/gnu/system.scm b/gnu/system.scm index 8df871f255..1921b60c25 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1373,6 +1373,8 @@ (define (operating-system-initrd-file os) #:linux (operating-system-kernel os) #:linux-modules (operating-system-initrd-modules os) + #:linux-extra-module-directories + (operating-system-kernel-loadable-modules os) #:mapped-devices mapped-devices #:keyboard-layout (operating-system-keyboard-layout os))) diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index dc08edc791..a8df9056ec 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -120,13 +120,19 @@ (define* (expression->initrd exp `(#:references-graphs (("closure" ,init)))) "/initrd.cpio.gz")) -(define (flat-linux-module-directory linux modules) +(define (flat-linux-module-directory packages modules) "Return a flat directory containing the Linux kernel modules listed in -MODULES and taken from LINUX." +MODULES and taken from PACKAGES." (define imported-modules (source-module-closure '((gnu build linux-modules) (guix build utils)))) + (define package-inputs + (map (match-lambda + ((p o) (gexp-input p o)) + (p (gexp-input p "out"))) + packages)) + (define build-exp (with-imported-modules imported-modules (with-extensions (list guile-zlib guile-zstd) @@ -138,8 +144,9 @@ (define (flat-linux-module-directory linux modules) (srfi srfi-26) (ice-9 match)) - (define module-dir - (string-append #$linux "/lib/modules")) + (define module-dirs + (map (cut string-append <> "/lib/modules") + '#$package-inputs)) (define builtin-modules (match (find-files module-dir (lambda (file stat) @@ -157,7 +164,7 @@ (define (flat-linux-module-directory linux modules) (lset-difference string=? '#$modules builtin-modules)) (define modules - (let* ((lookup (cut find-module-file module-dir <>)) + (let* ((lookup (cut find-module-file module-dirs <>)) (modules (map lookup modules-to-lookup))) (append modules (recursive-module-dependencies @@ -192,6 +199,7 @@ (define* (raw-initrd file-systems #:key (linux linux-libre) (linux-modules '()) + (linux-extra-module-directories '()) (pre-mount #t) (mapped-devices '()) (keyboard-layout #f) @@ -199,15 +207,16 @@ (define* (raw-initrd file-systems qemu-networking? volatile-root? (on-error 'debug)) - "Return as a file-like object a raw initrd, with kernel -modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be -mounted by the initrd, possibly in addition to the root file system specified -on the kernel command line via 'root'. LINUX-MODULES is a list of kernel -modules to be loaded at boot time. MAPPED-DEVICES is a list of device -mappings to realize before FILE-SYSTEMS are mounted. PRE-MOUNT is a -G-expression to evaluate before realizing MAPPED-DEVICES. -HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include -e2fsck/static or other packages needed by the initrd to check root partition. + "Return as a file-like object a raw initrd, with kernel modules taken from +LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd, +possibly in addition to the root file system specified on the kernel command +line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at +boot time. LINUX-EXTRA-MODULE-DIRECTORIES is a list of file-like objects which +will be searched for modules in addition to the linux kernel. MAPPED-DEVICES +is a list of device mappings to realize before FILE-SYSTEMS are mounted. +HELPER-PACKAGES is a list of packages to be copied in the initrd. It may +include e2fsck/static or other packages needed by the initrd to check root +partition. When true, KEYBOARD-LAYOUT is a record denoting the desired console keyboard layout. This is done before MAPPED-DEVICES are set up and @@ -243,7 +252,8 @@ (define* (raw-initrd file-systems #~()))) (define kodir - (flat-linux-module-directory linux linux-modules)) + (flat-linux-module-directory (cons linux linux-extra-module-directories) + linux-modules)) (expression->initrd (with-imported-modules (source-module-closure @@ -390,6 +400,7 @@ (define* (base-initrd file-systems #:key (linux linux-libre) (linux-modules '()) + (linux-extra-module-directories '()) (mapped-devices '()) (keyboard-layout #f) qemu-networking? @@ -410,9 +421,10 @@ (define* (base-initrd file-systems QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd. The initrd is automatically populated with all the kernel modules necessary -for FILE-SYSTEMS and for the given options. Additional kernel -modules can be listed in LINUX-MODULES. They will be added to the initrd, and -loaded at boot time in the order in which they appear." +for FILE-SYSTEMS and for the given options. Additional kernel modules can be +listed in LINUX-MODULES. Additional directories for modules can be listed in +LINUX-EXTRA-MODULE-DIRECTORIES. They will be added to the initrd, and loaded +at boot time in the order in which they appear." (define linux-modules* ;; Modules added to the initrd and loaded from the initrd. `(,@linux-modules @@ -432,6 +444,7 @@ (define* (base-initrd file-systems (raw-initrd file-systems #:linux linux #:linux-modules linux-modules* + #:linux-extra-module-directories linux-extra-module-directories #:mapped-devices mapped-devices #:helper-packages helper-packages #:keyboard-layout keyboard-layout From patchwork Sun Feb 16 12:52:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 38737 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 1A3F527BBEA; Sun, 16 Feb 2025 12:54:46 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS 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 9CA2F27BBE9 for ; Sun, 16 Feb 2025 12:54:45 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tjeA7-0006LG-04; Sun, 16 Feb 2025 07:54:19 -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 1tjeA5-0006Ka-7J for guix-patches@gnu.org; Sun, 16 Feb 2025 07:54:17 -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 1tjeA4-0007fe-M1; Sun, 16 Feb 2025 07:54:16 -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=vCWWkNucH/lViQB+qrOb6fJTg0rUx0PTq+0DfEz3jR8=; b=Hp99i3u584f/UAXxfIWpOQOid1wDMKVLKlExbbMwOjBfVJ/lTL2oXlyP2hzKde+Mil4wT6NuBM0+s/GdTEoHdPxaQY3bRaXDgrgy/BhuZeqpESBHb11xUNEy1zVK9Qh5w7wcCYzEkB8JZTmNjrjALTTB0d6irz7FdhzyTO9tXvjnRH+Gnn4MCiMlLkpl1DtMnq5lzF9f1xJzk+m6x/Fyaosd+wuwACXR+0YvhPqdGGAVitZ/dnctypHdjb8m+gXj3QUjd111VrEC655tVWthaBJ3/7Yzoca5ztqnzyvA9fJWWJzfNaiX1ViRD1K4Uk1JPSSLAjOw8MaNecyLANEAQg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tje9q-0007Gb-BH; Sun, 16 Feb 2025 07:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#55231] [PATCH v6 2/4] derivations: Fix indentation. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bjc@spork.org, maximedevos@telenet.be, kaelyn.alexi@protonmail.com, ludo@gnu.org, morgan.arnold@proton.me, ian@retrospec.tv, john.kehayias@protonmail.com, leo@famulari.name, felix.lechner@lease-up.com, andreas@enge.fr, bjc@spork.org, maxim.cournoyer@gmail.com, guix@cbaines.net, dev@jpoiret.xyz, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sun, 16 Feb 2025 12:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55231 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55231@debbugs.gnu.org Cc: Maxim Cournoyer , Brian Cully , Maxime Devos , Kaelyn , Ludovic =?utf-8?q?Court=C3=A8s?= , Morgan Arnold , Ian Eure , John Kehayias , Leo Famulari , Felix Lechner , Andreas Enge , bjc@spork.org, Maxim Cournoyer , Christopher Baines , Josselin Poiret , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Brian Cully , Maxime Devos , Kaelyn , Ludovic =?utf-8?q?Court=C3=A8s?= , Morgan Arnold , Ian Eure , John Kehayias , Leo Famulari , Felix Lechner , Andreas Enge , bjc@spork.org, Maxim Cournoyer , Christopher Baines , Josselin Poiret , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 55231-submit@debbugs.gnu.org id=B55231.173971041827860 (code B ref 55231); Sun, 16 Feb 2025 12:54:02 +0000 Received: (at 55231) by debbugs.gnu.org; 16 Feb 2025 12:53:38 +0000 Received: from localhost ([127.0.0.1]:60812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tje9S-0007FI-9m for submit@debbugs.gnu.org; Sun, 16 Feb 2025 07:53:38 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:58391) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tje9P-0007Ex-Rg for 55231@debbugs.gnu.org; Sun, 16 Feb 2025 07:53:36 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-220c8eb195aso72865235ad.0 for <55231@debbugs.gnu.org>; Sun, 16 Feb 2025 04:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739710408; x=1740315208; 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=vCWWkNucH/lViQB+qrOb6fJTg0rUx0PTq+0DfEz3jR8=; b=MpV2blfDPdbGY4dWfHYSP+fo79cs7M/1SSuHTMhcricKBgYrKewEUR34b5F9t240aW d0sCfLvpJE8gyrzJYujWf30UT+WGiODFjQmGNXn7KDxEXu6asG3BJ1s38mmljW6e6o+P CfkojzFqy4UnKgvolpDhBD4tTpDZTLTP98D8PsvFjoUAbjtYnn7ZnARyAmbcqNwHU/bU skKm3nY6/s7WyAOzcuGDavFSqNfcEieSzoyRip6nO6qkERvLcIQxaw+FTveNjUBQOW1Q RbXLG5uLL+X4hJKaOu/pQFjQmr7gSIFJCG/VHx7Y6NKkmo6mPNF2ndfijJXsYoPbZVAN lvNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739710408; x=1740315208; 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=vCWWkNucH/lViQB+qrOb6fJTg0rUx0PTq+0DfEz3jR8=; b=szJjanDNOTTtOFPlap984PHMIYxLbmKnCmeSMfGTm0DWB3mEwf22ORNrxEqYvDww4s rD1ZvpoSDCvTG75Ia/jPfWcwPyYxCk4WqsnMMuTLV2u6LkBHVE21mnqZ4siCux0GbpLt wLQvIfMIwvhlmp9NeebhWrSOKon1ZFAOiyy/rl/1KHYVn0cgecfFYN7I7vr07vEMCqN9 k5wiAqYEjgJGRO9aWOh5luegFw3Q2y3WheyVP3YdVlV0z6yGpCo9ac0gQjIiWNpC/Aut GHIKOJeCEVPyAXGDl5YMN9C9IpBdC7q1nhI9wvnDX/4BeWIDADFIX4YQc9DxUxC5BPmy 1RlA== X-Gm-Message-State: AOJu0Yw7CoCheZ29xQK+lJgm5jqgPS9lGy+hmNN4rRIYmvBqTkQlsJRW afO1/vPZrh8bSo2UbQsKA8DwzvXBmcR173m/R0jRkdfcsuJd0xjveqPKEq1v X-Gm-Gg: ASbGnct/uuC9v6M20Mjsdo2ArIkJFQW2B5LJdCBAOBdRYUZUzbaP5pCPj332GvleiTr QdS0wBxbRleF677H527aEr4hr4DAXidF1TbTKCAE9F3Ys/QVUms4u7vrWjGOzXLJq2nVA2FuUdV NLaJJc0tApb4P7JvGl0JJQzcInOqpXd7heeX2FSZd9ZQGZchNoAwcnEtK4xpcQ/+4YjpBLJomI6 XpLeb3EsadQWyBn1quGpzWN5II0rdmV1Xi0UgEGGdr9VjzaTr2sK0DvhXk00Ncwy+CD+q3FV6nV QbFcUEUD3aZnerNIvnJTru6EcxCIKqNclw== X-Google-Smtp-Source: AGHT+IHDmnuSKOSchS/PBRIezkLv1QGBmlU9+4uX50grfU4f5tUblbKJVEtw1JAPa4FuqEZLMe6O8w== X-Received: by 2002:a17:903:1d1:b0:220:d272:534d with SMTP id d9443c01a7336-2210405c6b6mr114538045ad.22.1739710408364; Sun, 16 Feb 2025 04:53:28 -0800 (PST) Received: from localhost.localdomain ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-220d82e843fsm54178725ad.220.2025.02.16.04.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2025 04:53:27 -0800 (PST) From: Maxim Cournoyer Date: Sun, 16 Feb 2025 21:52:46 +0900 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: <353146a4da0938e592fa4333b601abf5b98d937d.1739710358.git.maxim.cournoyer@gmail.com> References: <353146a4da0938e592fa4333b601abf5b98d937d.1739710358.git.maxim.cournoyer@gmail.com> 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/derivations.scm (derivation): Fix indentation. Change-Id: I2407b59788ce335c21c181d9f9e3f26a359e9bf5 --- guix/derivations.scm | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/guix/derivations.scm b/guix/derivations.scm index bef98cd26a..ffa69e924c 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -841,30 +841,30 @@ (define* (derivation store name builder args ;; corresponding environment variable. (match drv (($ outputs inputs sources - system builder args env-vars) + system builder args env-vars) (let* ((drv-hash (derivation-hash drv)) (outputs (map (match-lambda - ((output-name . ($ - _ algo hash rec?)) - (let ((path - (if hash - (fixed-output-path name hash - #:hash-algo algo - #:output output-name - #:recursive? rec?) - (output-path output-name - drv-hash name)))) - (cons output-name - (make-derivation-output path algo - hash rec?))))) + ((output-name . ($ + _ algo hash rec?)) + (let ((path + (if hash + (fixed-output-path name hash + #:hash-algo algo + #:output output-name + #:recursive? rec?) + (output-path output-name + drv-hash name)))) + (cons output-name + (make-derivation-output path algo + hash rec?))))) outputs))) (make-derivation outputs inputs sources system builder args (map (match-lambda - ((name . value) - (cons name - (or (and=> (assoc-ref outputs name) - derivation-output-path) - value)))) + ((name . value) + (cons name + (or (and=> (assoc-ref outputs name) + derivation-output-path) + value)))) env-vars) #f))))) @@ -910,10 +910,10 @@ (define* (derivation store name builder args ;; Return a variant of ENV-VARS where each OUTPUTS is associated with an ;; empty string, even outputs that do not appear in ENV-VARS. (let ((e (map (match-lambda - ((name . val) - (if (member name outputs) - (cons name "") - (cons name val)))) + ((name . val) + (if (member name outputs) + (cons name "") + (cons name val)))) env-vars))) (fold (lambda (output-name env-vars) (if (assoc output-name env-vars) From patchwork Sun Feb 16 12:52:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 38734 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 40B1C27BBEA; Sun, 16 Feb 2025 12:54:30 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS 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 AA9C227BBE2 for ; Sun, 16 Feb 2025 12:54:29 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tje9x-0006IX-FN; Sun, 16 Feb 2025 07:54:09 -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 1tje9v-0006IO-Gq for guix-patches@gnu.org; Sun, 16 Feb 2025 07:54:07 -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 1tje9v-0007ep-1P; Sun, 16 Feb 2025 07:54:07 -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=EbAN8FGWF+f5d2LmSP+kV7+TqTUBNPQJI3m3X4lf/Bo=; b=IvUNs4QcOmILYJzaC2Sph22nOC6D6JP9Q7t3HpCbTRkqwUZx24l/yyJB0AhcOFQ0rpFr/1QdL5L1A5gSZRCSNkJ36zuSJxhEpDl/7kpaqm+fawwNvj5ZdyV3JoPqSunFj7ffULV1uN5PpTESw2m7d8e4GuI/HSEwEHoqGRId2ZUsjn4WD7HcwJa+NF/WPrg1D+lK+AzP1nwy7IyfidYoqkGgmH9fVwXEkDaqV8lEHOzXnSWQQpPP2yEsQQTNIq1QyL3kYMbjrP7QwQHqj2A2Kuu3YZwznuMc7BObZp2N43h27uQ3OTArcQLSd9IInaeTpJpVCYIqEXXVer9TJbzmLg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tje9r-0007Gi-6d; Sun, 16 Feb 2025 07:54:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#55231] [PATCH v6 3/4] tests: Remove extraneous 'with-store' in derivations test. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bjc@spork.org, maximedevos@telenet.be, kaelyn.alexi@protonmail.com, ludo@gnu.org, morgan.arnold@proton.me, ian@retrospec.tv, john.kehayias@protonmail.com, leo@famulari.name, felix.lechner@lease-up.com, andreas@enge.fr, bjc@spork.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sun, 16 Feb 2025 12:54:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55231 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55231@debbugs.gnu.org Cc: Maxim Cournoyer , Brian Cully , Maxime Devos , Kaelyn , Ludovic =?utf-8?q?Court=C3=A8s?= , Morgan Arnold , Ian Eure , John Kehayias , Leo Famulari , Felix Lechner , Andreas Enge , bjc@spork.org, Maxim Cournoyer X-Debbugs-Original-Xcc: Brian Cully , Maxime Devos , Kaelyn , Ludovic =?utf-8?q?Court=C3=A8s?= , Morgan Arnold , Ian Eure , John Kehayias , Leo Famulari , Felix Lechner , Andreas Enge , bjc@spork.org, Maxim Cournoyer Received: via spool by 55231-submit@debbugs.gnu.org id=B55231.173971042327885 (code B ref 55231); Sun, 16 Feb 2025 12:54:03 +0000 Received: (at 55231) by debbugs.gnu.org; 16 Feb 2025 12:53:43 +0000 Received: from localhost ([127.0.0.1]:60815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tje9W-0007Fh-QW for submit@debbugs.gnu.org; Sun, 16 Feb 2025 07:53:43 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:48502) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tje9S-0007F6-SS for 55231@debbugs.gnu.org; Sun, 16 Feb 2025 07:53:39 -0500 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-220c8cf98bbso71265065ad.1 for <55231@debbugs.gnu.org>; Sun, 16 Feb 2025 04:53:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739710412; x=1740315212; 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=EbAN8FGWF+f5d2LmSP+kV7+TqTUBNPQJI3m3X4lf/Bo=; b=lvlwCrktFqijLszgdYhP3E5ybXVqvJ1PCu11JrTtmISYF/LVKtJ/QHy2XnugTpNvqo 1uEQFW2xhPhMUvBqiAGWCEmh34cNlfnTEiQCPsNtHE0z0BK4le3pvoPnvh/pAlww8YZq FsdGo1bRQJgBWexeFOXd6CKdldWU/OdkYaWQLteuxb10FLFyQfja7bfES1n9eEbI9XSK 1UnRT8CvkiN6b96/xoNIdB/RKdg9cIv6oEvUJEzHh8QsixfKTys8ZPLX1LYGKNlnWKkz QaQ5FVRSxSDNjQo6weW07xsRi67/sPnqv+dIvb3iVURIA8uBVjffxu/wqwd3oaoUrikL hCkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739710412; x=1740315212; 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=EbAN8FGWF+f5d2LmSP+kV7+TqTUBNPQJI3m3X4lf/Bo=; b=Tt/yD2A/Qb9vnrx+V9zsbNJyBA3+j20KW4eGfl+YvfUPeY5n008H101zpp1jq9eYWS AfnaZb+1pXH0ey5cwEX6X7S5MoUjk4g+eul4thNzPFf4Tg/Tc7xCCqI+zbDY3PL/JjzR uf+YUrGHyOFIfYNb4dKuXGk91MfbSEfFjY0I3yReJ0yB3eJQWl7MR5la7SwLJkTggmfA Olxe2QP/BfW91fRzIB2Ki6whV2zJD3sLzoxZH/NLuMtbCPRGAMdJkDbGxmTO7NLjJXaY xcO76TQQiSnEtm1BVhD9vGxTCOGyVpH7nM32j+89HvgVkIsd6I9nfhYpNcTmbEVvYdtR 4+6w== X-Gm-Message-State: AOJu0YxJeZa095kHfUhCepj5koqHnp3GLfPCXvOrnxUuQV8ljGVi9twV PXVP2cDC2uRG+TjhM535tmUQiww6XyeDFyPz7SjQnIhU03YYgGK0k8zrlx4A X-Gm-Gg: ASbGncvUSWFROXEq6y/5G2ElSUxt43KtLnZozkOTElRqS4sZ1RiDIV5/L+Ro4Vo3FWI iaNN1r6r+l/GMEIuzRClBxqTt2u/kqg5zlapGE7sv8YRK27AP+z2fF0hBWQQ+CIK4yldV/9RUrf 58fOn9le2MDUnL476qkU+g4GL6YbZeetWpYUYePx9VuTzZvM4bsIWh5d12Jrd6GwWdXlCf0eUqx rOW+/tPtQwURgZFHP2xyZCdvOHFY2ZvXYlkPA8ssICaVgjQPTPTqkNI/X3qS9KscCwXzWWtXEf1 Wfd40nXv/OlH6d2WXMndxgkBb9r7N6u73g== X-Google-Smtp-Source: AGHT+IE/nO49ewr+eR9gMaxjUpx0fBcKnKtRWcvz66cewO77khz8O7SvV60fVVS37Gfj1L+GFBeWHw== X-Received: by 2002:a17:902:dac5:b0:21f:507b:9ada with SMTP id d9443c01a7336-2210405cc66mr96845985ad.31.1739710412268; Sun, 16 Feb 2025 04:53:32 -0800 (PST) Received: from localhost.localdomain ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-220d82e843fsm54178725ad.220.2025.02.16.04.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2025 04:53:31 -0800 (PST) From: Maxim Cournoyer Date: Sun, 16 Feb 2025 21:52:47 +0900 Message-ID: <1c9a81869981a3281b6a3ef68bda73b336be2e5c.1739710358.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <353146a4da0938e592fa4333b601abf5b98d937d.1739710358.git.maxim.cournoyer@gmail.com> References: <353146a4da0938e592fa4333b601abf5b98d937d.1739710358.git.maxim.cournoyer@gmail.com> 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 * tests/derivations.scm ("derivation fails but keep going"): Remove extraneous 'with-store'. Change-Id: If30c2d457504b8524cd167f1a145fbbea61b513c --- tests/derivations.scm | 45 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/tests/derivations.scm b/tests/derivations.scm index efcd21f324..72ea9aa9cc 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -150,29 +150,28 @@ (define* (directory-contents dir #:optional (slurp get-bytevector-all)) (test-assert "derivation fails but keep going" ;; In keep-going mode, 'build-derivations' should fail because of D1, but it ;; must return only after D2 has succeeded. - (with-store store - (let* ((d1 (derivation %store "fails" - %bash `("-c" "false") - #:sources (list %bash))) - (d2 (build-expression->derivation %store "sleep-then-succeed" - `(begin - ,(random-text) - ;; XXX: Hopefully that's long - ;; enough that D1 has already - ;; failed. - (sleep 2) - (mkdir %output))))) - (set-build-options %store - #:use-substitutes? #f - #:keep-going? #t) - (guard (c ((store-protocol-error? c) - (and (= 100 (store-protocol-error-status c)) - (string-contains (store-protocol-error-message c) - (derivation-file-name d1)) - (not (valid-path? %store (derivation->output-path d1))) - (valid-path? %store (derivation->output-path d2))))) - (build-derivations %store (list d1 d2)) - #f)))) + (let* ((d1 (derivation %store "fails" + %bash `("-c" "false") + #:sources (list %bash))) + (d2 (build-expression->derivation %store "sleep-then-succeed" + `(begin + ,(random-text) + ;; XXX: Hopefully that's long + ;; enough that D1 has already + ;; failed. + (sleep 2) + (mkdir %output))))) + (set-build-options %store + #:use-substitutes? #f + #:keep-going? #t) + (guard (c ((store-protocol-error? c) + (and (= 100 (store-protocol-error-status c)) + (string-contains (store-protocol-error-message c) + (derivation-file-name d1)) + (not (valid-path? %store (derivation->output-path d1))) + (valid-path? %store (derivation->output-path d2))))) + (build-derivations %store (list d1 d2)) + #f))) (test-assert "identical files are deduplicated" ;; Note: DATA must be longer than %DEDUPLICATION-MINIMUM-SIZE. From patchwork Sun Feb 16 12:52:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 38735 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 84C7427BBEA; Sun, 16 Feb 2025 12:54:40 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS 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 F3B5827BBE2 for ; Sun, 16 Feb 2025 12:54:39 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tjeA6-0006L9-4q; Sun, 16 Feb 2025 07:54:18 -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 1tjeA5-0006Kb-7M for guix-patches@gnu.org; Sun, 16 Feb 2025 07:54:17 -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 1tjeA4-0007ff-My; Sun, 16 Feb 2025 07:54:16 -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=w1WyFeWIP6FgMY04mB07xpdqvsdZ3qMec56fZMylY3k=; b=Hviwtr2GpLvDPoy0nd1OyMtWkPd8qTfpyYrBQyvXRCMKxQPkdXs6tGzx+EhjfTbqqOKi6pM/6GxYlVC9bWkGi93Uc7nJe2oyBBbJ65w/yuH6nZryPIGN2hTTBilaeMwrQPpHEhBQw+trjpOtfXjvSAPnQKkKe8QekGCZ7iggMYqUpZp8W38zxbNKYAyhHpTUtsNB32Ehug3e5i7SnE45UwLXxPsg0lqAeM3gx8pyGvnoKPsVdDibBIkIS+Lk3hTYnS8o/oNzJ4mSJ7oQL3de1YdYwUlobbSaydI0MHnwd9claeGEqKhSD7bQI7kkfHs4mxBa8+6rHZgZDf8n+2FNvg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tje9r-0007Gr-NU; Sun, 16 Feb 2025 07:54:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#55231] [PATCH v6 4/4] Propagate non-substitutability of derivations. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bjc@spork.org, maximedevos@telenet.be, kaelyn.alexi@protonmail.com, ludo@gnu.org, morgan.arnold@proton.me, ian@retrospec.tv, john.kehayias@protonmail.com, leo@famulari.name, felix.lechner@lease-up.com, andreas@enge.fr, bjc@spork.org, maxim.cournoyer@gmail.com, guix@cbaines.net, dev@jpoiret.xyz, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sun, 16 Feb 2025 12:54:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55231 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55231@debbugs.gnu.org Cc: Morgan Arnold , Maxim Cournoyer , Brian Cully , Maxime Devos , Kaelyn , Ludovic =?utf-8?q?Court=C3=A8s?= , Morgan Arnold , Ian Eure , John Kehayias , Leo Famulari , Felix Lechner , Andreas Enge , bjc@spork.org, Maxim Cournoyer , Christopher Baines , Josselin Poiret , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Brian Cully , Maxime Devos , Kaelyn , Ludovic =?utf-8?q?Court=C3=A8s?= , Morgan Arnold , Ian Eure , John Kehayias , Leo Famulari , Felix Lechner , Andreas Enge , bjc@spork.org, Maxim Cournoyer , Christopher Baines , Josselin Poiret , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 55231-submit@debbugs.gnu.org id=B55231.173971042827904 (code B ref 55231); Sun, 16 Feb 2025 12:54:03 +0000 Received: (at 55231) by debbugs.gnu.org; 16 Feb 2025 12:53:48 +0000 Received: from localhost ([127.0.0.1]:60818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tje9b-0007Fz-93 for submit@debbugs.gnu.org; Sun, 16 Feb 2025 07:53:47 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:55628) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tje9X-0007FH-Po for 55231@debbugs.gnu.org; Sun, 16 Feb 2025 07:53:44 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-220bff984a0so61407895ad.3 for <55231@debbugs.gnu.org>; Sun, 16 Feb 2025 04:53:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739710417; x=1740315217; 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=w1WyFeWIP6FgMY04mB07xpdqvsdZ3qMec56fZMylY3k=; b=lcWNGT2yc47SpCuiORWUSHcPQQeCjpojJv8nC5gs1yaTdtrajhwNCOvVZDD5LhMuu6 +9F/OzBRHWBT5pnuljK8dhD2uhdyfQsGV33CiCYVnLOfdUWk3YF0dJ7aC0i+FqhdJzM6 85NF+5bXmds5GAzLBRLDlbryOCwbaIostMekLSM9DZidXY0K1pgmIaubyXXG4wnhOkyG VVvCp1tSGGWSJ+Ns0BFw4DjUziC7mLSmuEujfy+ypH0ARAumDp9Uwr1AQq3N+CTtl3pP lzPxr52eB9ZaVxT6lhBCfs/UA2jlovfnGFCvP2yMp11SAapoKgUKYNnAKjxDL8Ub7sO/ VAVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739710417; x=1740315217; 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=w1WyFeWIP6FgMY04mB07xpdqvsdZ3qMec56fZMylY3k=; b=YCTu1Y6QtPSkB2/JkPK1Bj5CzyaVKD+uvLKIzNbkX/XNQPPcWKsIzEq2j5C0d8FoH7 U7z/Y+wrj9Y2j8cotvJYdtaFuJ+LxZeNu/YhDVjQc8Zh4reNgfGXziXI4Cxfqoi79Ct4 M2sJ50xjnLvDqXGdVcVQm0tYY5TDSX8PBz62c7At13YBCtBuuUXltlUsC9Kq8bTNw/c+ T8YPhfdps1tfmwzmbUprMkKTClA6zWX/TCq+/uJKCcDTWAnwEDNio1xh8VBGjsT5oLn5 UzSK5OJl8XeQQbon0Nu/YcGayjzkSXqhNmE260Ym6AxrNsJ1NrHLsIm3n5QVAVz4TuY6 +UJw== X-Gm-Message-State: AOJu0YxNiaHSh6B0J4H4FVcX48rV4E2rPsuS33wqvLlcWX4DeQC7HkKv ro81+pDNpSAlfbQcIWahDZOGoD9/6Zv9vO2JSR/VRN1+Eiaq6xno4Z7BgJWu X-Gm-Gg: ASbGncsXuKtTO/5O8zuGs4BtyVcJdxTuKIOzp1jEXjT0xScRro0eVYidjVB6IDv3cta opfcB/b1eNkJmJkqqaTFOPn3bp/wNREwbN+qmeMQM4e17O/5ZnWakcj75O+mOnBOjivIsOZ8zWK MbbiZwj97c4fSBB8w108N1K0qPziIOiVuITdlO7EPEAR21+Bhs16loMBaod4yarQrS1eiw3dC2q TH3Mwl+svjBqmbH7SLrhxedxtXjhJiO2iOTS1rgAqW6GXn+tY6r6v0O4nV4svVTgDvLsET7Qaoz ZuRKUhgu/28LZZ+iml/6Ucmvl6ytB6TX4g== X-Google-Smtp-Source: AGHT+IGKPYzStDao+WtNVe3edM/CCDiWTZCHitBlwZMIjyJDUobdavi3kO/v1KyN8q4qof6QvVpTjQ== X-Received: by 2002:a17:902:ef49:b0:21f:c67:a68a with SMTP id d9443c01a7336-22104081daemr99817485ad.31.1739710416776; Sun, 16 Feb 2025 04:53:36 -0800 (PST) Received: from localhost.localdomain ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-220d82e843fsm54178725ad.220.2025.02.16.04.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2025 04:53:36 -0800 (PST) From: Maxim Cournoyer Date: Sun, 16 Feb 2025 21:52:48 +0900 Message-ID: <3a29ed41b52ef12aa92d31ff740b01777785e6c6.1739710358.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <353146a4da0938e592fa4333b601abf5b98d937d.1739710358.git.maxim.cournoyer@gmail.com> References: <353146a4da0938e592fa4333b601abf5b98d937d.1739710358.git.maxim.cournoyer@gmail.com> 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: Morgan Arnold This commit changes the conditions under which derivations, as constructed by the `derivation' procedure, are made substitutable, to prevent potential copyright violations related to the construction of substitutable initrds including non-substitutable derivations (in particular, ZFS). This change prevents such copyright violations by only marking a derivation as substitutable if it is itself marked substitutable along all of its inputs. This means that non-substitutable derivations propagate to other derivations using them as input. Change-Id: I80ba4a371ee0c55a1294aff311d4e7b151055fac Signed-off-by: Maxim Cournoyer Modified-by: Maxim Cournoyer --- guix/derivations.scm | 53 +++++++++++++++++++++++-------------------- tests/derivations.scm | 16 +++++++------ 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/guix/derivations.scm b/guix/derivations.scm index ffa69e924c..f4e7c56981 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -868,33 +868,36 @@ (define* (derivation store name builder args env-vars) #f))))) - (define (user+system-env-vars) + (define (user+system-env-vars inputs) ;; Some options are passed to the build daemon via the env. vars of ;; derivations (urgh!). We hide that from our API, but here is the place ;; where we kludgify those options. - (let ((env-vars `(,@(if local-build? - `(("preferLocalBuild" . "1")) - '()) - ,@(if (not substitutable?) - `(("allowSubstitutes" . "0")) - '()) - ,@(if allowed-references - `(("allowedReferences" - . ,(string-join allowed-references))) - '()) - ,@(if disallowed-references - `(("disallowedReferences" - . ,(string-join disallowed-references))) - '()) - ,@(if leaked-env-vars - `(("impureEnvVars" - . ,(string-join leaked-env-vars))) - '()) - ,@(match properties - (() '()) - (lst `(("guix properties" - . ,(object->string properties))))) - ,@env-vars))) + (let* ((substitutable-inputs? (every substitutable-derivation? + (map derivation-input-derivation + inputs))) + (env-vars `(,@(if local-build? + `(("preferLocalBuild" . "1")) + '()) + ,@(if (and substitutable? substitutable-inputs?) + '() + `(("allowSubstitutes" . "0"))) + ,@(if allowed-references + `(("allowedReferences" + . ,(string-join allowed-references))) + '()) + ,@(if disallowed-references + `(("disallowedReferences" + . ,(string-join disallowed-references))) + '()) + ,@(if leaked-env-vars + `(("impureEnvVars" + . ,(string-join leaked-env-vars))) + '()) + ,@(match properties + (() '()) + (lst `(("guix properties" + . ,(object->string properties))))) + ,@env-vars))) (match references-graphs (((file . path) ...) (let ((value (map (cut string-append <> " " <>) @@ -967,7 +970,7 @@ (define* (derivation store name builder args (filter-map input->derivation-input inputs)) derivation-inputoutput-path drv2)))) + ;; DRV2 is *not* available as a substitute, since it has drv1 as + ;; input, and the non-substitutability is viral to avoid + ;; distributing non-substitutable items that could have become + ;; embedded, for example in an initrd. + (and (null? download) (match build - (((= derivation-file-name build)) - (string=? build (derivation-file-name drv1)))))))))) + (((= derivation-file-name build1) + (= derivation-file-name build2)) + (string=? build1 (derivation-file-name drv1)) + (string=? build2 (derivation-file-name drv2)))))))))) (test-assert "derivation-build-plan and substitutes, local build" (with-store store