gnu: cuirass: Use gexps.

* gnu/packages/ci.scm (cuirass)[arguments]: Rewrite as per ‘guix style
-S arguments’.
This commit is contained in:
Ludovic Courtès 2023-10-12 22:05:39 +02:00
parent 2588fb98f0
commit f0c929f1e6
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

View File

@ -29,6 +29,7 @@
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix gexp)
#:use-module ((guix search-paths) #:select ($SSL_CERT_DIR)) #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR))
#:use-module (gnu packages autotools) #:use-module (gnu packages autotools)
#:use-module (gnu packages base) #:use-module (gnu packages base)
@ -75,59 +76,63 @@
"16d9ylzk8mwsgppfdxyl0k2mkwll7fq17d6v09406rqkgddxg3m2")))) "16d9ylzk8mwsgppfdxyl0k2mkwll7fq17d6v09406rqkgddxg3m2"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:modules ((guix build utils) (list #:modules `((guix build utils)
(guix build gnu-build-system) (guix build gnu-build-system)
(ice-9 match) (ice-9 match)
(ice-9 rdelim) (ice-9 rdelim)
(ice-9 popen) (ice-9 popen)
(srfi srfi-1)) (srfi srfi-1))
#:configure-flags '("--localstatedir=/var") ;for /var/log/cuirass #:configure-flags #~'("--localstatedir=/var") ;for /var/log/cuirass
;; XXX: HTTP tests fail on aarch64 due to Fibers errors, disable them ;; XXX: HTTP tests fail on aarch64 due to Fibers errors, disable them
;; on that architecture for now. ;; on that architecture for now.
#:tests? ,(let ((s (or (%current-target-system) #:tests? (let ((s (or (%current-target-system)
(%current-system)))) (%current-system))))
(not (string-prefix? "aarch64" s))) (not (string-prefix? "aarch64" s)))
#:parallel-tests? #f #:parallel-tests? #f
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-before 'bootstrap 'fix-version-gen (add-before 'bootstrap 'fix-version-gen
(lambda _ (lambda _
(patch-shebang "build-aux/git-version-gen") (patch-shebang "build-aux/git-version-gen")
(call-with-output-file ".tarball-version" (call-with-output-file ".tarball-version"
(lambda (port) (lambda (port)
(display ,version port))))) (display #$(package-version this-package) port)))))
(add-after 'install 'wrap-program (add-after 'install 'wrap-program
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
;; Wrap the 'cuirass' command to refer to the right modules. ;; Wrap the 'cuirass' command to refer to the right modules.
;; Do so by collecting the subset of INPUTS that provides Guile ;; Do so by collecting the subset of INPUTS that provides Guile
;; modules. This includes direct inputs as well as their ;; modules. This includes direct inputs as well as their
;; propagated inputs--e.g., 'guix' propagates 'guile-zstd'. ;; propagated inputs--e.g., 'guix' propagates 'guile-zstd'.
(define (sub-directory suffix) (define (sub-directory suffix)
(match-lambda (match-lambda
((label . directory) ((label . directory)
(let ((directory (string-append directory suffix))) (let ((directory (string-append directory suffix)))
(and (directory-exists? directory) (and (directory-exists? directory)
directory))))) directory)))))
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(effective (effective
(read-line (read-line
(open-pipe* OPEN_READ (which "guile") (open-pipe* OPEN_READ (which "guile") "-c"
"-c" "(display (effective-version))"))) "(display (effective-version))")))
(mods (filter-map (sub-directory (mods (filter-map (sub-directory
(string-append "/share/guile/site/" (string-append
effective)) "/share/guile/site/"
inputs)) effective))
(objs (filter-map (sub-directory inputs))
(string-append "/lib/guile/" (objs (filter-map (sub-directory
effective (string-append
"/site-ccache")) "/lib/guile/" effective
inputs))) "/site-ccache"))
(wrap-program (string-append out "/bin/cuirass") inputs)))
`("PATH" ":" prefix (,(string-append out "/bin"))) (wrap-program (string-append out "/bin/cuirass")
`("GUILE_LOAD_PATH" ":" prefix ,mods) `("PATH" ":" prefix
`("GUILE_LOAD_COMPILED_PATH" ":" prefix ,objs)))))))) (,(string-append out "/bin")))
`("GUILE_LOAD_PATH" ":" prefix
,mods)
`("GUILE_LOAD_COMPILED_PATH" ":" prefix
,objs))))))))
(inputs (inputs
(list guile-3.0-latest (list guile-3.0-latest
guile-avahi guile-avahi