[PATCH 0/2] Update fzf, include binaries and install completions

  • Done
  • quality assurance status badge
Details
3 participants
  • EuAndreh
  • Ludovic Courtès
  • Nicolas Goaziou
Owner
unassigned
Submitted by
EuAndreh
Severity
normal
E
E
EuAndreh wrote on 18 Jan 2021 19:59
(address . guix-patches@gnu.org)(name . EuAndreh)(address . eu@euandre.org)
20210118185925.24412-1-eu@euandre.org
I've tested both the package update and the extra phases added.
The Bash completions are being installed properly, but I haven't tested
the zsh ones.

I remember seeing somewhere a discussion on aliasing this type of package,
so that the "go-github-com-junegunn-fzf" is the default imported Go module,
to be used as input for other packages, and adding a top-level "fzf" package,
which does the ad-hoc packaging code I've added, so that a user can install
the "fzf" package with Bash integration and similar features.

I couldn't find anything on the manual also, I welcome comments on this :)

EuAndreh (2):
gnu: go-github-com-junegunn-fzf: Copy binaries and install shell
completions.
gnu: go-github-com-junegunn-fzf: Update to 0.25.0.

gnu/packages/terminals.scm | 35 +++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)

--
2.30.0
E
E
EuAndreh wrote on 18 Jan 2021 20:04
[PATCH 1/2] gnu: go-github-com-junegunn-fzf: Copy binaries and install shell completions.
(address . 45965@debbugs.gnu.org)(name . EuAndreh)(address . eu@euandre.org)
20210118190459.27787-1-eu@euandre.org
* gnu/packages/terminals.scm (go-github-com-junegunn-fzf)[arguments]: Add
copy-binaries, wrap-programs and install-completion phases.
---
gnu/packages/terminals.scm | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)

