Subject: [PATCH 1/5] pack: Extract keyword-ref procedure from debian-archive.

From: Maxim Cournoyer <[email-masked]>
Date: Fri, 3 Feb 2023 17:14:04 -0500

Rationale: the upcoming rpm-archive builder will also use it.

* guix/scripts/pack.scm:
(keyword-ref): New top-level procedure, extracted from...
(debian-archive): ... here.  Adjust usages accordingly.
---

 guix/scripts/pack.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index f65642fb85..7e466a2be7 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -194,6 +194,12 @@ (define (symlink-spec-option-parser opt name arg result)
      (leave (G_ "~a: invalid symlink specification~%")
             arg))))
 
+(define (keyword-ref lst keyword)
+  "Return the value of KEYWORD in LST, else #f."
+  (match (memq keyword lst)
+    ((_ value . _) value)
+    (#f #f)))
+
 
 ;;;
 ;;; Tarball format.
@@ -762,20 +768,15 @@ (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))
+              #$(keyword-ref `(,@extra-options) #:control-file))
 
             (define postinst-file
-              (keyword-ref '#$extra-options #:postinst-file))
+              #$(keyword-ref `(,@extra-options) #:postinst-file))
 
             (define triggers-file
-              (keyword-ref '#$extra-options #:triggers-file))
+              #$(keyword-ref `(,@extra-options) #:triggers-file))
 
             (define control-tarball-file-name
               (string-append "control.tar"
-- 
2.39.1