From patchwork Sun Mar 3 18:38:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Rimoldi X-Patchwork-Id: 61322 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 DBD1F27BBEA; Sun, 3 Mar 2024 18:39:53 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED 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 BD2CD27BBE2 for ; Sun, 3 Mar 2024 18:39:52 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rgqkK-0000KE-3l; Sun, 03 Mar 2024 13:39:36 -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 1rgqkH-0000JY-MO for guix-patches@gnu.org; Sun, 03 Mar 2024 13:39:33 -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 1rgqkH-0001CI-DO for guix-patches@gnu.org; Sun, 03 Mar 2024 13:39:33 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rgqkk-0003PC-4k for guix-patches@gnu.org; Sun, 03 Mar 2024 13:40:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69530] [PATCH] doc: cookbook: Update "Build system arguments" section. Resent-From: rimarko@libero.it Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 03 Mar 2024 18:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69530 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69530@debbugs.gnu.org Cc: Marco Rimoldi X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170949119513071 (code B ref -1); Sun, 03 Mar 2024 18:40:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Mar 2024 18:39:55 +0000 Received: from localhost ([127.0.0.1]:41303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgqkc-0003Ol-Ee for submit@debbugs.gnu.org; Sun, 03 Mar 2024 13:39:54 -0500 Received: from lists.gnu.org ([209.51.188.17]:42194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgqka-0003Ob-Af for submit@debbugs.gnu.org; Sun, 03 Mar 2024 13:39:53 -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 1rgqk6-0000Ig-Tz for guix-patches@gnu.org; Sun, 03 Mar 2024 13:39:22 -0500 Received: from smtp-32.italiaonline.it ([213.209.10.32] helo=libero.it) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgqk4-0001BH-Pc for guix-patches@gnu.org; Sun, 03 Mar 2024 13:39:22 -0500 Received: from localhost ([93.38.119.137]) by smtp-32.iol.local with ESMTPA id gqjurMRA23TWBgqjzrJ5vP; Sun, 03 Mar 2024 19:39:16 +0100 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2021; t=1709491156; bh=2tb0psqUGuNKGCQLCqteGd/3p5tTCbn2yvqXhL/Vm0c=; h=From; b=PfTYuuk8YcL+Otnc26jLElfMwNyBDVV7pv4j8qyBh6+jBNeVtdOlaXppxPpzYg5Sl hag1MqzECCPOWAGJzu5v2rVxD/Kz8Puyup1TUjjRj1l2LCCgOnlZwK6vPy7Qpts+P+ 5wjom0ZY/d/ubAm8SPT8U2M/tLITWTwQEhe6/V0QrTZ3nt8jN2qVmbauOyJX31APbP ogAXxcwh6nXZZtgNZLltBXupZdB/Xe3rVKZqQJkxS3COjYerbfgK+E2kNZNi7B9mLb IX3NjeO19nBN/viA66p0yydq09fOMlBb8xe3F0x78YWhs1TOE7qjhYH0+t1DwRw4eC 2aI5n5ELGv84g== X-CNFS-Analysis: v=2.4 cv=JthSr94C c=1 sm=1 tr=0 ts=65e4c3d4 cx=a_exe a=zr5aN+YwjWvrDHBFAPbA8Q==:117 a=zr5aN+YwjWvrDHBFAPbA8Q==:17 a=oITmD3ktC8U1JffAZ0IA:9 Date: Sun, 3 Mar 2024 19:38:52 +0100 Message-ID: <40f63cec491071b498d4e9b59bc6bc29d80cee19.1709491132.git.rimarko@libero.it> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-CMAE-Envelope: MS4xfIkcsLG4lv+GQJlWe0KiH4gY+FlAK2GIOrGQ9jpow0uHXshTtB8AcBCIkXI2GXD1238XfGjHJz8B3yOPbE/6G5raxrrVv0UThLnDTGxcXwP83ygzjE0F QWJQBMQ6QJYx/IX+YM/yjyc/lnAhs5sfZ5YBqgeB9BuGsuhXwUeUIqp/ejKm1uPZbN5vJzMYYwpbjJe1Cb2nP97Fhifwb7dyjtU= Received-SPF: pass client-ip=213.209.10.32; envelope-from=rimarko@libero.it; helo=libero.it X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: rimarko@libero.it X-ACL-Warn: , Marco Rimoldi via Guix-patches X-Patchwork-Original-From: Marco Rimoldi via Guix-patches via From: Marco Rimoldi 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: Marco Rimoldi * doc/guix-cookbook.texi (Build system arguments) Remove recommendation on phase return value. Ensure code examples can run and are up-to-date. Change-Id: I143babf79983751578d6d4e20b20195ea000656d --- doc/guix-cookbook.texi | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) base-commit: f00f56514d90ebba5d9e08ec786c8118e437097c diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 2366c13caf..7835d64dcb 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi @@ -1246,6 +1246,7 @@ Extended example validate-documentation-location delete-info-dir-file patch-dot-desktop-files + make-dynamic-linker-cache install-license-files reset-gzip-timestamps compress-documentation))) @@ -1256,8 +1257,8 @@ Extended example @lisp (add-to-load-path "/path/to/guix/checkout") ,use (guix build gnu-build-system) -(map first %standard-phases) -@result{} (set-SOURCE-DATE-EPOCH set-paths install-locale unpack bootstrap patch-usr-bin-file patch-source-shebangs configure patch-generated-file-shebangs build check install patch-shebangs strip validate-runpath validate-documentation-location delete-info-dir-file patch-dot-desktop-files install-license-files reset-gzip-timestamps compress-documentation) +(map car %standard-phases) +@result{} (set-SOURCE-DATE-EPOCH set-paths install-locale unpack bootstrap patch-usr-bin-file patch-source-shebangs configure patch-generated-file-shebangs build check install patch-shebangs strip validate-runpath validate-documentation-location delete-info-dir-file patch-dot-desktop-files make-dynamic-linker-cache install-license-files reset-gzip-timestamps compress-documentation) @end lisp If you want to know more about what happens during those phases, consult the @@ -1279,13 +1280,25 @@ Extended example ;; Preserve timestamps (set to the Epoch) on the copied tree so that ;; things work deterministically. (copy-recursively source "." - #:keep-mtime? #true)) + #:keep-mtime? #t) + ;; Make the source checkout files writable, for convenience. + (for-each (lambda (f) + (false-if-exception (make-file-writable f))) + (find-files "."))) (begin - (if (string-suffix? ".zip" source) - (invoke "unzip" source) - (invoke "tar" "xvf" source)) - (chdir (first-subdirectory ".")))) - #true) + (cond + ((string-suffix? ".zip" source) + (invoke "unzip" source)) + ((tarball? source) + (invoke "tar" "xvf" source)) + (else + (let ((name (strip-store-file-name source)) + (command (compressor source))) + (copy-file source name) + (when command + (invoke command "--decompress" name))))) + ;; Attempt to change into child directory. + (and=> (first-subdirectory ".") chdir)))) @end lisp Note the @code{chdir} call: it changes the working directory to where the source was @@ -1321,14 +1334,10 @@ Extended example (let ((bash-directory (assoc-ref inputs "bash")) (output-directory (assoc-ref outputs "out")) (doc-directory (assoc-ref outputs "doc"))) - ;; ... - #true)) + ;; ... )) @end lisp -The procedure must return @code{#true} on success. It's brittle to rely on the return -value of the last expression used to tweak the phase because there is no -guarantee it would be a @code{#true}. Hence the trailing @code{#true} to ensure the right value -is returned on success. +Its return value is ignored. @subsubsection Code staging