From patchwork Fri Feb 17 01:49:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 47029 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 5B1E416952; Fri, 17 Feb 2023 01:52:09 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,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 9D95E1693E for ; Fri, 17 Feb 2023 01:52:08 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSpu1-0007fb-AN; Thu, 16 Feb 2023 20:51: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 1pSptv-0007dw-3D for guix-patches@gnu.org; Thu, 16 Feb 2023 20:51:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSptu-0004NE-RJ for guix-patches@gnu.org; Thu, 16 Feb 2023 20:51:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSptu-0007VH-MV for guix-patches@gnu.org; Thu, 16 Feb 2023 20:51:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61255] [PATCH v2 2/8] pack: Use let-keywords instead of keyword-ref. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Feb 2023 01:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61255 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61255@debbugs.gnu.org Cc: Josselin Poiret , Tobias Geerinckx-Rice , Maxim Cournoyer , Simon Tournier , Mathieu Othacehe , ludo@gnu.org, Christopher Baines , Ricardo Wurmus Received: via spool by 61255-submit@debbugs.gnu.org id=B61255.167659861628699 (code B ref 61255); Fri, 17 Feb 2023 01:51:02 +0000 Received: (at 61255) by debbugs.gnu.org; 17 Feb 2023 01:50:16 +0000 Received: from localhost ([127.0.0.1]:38071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSptA-0007Sj-1u for submit@debbugs.gnu.org; Thu, 16 Feb 2023 20:50:16 -0500 Received: from mail-qv1-f50.google.com ([209.85.219.50]:33506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSpt8-0007SE-Ay for 61255@debbugs.gnu.org; Thu, 16 Feb 2023 20:50:14 -0500 Received: by mail-qv1-f50.google.com with SMTP id j9so3014345qvt.0 for <61255@debbugs.gnu.org>; Thu, 16 Feb 2023 17:50:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=0qHTKOtyMhSw+KuYJe51SCUVMgqGcETF+XOOn/CziL8=; b=VPX5OcW6SKfx006wrAK0ijMb2VLPzFxZEK5iDwBLuHV34XKKrv66Pevkt8de0ttOxJ Ty+zVScfgQDb5wUMVw+Xd3l48XgKCaAJn4jwPmbqjotD10cXJwIV/oX/N4yv24gXITIc Qd4rDL4wjDtMYY1o+qX8vtmvDwdEWK0HEVtg7bAdtAjwPIMQ+vGgZWkZrBdjXd8YQv0Z lR4FSdnjv/UYQkyYrvoHa+GIv8XkLKQoycYW3LCGQQv/2j56jNtyNZk3ip8hZH4MBTqS 7RqUJvY4OnsW2uArCoLTeE/3oKS/aVkEJ4Zw/VuHana1StOtu0Cb3Bm9LQmLQ/SxWbjx SnkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=0qHTKOtyMhSw+KuYJe51SCUVMgqGcETF+XOOn/CziL8=; b=MNjIee8k7cjNg12T12mAclKVK2dvv4q+peQa9ttwCqGcINFQmb01qywNBS8u7aUVf9 Gl+dMk8YMotKtRV6FmUPgYqssu+jIeV6fzOWBreyffzFX0Y6Uz4GsSPmwGq+KuhAnPf3 2IWPiuUBWzK1wTUqZBRAi0+bSC3NHxfLMC+yNaoG3/X2ciG0Sk5vXziL0utRuIfMF6EP iro4BlIsiyoJAULBqEq0XBXanZBFuJESV0NZob/aaxpCxwXwdqTKs27bnml2T6I5UHp0 ljagUDNHctqFi1nCTQqsnYNi2I1lhAYnOAcgd1ynj/ucgZ97FvuGCbt5pVnExfFQ74Z3 MygA== X-Gm-Message-State: AO0yUKUmq3NdhC7f+y4+EHm0m0R+8VTlk80Q/y46LZ1Tyyd2IjrM8C/R NhhlFlGnZ1dWGsW+r9/Jnup6wX2FM1TdzZ2b X-Google-Smtp-Source: AK7set+a/bbs5EJg/5YM+jHV5aJGRZ1dOpjIJKJ+f9ERr696Uc1K553IBHnq9g+R27dvnAotJKDmoA== X-Received: by 2002:a05:6214:5296:b0:56e:b5a1:b52d with SMTP id kj22-20020a056214529600b0056eb5a1b52dmr13554460qvb.28.1676598608768; Thu, 16 Feb 2023 17:50:08 -0800 (PST) Received: from localhost.localdomain (dsl-152-188.b2b2c.ca. [66.158.152.188]) by smtp.gmail.com with ESMTPSA id g66-20020a37b645000000b0073b425f6e33sm2316242qkf.100.2023.02.16.17.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 17:50:08 -0800 (PST) From: Maxim Cournoyer Date: Fri, 17 Feb 2023 02:49:31 +0100 Message-Id: <20230217014938.20919-3-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230217014938.20919-1-maxim.cournoyer@gmail.com> References: <20230217014938.20919-1-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/scripts/pack.scm: (debian-archive): Bind extra-options keyword arguments via let-keywords. --- Changes in v2: - Use let-keywords instead of custom keyword-ref guix/scripts/pack.scm | 97 ++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 53 deletions(-) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index f65642fb85..e552cb108a 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -678,16 +678,15 @@ (define %valid-compressors '("gzip" "xz" "none")) (define data-tarball (computed-file (string-append "data.tar" (compressor-extension compressor)) - (self-contained-tarball/builder - profile - #:profile-name profile-name - #:compressor compressor - #:localstatedir? localstatedir? - #:symlinks symlinks - #:archiver archiver) - #:local-build? #f ;allow offloading - #:options (list #:references-graphs `(("profile" ,profile)) - #:target target))) + (self-contained-tarball/builder profile + #:profile-name profile-name + #:compressor compressor + #:localstatedir? localstatedir? + #:symlinks symlinks + #:archiver archiver) + #:local-build? #f ;allow offloading + #:options (list #:references-graphs `(("profile" ,profile)) + #:target target))) (define build (with-extensions (list guile-gcrypt) @@ -702,6 +701,7 @@ (define build (guix build utils) (guix profiles) (ice-9 match) + (ice-9 optargs) (srfi srfi-1)) (define machine-type @@ -762,32 +762,23 @@ (define data-tarball-file-name (strip-store-file-name (copy-file #+data-tarball data-tarball-file-name) - (define (keyword-ref lst keyword) - (match (memq keyword lst) - ((_ value . _) value) - (#f #f))) - ;; Generate the control archive. - (define control-file - (keyword-ref '#$extra-options #:control-file)) - - (define postinst-file - (keyword-ref '#$extra-options #:postinst-file)) - - (define triggers-file - (keyword-ref '#$extra-options #:triggers-file)) - - (define control-tarball-file-name - (string-append "control.tar" - #$(compressor-extension compressor))) - - ;; Write the compressed control tarball. Only the control file is - ;; mandatory (see: 'man deb' and 'man deb-control'). - (if control-file - (copy-file control-file "control") - (call-with-output-file "control" - (lambda (port) - (format port "\ + (let-keywords '#$extra-options #f + ((control-file #f) + (postinst-file #f) + (triggers-file #f)) + + (define control-tarball-file-name + (string-append "control.tar" + #$(compressor-extension compressor))) + + ;; Write the compressed control tarball. Only the control file is + ;; mandatory (see: 'man deb' and 'man deb-control'). + (if control-file + (copy-file control-file "control") + (call-with-output-file "control" + (lambda (port) + (format port "\ Package: ~a Version: ~a Description: Debian archive generated by GNU Guix. @@ -797,28 +788,28 @@ (define control-tarball-file-name Section: misc ~%" package-name package-version architecture)))) - (when postinst-file - (copy-file postinst-file "postinst") - (chmod "postinst" #o755)) + (when postinst-file + (copy-file postinst-file "postinst") + (chmod "postinst" #o755)) - (when triggers-file - (copy-file triggers-file "triggers")) + (when triggers-file + (copy-file triggers-file "triggers")) - (define tar (string-append #+archiver "/bin/tar")) + (define tar (string-append #+archiver "/bin/tar")) - (apply invoke tar - `(,@(tar-base-options - #:tar tar - #:compressor #+(and=> compressor compressor-command)) - "-cvf" ,control-tarball-file-name - "control" - ,@(if postinst-file '("postinst") '()) - ,@(if triggers-file '("triggers") '()))) + (apply invoke tar + `(,@(tar-base-options + #:tar tar + #:compressor #+(and=> compressor compressor-command)) + "-cvf" ,control-tarball-file-name + "control" + ,@(if postinst-file '("postinst") '()) + ,@(if triggers-file '("triggers") '()))) - ;; Create the .deb archive using GNU ar. - (invoke (string-append #+binutils "/bin/ar") "-rv" #$output - "debian-binary" - control-tarball-file-name data-tarball-file-name))))) + ;; Create the .deb archive using GNU ar. + (invoke (string-append #+binutils "/bin/ar") "-rv" #$output + "debian-binary" + control-tarball-file-name data-tarball-file-name)))))) (gexp->derivation (string-append name ".deb") build