Toggle diff (51 lines)
diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm
index 74e1937bbc..308ff99bf0 100644
--- a/gnu/packages/terminals.scm
+++ b/gnu/packages/terminals.scm
@@ -813,7 +813,33 @@ programmer to write text-based user interfaces.")
"0n0cy5q2r3dm1a3ivlzrv9c5d11awxlqim5b9x8zc85dlr73n35l"))))
(build-system go-build-system)
(arguments
- `(#:import-path "github.com/junegunn/fzf"))
+ `(#:import-path "github.com/junegunn/fzf"
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'install 'copy-binaries
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (with-directory-excursion "src/github.com/junegunn/fzf"
+ (install-file "bin/fzf-tmux"
+ (string-append out "/bin"))))))
+ (add-after 'copy-binaries 'wrap-programs
+ (lambda* (#:key outputs inputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (ncurses (assoc-ref inputs "ncurses")))
+ (wrap-program (string-append out "/bin/fzf-tmux")
+ `("PATH" ":" prefix (,(string-append ncurses "/bin")))))))
+ (add-after 'install 'install-completions
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bash-completion (string-append out "/etc/bash_completion.d"))
+ (zsh-completion (string-append out "/share/zsh/site-functions")))
+ (with-directory-excursion "src/github.com/junegunn/fzf"
+ (mkdir-p bash-completion)
+ (copy-file "shell/completion.bash"
+ (string-append bash-completion "/fzf"))
+ (mkdir-p zsh-completion)
+ (copy-file "shell/completion.zsh"
+ (string-append zsh-completion "/_fzf")))))))))
(inputs
`(("go-github.com-mattn-go-runewidth" ,go-github.com-mattn-go-runewidth)
("go-github-com-mattn-go-shellwords" ,go-github-com-mattn-go-shellwords)
@@ -821,7 +847,8 @@ programmer to write text-based user interfaces.")
("go-github-com-gdamore-tcell" ,go-github-com-gdamore-tcell)
("go-github-com-saracen-walker" ,go-github-com-saracen-walker)
("go-golang.org-x-sync-errgroup" ,go-golang.org-x-sync-errgroup)
- ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)))
+ ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)
+ ("ncurses" ,ncurses)))
(home-page "https://github.com/junegunn/fzf")
(synopsis "Command-line fuzzy-finder")
(description "This package provides an interactive command-line filter
--
2.30.0
E
E
EuAndreh wrote on 18 Jan 2021 20:04
[PATCH 2/2] gnu: go-github-com-junegunn-fzf: Update to 0.25.0.
(address . 45965@debbugs.gnu.org)(name . EuAndreh)(address . eu@euandre.org)
20210118190459.27787-2-eu@euandre.org
* gnu/packages/terminals.scm (go-github-com-junegunn-fzf): Update to 0.25.0.
---
gnu/packages/terminals.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm
index 308ff99bf0..9c89134aaa 100644
--- a/gnu/packages/terminals.scm
+++ b/gnu/packages/terminals.scm
@@ -800,7 +800,7 @@ programmer to write text-based user interfaces.")
(define-public go-github-com-junegunn-fzf
(package
(name "go-github-com-junegunn-fzf")
- (version "0.22.0")
+ (version "0.25.0")
(source
(origin
(method git-fetch)
@@ -810,7 +810,7 @@ programmer to write text-based user interfaces.")
(file-name (git-file-name name version))
(sha256
(base32
- "0n0cy5q2r3dm1a3ivlzrv9c5d11awxlqim5b9x8zc85dlr73n35l"))))
+ "1j5bfxl4w8w3n89p051y8dhxg0py9l98v7r2gkr63bg4lj32faz8"))))
(build-system go-build-system)
(arguments
`(#:import-path "github.com/junegunn/fzf"
--
2.30.0
N
N
Nicolas Goaziou wrote on 5 Feb 2021 21:57
Re: [bug#45965] [PATCH 0/2] Update fzf, include binaries and install completions
(name . guix-patches--- via)(address . guix-patches@gnu.org)
87y2g2w7uq.fsf@nicolasgoaziou.fr
Hello,

guix-patches--- via <guix-patches@gnu.org> writes:

Toggle quote (10 lines)
> I've tested both the package update and the extra phases added.
> The Bash completions are being installed properly, but I haven't tested
> the zsh ones.
>
> I remember seeing somewhere a discussion on aliasing this type of package,
> so that the "go-github-com-junegunn-fzf" is the default imported Go module,
> to be used as input for other packages, and adding a top-level "fzf" package,
> which does the ad-hoc packaging code I've added, so that a user can install
> the "fzf" package with Bash integration and similar features.

Indeed, having to install "go-github-com-junegunn-fzf" when you are
really looking for "fzf" is not very intuitive.

So, "fzf" could inherit from "go-github-com-junegunn-fzf" and add all
the bells and whistles.

Would you want to provide a patch for that?

Meanwhile, I'm going to apply the update and leave the first patch out.

Regards,
--
Nicolas Goaziou
E
E
EuAndreh wrote on 5 Feb 2021 23:31
87v9b6ywml.fsf@euandre.org
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

Toggle quote (2 lines)
> Would you want to provide a patch for that?

Sure, I'll do it in the next few days.
E
E
EuAndreh wrote on 8 Feb 2021 18:08
[PATCH] gnu: Add fzf.
(name . EuAndreh)(address . eu@euandre.org)
20210208170827.29641-1-eu@euandre.org
* gnu/packages/terminals.scm (fzf): New variable, which inherits
from the existing go-github-com-junegunn-fzf package, but also
install other binary, and completion for direct usage.
---
Done as discussed.

gnu/packages/terminals.scm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)

Toggle diff (50 lines)
diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm
index a9897ec623..7ccba97968 100644
--- a/gnu/packages/terminals.scm
+++ b/gnu/packages/terminals.scm
@@ -824,6 +824,43 @@ programmer to write text-based user interfaces.")
usable with any list--including files, command history, processes and more.")
(license license:expat)))
+(define-public fzf
+ (package
+ (inherit go-github-com-junegunn-fzf)
+ (name "fzf")
+ (arguments
+ `(,@(ensure-keyword-arguments
+ (package-arguments go-github-com-junegunn-fzf)
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'install 'copy-binaries
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (with-directory-excursion "src/github.com/junegunn/fzf"
+ (install-file "bin/fzf-tmux"
+ (string-append out "/bin"))))))
+ (add-after 'copy-binaries 'wrap-programs
+ (lambda* (#:key outputs inputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (ncurses (assoc-ref inputs "ncurses")))
+ (wrap-program (string-append out "/bin/fzf-tmux")
+ `("PATH" ":" prefix (,(string-append ncurses "/bin")))))))
+ (add-after 'install 'install-completions
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bash-completion (string-append out "/etc/bash_completion.d"))
+ (zsh-completion (string-append out "/share/zsh/site-functions")))
+ (with-directory-excursion "src/github.com/junegunn/fzf"
+ (mkdir-p bash-completion)
+ (copy-file "shell/completion.bash"
+ (string-append bash-completion "/fzf"))
+ (mkdir-p zsh-completion)
+ (copy-file "shell/completion.zsh"
+ (string-append zsh-completion "/_fzf")))))))))))
+ (inputs
+ `(,@(package-inputs go-github-com-junegunn-fzf)
+ ("ncurses" ,ncurses)))))
+
(define-public go-github.com-howeyc-gopass
(let ((commit "bf9dde6d0d2c004a008c27aaee91170c786f6db8")
(revision "0"))
--
2.30.0
L
L
Ludovic Courtès wrote on 19 Mar 2021 22:15
Re: bug#45965: [PATCH 0/2] Update fzf, include binaries and install completions
(name . EuAndreh)(address . eu@euandre.org)
87o8fec0ab.fsf_-_@gnu.org
Hi,

EuAndreh <eu@euandre.org> skribis:

Toggle quote (4 lines)
> * gnu/packages/terminals.scm (fzf): New variable, which inherits
> from the existing go-github-com-junegunn-fzf package, but also
> install other binary, and completion for direct usage.

I think it had fallen through the cracks; applied!

Toggle quote (2 lines)
> + (arguments
> + `(,@(ensure-keyword-arguments
^^^
I simplified this to:

(arguments (ensure-keyword-arguments …))

Thanks,
Ludo’.
Closed
E
E
EuAndreh wrote on 21 Mar 2021 14:42
(name . Ludovic Courtès)(address . ludo@gnu.org)
161633415545.27353.16979333116852472176@localhost
Thanks :)
Closed
?