diff mbox series

[bug#54560,04/47] gnu: go-github-com-prometheus-client-golang: Update to 1.12.1.

Message ID 20220325133211.5128-4-hello@lnikki.la
State New
Headers show
Series [bug#54560,01/47] gnu: Add go-google-golang-org-protobuf. | expand

Commit Message

Leo Nikkilä March 25, 2022, 1:31 p.m. UTC
* gnu/packages/patches/go-github-com-prometheus-common-remove-readidletimeout.patch:
New patch, avoid updating go-golang-org-x-net just yet.
* gnu/packages/syncthing.scm (go-github-com-prometheus-client-golang):
Update to 1.12.1.
(go-github-com-prometheus-client-model): Update to 0.2.0.
(go-github-com-prometheus-common): Update to 0.32.1.
[patches]: Use patch.
(go-github-com-prometheus-procfs): Update to 0.7.3.
{unpack-test-data}, {delete-test-data}: New phases.
[arguments]: Enable tests.
---
 ...etheus-common-remove-readidletimeout.patch |  28 +++
 gnu/packages/syncthing.scm                    | 182 ++++++++++--------
 2 files changed, 130 insertions(+), 80 deletions(-)
 create mode 100644 gnu/packages/patches/go-github-com-prometheus-common-remove-readidletimeout.patch

Comments

M March 25, 2022, 7:19 p.m. UTC | #1
Leo Nikkilä schreef op vr 25-03-2022 om 15:31 [+0200]:
> +       #:phases
> +       (modify-phases %standard-phases
> +         ;; Source-only package
> +         (delete 'build))))

Why is this phase deleted?  I know it is currently being done for a few
other go packages, but AFAIK these deletals are pointless.  I'm
wondering if removing them from other Go packages would cause any
problems ...

Greetings,
Maxime
M March 25, 2022, 7:20 p.m. UTC | #2
Leo Nikkilä schreef op vr 25-03-2022 om 15:31 [+0200]:
> +       #:tests? #f

Is ignoring tests still necessary?
M March 25, 2022, 7:22 p.m. UTC | #3
Leo Nikkilä schreef op vr 25-03-2022 om 15:31 [+0200]:
> +             #t))

Returning #t from phases is not necessary anymore.  I'm wondering, did
you find this in some documentation floating around somewhere or
something?  If so, I'd like to know where such that it can be updated.

Greetings,
Maxime.
M March 25, 2022, 7:23 p.m. UTC | #4
Leo Nikkilä schreef op vr 25-03-2022 om 15:31 [+0200]:
>         '(#:tests? #f

Is this still necessary?
M March 25, 2022, 7:24 p.m. UTC | #5
Leo Nikkilä schreef op vr 25-03-2022 om 15:31 [+0200]:
> +    (name "go-github-com-prometheus-procfs")

This looks Linux-specific.  Is it?  If so, please remove non-linux
things from supporetd-systems:

  (supported-systems (filter target-linux? %supported-systems))
Leo Nikkilä March 25, 2022, 10:55 p.m. UTC | #6
> Why is the 'build phase deleted?

> Is ignoring tests still necessary?

Looks like you're right, I was able to use the default build phases with these packages locally, after minor tweaks. I believe I followed the pattern from the existing packages earlier, seems it's unnecessary.

> Returning #t from phases is not necessary anymore.  I'm wondering, did
> you find this in some documentation floating around somewhere or
> something?

Old habit, I learned this when this was still common. Will remove these.

> This looks Linux-specific.

Thank you, it is.
diff mbox series

Patch

diff --git a/gnu/packages/patches/go-github-com-prometheus-common-remove-readidletimeout.patch b/gnu/packages/patches/go-github-com-prometheus-common-remove-readidletimeout.patch
new file mode 100644
index 0000000000..4eea8ae5c5
--- /dev/null
+++ b/gnu/packages/patches/go-github-com-prometheus-common-remove-readidletimeout.patch
@@ -0,0 +1,28 @@ 
+ConfigureTransports was introduced in a newer version of
+go-golang-org-x-net:
+<https://github.com/golang/net/commit/08b38378de702b893ee869b94b32f833e2933bd2>
+
+Prior to this, Prometheus didn't configure ReadIdleTimeout:
+<https://github.com/prometheus/common/commit/b5c358997cbf126e8f8518cdc024c32da3996d48>
+
+It's somewhat unclear whether ReadIdleTimeout is absolutely required to
+work around the upstream issues with HTTP/2 mentioned in the codebase,
+however HTTP/2 can be disabled using enable_http2 if this is the case.
+
+diff --git a/config/http_config.go b/config/http_config.go
+index 4b87241..7698ba4 100644
+--- a/config/http_config.go
++++ b/config/http_config.go
+@@ -411,11 +411,10 @@ func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string, optFuncs ...HT
+ 			// issues again, but will be removed once we are confident that
+ 			// things work as expected.
+ 
+-			http2t, err := http2.ConfigureTransports(rt.(*http.Transport))
++			err := http2.ConfigureTransport(rt.(*http.Transport))
+ 			if err != nil {
+ 				return nil, err
+ 			}
+-			http2t.ReadIdleTimeout = time.Minute
+ 		}
+ 
+ 		// If a authorization_credentials is provided, create a round tripper that will set the
diff --git a/gnu/packages/syncthing.scm b/gnu/packages/syncthing.scm
index 107b97e547..b9c72a3212 100644
--- a/gnu/packages/syncthing.scm
+++ b/gnu/packages/syncthing.scm
@@ -7,6 +7,7 @@ 
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Leo Nikkilä <hello@lnikki.la>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -819,34 +820,32 @@  (define-public go-github-com-beorn7-perks-quantile
       (license expat))))
 
 (define-public go-github-com-prometheus-client-model
-  (let ((commit "14fe0d1b01d4d5fc031dd4bec1823bd3ebbe8016")
-        (revision "2"))
-    (package
-      (name "go-github-com-prometheus-client-model")
-      (version (git-version "0.0.2" revision commit))
-      (source (origin
-                (method git-fetch)
-                (uri (git-reference
-                       (url "https://github.com/prometheus/client_model")
-                       (commit commit)))
-                (file-name (git-file-name name version))
-                (sha256
-                 (base32
-                  "0zdmk6rbbx39cvfz0r59v2jg5sg9yd02b4pds5n5llgvivi99550"))))
-      (build-system go-build-system)
-      (arguments
-       '(#:import-path "github.com/prometheus/client_model"
-         #:tests? #f
-         #:phases
-         (modify-phases %standard-phases
-           ;; Source-only package
-           (delete 'build))))
-      (propagated-inputs
-       (list go-github-com-golang-protobuf-proto))
-      (synopsis "Data model artifacts for Prometheus")
-      (description "This package provides data model artifacts for Prometheus.")
-      (home-page "https://github.com/prometheus/client_model")
-      (license asl2.0))))
+  (package
+    (name "go-github-com-prometheus-client-model")
+    (version "0.2.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/prometheus/client_model")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0jffnz94d6ff39fr96b5w8i8yk26pwnrfggzz8jhi8k0yihg2c9d"))))
+    (build-system go-build-system)
+    (arguments
+     '(#:import-path "github.com/prometheus/client_model"
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; Source-only package
+         (delete 'build))))
+    (propagated-inputs (list go-github-com-golang-protobuf-proto
+                             go-github-com-golang-protobuf-ptypes))
+    (synopsis "Data model artifacts for Prometheus")
+    (description "This package provides data model artifacts for Prometheus.")
+    (home-page "https://github.com/prometheus/client_model")
+    (license asl2.0)))
 
 (define-public go-github-com-matttproud-golang-protobuf-extensions-pbutil
   (let ((commit "c12348ce28de40eed0136aa2b644d0ee0650e56c")
@@ -879,65 +878,87 @@  (define-public go-github-com-matttproud-golang-protobuf-extensions-pbutil
       (license asl2.0))))
 
 (define-public go-github-com-prometheus-common
-    (package
-      (name "go-github-com-prometheus-common")
-      (version "0.4.1")
-      (source (origin
-                (method git-fetch)
-                (uri (git-reference
-                       (url "https://github.com/prometheus/common")
-                       (commit (string-append "v" version))))
-                (file-name (git-file-name name version))
-                (sha256
-                 (base32
-                  "0sf4sjdckblz1hqdfvripk3zyp8xq89w7q75kbsyg4c078af896s"))))
-      (build-system go-build-system)
-      (arguments
-       '(#:import-path "github.com/prometheus/common"
-         #:tests? #f
-         #:phases
-         (modify-phases %standard-phases
-           ;; Source-only package
-           (delete 'build))))
-      (propagated-inputs
-       (list go-github-com-golang-protobuf-proto
-             go-github-com-matttproud-golang-protobuf-extensions-pbutil
-             go-github-com-prometheus-client-model))
-      (synopsis "Prometheus metrics")
-      (description "This package provides tools for reading and writing
+  (package
+    (name "go-github-com-prometheus-common")
+    (version "0.32.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/prometheus/common")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0501dwlv427vr78c59h4z25vxzkzjx76haydjj4pql1sx44546vv"))
+              ;; This can be removed once go-golang-org-x-net is
+              ;; updated past 08b38378de702b893ee869b94b32f833e2933bd2.
+              (patches
+               (search-patches
+                "go-github-com-prometheus-common-remove-readidletimeout.patch"))))
+    (build-system go-build-system)
+    (arguments
+     '(#:import-path "github.com/prometheus/common"
+                     #:tests? #f
+                     #:phases
+                     (modify-phases %standard-phases
+                       ;; Source-only package
+                       (delete 'build))))
+    (propagated-inputs
+     (list go-github-com-golang-protobuf-proto
+           go-github-com-golang-protobuf-ptypes
+           go-github-com-julienschmidt-httprouter
+           go-github-com-matttproud-golang-protobuf-extensions-pbutil
+           go-github-com-prometheus-client-model))
+    (synopsis "Prometheus metrics")
+    (description "This package provides tools for reading and writing
 Prometheus metrics.")
-      (home-page "https://github.com/prometheus/common")
-      (license asl2.0)))
+    (home-page "https://github.com/prometheus/common")
+    (license asl2.0)))
 
 (define-public go-github-com-prometheus-procfs
-    (package
-      (name "go-github-com-prometheus-procfs")
-      (version "0.0.4")
-      (source (origin
-                (method git-fetch)
-                (uri (git-reference
-                       (url "https://github.com/prometheus/procfs")
-                       (commit (string-append "v" version))))
-                (file-name (git-file-name name version))
-                (sha256
-                 (base32
-                  "1z5jq5rjala0a0di4nwk1rai0z9f73qwqj6mgcbpjbg2qknlb544"))))
-      (build-system go-build-system)
-      (arguments
-       '(#:import-path "github.com/prometheus/procfs"
-         ;; The tests require Go modules, which are not yet supported in Guix's
-         ;; Go build system.
-         #:tests? #f))
-      (synopsis "Go library for reading @file{/proc}")
-      (description "The @code{procfs} Go package provides functions to retrieve
+  (package
+    (name "go-github-com-prometheus-procfs")
+    (version "0.7.3")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/prometheus/procfs")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "00z7ghcb86y2ajx0xvwmn3d18nq4djmvmjn52crgm85gsl442lb4"))))
+    (build-system go-build-system)
+    (arguments
+     '(#:import-path "github.com/prometheus/procfs"
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'unpack-test-data
+           (lambda* (#:key tests? import-path #:allow-other-keys)
+             (when tests?
+               (with-directory-excursion (string-append "src/" import-path)
+                 (invoke "make" "fixtures")))
+             #t))
+         ;; We don't want to install fixtures and other test data.
+         (add-before 'install 'delete-test-data
+           (lambda* (#:key import-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" import-path)
+                (delete-file "ttar")
+                (delete-file "fixtures.ttar")
+                (delete-file-recursively "fixtures"))
+             #t)))))
+    (propagated-inputs (list go-golang-org-x-sys))
+    (native-inputs (list go-github-com-google-go-cmp-cmp))
+    (synopsis "Go library for reading @file{/proc}")
+    (description "The @code{procfs} Go package provides functions to retrieve
 system, kernel, and process metrics from the @file{/proc} pseudo file system.")
-      (home-page "https://github.com/prometheus/procfs")
-      (license asl2.0)))
+    (home-page "https://github.com/prometheus/procfs")
+    (license asl2.0)))
 
 (define-public go-github-com-prometheus-client-golang
     (package
       (name "go-github-com-prometheus-client-golang")
-      (version "1.2.1")
+      (version "1.12.1")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
@@ -946,7 +967,7 @@  (define-public go-github-com-prometheus-client-golang
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
-                  "0zs49psk23n9z8wrl02d5vib5wclpym8kaxcy6n5pk696i419065"))))
+                  "0d46nindizpjgdygryc140fd94j1qfkzwyzwh9p2g3zp6v4fw0s1"))))
       (build-system go-build-system)
       (arguments
        '(#:tests? #f
@@ -958,6 +979,7 @@  (define-public go-github-com-prometheus-client-golang
       (propagated-inputs
        (list go-github-com-beorn7-perks-quantile
              go-github-com-golang-protobuf-proto
+             go-github-com-golang-protobuf-ptypes
              go-github-com-prometheus-client-model
              go-github-com-prometheus-common
              go-github-com-prometheus-procfs