From unknown Sat Jun 21 03:27:33 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#43064 <43064@debbugs.gnu.org> To: bug#43064 <43064@debbugs.gnu.org> Subject: Status: [PATCH] gexp: computed-file: Prevent mistakenly overriding default option values. Reply-To: bug#43064 <43064@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:27:33 +0000 retitle 43064 [PATCH] gexp: computed-file: Prevent mistakenly overriding de= fault option values. reassign 43064 guix-patches submitter 43064 Maxim Cournoyer severity 43064 normal tag 43064 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 27 01:14:53 2020 Received: (at submit) by debbugs.gnu.org; 27 Aug 2020 05:14:53 +0000 Received: from localhost ([127.0.0.1]:41366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBAFQ-0005KB-Ln for submit@debbugs.gnu.org; Thu, 27 Aug 2020 01:14:53 -0400 Received: from lists.gnu.org ([209.51.188.17]:35724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBAFM-0005K1-Oj for submit@debbugs.gnu.org; Thu, 27 Aug 2020 01:14:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBAFM-0001Tt-Jp for guix-patches@gnu.org; Thu, 27 Aug 2020 01:14:48 -0400 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:35083) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBAFK-0006gA-SO for guix-patches@gnu.org; Thu, 27 Aug 2020 01:14:48 -0400 Received: by mail-qk1-x731.google.com with SMTP id p25so4905023qkp.2 for ; Wed, 26 Aug 2020 22:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=T4tZLkhcVqNWkplElLEsdqQ/7U/CXUzLU6orPqVLDYU=; b=QpmzJL81vJdxXL4ij+u9N1WTYa+VYNOp/LC7Fza4dxSv5D1rskipeX5nScTSxTyisv 2Q3tZSTSIjHtzAQis1fD3z4N9FysH7gG3z1szBLzHa3o5kZBemkCGpc2Qc72qzlVWNl3 baMTlPemnPRQanCt6FVMJlg/AMo85RcyBp+jkIfe43LxAg+dBsAe5wKaNuE7GZKzzZ87 rOzoIdhEQZB5DiHp8tMloLXWc0iVW6TTctYYv5A0VcAi+dC1y8AJYDXaxlERu1pFrZj9 JZbc2SUI3yYK6DnWqRPhQpEjjrwG7kSn/azJhs/zubSui1ZH3VzTRfomGanP5dVZ9QWF ZZeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=T4tZLkhcVqNWkplElLEsdqQ/7U/CXUzLU6orPqVLDYU=; b=jok4DH4WzeKFxVbrruBivgr2E2lbms/a2Ml+dFc04VG3dip+Snop5dpqeUbc3XuTmT 56WY0fQQbBQqnp3FQNTv2fkAnCKitUMAFscTjWbOqssSCxM6919VvHz0/kG2h2josZ6v 0bY/Te/01LkiRVxqzr/QXaObDe1k1sveb4wwMjLX8emdoV44MM7Xe8PKWLv1jS01wMA+ aJcnX9bfSg9byMUmL2YDfPIJnSbYeZiofJDUv6YOlj+ypaAh6MBbwX/SIEqvvq507inq cbcmxfz6rKzAWzojxAN4T0EFRwQ+Bd6FmHh6mJXcIk0lrThfoYqK8RyrfYkBKm86uhUs Tj9w== X-Gm-Message-State: AOAM531KirHRFOdGkUbsWrqKc+xTaqUWI/xxRUjQ2DG/wNoLEnSVwFhb 6fePWn+jDcALPtvPkxiscZIpEcy/KVg= X-Google-Smtp-Source: ABdhPJzoyw4xVKD27QuLu9BAv3xB2PqrA72xn7Y+t+fc7AgGdPqMgcosMYKTLOB6c4SpTV/pLumntg== X-Received: by 2002:a37:b247:: with SMTP id b68mr3170209qkf.90.1598505285091; Wed, 26 Aug 2020 22:14:45 -0700 (PDT) Received: from localhost.localdomain (dsl-205-151-56-239.b2b2c.ca. [205.151.56.239]) by smtp.gmail.com with ESMTPSA id z14sm950469qtn.92.2020.08.26.22.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 22:14:44 -0700 (PDT) From: Maxim Cournoyer To: guix-patches@gnu.org Subject: [PATCH] gexp: computed-file: Prevent mistakenly overriding default option values. Date: Thu, 27 Aug 2020 01:12:26 -0400 Message-Id: <20200827051226.28117-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset=yes Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qk1-x731.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: submit Cc: Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Because the options are passed as a list rather than actual keyword arguments, omitting to repeat the default values in that list easily causes the default values to be lost. * guix/gexp.scm (%computed-file-default-options): New variable. (alist->plist): New procedure. (computed-file-combine-options-with-defaults): New procedure. (computed-file): Use the above procedures to form the default OPTIONS value. Update doc. Use the COMPUTED-FILE-COMBINE-OPTIONS-WITH-DEFAULTS procedure to combine the user options with the default options, when they aren't overridden. * tests/gexp.scm ("computed-file options defaults honored") ("computed-file options defaults overridden"): Add tests. --- guix/gexp.scm | 42 +++++++++++++++++++++++++++++++++++++++--- tests/gexp.scm | 12 ++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/guix/gexp.scm b/guix/gexp.scm index 67b6121313..14e07e8fe6 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2018 Clément Lassieur ;;; Copyright © 2018 Jan Nieuwenhuizen ;;; Copyright © 2019, 2020 Mathieu Othacehe +;;; Copyright © 2020 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -503,14 +504,49 @@ This is the declarative counterpart of 'text-file'." (guile computed-file-guile) ; (options computed-file-options)) ;list of arguments +;;; Alist containing the default options for computed-file. +(define %computed-file-default-options '((#:local-build? . #t))) + +(define (alist->plist alist) + "Transform an association list into a property list." + (fold (lambda (current acc) + (match current + ((x . y) + (append acc (list x y))))) + '() + alist)) + +(define (computed-file-combine-options-with-defaults options) + + (define alist->keys + (match-lambda + (((key . value) ...) + key))) + + (define (plist->keys plist) + (filter keyword? plist)) + + (define (default-keys->plist keys) + (append-map (lambda (key) + (list key (assq-ref %computed-file-default-options key))) + keys)) + + (let ((default-keys (lset-difference + eq? + (alist->keys %computed-file-default-options) + (plist->keys options)))) + (append options (default-keys->plist default-keys)))) + (define* (computed-file name gexp - #:key guile (options '(#:local-build? #t))) + #:key guile (options (alist->plist + %computed-file-default-options))) "Return an object representing the store item NAME, a file or directory computed by GEXP. OPTIONS is a list of additional arguments to pass -to 'gexp->derivation'. +to 'gexp->derivation', which defaults to %COMPUTED-FILE-DEFAULT-OPTIONS. This is the declarative counterpart of 'gexp->derivation'." - (%computed-file name gexp guile options)) + (let ((options* (computed-file-combine-options-with-defaults options))) + (%computed-file name gexp guile options*))) (define-gexp-compiler (computed-file-compiler (file ) system target) diff --git a/tests/gexp.scm b/tests/gexp.scm index 1beeb67c21..350065b58d 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2020 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -62,6 +63,9 @@ #:target target) #:guile-for-build (%guile-for-build))) +(define computed-file-combine-options-with-defaults + (@@ (guix gexp) computed-file-combine-options-with-defaults)) + (define %extension-package ;; Example of a package to use when testing 'with-extensions'. (dummy-package "extension" @@ -1367,6 +1371,14 @@ (return (and (derivation? drv1) (derivation? drv2) (store-path? item))))) +(test-equal "computed-file options defaults honored" + '(#:substitutable? #t #:local-build? #t) + (computed-file-combine-options-with-defaults '(#:substitutable? #t))) + +(test-equal "computed-file options defaults overridden" + '(#:local-build? #f) + (computed-file-combine-options-with-defaults '(#:local-build? #f))) + (test-assertm "lower-object, computed-file" (let* ((text (plain-file "foo" "Hello!")) (exp #~(begin -- 2.27.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 27 01:22:41 2020 Received: (at 43064) by debbugs.gnu.org; 27 Aug 2020 05:22:41 +0000 Received: from localhost ([127.0.0.1]:41372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBAMz-0005WW-KL for submit@debbugs.gnu.org; Thu, 27 Aug 2020 01:22:41 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:44715) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBAMx-0005WJ-Up for 43064@debbugs.gnu.org; Thu, 27 Aug 2020 01:22:40 -0400 Received: by mail-qk1-f196.google.com with SMTP id d139so4858565qke.11 for <43064@debbugs.gnu.org>; Wed, 26 Aug 2020 22:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=61yVeHTp1yBj5m95N+tPBDw9+V0M0/g5SqE3JzQIjvo=; b=P2FipEwC1/olioSvjcWJsH0s+QluY/Nq+3V0/jz4X6x4dY3BO8oC7pmJOp6rI0m/2y 03f6IiGpNrOWLmSXSKFxjIZSObpAk1TRl0NjTMv2XQakYcA0nrITui5Eccbi6IT3ufzv 6JtEgAPbhud3YsLEAmXeNT4s6cofjdv9Qxqmrh4OkXKhBRc4YRMlXoipmCD9fIN6TWY9 y97zlgpLAp2BkEBTb0nGs9zDmGprqKu+YcVUwrY2jGAAbWyA28jqpKJG0/qeSg1phh/y spEKCc1Cnd6GDbkglfqrFTGFH4KJH4covU8dmxVisHSJevPa57r6+8rQqumJ8hkDb9bs VHRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=61yVeHTp1yBj5m95N+tPBDw9+V0M0/g5SqE3JzQIjvo=; b=BguELBONybtHucLbwTQWtMs9i10gghT/As16cB8gOJ+TXG24hQGMnQgSjEMHE0Vz+A 1xMo7/wsFPSfkSM/HgvwUrGPPw/LL4NwelzCYx/pvAyF4+gSrkTaXYw6JvdTrwAjDHif Z6vxCF4Nymh4zxzu4roVqDthl3UH4XdEgIfjA/LY6CRxopI0BtITZZaY7fiLH28eXk5p b5fLh5FFZgqaMERIPSEMDG/iZ5ROo2P0aOfpNsBBN2QcToqujSMmFyp0ntNh2dnmyuYP cvj9S8M/wI0DnMRzq23JCPzKWCHQEGZr7TlOumQW7sgN3dB+q94tTf8vRZJHFBd3pmYF x0FQ== X-Gm-Message-State: AOAM533IoqvMfOUsZ0CegVVLbPPXQpRe+7XevFl8E6E2J88SPM6Venin CjkOAvtsvz9iDlyajWmMAY8eol7SZZo= X-Google-Smtp-Source: ABdhPJwOIR+uaurNLpSTR/hBNcIKdwylzuZd5WLSjKcribF7nYvBNezrKNlXuED/lKph7ShMhpIrVA== X-Received: by 2002:a37:314:: with SMTP id 20mr1725988qkd.274.1598505754269; Wed, 26 Aug 2020 22:22:34 -0700 (PDT) Received: from localhost.localdomain (dsl-205-151-56-239.b2b2c.ca. [205.151.56.239]) by smtp.gmail.com with ESMTPSA id m66sm1068071qkf.86.2020.08.26.22.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 22:22:33 -0700 (PDT) From: Maxim Cournoyer To: 43064@debbugs.gnu.org Subject: [PATCH] Revert "system: image: Do not offload image files." Date: Thu, 27 Aug 2020 01:21:22 -0400 Message-Id: <20200827052122.28627-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43064 Cc: Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This reverts commit 6a9581741e4ee81226aeb2f1c997df76670a6aab, which is obsoleted by the previous commit. --- gnu/system/image.scm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gnu/system/image.scm b/gnu/system/image.scm index c1a718d607..36f56e237d 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -266,8 +266,7 @@ used in the image." #$output image-root))))) (computed-file "partition.img" image-builder - #:options `(#:local-build? #t ;typically large file - #:references-graphs ,inputs)))) + #:options `(#:references-graphs ,inputs)))) (define (partition->config partition) ;; Return the genimage partition configuration for PARTITION. @@ -325,8 +324,7 @@ image ~a { #~(symlink (string-append #$image-dir "/" #$genimage-name) #$output) - #:options `(#:local-build? #t ;typically large file - #:substitutable? ,substitutable?)))) + #:options `(#:substitutable? ,substitutable?)))) ;; @@ -403,8 +401,7 @@ used in the image. " #:volume-id #$root-label #:volume-uuid #$root-uuid))))) (computed-file name builder - #:options `(#:local-build? #t ;typically large file - #:references-graphs ,inputs + #:options `(#:references-graphs ,inputs #:substitutable? ,substitutable?)))) -- 2.27.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 30 15:41:24 2020 Received: (at 43064) by debbugs.gnu.org; 30 Aug 2020 19:41:24 +0000 Received: from localhost ([127.0.0.1]:50779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCTCe-0005Pj-2w for submit@debbugs.gnu.org; Sun, 30 Aug 2020 15:41:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCTCc-0005PW-4k for 43064@debbugs.gnu.org; Sun, 30 Aug 2020 15:41:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44063) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCTCW-0006Gr-S2; Sun, 30 Aug 2020 15:41:16 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=43452 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kCTCT-0005dq-W3; Sun, 30 Aug 2020 15:41:16 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: [bug#43064] [PATCH] gexp: computed-file: Prevent mistakenly overriding default option values. References: <20200827051226.28117-1-maxim.cournoyer@gmail.com> Date: Sun, 30 Aug 2020 21:41:11 +0200 In-Reply-To: <20200827051226.28117-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Thu, 27 Aug 2020 01:12:26 -0400") Message-ID: <877dtfj50o.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 43064 Cc: 43064@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Maxim Cournoyer skribis: > Because the options are passed as a list rather than actual keyword argum= ents, > omitting to repeat the default values in that list easily causes the defa= ult > values to be lost. > > * guix/gexp.scm (%computed-file-default-options): New variable. > (alist->plist): New procedure. > (computed-file-combine-options-with-defaults): New procedure. > (computed-file): Use the above procedures to form the default OPTIONS val= ue. > Update doc. Use the COMPUTED-FILE-COMBINE-OPTIONS-WITH-DEFAULTS procedur= e to > combine the user options with the default options, when they aren't > overridden. > * tests/gexp.scm ("computed-file options defaults honored") > ("computed-file options defaults overridden"): Add tests. How about exposing some of the relevant options as keywords? We can keep #:options as an =E2=80=9Cescape hatch=E2=80=9D and add things like like #:local-build? etc. That would be simpler and more idiomatic. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 31 00:38:25 2020 Received: (at 43064) by debbugs.gnu.org; 31 Aug 2020 04:38:26 +0000 Received: from localhost ([127.0.0.1]:51202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCbaL-0005hF-L1 for submit@debbugs.gnu.org; Mon, 31 Aug 2020 00:38:25 -0400 Received: from mail-qk1-f180.google.com ([209.85.222.180]:33307) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCbaJ-0005h0-GV for 43064@debbugs.gnu.org; Mon, 31 Aug 2020 00:38:23 -0400 Received: by mail-qk1-f180.google.com with SMTP id p4so5104167qkf.0 for <43064@debbugs.gnu.org>; Sun, 30 Aug 2020 21:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rRh+KbFFqT+InHPiAc5oDiFEKrVrSAGMDk4jhRgcugU=; b=R2X4ZokcBfcz5+MTV3V1Oh2eDVY5IiCXAkPuYXrzApiP2Vh1INf/iVkr1LA6NWwSYb awUb/XZoZfuhq07bUNdkT3HU7gXj+U4nCGw1BjgE9EA6+Y099umO+8UTQ8EzK8VVEcLG CLtnxnowIIObhLG8DtR6BfaqYbWpRUMymxCJNbVJN+URkg7NzC3S7xDyobLpyaEZoTe3 N7Zrix4QQfH72Q+s4FHGaAb40WHNBULBKRWZ+2Q+n/h/iBLYHGdy6ts4fsKLuVoBFTdC /RcFUBZ9dxFlVHhS1dlwr+7GBouYyYvFzhhou20FahsoiNFlHPG1dRU7gtaucIQiG7NK FV4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rRh+KbFFqT+InHPiAc5oDiFEKrVrSAGMDk4jhRgcugU=; b=fbbiJZcCwuYRrr0rviEauFFwoCGc/EqJsAT55EyRxhcAndHMVh6yfnZWJ8DN+9/znL dN5pfyss9KjxaspwwyvWas03gWRGmAovJXe3os3cqXDSfi1xTFMEmAV8bHSlUKcPpaPx kSPR9LAcEgNTezuiXF3sFixcT3N9Yhdm9jprFI7o+c5wRy21vhcXCLvtnhSIAVbUw07q NalIIvDaKtm5HEtMwBPWqTYYS2TXGHZVuqnOFphNp9AxB2JMHttUUwxxpuu1cTTMvU7z hbZdFLRrW9VFwyxPhqjng3o3mwdVBhXHfUdVpJz4BHvwwU+BTj1cIQBlKTI0h4knLZpM O1Jw== X-Gm-Message-State: AOAM533lSQKWooPdwymZVyghJAsTbH2fWY3sp8B/Mp1Qd5DXMRQaiubZ 1Qcg4TvA7w181wUHnQsugil0T9AxnnE= X-Google-Smtp-Source: ABdhPJz0HteJ/yKUPWb1PtE/HPRBFFxnEjctG0oBLHxaZWGxdDQ4D2OFAspEupZXeTJYivmux/Y6ug== X-Received: by 2002:a05:620a:686:: with SMTP id f6mr9479696qkh.60.1598848697812; Sun, 30 Aug 2020 21:38:17 -0700 (PDT) Received: from localhost.localdomain (dsl-10-146-221.b2b2c.ca. [72.10.146.221]) by smtp.gmail.com with ESMTPSA id w44sm9160066qtj.86.2020.08.30.21.38.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Aug 2020 21:38:17 -0700 (PDT) From: Maxim Cournoyer To: 43064@debbugs.gnu.org Subject: [PATCH v2] gexp: computed-file: Prevent mistakenly overriding default option values. Date: Mon, 31 Aug 2020 00:37:44 -0400 Message-Id: <20200831043744.11165-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <877dtfj50o.fsf@gnu.org> References: <877dtfj50o.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43064 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= , Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) In order to do so, default to an empty options list, and expose options whose default values are sensitive directly as keyword arguments. * guix/gexp.scm (computed-file): Extract the LOCAL-BUILD? parameter from the OPTIONS parameter to make it a stand-alone keyword argument. Introduce an OPTIONS* binding which is obtained by combining the LOCAL-BUILD? keyword and its value with OPTIONS. Suggested-by: Ludovic Courtès --- guix/gexp.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/guix/gexp.scm b/guix/gexp.scm index 67b6121313..9d3c52e783 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2018 Clément Lassieur ;;; Copyright © 2018 Jan Nieuwenhuizen ;;; Copyright © 2019, 2020 Mathieu Othacehe +;;; Copyright © 2020 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -504,13 +505,15 @@ This is the declarative counterpart of 'text-file'." (options computed-file-options)) ;list of arguments (define* (computed-file name gexp - #:key guile (options '(#:local-build? #t))) + #:key guile (local-build? #t) (options '())) "Return an object representing the store item NAME, a file or directory -computed by GEXP. OPTIONS is a list of additional arguments to pass -to 'gexp->derivation'. +computed by GEXP. When LOCAL-BUILD? is #t (the default), it ensures the +corresponding derivation is built locally. OPTIONS may be used to pass +additional arguments to 'gexp->derivation'. This is the declarative counterpart of 'gexp->derivation'." - (%computed-file name gexp guile options)) + (let ((options* `(#:local-build? ,local-build? ,@options))) + (%computed-file name gexp guile options*))) (define-gexp-compiler (computed-file-compiler (file ) system target) -- 2.27.0 From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 31 09:34:55 2020 Received: (at 43064) by debbugs.gnu.org; 31 Aug 2020 13:34:55 +0000 Received: from localhost ([127.0.0.1]:51839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCjxW-0006rl-Si for submit@debbugs.gnu.org; Mon, 31 Aug 2020 09:34:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCjxV-0006rX-Qi for 43064@debbugs.gnu.org; Mon, 31 Aug 2020 09:34:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56208) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCjxQ-0001v8-I2; Mon, 31 Aug 2020 09:34:48 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=36214 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kCjxQ-0005xZ-4x; Mon, 31 Aug 2020 09:34:48 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: [PATCH v2] gexp: computed-file: Prevent mistakenly overriding default option values. References: <877dtfj50o.fsf@gnu.org> <20200831043744.11165-1-maxim.cournoyer@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 15 Fructidor an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 31 Aug 2020 15:34:46 +0200 In-Reply-To: <20200831043744.11165-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Mon, 31 Aug 2020 00:37:44 -0400") Message-ID: <87lfhvc51l.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 43064 Cc: 43064@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Maxim Cournoyer skribis: > In order to do so, default to an empty options list, and expose options w= hose > default values are sensitive directly as keyword arguments. > > * guix/gexp.scm (computed-file): Extract the LOCAL-BUILD? parameter from = the > OPTIONS parameter to make it a stand-alone keyword argument. Introduce an > OPTIONS* binding which is obtained by combining the LOCAL-BUILD? keyword = and > its value with OPTIONS. > > Suggested-by: Ludovic Court=C3=A8s [...] > (define* (computed-file name gexp > - #:key guile (options '(#:local-build? #t))) > + #:key guile (local-build? #t) (options '())) > "Return an object representing the store item NAME, a file or directory > -computed by GEXP. OPTIONS is a list of additional arguments to pass > -to 'gexp->derivation'. > +computed by GEXP. When LOCAL-BUILD? is #t (the default), it ensures the > +corresponding derivation is built locally. OPTIONS may be used to pass > +additional arguments to 'gexp->derivation'. >=20=20 > This is the declarative counterpart of 'gexp->derivation'." Please update doc/guix.texi as well. Otherwise LGTM, thanks! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 01 09:00:12 2020 Received: (at 43064-done) by debbugs.gnu.org; 1 Sep 2020 13:00:12 +0000 Received: from localhost ([127.0.0.1]:55343 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kD5tU-0006qs-2K for submit@debbugs.gnu.org; Tue, 01 Sep 2020 09:00:12 -0400 Received: from mail-qv1-f66.google.com ([209.85.219.66]:42529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kD5tQ-0006pY-6d for 43064-done@debbugs.gnu.org; Tue, 01 Sep 2020 09:00:10 -0400 Received: by mail-qv1-f66.google.com with SMTP id h1so427624qvo.9 for <43064-done@debbugs.gnu.org>; Tue, 01 Sep 2020 06:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=5EeycRaTztmjZqy3jVWwWnuhVh7uk3sPM547roM+8B4=; b=RRPvN1wJ1CDXp53vIsCNOi4rJ8mmd4oAc/D1dfdrdXCs4SwaYQwnLKWoFV/dnHfNdq LJL+bl3+1F1evcJY1ALy+DKiFfwUvs+skuVPfyaORswBQe0LBdmYOhb+BwcCfT7i8gfw rWDfUDiNKJEyXifVJGU0bcFOAqlTAHxG3dXWJ9uT/FvvtLsH62Op64K+Ncj1DTHgUbdG U1xjbkbAOm1UuTDfGBx1PJEXF3RHrEbq31KOIvJc5iCg++thhIlTUC9VTnCic7d1kKYf VhkSfQooJCFUq1Gr9Pe5syncZEnMmsQCWuGsfk35gm7IuVmcKwzST/OVUczaq8loUwPg PTRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=5EeycRaTztmjZqy3jVWwWnuhVh7uk3sPM547roM+8B4=; b=NOECM7/0LaoaPvCW50qLF/ghqyd24tAcQlMhbAFH1U5RaBJbXgMAVpLcPjs418l9WE 7v72bYvguwCbHarYHILWXxEnxORfObGOD5iaMRCZwulMYV6yQ9vTd/zBLRDpWKyjjM+y iLcVf1yzSD+mwzsgQ9xWXwgglDZGLDNiyeEWvqk0zJdmuRzKNSETkFW/uZb9+KPBaMOC Y5/8Qjkj9IvhzgRvWzNn7gYPMF56Yg23z1attFDSjAYfK/4VDq9c2KEHwgWhI22y/UJM EwaCjwhYXn4E9XHYorbUJuFCkHzE2zdEA+kUerVCoE3E+1SS0m3akNzumBmdtpgojfTx ybQQ== X-Gm-Message-State: AOAM532XiWW7Zmq/TGvzxQBRRaSuxfMcl745z1op30CKolGIVb2FDH2d JtDvEvjOwivg23hhR9gYklDDPTQYCTk= X-Google-Smtp-Source: ABdhPJxOndr7v07c8MZro1gaZtzk3CUSmEqB4GZVHjbD+p/87LHCmY5TiYbN0Ak33nHjmwlH+JfOtw== X-Received: by 2002:a0c:cb0e:: with SMTP id o14mr1834969qvk.164.1598965202334; Tue, 01 Sep 2020 06:00:02 -0700 (PDT) Received: from hurd (dsl-10-133-254.b2b2c.ca. [72.10.133.254]) by smtp.gmail.com with ESMTPSA id r24sm1256710qtm.70.2020.09.01.06.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 06:00:01 -0700 (PDT) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [PATCH v2] gexp: computed-file: Prevent mistakenly overriding default option values. References: <877dtfj50o.fsf@gnu.org> <20200831043744.11165-1-maxim.cournoyer@gmail.com> <87lfhvc51l.fsf@gnu.org> Date: Tue, 01 Sep 2020 09:00:12 -0400 In-Reply-To: <87lfhvc51l.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 31 Aug 2020 15:34:46 +0200") Message-ID: <87imcxzm77.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43064-done Cc: 43064-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ludovic Court=C3=A8s writes: > Hi, > > Maxim Cournoyer skribis: > >> In order to do so, default to an empty options list, and expose options = whose >> default values are sensitive directly as keyword arguments. >> >> * guix/gexp.scm (computed-file): Extract the LOCAL-BUILD? parameter from= the >> OPTIONS parameter to make it a stand-alone keyword argument. Introduce = an >> OPTIONS* binding which is obtained by combining the LOCAL-BUILD? keyword= and >> its value with OPTIONS. >> >> Suggested-by: Ludovic Court=C3=A8s [...] > Please update doc/guix.texi as well. > > Otherwise LGTM, thanks! > > Ludo=E2=80=99. Done! Thank you, Maxim From unknown Sat Jun 21 03:27:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 30 Sep 2020 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator