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 oGKaJtUe82bzWQEA62LTzQ:P1 (envelope-from ) for ; Tue, 24 Sep 2024 20:19:33 +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 oGKaJtUe82bzWQEA62LTzQ (envelope-from ) for ; Tue, 24 Sep 2024 22:19:33 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=OiNYr+hV; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=kqjqF31u; 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=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1727209173; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: 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=QteUtgaSNOJNx+iQfdWcFfOTpE489gZml7BFAYdwl1Y=; b=D0uUs+A4fCCUqNTWjbGdw8cUvAmkpbHG/5MAlAaPu19Zr+ybargM0xHYJKCLrwVAu8QrSo QV0rY313XSXACZA+TQCd3KtLQ0ckL54Lj5St4CtxzuYuMSi0K/FvXUVFmzHpXST9YPnH5l 17aVRTnT5FSkX4kKWIkN9UsSkdA2TBSfa9U/XzOnaaWXiFfW5jrAbEH8IhZsxgsUBJHkkO 6NVMDEeDaOW87YrP7KVUg6OxBwcWGyT3TdHCnNMwAI19Q9SfKMpdWCr5aUidShhj/tJco6 uiSwfeVIMqhJagrGrjANeCdneMnb7kPfdln7UflNha4/92bp4n9QewcbFH8kTg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=OiNYr+hV; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=kqjqF31u; 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=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1727209173; a=rsa-sha256; cv=none; b=dGWsNtpfeZjrZ9Sr5I1GY3LeoaIVPjILN2Xrp+Vpnrtbq/eTZm7uEFsji7KfISodG896m7 r3Y1kcgw/y5/bGVNaxECpMAqgSdIKIbyq3qnZBIMyGfp7gLINVOzfkZMaybt7dwxoFTik/ p3VBuCrn9e+aFhXbHREKBsP6nNkAd1sJBzZAAHqWDTkDifHMETK9WYaobLNGWimisHTsrw 9n8/VWWcvMzlthrjBnXGfi60IkS7mnt6W4lQ7IDSBcrmXtRU7sLfURHVtgYTNSpFHK3sNZ LogX03/YUYCPRzd1Ge+dS11h18O3k5XPpZ+YW7032NgYUeSKboGIp0Zjvs2Ogw== 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 6DDD9682EB for ; Tue, 24 Sep 2024 22:19:33 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stBze-000471-9n; Tue, 24 Sep 2024 16:18:42 -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 1stBzc-0003zN-Qj for guix-patches@gnu.org; Tue, 24 Sep 2024 16:18: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 1stBzc-0002jw-Gz for guix-patches@gnu.org; Tue, 24 Sep 2024 16:18:40 -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=QteUtgaSNOJNx+iQfdWcFfOTpE489gZml7BFAYdwl1Y=; b=OiNYr+hVNz/cK+4TUpHjf2N7dIVsM6TiPIJHNAkfxCn6Hwz1cwBabvrF/1Ylh1130zWT093ciIAS4yOo9qFDL3yM5m+R+TH1peJFYbgD2HuOQXsZ6wi7/giXqwC3BIUItyZmSROsFMKVgV87h5O0gtoSWf5W6MTp1mgPDJ0wOEB9V764uEMAUETjcrk7klRsNWgn0R9lEFsF4cfNeneEHlW0fKj6KXzXhX0I3/UIuOvcsgsoEDyhqibAXdn8YxLNo/GaGZIMhUcM1CbfcUoHCv9/m69RX+LJBhJnNnMsYT0+0IVu7seqe6iPDZOJ5kVQasI/vQAS+Y03qrNjN+hVNQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stC01-0004mH-7Q for guix-patches@gnu.org; Tue, 24 Sep 2024 16:19:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72457] [PATCH v6 05/12] gnu: system: image: Reduce subprocedure indentation. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 24 Sep 2024 20:19:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72457 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72457@debbugs.gnu.org Received: via spool by 72457-submit@debbugs.gnu.org id=B72457.172720913118287 (code B ref 72457); Tue, 24 Sep 2024 20:19:05 +0000 Received: (at 72457) by debbugs.gnu.org; 24 Sep 2024 20:18:51 +0000 Received: from localhost ([127.0.0.1]:38425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stBzm-0004km-PC for submit@debbugs.gnu.org; Tue, 24 Sep 2024 16:18:51 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39007 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stBza-0004iX-U8 for 72457@debbugs.gnu.org; Tue, 24 Sep 2024 16:18:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727202614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QteUtgaSNOJNx+iQfdWcFfOTpE489gZml7BFAYdwl1Y=; b=kqjqF31uQB/Kq9IxRdskOBCTOkJ7zMkQVz5EFVYVcwuxMZxIFxlTSI3+FijuQxlUj1SIBL 4ZA+bhtgbgE6EPUmJGZegjIWDozQi5Vwdjk+sSTUHiX4/qPnWZYDN1W6b/SlY2Hnlt2JPD TGNZyVwC8K2xuxZuwqvZyNstVVKb8C7XfGMPvBjW7+rJ3qCR5Z/CEVM2qZ8pkSjC0P1dzi 8K9xSkqWaDqGDWtL0Wk59FNMAKNyrgpYuvssevLlImhQkHU6x7ISaFRJziWk925ygY16CT dazYZexyCLpPHX1vS6pvSCilN7KsqGNkQic0FSrg8HmVewqCL+MmEg4TRr1HuA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id aba01f88 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <72457@debbugs.gnu.org>; Tue, 24 Sep 2024 18:30:14 +0000 (UTC) Date: Tue, 24 Sep 2024 20:29:12 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches From: Herman Rimm via Guix-patches via 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: 6DDD9682EB X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -6.52 X-Migadu-Spam-Score: -6.52 X-TUID: teNqYMfO7RCX * gnu/system/image.scm (system-disk-image): Reduce indentation. Change-Id: I9cf59d3a61d0c6e7e90009e62661f74f774f090a --- gnu/system/image.scm | 115 ++++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/gnu/system/image.scm b/gnu/system/image.scm index b58de1db14..6201b36334 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -448,63 +448,66 @@ (define* (system-disk-image image (format #f (G_ "unsupported partition type: ~a") file-system))))))))) + (define (image-builder partition) + "A directory, filled by calling the PARTITION initializer +procedure, is first created within the store. Then, an image of this +directory is created using tools such as 'mke2fs' or 'mkdosfs', +depending on the partition file-system type." + (let ((os (image-operating-system image)) + (schema (local-file (search-path %load-path + "guix/store/schema.sql"))) + (graph (match inputs + (((names . _) ...) + names))) + (type (partition-file-system partition))) + (with-imported-modules* + (let ((initializer (or #$(partition-initializer partition) + initialize-root-partition)) + (inputs '#+(cond + ((string-prefix? "ext" type) + (list e2fsprogs fakeroot)) + ((or (string=? type "vfat") + (string-prefix? "fat" type)) + (list dosfstools fakeroot mtools)) + (else + '()))) + (image-root (string-append (getcwd) "/tmp-root")) + (copy-closures? (not #$(image-shared-store? image)))) + (sql-schema #$schema) + + (set-path-environment-variable "PATH" '("bin" "sbin") inputs) + + ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be + ;; decoded. + (setenv "GUIX_LOCPATH" + #+(file-append (libc-utf8-locales-for-target + (%current-system)) + "/lib/locale")) + (setlocale LC_ALL "en_US.utf8") + + (initializer image-root + #:references-graphs '#$graph + #:deduplicate? #f + #:copy-closures? copy-closures? + #:system-directory #$os) + ;; There's no point installing a bootloader if we do not + ;; populate the store. + (when copy-closures? + ;; Root-offset isn't necessary: we override 'root. + #$(bootloader-configurations->gexp + bootloader-config bootmeta + #:overrides (targets partition))) + (make-partition-image #$(partition->gexp partition) + #$output + image-root))))) + (define (partition-image partition) - ;; Return as a file-like object, an image of the given PARTITION. A - ;; directory, filled by calling the PARTITION initializer procedure, is - ;; first created within the store. Then, an image of this directory is - ;; created using tools such as 'mke2fs' or 'mkdosfs', depending on the - ;; partition file-system type. - (let* ((os (image-operating-system image)) - (schema (local-file (search-path %load-path - "guix/store/schema.sql"))) - (graph (match inputs - (((names . _) ...) - names))) - (type (partition-file-system partition)) - (image-builder - (with-imported-modules* - (let ((initializer (or #$(partition-initializer partition) - initialize-root-partition)) - (inputs '#+(cond - ((string-prefix? "ext" type) - (list e2fsprogs fakeroot)) - ((or (string=? type "vfat") - (string-prefix? "fat" type)) - (list dosfstools fakeroot mtools)) - (else - '()))) - (image-root (string-append (getcwd) "/tmp-root")) - (copy-closures? (not #$(image-shared-store? image)))) - (sql-schema #$schema) - - (set-path-environment-variable "PATH" '("bin" "sbin") inputs) - - ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be - ;; decoded. - (setenv "GUIX_LOCPATH" - #+(file-append (libc-utf8-locales-for-target - (%current-system)) - "/lib/locale")) - (setlocale LC_ALL "en_US.utf8") - - (initializer image-root - #:references-graphs '#$graph - #:deduplicate? #f - #:copy-closures? copy-closures? - #:system-directory #$os) - ;; no point installing a bootloader if we don't populate store - (when copy-closures? - ;; root-offset isn't necessary - we override 'root - #$(bootloader-configurations->gexp bootloader-config bootmeta - #:overrides (targets partition))) - (make-partition-image #$(partition->gexp partition) - #$output - image-root))))) - (computed-file "partition.img" image-builder - ;; Allow offloading so that this I/O-intensive process - ;; doesn't run on the build farm's head node. - #:local-build? #f - #:options `(#:references-graphs ,inputs)))) + "Return as a file-like object, an image of the given PARTITION." + (computed-file "partition.img" (image-builder partition) + ;; Allow offloading so that this I/O-intensive process + ;; doesn't run on the build farm's head node. + #:local-build? #f + #:options `(#:references-graphs ,inputs))) (define (gpt-image? image) (eq? 'gpt (image-partition-table-type image))) -- 2.45.2