Subject: [bug#74049] [PATCH v2] gnu: matterbridge: Unbundle most golang.org dependencies.

From: Denis 'GNUtoo' Carikli <[email-masked]>
Date: Tue, 5 Nov 2024 23:27:36 +0100

The vendor/golang.org/x/net and vendor/github.com/russross/blackfriday
dependencies were kept because removing any of them results in a compilation
failure:
    %exception #<&invoke-error program: "go" arguments: ("install" "-v" "-x"
     "-ldflags=-s -w" "-trimpath" "github.com/42wim/matterbridge")
     exit-status: 1 term-signal: #f stop-signal: #f>

* gnu/packages/messaging.scm (matterbridge) [source]:
  Add snippet removing the unbundled dependencies.
  [arguments]: Add new unbundled dependencies.

Signed-off-by: Denis 'GNUtoo' Carikli <[email-masked]>
Change-Id: I67afeff8721833d34a54fd52684a4acbcbcaf179
---
ChangeLog v1->v2:
* Updated copyrights in messaging.scm.
* Unbundled all I could with the existing Guix packages and the commit message
  was updated accordingly.
* Added comments to group the dependencies together as there are lots of
  dependencies.
---
 gnu/packages/messaging.scm | 140 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 139 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index c482cd469e..f2d7dd90fb 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -29,7 +29,7 @@
 ;;; Copyright © 2020, 2021 Robert Karszniewicz <[email-masked]>
 ;;; Copyright © 2020 Giacomo Leidi <[email-masked]>
 ;;; Copyright © 2021 Maxime Devos <[email-masked]>
-;;; Copyright © 2021, 2023 Denis 'GNUtoo' Carikli <[email-masked]>
+;;; Copyright © 2021, 2023-2024 Denis 'GNUtoo' Carikli <[email-masked]>
 ;;; Copyright © 2021, 2024 Vinicius Monego <[email-masked]>
 ;;; Copyright © 2021 jgart <[email-masked]>
 ;;; Copyright © 2022 Aleksandr Vityazev <[email-masked]>
@@ -96,6 +96,9 @@ (define-module (gnu packages messaging)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages golang-build)
+  #:use-module (gnu packages golang-check)
+  #:use-module (gnu packages golang-compression)
+  #:use-module (gnu packages golang-crypto)
   #:use-module (gnu packages golang-web)
   #:use-module (gnu packages golang-xyz)
   #:use-module (gnu packages gperf)
@@ -3302,6 +3305,69 @@ (define-public matterbridge
                     (url "https://github.com/42wim/matterbridge")
                     (commit (string-append "v" version))))
               (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              (snippet '(for-each delete-file-recursively
+                                  ;; TODO: unbundle the rest as well
+                                  '(;; golang.org
+                                    "vendor/golang.org/x/crypto"
+                                    "vendor/golang.org/x/image"
+                                    "vendor/golang.org/x/mod"
+                                    "vendor/golang.org/x/oauth2"
+                                    "vendor/golang.org/x/sys"
+                                    "vendor/golang.org/x/term"
+                                    "vendor/golang.org/x/text"
+                                    "vendor/golang.org/x/time"
+                                    "vendor/golang.org/x/tools"
+                                    ;; google.golang.org
+                                    "vendor/google.golang.org/protobuf/"
+                                    ;; gopkg.in
+                                    "vendor/gopkg.in/ini.v1"
+                                    "vendor/gopkg.in/yaml.v2"
+                                    "vendor/gopkg.in/yaml.v3"
+                                    "vendor/gopkg.in/natefinch"
+                                    ;; filippo.io
+                                    "vendor/filippo.io"
+                                    ;; uber.org
+                                    "vendor/go.uber.org/atomic"
+                                    "vendor/go.uber.org/multierr"
+                                    "vendor/go.uber.org/zap"
+                                    ;; github.com
+                                    "vendor/github.com/blang"
+                                    "vendor/github.com/d5"
+                                    "vendor/github.com/davecgh"
+                                    "vendor/github.com/dustin"
+                                    "vendor/github.com/vmihailenco/tagparser"
+                                    "vendor/github.com/francoispqt"
+                                    "vendor/github.com/fsnotify"
+                                    "vendor/github.com/go-asn1-ber"
+                                    "vendor/github.com/golang"
+                                    "vendor/github.com/golang-jwt"
+                                    "vendor/github.com/google/uuid"
+                                    "vendor/github.com/gorilla/websocket"
+                                    "vendor/github.com/hashicorp"
+                                    "vendor/github.com/json-iterator"
+                                    "vendor/github.com/klauspost"
+                                    "vendor/github.com/jpillora"
+                                    "vendor/github.com/kballard"
+                                    "vendor/github.com/magiconair"
+                                    "vendor/github.com/mattn/go-colorable"
+                                    "vendor/github.com/mattn/go-isatty"
+                                    "vendor/github.com/mattn/go-runewidth"
+                                    "vendor/github.com/minio/sha256-simd"
+                                    "vendor/github.com/mitchellh"
+                                    "vendor/github.com/modern-go"
+                                    "vendor/github.com/opentracing"
+                                    "vendor/github.com/pelletier"
+                                    "vendor/github.com/pkg"
+                                    "vendor/github.com/rivo"
+                                    "vendor/github.com/sirupsen"
+                                    "vendor/github.com/skip2"
+                                    "vendor/github.com/spf13"
+                                    "vendor/github.com/stretchr"
+                                    "vendor/github.com/subosito"
+                                    "vendor/github.com/valyala/bytebufferpool"
+                                    "vendor/github.com/pmezard"
+                                    "vendor/github.com/mgutz/ansi")))
               (sha256
                (base32
                 "0939fiy7z53izznfhlr7c6vaskbmkbj3ncb09fzx5dmz9cjngy80"))))
