Subject: [PATCH] gnu: go-ipfs: Unbundle many dependencies.
From: Maxime Devos <[email-masked]>
To: [email-masked]
Cc: Maxime Devos <[email-masked]>
Date: Tue, 13 Sep 2022 14:05:03 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tested with "./pre-inst-env guix build go-ipfs" and "make check-system
TESTS=ipfs".

go-github-com-blang-semver is currently out-of-date, so it cannot be unbundled
yet (at least, the build process seems to complain about the version).

* gnu/packages/ipfs.scm (go-ipfs): Add snippet removing many bundled
dependencies.
(inputs): Add many inputs.
---
 gnu/packages/ipfs.scm | 108 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 106 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/ipfs.scm b/gnu/packages/ipfs.scm
index ccc36007b4..08c79dbc16 100644
--- a/gnu/packages/ipfs.scm
+++ b/gnu/packages/ipfs.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2019, 2020 Martin Becze <[email-masked]>
 ;;; Copyright © 2020, 2021 Michael Rohleder <[email-masked]>
+;;; Copyright © 2022 Maxime Devos <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,7 +28,8 @@ (define-module (gnu packages ipfs)
   #:use-module (guix build-system go)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages python)
-  #:use-module (gnu packages shells))
+  #:use-module (gnu packages shells)
+  #:use-module (gnu packages syncthing))
 
 (define-public go-github-com-ipfs-go-ipfs-cmdkit-files
   (let ((commit
@@ -226,11 +228,113 @@ (define-public go-ipfs
              "/go-ipfs-source.tar.gz"))
        (sha256
         (base32 "13pmj83hwpz6mk7x52qn0cjnfqxqw2qri3r0k4b270w3bafcccwm"))
-       (file-name (string-append name "-" version "-source"))))
+       (file-name (string-append name "-" version "-source"))
+       (modules '((guix build utils)))
+       (snippet '(for-each delete-file-recursively
+                           ;; TODO: unbundle the rest as well
+                           '("vendor/github.com/alecthomas"
+                             ;; "vendor/github.com/blang"
+                             "vendor/github.com/cespare"
+                             ;; TODO: Go files not found
+                             ;; "vendor/github.com/cheggaaa"
+                             "vendor/github.com/davecgh"
+                             "vendor/github.com/dustin"
+                             "vendor/github.com/flynn"
+                             "vendor/github.com/francoispqt"
+                             "vendor/github.com/fsnotify"
+                             "vendor/github.com/gogo"
+                             "vendor/github.com/golang/groupcache"
+                             "vendor/github.com/golang/snappy"
+                             "vendor/github.com/google/uuid"
+                             "vendor/github.com/gorilla"
+                             ;; These should be fine, they are part of
+                             ;; the IPFS project
+                             ;; "vendor/github.com/ipfs"
+                             ;; "vendor/github.com/ipld"
+                             "vendor/github.com/jackpal"
+                             "vendor/github.com/klauspost"
+                             ;; TODO: Go files not found
+                             ;; "vendor/github.com/lucas-clemente"
+                             "vendor/github.com/mattn"
+                             "vendor/github.com/mgutz"
+                             "vendor/github.com/minio"
+                             "vendor/github.com/mitchellh"
+                             "vendor/github.com/mr-tron"
+                             "vendor/github.com/opentracing"
+                             "vendor/github.com/pkg"
+                             "vendor/github.com/pmezard"
+                             "vendor/github.com/prometheus/client_golang"
+                             "vendor/github.com/prometheus/client_model"
+                             "vendor/github.com/prometheus/common"
+                             "vendor/github.com/prometheus/procfs"
+                             "vendor/github.com/spaolacci"
+                             "vendor/github.com/stretchr"
+                             "vendor/github.com/syndtr"
+                             "vendor/golang.org/x"
+                             "vendor/gopkg.in/yaml.v2"
+                             "vendor/gopkg.in/yaml.v3"
+                             "vendor/go.uber.org/atomic"
+                             "vendor/go.uber.org/multierr"
+                             "vendor/go.uber.org/zap"
+                             "vendor/lukechampine.com")))))
     (build-system go-build-system)
     (arguments
      `(#:unpack-path "github.com/ipfs/go-ipfs"
        #:import-path "github.com/ipfs/go-ipfs/cmd/ipfs"))
+    (inputs (list go-github-com-alecthomas-units
+                  ;; TODO: needs to be updated first
+                  ;; go-github-com-blang-semver
+                  go-github-com-cespare-xxhash
+                  go-github-com-cheekybits-genny
+                  go-github-com-cheggaaa-pb-v3
+                  go-github-com-davecgh-go-spew
+                  go-github-com-dustin-go-humanize
+                  go-github-com-flynn-noise
+                  go-github-com-francoispqt-gojay
+                  go-github-com-fsnotify-fsnotify
+                  go-github-com-gogo-protobuf
+                  go-github-com-google-uuid
+                  go-github-com-golang-groupcache-lru
+                  go-github-com-golang-snappy
+                  go-github-com-gorilla-websocket
+                  go-github-com-jackpal-go-nat-pmp
+                  go-github-com-klauspost-compress
+                  go-github-com-klauspost-cpuid
+                  go-github-com-lucas-clemente-quic-go
+                  go-github-com-mattn-go-colorable
+                  go-github-com-mattn-go-isatty
+                  go-github-com-mattn-go-runewidth
+                  go-github-com-mgutz-ansi
+                  go-github-com-minio-blake2b-simd
+                  go-github-com-minio-sha256-simd
+                  go-github-com-mitchellh-go-homedir
+                  go-github-com-mr-tron-base58
+                  go-github-com-opentracing-opentracing-go
+                  go-github-com-pkg-errors
+                  go-github-com-pmezard-go-difflib
+                  go-github-com-prometheus-client-golang
+                  go-github-com-prometheus-client-model
+                  go-github-com-prometheus-common
+                  go-github-com-prometheus-procfs
+                  go-github-com-spaolacci-murmur3
+                  go-github-com-stretchr-testify
+                  go-github-com-syndtr-goleveldb
+                  go-gopkg-in-yaml-v2
+                  go-gopkg-in-yaml-v3
+                  go-go-uber-org-atomic
+                  go-go-uber-org-multierr
+                  go-go-uber-org-zap
+                  go-golang-org-x-crypto
+                  go-golang-org-x-lint
+                  go-golang-org-x-mod
+                  go-golang-org-x-net
+                  go-golang-org-x-oauth2
+                  go-golang-org-x-sync
+                  go-golang-org-x-sys
+                  go-golang-org-x-term
+                  go-golang-org-x-tools
+                  go-golang-org-x-xerrors
+                  go-lukechampine-com-blake3))
     (native-inputs
      (list python-minimal-wrapper zsh))
     (home-page "https://ipfs.io")

base-commit: a44e08337d15b3f254a35d0311663c2bbd501852
prerequisite-patch-id: 0caac311875ee39cb48573657ebb960e90da6dfb
prerequisite-patch-id: 418285493d89ebf102175902d9b09a0174e88190
prerequisite-patch-id: 3c39eb839d9d3ff3fca6cd98621a5d5c411b7af4
prerequisite-patch-id: 8d5662e874c469f5ee496ef5181cf2d0a30ad1d8
prerequisite-patch-id: 26513c3b3b86963df718ee41d14a25d1cc6a8f3f
prerequisite-patch-id: 2b2497e2edec0afc48ebadd6f09f0c661c466127
prerequisite-patch-id: 2712efb97bf33985fd0658e4dd8e936dc08be5fe
prerequisite-patch-id: 9d2409b480a8bff0fef029b4b095922d4957e06f
prerequisite-patch-id: 51a32abca3efec1ba67ead59b8694c5ea3129ad3
prerequisite-patch-id: 7d55e3b39eb8803f058857d4412796b3f5dc0856
prerequisite-patch-id: 9092927761a340c07a99f5f3ed314a6add04cdee
-- 
2.37.3