Archived
1
0
Fork 0

gnu: xfstests: Update package style.

* gnu/packages/file-systems.scm (xfstests)[arguments]:
Rewrite as G-expressions.  Never refer to inputs by label.
[inputs]: Remove input labels.
This commit is contained in:
Tobias Geerinckx-Rice 2023-08-06 02:00:00 +02:00
parent ef919436f6
commit bf587a2094
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -1217,121 +1217,117 @@ APFS.")
(base32 "1sbkryl04xflrk6jb4fsl3h2whilj5m3vpdkpwwb26idp7ckjjv6")))) (base32 "1sbkryl04xflrk6jb4fsl3h2whilj5m3vpdkpwwb26idp7ckjjv6"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:phases (list
(modify-phases %standard-phases #:phases
(add-after 'unpack 'patch-tool-locations #~(modify-phases %standard-phases
(lambda* (#:key inputs #:allow-other-keys) (add-after 'unpack 'patch-tool-locations
(substitute* "common/config" (lambda* (#:key inputs #:allow-other-keys)
;; Make absolute file names relative. (substitute* "common/config"
(("(MKFS_PROG=\").*(\")" _ pre post) ;; Make absolute file names relative.
(string-append pre "mkfs" post))) (("(MKFS_PROG=\").*(\")" _ pre post)
(for-each (lambda (file) (string-append pre "mkfs" post)))
(substitute* file (for-each (lambda (file)
(("( -s|#.|[= ])(/bin/sh|/bin/bash)" _ pre match) (substitute* file
(string-append pre (("( -s|#.|[= ])(/bin/sh|/bin/bash)" _ pre match)
(assoc-ref inputs "bash") (string-append pre
match)) (search-input-file inputs match)))
(("/bin/(rm|true)" match) (("/bin/(rm|true)" match)
(search-input-file inputs match)) (search-input-file inputs match))
(("/usr(/bin/time)" _ match) (("/usr(/bin/time)" _ match)
(search-input-file inputs match)))) (search-input-file inputs match))))
(append (find-files "common" ".*") (append (find-files "common" ".*")
(find-files "tests" ".*") (find-files "tests" ".*")
(find-files "tools" ".*") (find-files "tools" ".*")
(find-files "src" "\\.(c|sh)$"))))) (find-files "src" "\\.(c|sh)$")))))
(replace 'bootstrap (replace 'bootstrap
(lambda* (#:key make-flags #:allow-other-keys) (lambda* (#:key make-flags #:allow-other-keys)
(substitute* "Makefile" (substitute* "Makefile"
;; Avoid a mysterious (to me) permission denied error. ;; Avoid a mysterious (to me) permission denied error.
(("cp ") "cp -f ")) (("cp ") "cp -f "))
(substitute* "m4/package_utilies.m4" (substitute* "m4/package_utilies.m4"
;; Fix the bogus hard-coded paths for every single binary. ;; Fix the bogus hard-coded paths for every single binary.
(("(AC_PATH_PROG\\(.*, ).*(\\))" _ pre post) (("(AC_PATH_PROG\\(.*, ).*(\\))" _ pre post)
(string-append pre (getenv "PATH") post))) (string-append pre (getenv "PATH") post)))
(apply invoke "make" "configure" make-flags))) (apply invoke "make" "configure" make-flags)))
(add-after 'install 'wrap-xfstests/check (add-after 'install 'wrap-xfstests/check
;; Keep wrapping distinct from 'create-helper-script below: users ;; Keep wrapping distinct from 'create-helper-script below: users
;; must be able to invoke xfstests/check directly if they prefer. ;; must be able to invoke xfstests/check directly if they prefer.
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))) (wrap-program (string-append #$output "/xfstests/check")
(wrap-program (string-append out "/xfstests/check") ;; Prefix the user's PATH with the minimum required tools.
;; Prefix the user's PATH with the minimum required tools. ;; The suite has many other optional dependencies and will
;; The suite has many other optional dependencies and will ;; automatically select tests based on the original PATH.
;; automatically select tests based on the original PATH. `("PATH" ":" prefix
`("PATH" ":" prefix ,(map (lambda (file)
,(map (lambda (name) (dirname (search-input-file inputs file)))
(let ((input (assoc-ref inputs name))) (list "bin/setfacl" ; acl
(string-append input "/bin:" "bin/attr" ; attr
input "/sbin"))) "bin/ls" ; coreutils
(list "acl" "bin/hostname" ; inetutils
"attr" "sbin/mkfs.xfs")))))) ; xfsprogs
"coreutils" (add-after 'install 'create-helper
"inetutils" ;; Upstream installs only a check script that's not in $PATH and
"xfsprogs"))))))) ;; would try to write to the store without explaining how to change
(add-after 'install 'create-helper ;; that. Install a simple helper script to make it discoverable.
;; Upstream installs only a check script that's not in $PATH and (lambda* (#:key inputs #:allow-other-keys)
;; would try to write to the store without explaining how to change (let* ((check (string-append #$output "/xfstests/check"))
;; that. Install a simple helper script to make it discoverable. (bin (string-append #$output "/bin"))
(lambda* (#:key inputs outputs #:allow-other-keys) (helper (string-append bin "/xfstests-check")))
(let* ((out (assoc-ref outputs "out")) (mkdir-p bin)
(check (string-append out "/xfstests/check")) (with-output-to-file helper
(bin (string-append out "/bin")) (lambda _
(helper (string-append bin "/xfstests-check"))) (format #t "#!~a --no-auto-compile\n!#\n"
(mkdir-p bin) (search-input-file inputs "/bin/guile"))
(with-output-to-file helper (write
(lambda _ `(begin
(format #t "#!~a --no-auto-compile\n!#\n" (define (try proc dir)
(search-input-file inputs "/bin/guile")) "Try to PROC DIR. Return DIR on success, else #f."
(write (with-exception-handler (const #f)
`(begin (lambda _ (proc dir) dir)
(define (try proc dir) #:unwind? #t))
"Try to PROC DIR. Return DIR on success, else #f."
(with-exception-handler (const #f)
(lambda _ (proc dir) dir)
#:unwind? #t))
(define args (define args
(cdr (command-line))) (cdr (command-line)))
(when (or (member "--help" args) (when (or (member "--help" args)
(member "-h" args)) (member "-h" args))
(format #t "Usage: ~a [OPTION]... (format #t "Usage: ~a [OPTION]...
This Guix helper sets up a new writable RESULT_BASE if it's unset, then executes This Guix helper sets up a new writable RESULT_BASE if it's unset, then executes
xfstest's \"~a\" command (with any OPTIONs) as documented below.\n\n" xfstest's \"~a\" command (with any OPTIONs) as documented below.\n\n"
,(basename helper) ,(basename helper)
,(basename check))) ,(basename check)))
(let* ((gotenv-base (getenv "RESULT_BASE")) (let* ((gotenv-base (getenv "RESULT_BASE"))
(base (or gotenv-base (base (or gotenv-base
(let loop ((count 0)) (let loop ((count 0))
(or (try mkdir (or (try mkdir
(format #f "xfstests.~a" (format #f "xfstests.~a"
count)) count))
(loop (+ 1 count)))))) (loop (+ 1 count))))))
(result-base (if (string-prefix? "/" base) (result-base (if (string-prefix? "/" base)
base base
(string-append (getcwd) "/" (string-append (getcwd) "/"
base)))) base))))
(setenv "RESULT_BASE" result-base) (setenv "RESULT_BASE" result-base)
;; CHECK must run in its own directory or will fail. ;; CHECK must run in its own directory or will fail.
(chdir ,(dirname check)) (chdir ,(dirname check))
(let ((status (let ((status
(status:exit-val (apply system* ,check args)))) (status:exit-val (apply system* ,check args))))
(unless gotenv-base (unless gotenv-base
(try rmdir result-base)) (try rmdir result-base))
status)))))) status))))))
(chmod helper #o755))))))) (chmod helper #o755)))))))
(native-inputs (native-inputs
(list autoconf automake libtool)) (list autoconf automake libtool))
(inputs (inputs
`(("acl" ,acl) (list acl
("attr" ,attr) attr
("guile" ,guile-3.0) ; for our xfstests-check helper script guile-3.0 ; for our xfstests-check helper script
("inetutils" ,inetutils) ; for hostname inetutils
("libuuid" ,util-linux "lib") `(,util-linux "lib")
("perl" ,perl) ; to automagically patch shebangs perl
("time" ,time) time
("xfsprogs" ,xfsprogs))) xfsprogs))
(home-page "https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git") (home-page "https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git")
(synopsis "File system @acronym{QA, Quality Assurance} test suite") (synopsis "File system @acronym{QA, Quality Assurance} test suite")
(description (description