Subject: [bug#63044] [PATCH 1/4] gnu: criu: Use gexps.

From: Brian Cully <[email-masked]>
Date: Sun, 23 Apr 2023 21:18:56 -0400

* gnu/packages/virtualization.scm (criu) [arguments]: use gexps instead of
quasi-quoting.
---
 gnu/packages/virtualization.scm | 147 ++++++++++++++++----------------
 1 file changed, 73 insertions(+), 74 deletions(-)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 4a0d6b0096..20cbfcfcfe 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -1682,81 +1682,80 @@ (define-public criu
         (base32 "0ff3xfcf0wfz02fc0qbj56mci1a0xdl8jzaihaw6qyjvgrsiq7fh"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:test-target "test"
-       #:tests? #f ; tests require mounting as root
-       #:make-flags
-       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
-             (string-append "LIBDIR=$(PREFIX)/lib")
-             ;; Upstream mistakenly puts binaries in /var.  Now, in practice no
-             ;; plugins are built, but the build system still fails otherwise.
-             (string-append "PLUGINDIR=$(LIBDIR)/criu")
-             (string-append "ASCIIDOC="
-                            (search-input-file %build-inputs
-                                               "/bin/asciidoc"))
-             (string-append "PYTHON=python3")
-             (string-append "XMLTO="
-                            (search-input-file %build-inputs
-                                               "/bin/xmlto")))
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)            ; no configure script
-         (add-after 'unpack 'fix-documentation
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (substitute* "Documentation/Makefile"
-               (("-m custom.xsl")
-                (string-append
-                 "-m custom.xsl --skip-validation -x "
-                 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
-                 ,(package-name docbook-xsl) "-"
-                 ,(package-version docbook-xsl)
-                 "/manpages/docbook.xsl")))))
-         (add-after 'unpack 'hardcode-variables
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             ;; Hardcode arm version detection
-             (substitute* "Makefile"
-               (("ARMV.*:=.*") "ARMV := 7\n"))
-             ;; Hard-code the correct PLUGINDIR above.
-             (substitute* "criu/include/plugin.h"
-               (("/var") (string-append (assoc-ref outputs "out"))))
-             ))
-         (add-before 'build 'fix-symlink
-           (lambda* (#:key inputs #:allow-other-keys)
-             ;; The file 'images/google/protobuf/descriptor.proto' points to
-             ;; /usr/include/..., which obviously does not exist.
-             (let* ((file "google/protobuf/descriptor.proto")
-                    (target (string-append "images/" file))
-                    (source (search-input-file
-                             inputs
-                             (string-append "include/" file))))
-               (delete-file target)
-               (symlink source target))))
-         (add-after 'install 'wrap
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             ;; Make sure 'crit' runs with the correct PYTHONPATH.
-             (let* ((out  (assoc-ref outputs "out"))
-                    (site (string-append out "/lib/python"
-                                         ,(version-major+minor
-                                           (package-version python))
-                                         "/site-packages"))
-                    (path (getenv "GUIX_PYTHONPATH")))
-               (wrap-program (string-append out "/bin/crit")
-                 `("GUIX_PYTHONPATH" ":" prefix (,site ,path))))))
-         (add-after 'install 'delete-static-libraries
-           ;; Not building/installing these at all doesn't seem to be supported.
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (for-each delete-file (find-files out "\\.a$"))))))))
+     (list
+      #:test-target "test"
+      #:tests? #f ; tests require mounting as root
+      #:make-flags
+      #~(list (string-append "PREFIX=" #$output)
+              (string-append "LIBDIR=$(PREFIX)/lib")
+              ;; Upstream mistakenly puts binaries in /var.  Now, in practice no
+              ;; plugins are built, but the build system still fails otherwise.
+              (string-append "PLUGINDIR=$(LIBDIR)/criu")
+              (string-append "ASCIIDOC="
+                             (search-input-file %build-inputs
+                                                "/bin/asciidoc"))
+              (string-append "PYTHON=python3")
+              (string-append "XMLTO="
+                             (search-input-file %build-inputs
+                                                "/bin/xmlto")))
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)            ; no configure script
+          (add-after 'unpack 'fix-documentation
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (substitute* "Documentation/Makefile"
+                (("-m custom.xsl")
+                 (string-append
+                  "-m custom.xsl --skip-validation -x "
+                  (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
+                  #$(package-name docbook-xsl) "-"
+                  #$(package-version docbook-xsl)
+                  "/manpages/docbook.xsl")))))
+          (add-after 'unpack 'hardcode-variables
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              ;; Hardcode arm version detection
+              (substitute* "Makefile"
+                (("ARMV.*:=.*") "ARMV := 7\n"))
+              ;; Hard-code the correct PLUGINDIR above.
+              (substitute* "criu/include/plugin.h"
+                (("/var") (string-append (assoc-ref outputs "out"))))
+              ))
+          (add-before 'build 'fix-symlink
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; The file 'images/google/protobuf/descriptor.proto' points to
+              ;; /usr/include/..., which obviously does not exist.
+              (let* ((file "google/protobuf/descriptor.proto")
+                     (target (string-append "images/" file))
+                     (source (search-input-file
+                              inputs
+                              (string-append "include/" file))))
+                (delete-file target)
+                (symlink source target))))
+          (add-after 'install 'wrap
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              ;; Make sure 'crit' runs with the correct PYTHONPATH.
+              (let* ((site (string-append #$output "/lib/python"
+                                          #$(version-major+minor
+                                             (package-version python))
+                                          "/site-packages"))
+                     (path (getenv "GUIX_PYTHONPATH")))
+                (wrap-program (string-append #$output "/bin/crit")
+                  `("GUIX_PYTHONPATH" ":" prefix (,site ,path))))))
+          (add-after 'install 'delete-static-libraries
+            ;; Not building/installing these at all doesn't seem to be supported.
+            (lambda _
+              (for-each delete-file (find-files #$output "\\.a$")))))))
     (inputs
-     `(("protobuf" ,protobuf)
-       ("python" ,python)
-       ("python-protobuf" ,python-protobuf)
-       ("iproute" ,iproute)
-       ("libaio" ,libaio)
-       ("libcap" ,libcap)
-       ("libnet" ,libnet)
-       ("libnl" ,libnl)
-       ("libbsd" ,libbsd)
-       ("nftables" ,nftables)))
+     (list protobuf
+           python
+           python-protobuf
+           iproute
+           libaio
+           libcap
+           libnet
+           libnl
+           libbsd
+           nftables))
     (native-inputs
      (list pkg-config
            perl
-- 
2.39.2