From cf5286df357e34f0da24911c09aa821357175ddf Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 31 Mar 2026 21:14:58 +0300 Subject: gnu: git-absorb: Adjust custom phase. * gnu/packages/rust-apps.scm (git-absorb)[arguments]: Rewrite the phase to install the shell completions. Change-Id: Ia41c4766f13fdfbd2d6cae75649d7d4258a56c3c --- gnu/packages/rust-apps.scm | 75 +++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 38 deletions(-) (limited to 'gnu') diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm index 4f529c09cea..1988092487a 100644 --- a/gnu/packages/rust-apps.scm +++ b/gnu/packages/rust-apps.scm @@ -4335,44 +4335,43 @@ tools.") (base32 "1xr1bjia3sx2i7hw99r2s950xi4fa996bcg3n7j9arcjmrb7w14c")))) (build-system cargo-build-system) (arguments - `(#:install-source? #f - #:phases - (modify-phases %standard-phases - (add-after 'install 'install-manual-page - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (man (string-append out "/share/man/man1"))) - (with-directory-excursion "Documentation" - (invoke "a2x" - "--no-xmllint" - "--doctype=manpage" - "--format=manpage" - "git-absorb.adoc")) - (install-file "Documentation/git-absorb.1" man)))) - (add-after 'install 'install-completions - (lambda* (#:key native-inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (share (string-append out "/share")) - (git-absorb - (if ,(%current-target-system) - (search-input-file native-inputs "/bin/git-absorb") - (string-append out "/bin/git-absorb")))) - (mkdir-p (string-append out "/etc/bash_completion.d")) - (with-output-to-file - (string-append out "/etc/bash_completion.d/git-absorb") - (lambda _ (invoke git-absorb "--gen-completions" "bash"))) - (mkdir-p (string-append share "/fish/vendor_completions.d")) - (with-output-to-file - (string-append share "/fish/vendor_completions.d/git-absorb.fish") - (lambda _ (invoke git-absorb "--gen-completions" "fish"))) - (mkdir-p (string-append share "/zsh/site-functions")) - (with-output-to-file - (string-append share "/zsh/site-functions/_git-absorb") - (lambda _ (invoke git-absorb "--gen-completions" "zsh"))) - (mkdir-p (string-append share "/elvish/lib")) - (with-output-to-file - (string-append share "/elvish/lib/git-absorb") - (lambda _ (invoke git-absorb "--gen-completions" "elvish"))))))))) + (list + #:install-source? #f + #:modules + '((guix build cargo-build-system) + (guix build utils) + (ice-9 match)) + #:phases + #~(modify-phases %standard-phases + (add-after 'install 'install-manual-page + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (man (string-append out "/share/man/man1"))) + (with-directory-excursion "Documentation" + (invoke "a2x" + "--no-xmllint" + "--doctype=manpage" + "--format=manpage" + "git-absorb.adoc")) + (install-file "Documentation/git-absorb.1" man)))) + (add-after 'install 'install-completions + (lambda* (#:key native-inputs #:allow-other-keys) + (for-each + (match-lambda + ((shell . path) + (mkdir-p (in-vicinity #$output (dirname path))) + (let ((binary + (if #$(%current-target-system) + (search-input-file native-inputs "bin/git-absorb") + (in-vicinity #$output "bin/git-absorb")))) + (with-output-to-file (in-vicinity #$output path) + (lambda _ + (invoke binary "--gen-completions" shell)))))) + '(("bash" . "share/bash-completion/completions/git-absorb") + ("elvish" . "share/elvish/lib/git-absorb") + ("fish" . "share/fish/vendor_completions.d/git-absorb.fish") + ("nushell" . "share/nushell/vendor/autoload/git-absorb") + ("zsh" . "share/zsh/site-functions/_git-absorb")))))))) (native-inputs (append (if (%current-target-system) -- cgit v1.3