unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Rohleder <mike@rohleder.de>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 57722@debbugs.gnu.org
Subject: [bug#57722] [PATCH] gnu: ipfs: Install bash completion.
Date: Tue, 13 Sep 2022 11:49:57 +0200	[thread overview]
Message-ID: <87k067ppru.fsf@rohleder.de> (raw)
In-Reply-To: <5d80a74a-fb2f-2236-a722-62e9d20b8487@telenet.be> (Maxime Devos's message of "Sun, 11 Sep 2022 13:47:58 +0200")


[-- Attachment #1.1: Type: text/plain, Size: 739 bytes --]

Hey Maxime,

Thank you for reviewing and your helpful tips!

Here is a second version, I hope it's better.

I dont know how to test cross compiling, though (on a x86_64 system):

./pre-inst-env guix build --system=aarch64-linux go-ipfs
[...]
building /gnu/store/ssvif7gdgv7xn7jmgmcp4ws71fgmwn5x-go-ipfs-0.11.0.drv...
;;; Stat of /tmp/guix-build-go-ipfs-0.11.0.drv-0/guile failed:
;;; In procedure stat: No such file or directory: "/tmp/guix-build-go-ipfs-0.11.0.drv-0/guile"
Backtrace:
           0 (primitive-load "/tmp/guix-build-go-ipfs-0.11.0.drv-0/g?")

ERROR: In procedure primitive-load:
In procedure open-file: No such file or directory: "/tmp/guix-build-go-ipfs-0.11.0.drv-0/guile"

And then I'm completely lost and confused. ;)


[-- Attachment #1.2: go-ipfs: Install bash completion. --]
[-- Type: text/x-patch, Size: 2867 bytes --]

From bbf32c53a2402f6f123d00d2e5ece9efdbf10504 Mon Sep 17 00:00:00 2001
From: Michael Rohleder <mike@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.
---
 gnu/packages/ipfs.scm | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/ipfs.scm b/gnu/packages/ipfs.scm
index ccc36007b4..d1e04c3ae0 100644
--- a/gnu/packages/ipfs.scm
+++ b/gnu/packages/ipfs.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
-;;; Copyright © 2020, 2021 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2020, 2021, 2022 Michael Rohleder <mike@rohleder.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,6 +22,7 @@
 (define-module (gnu packages ipfs)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix download)
   #:use-module (guix build-system go)
@@ -229,10 +230,28 @@ (define-public go-ipfs
        (file-name (string-append name "-" version "-source"))))
     (build-system go-build-system)
     (arguments
-     `(#:unpack-path "github.com/ipfs/go-ipfs"
-       #:import-path "github.com/ipfs/go-ipfs/cmd/ipfs"))
+     (list
+      #:unpack-path "github.com/ipfs/go-ipfs"
+      #:import-path "github.com/ipfs/go-ipfs/cmd/ipfs"
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; https://github.com/ipfs/kubo/blob/master/docs/command-completion.md
+          (add-after 'install 'install-bashcompletion
+            (lambda _
+              (let ((completiondir (string-append #$output
+                                                  "/etc/bash_completion.d")))
+                (mkdir-p completiondir)
+                (with-output-to-file (string-append completiondir "/ipfs")
+                  (lambda _
+                    (invoke #$(if (%current-target-system)
+                                  "ipfs"
+                                  #~(string-append #$output "/bin/ipfs"))
+                            "commands" "completion" "bash")))))))))
     (native-inputs
-     (list python-minimal-wrapper zsh))
+     (append (if (%current-target-system)
+                 (list this-package)
+                 '())
+             (list python-minimal-wrapper zsh)))
     (home-page "https://ipfs.io")
     (synopsis "Go implementation of IPFS, a peer-to-peer hypermedia protocol")
     (description "IPFS is a global, versioned, peer-to-peer file system.  It
-- 
2.37.3


[-- Attachment #1.3: Type: text/plain, Size: 131 bytes --]


-- 
Nichts ist in der Welt ist so gerecht verteilt wie der Verstand. 
Jedermann ist der Meinung, dass er genuegend davon hat.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

  parent reply	other threads:[~2022-09-13  9:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-10 21:47 [bug#57722] [PATCH] gnu: ipfs: Install bash completion Michael Rohleder
2022-09-11 11:47 ` Maxime Devos
2022-09-12 11:21   ` Maxime Devos
2022-09-13  9:49   ` Michael Rohleder [this message]
2022-09-13 10:48     ` Maxime Devos
2022-09-13 11:02       ` Maxime Devos
2022-09-14 21:29     ` bug#57722: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k067ppru.fsf@rohleder.de \
    --to=mike@rohleder.de \
    --cc=57722@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).