[bug#76594,v3,1/4] gnu: quilt: Use gexps.

Message ID CH3PR84MB3424266E74432DF8762181BEC5B02@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
State New
Headers
Series some quilt things |

Commit Message

Morgan Smith April 13, 2025, 5:39 p.m. UTC
  * gnu/packages/patchutils.scm (quilt): Use gexps.

Change-Id: I81373365d0729b90b3e31e122eaede2daa7ae5cb
---
 gnu/packages/patchutils.scm | 111 ++++++++++++++++++------------------
 1 file changed, 57 insertions(+), 54 deletions(-)


base-commit: 03edfea126a88110b520469e96eae73ce86d4b7d
  

Patch

diff --git a/gnu/packages/patchutils.scm b/gnu/packages/patchutils.scm
index 3cd3507b07..b929ed9a5a 100644
--- a/gnu/packages/patchutils.scm
+++ b/gnu/packages/patchutils.scm
@@ -52,6 +52,7 @@  (define-module (gnu packages patchutils)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages guile)
   #:use-module (gnu packages less)
   #:use-module (gnu packages mail)
   #:use-module (gnu packages text-editors)
@@ -182,61 +183,63 @@  (define-public quilt
      (list gettext-minimal))
     (inputs
      (list bash-minimal perl less file gzip ed
-           diffutils diffstat findutils tar))
+           diffutils diffstat findutils tar
+           ;; for wrap-script
+           guile-3.0))
     (arguments
-     '(#:parallel-tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'check)
-         (add-after 'install 'wrap-program
-           ;; quilt's configure checks for the absolute path to the utilities it
-           ;; needs, but uses only the name when invoking them, so we need to
-           ;; make sure the quilt script can find those utilities when run.
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((cmd-path (lambda (cmd) (dirname (which cmd))))
-                   (out      (assoc-ref outputs "out")))
-               (wrap-program (string-append out "/bin/quilt")
-                 `("PATH" ":" prefix
-                   ,(map cmd-path
-                         (list "bash" "diff" "diffstat" "ed" "file" "find" "grep"
-                               "gzip" "less" "patch" "perl" "rm" "sed" "tar"))))
-               (wrap-program (string-append out "/share/quilt/scripts/backup-files")
-                 `("PATH" ":" prefix
-                   ,(map cmd-path
-                         (list "find" "grep" "mkdir")))))))
-         (add-after 'compress-documentation 'check
-           (lambda _
-             (substitute* '("test/run" "test/edit.test")
-               (("/bin/sh") (which "sh"))
-               (("rm -rf") (string-append (which "rm") " -rf")))
-             (substitute* "Makefile"
-               (("^(PATH|QUILT_DIR).*" &)
-                (string-append "#" &)) ; Test the installed 'quilt'
-               (("export QUILT_DIR") "export")
-               (("\\| sort") (string-append "| " (which "sort")))
-               (("\\| sed") (string-append "| " (which "sed")))
-               (("(chmod|touch)" &) (which &)))
-             ;; Tests are scripts interpreted by `test/run` and may specify
-             ;; the execution of several tools.  But PATH will be empty, so
-             ;; rewrite with the full file name:
-             (setenv "PATH" (string-append %output "/bin" ":" (getenv "PATH")))
-             (substitute* (find-files "test" "\\.test$")
-               (("([\\$\\|] )([[:graph:]]+)([[:blank:]\n]+)"
-                 & > cmd <)
-                (if (string=? cmd "zcat")
-                    ;; The `zcat` program is a script, and it will not be able
-                    ;; to invoke its `gzip` with PATH unset.  It's a simple
-                    ;; script though, so just translate here:
-                    (string-append > (which "gzip") " -cd " <)
-                    (or (and=> (which cmd)
-                               (lambda (p) (string-append > p <)))
-                        &))))
-             (let ((make (which "make")))
-               ;; Assert the installed 'quilt' can find utilities it needs.
-               (unsetenv "PATH")
-               ;; Used by some tests for access to internal "scripts"
-               (setenv "QUILT_DIR" (string-append %output "/share/quilt"))
-               (invoke make "check")))))))
+     (list
+      #:parallel-tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'check)
+          (add-after 'install 'wrap-script
+            ;; quilt's configure checks for the absolute path to the utilities it
+            ;; needs, but uses only the name when invoking them, so we need to
+            ;; make sure the quilt script can find those utilities when run.
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((cmd-path (lambda (cmd) (dirname (which cmd)))))
+                (wrap-script (string-append #$output "/bin/quilt")
+                  `("PATH" ":" prefix
+                    ,(map cmd-path
+                          (list "bash" "diff" "diffstat" "ed" "file" "find" "grep"
+                                "gzip" "less" "patch" "perl" "rm" "sed" "tar"))))
+                (wrap-script (string-append #$output "/share/quilt/scripts/backup-files")
+                  `("PATH" ":" prefix
+                    ,(map cmd-path
+                          (list "find" "grep" "mkdir")))))))
+          (add-after 'compress-documentation 'check
+            (lambda _
+              (substitute* '("test/run" "test/edit.test")
+                (("/bin/sh") (which "sh"))
+                (("rm -rf") (string-append (which "rm") " -rf")))
+              (substitute* "Makefile"
+                (("^(PATH|QUILT_DIR).*" &)
+                 (string-append "#" &)) ; Test the installed 'quilt'
+                (("export QUILT_DIR") "export")
+                (("\\| sort") (string-append "| " (which "sort")))
+                (("\\| sed") (string-append "| " (which "sed")))
+                (("(chmod|touch)" &) (which &)))
+              ;; Tests are scripts interpreted by `test/run` and may specify
+              ;; the execution of several tools.  But PATH will be empty, so
+              ;; rewrite with the full file name:
+              (setenv "PATH" (string-append #$output "/bin" ":" (getenv "PATH")))
+              (substitute* (find-files "test" "\\.test$")
+                (("([\\$\\|] )([[:graph:]]+)([[:blank:]\n]+)"
+                  & > cmd <)
+                 (if (string=? cmd "zcat")
+                     ;; The `zcat` program is a script, and it will not be able
+                     ;; to invoke its `gzip` with PATH unset.  It's a simple
+                     ;; script though, so just translate here:
+                     (string-append > (which "gzip") " -cd " <)
+                     (or (and=> (which cmd)
+                                (lambda (p) (string-append > p <)))
+                         &))))
+              (let ((make (which "make")))
+                ;; Assert the installed 'quilt' can find utilities it needs.
+                (unsetenv "PATH")
+                ;; Used by some tests for access to internal "scripts"
+                (setenv "QUILT_DIR" (string-append #$output "/share/quilt"))
+                (invoke make "check")))))))
     (home-page "https://savannah.nongnu.org/projects/quilt/")
     (synopsis "Script for managing patches to software")
     (description