diff mbox series

[bug#49494,6/7] gnu: Add go-github-com-klauspost-compress.

Message ID 20210709161940.12759-6-arunisaac@systemreboot.net
State Accepted
Headers show
Series [bug#49494,1/7] gnu: Add go-github-com-davecgh-go-xdr. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Arun Isaac July 9, 2021, 4:19 p.m. UTC
* gnu/packages/golang.scm (go-github-com-klauspost-compress): New variable.
---
 gnu/packages/golang.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Sarah Morgensen July 22, 2021, 11:38 p.m. UTC | #1
Hi,

Thanks for your patches.

Arun Isaac <arunisaac@systemreboot.net> writes:

> * gnu/packages/golang.scm (go-github-com-klauspost-compress): New variable.
> ---
>  gnu/packages/golang.scm | 37 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
>
> diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
> index 5a7f27bc91..ef54e15afc 100644
> --- a/gnu/packages/golang.scm
> +++ b/gnu/packages/golang.scm
> @@ -67,6 +67,7 @@
>    #:use-module (gnu packages perl)
>    #:use-module (gnu packages pkg-config)
>    #:use-module (gnu packages pulseaudio)
> +  #:use-module (gnu packages syncthing)
>    #:use-module (gnu packages terminals)
>    #:use-module (gnu packages textutils)
>    #:use-module (gnu packages tls)
> @@ -8352,3 +8353,39 @@ is a low-level framework for building crypto protocols.  Noise protocols
>  support mutual and optional authentication, identity hiding, forward secrecy,
>  zero round-trip encryption, and other advanced features.")
>      (license license:bsd-3)))
> +
> +(define-public go-github-com-klauspost-compress
> +  (package
> +    (name "go-github-com-klauspost-compress")
> +    (version "1.13.1")
> +    (source
> +      (origin
> +        (method git-fetch)
> +        (uri (git-reference
> +               (url "https://github.com/klauspost/compress")
> +               (commit (string-append "v" version))))
> +        (file-name (git-file-name name version))
> +        (sha256
> +          (base32
> +            "0ydnf9rizlhm8rilh14674qqx272sbwbkjx06xn9pqvy6mmn2r3r"))))
> +    (build-system go-build-system)
> +    (arguments
> +     `(#:import-path "github.com/klauspost/compress"
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-before 'reset-gzip-timestamps 'fix-permissions
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             ;; Provide write permissions on gzip files so that
> +             ;; reset-gzip-timestamps has sufficient permissions.
> +             (for-each (lambda (file)
> +                         (chmod file #o644))
> +                       (find-files (assoc-ref outputs "out")
> +                                   (lambda (file stat)
> +                                     (and (eq? 'regular (stat:type stat))
> +                                          (string-suffix? ".gz" file))))))))))

You can simplify this with the Guix built-in MAKE-FILE-WRITABLE and
taking advantage of the facts that FIND-FILES can take a regex as PRED
and does not follow symlinks or return directories by default:

  (for-each make-file-writable
            (find-files (assoc-ref outputs "out") ".*\\.t?gz$"))


> +    (propagated-inputs
> +     `(("go-github-com-golang-snappy" ,go-github-com-golang-snappy)))
> +    (home-page "https://github.com/klauspost/compress")
> +    (synopsis "Go compression library")
> +    (description "@code{compress} provides various compression algorithms.")
> +    (license license:bsd-3)))
diff mbox series

Patch

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 5a7f27bc91..ef54e15afc 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -67,6 +67,7 @@ 
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pulseaudio)
+  #:use-module (gnu packages syncthing)
   #:use-module (gnu packages terminals)
   #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
@@ -8352,3 +8353,39 @@  is a low-level framework for building crypto protocols.  Noise protocols
 support mutual and optional authentication, identity hiding, forward secrecy,
 zero round-trip encryption, and other advanced features.")
     (license license:bsd-3)))
+
+(define-public go-github-com-klauspost-compress
+  (package
+    (name "go-github-com-klauspost-compress")
+    (version "1.13.1")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/klauspost/compress")
+               (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+          (base32
+            "0ydnf9rizlhm8rilh14674qqx272sbwbkjx06xn9pqvy6mmn2r3r"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "github.com/klauspost/compress"
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'reset-gzip-timestamps 'fix-permissions
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Provide write permissions on gzip files so that
+             ;; reset-gzip-timestamps has sufficient permissions.
+             (for-each (lambda (file)
+                         (chmod file #o644))
+                       (find-files (assoc-ref outputs "out")
+                                   (lambda (file stat)
+                                     (and (eq? 'regular (stat:type stat))
+                                          (string-suffix? ".gz" file))))))))))
+    (propagated-inputs
+     `(("go-github-com-golang-snappy" ,go-github-com-golang-snappy)))
+    (home-page "https://github.com/klauspost/compress")
+    (synopsis "Go compression library")
+    (description "@code{compress} provides various compression algorithms.")
+    (license license:bsd-3)))