GNU bug report logs - #57722
[PATCH] gnu: ipfs: Install bash completion.

Previous Next

Package: guix-patches;

Reported by: Michael Rohleder <mike <at> rohleder.de>

Date: Sat, 10 Sep 2022 21:49:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Michael Rohleder <mike <at> rohleder.de>
Subject: bug#57722: closed (Re: bug#57722: [PATCH] gnu: ipfs: Install bash
 completion.)
Date: Wed, 14 Sep 2022 21:30:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#57722: [PATCH] gnu: ipfs: Install bash completion.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 57722 <at> debbugs.gnu.org.

-- 
57722: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57722
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Michael Rohleder <mike <at> rohleder.de>
Cc: 57722-done <at> debbugs.gnu.org, Maxime Devos <maximedevos <at> telenet.be>
Subject: Re: bug#57722: [PATCH] gnu: ipfs: Install bash completion.
Date: Wed, 14 Sep 2022 23:29:25 +0200
Michael Rohleder <mike <at> rohleder.de> skribis:

> From bbf32c53a2402f6f123d00d2e5ece9efdbf10504 Mon Sep 17 00:00:00 2001
> From: Michael Rohleder <mike <at> rohleder.de>
> Date: Tue, 13 Sep 2022 11:29:23 +0200
> Subject: [PATCH] gnu: go-ipfs: Install bash completion.
>
> * gnu/packages/ipfs.scm (go-ipfs)[arguments]: Use gexp.
> Add 'install-bashcompletion phase to install bash completion.

Applied, thanks!

Great that Maxime found a bug as a side effect.  :-)

[Message part 3 (message/rfc822, inline)]
From: Michael Rohleder <mike <at> rohleder.de>
To: guix-patches <at> gnu.org
Cc: Michael Rohleder <mike <at> rohleder.de>
Subject: [PATCH] gnu: ipfs: Install bash completion.
Date: Sat, 10 Sep 2022 23:47:21 +0200
* gnu/packages/ipfs.scm (ipfs)[arguments]: Add 'install-bashcompletion
phase to install bash completion.
---
 gnu/packages/ipfs.scm | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/ipfs.scm b/gnu/packages/ipfs.scm
index ccc36007b4..faa209bf2a 100644
--- a/gnu/packages/ipfs.scm
+++ b/gnu/packages/ipfs.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2018 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2019, 2020 Martin Becze <mjbecze <at> riseup.net>
-;;; Copyright © 2020, 2021 Michael Rohleder <mike <at> rohleder.de>
+;;; Copyright © 2020, 2021, 2022 Michael Rohleder <mike <at> rohleder.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -230,7 +230,26 @@ (define-public go-ipfs
     (build-system go-build-system)
     (arguments
      `(#:unpack-path "github.com/ipfs/go-ipfs"
-       #:import-path "github.com/ipfs/go-ipfs/cmd/ipfs"))
+       #:import-path "github.com/ipfs/go-ipfs/cmd/ipfs"
+       #:modules ((guix build utils)
+                  (guix build go-build-system)
+                  (ice-9 popen)
+                  (ice-9 textual-ports))
+       #:phases
+       (modify-phases %standard-phases
+         ;; https://github.com/ipfs/kubo/blob/master/docs/command-completion.md
+         (add-after 'install 'install-bashcompletion
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (completiondir (string-append out "/etc/bash_completion.d")))
+               (mkdir-p completiondir)
+               (call-with-output-file (string-append completiondir "/ipfs")
+                 (lambda (port)
+                   (let ((input-pipe (open-pipe* OPEN_READ
+                                                 (string-append out "/bin/ipfs")
+                                                 "commands" "completion" "bash")))
+                     (display (get-string-all input-pipe) port)
+                     (close-pipe input-pipe))))))))))
     (native-inputs
      (list python-minimal-wrapper zsh))
     (home-page "https://ipfs.io")
-- 
2.37.3




This bug report was last modified 2 years and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.