@@ -3309,6 +3375,78 @@ (define-public matterbridge
     (arguments
      (list
       #:import-path "github.com/42wim/matterbridge"))
+    (inputs (list
+             ;; golang.org
+             go-golang-org-x-crypto
+             go-golang-org-x-image
+             go-golang-org-x-mod
+             go-golang-org-x-oauth2
+             go-golang-org-x-sys
+             go-golang-org-x-term
+             go-golang-org-x-text
+             go-golang-org-x-time
+             go-golang-org-x-tools
+             ;; google.golang.org
+             go-google-golang-org-protobuf
+             ;; gopkg.in
+             go-gopkg-in-ini-v1
+             go-gopkg-in-yaml-v2
+             go-gopkg-in-yaml-v3
+             go-gopkg-in-natefinch-lumberjack.v2
+             ;; filippo.io
+             go-filippo-io-edwards25519
+             ;; uber.org
+             go-go-uber-org-atomic
+             go-go-uber-org-multierr
+             go-go-uber-org-zap
+             ;; github.com
+             go-github-com-blang-semver
+             go-github-com-d5-tengo-v2
+             go-github-com-davecgh-go-spew
+             go-github-com-dustin-go-humanize
+             go-github-com-vmihailenco-tagparser
+             go-github-com-francoispqt-gojay
+             go-github-com-fsnotify-fsnotify
+             go-github-com-go-asn1-ber-asn1-ber
+             go-github-com-golang-protobuf
+             go-github-com-golang-jwt-jwt
+             go-github-com-google-uuid
+             go-github-com-gorilla-websocket
+             go-github-com-hashicorp-hcl
+             go-github-com-hashicorp-errwrap
+             go-github-com-hashicorp-golang-lru
+             go-github-com-hashicorp-go-multierror
+             go-github-com-json-iterator-go
+             go-github-com-klauspost-cpuid-v2
+             go-github-com-klauspost-compress
+             go-github-com-jpillora-backoff
+             go-github-com-kballard-go-shellquote
+             go-github-com-magiconair-properties
+             go-github-com-mattn-go-colorable
+             go-github-com-mattn-go-isatty
+             go-github-com-mattn-go-runewidth
+             go-github-com-minio-sha256-simd
+             go-github-com-mitchellh-go-homedir
+             go-github-com-mitchellh-mapstructure
+             go-github-com-modern-go-reflect2
+             go-github-com-modern-go-concurrent
+             go-github-com-opentracing-opentracing-go
+             go-github-com-pelletier-go-toml
+             go-github-com-pelletier-go-toml-v2
+             go-github-com-pkg-errors
+             go-github-com-rivo-uniseg
+             go-github-com-sirupsen-logrus
+             go-github-com-skip2-go-qrcode
+             go-github-com-spf13-pflag
+             go-github-com-spf13-jwalterweatherman
+             go-github-com-spf13-cast
+             go-github-com-spf13-afero
+             go-github-com-spf13-viper
+             go-github-com-stretchr-testify
+             go-github-com-subosito-gotenv
+             go-github-com-valyala-bytebufferpool
+             go-github-com-pmezard-go-difflib
+             go-github-com-mgutz-ansi))
     (synopsis "Bridge together various messaging networks and protocols")
     (description
      "Relays messages between different channels from various

base-commit: 78ffa637313f61a4fec06e5f1e41595f0e79b9eb
-- 
2.46.0