[PATCH 0/6] gnu: golang: Add minify

  • Done
  • quality assurance status badge
Details
3 participants
  • Hilton Chain
  • Sharlatan Hellseher
  • Thomas Ieong
Owner
unassigned
Submitted by
Thomas Ieong
Severity
normal
T
T
Thomas Ieong wrote on 3 Mar 2023 23:55
(address . guix-patches@gnu.org)(name . Thomas Ieong)(address . th.ieong@free.fr)
cover.1677883649.git.th.ieong@free.fr
Hello there!

This is a patch series to add the golang minify package, a golang
dependency needed for sourcehut.

Thomas Ieong (6):
gnu: Add go-github-com-djherbis-atime.
gnu: Add go-github-com-matryer-try.
gnu: Add go-github-com-tdewolff-parse-v2.
gnu: Add go-github-com-tdewolff-test.
gnu: Add go-github-com-tdewolff-minify-v2.
gnu: Add minify.

gnu/packages/golang.scm | 143 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 143 insertions(+)


base-commit: 73cb232442a50aa00104ad739db93f44df9de073
--
2.39.1
T
T
Thomas Ieong wrote on 4 Mar 2023 00:01
[PATCH 1/6] gnu: Add go-github-com-djherbis-atime.
(address . 61946@debbugs.gnu.org)(name . Thomas Ieong)(address . th.ieong@free.fr)
d37dc078ad4058efa4e74ce98fa2b9db38e5dfd5.1677883649.git.th.ieong@free.fr
* gnu/packages/golang.scm (go-github-com-djherbis-atime): New variable.
---
gnu/packages/golang.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Toggle diff (43 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 465e0fd4c7..e213ce6cb6 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -40,6 +40,7 @@
;;; Copyright © 2022 ( <paren@disroot.org>
;;; Copyright © 2023 Hilton Chain <hako@ultrarare.space>
;;; Copyright © 2023 Timo Wilken <guix@twilken.net>
+;;; Copyright © 2023 Thomas Ieong <th.ieong@free.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -9614,6 +9615,28 @@ (define-public go-github-com-bep-golibsass
"This package provides SCSS compiler support for Go applications.")
(license license:expat)))
+(define-public go-github-com-djherbis-atime
+ (package
+ (name "go-github-com-djherbis-atime")
+ (version "1.1.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/djherbis/atime")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0xsz55zpihd9wyrj6qvm3miqzb6x3mnp5apzs0dx1byndhb8adpq"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/djherbis/atime"))
+ (home-page "https://github.com/djherbis/atime")
+ (synopsis "Access Times for files")
+ (description
+ "Package atime provides a platform-independent way to get atimes for files.")
+ (license license:expat)))
+
(define-public go-github-com-hashicorp-go-syslog
(package
(name "go-github-com-hashicorp-go-syslog")
--
2.39.1
T
T
Thomas Ieong wrote on 4 Mar 2023 00:01
[PATCH 2/6] gnu: Add go-github-com-matryer-try.
(address . 61946@debbugs.gnu.org)(name . Thomas Ieong)(address . th.ieong@free.fr)
18e0e057247ef14681c3131b52a83a16dac485dd.1677883649.git.th.ieong@free.fr
* gnu/packages/golang.scm (go-github-com-matryer-try): New variable.
---
gnu/packages/golang.scm | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index e213ce6cb6..1bd2a51d8d 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9637,6 +9637,37 @@ (define-public go-github-com-djherbis-atime
"Package atime provides a platform-independent way to get atimes for files.")
(license license:expat)))
+(define-public go-github-com-matryer-try
+ (package
+ (name "go-github-com-matryer-try")
+ (version "1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/matryer/try")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "15f0m5ywihivnvwzcw0mh0sg27aky9rkywvxqszxka9q051qvsmy"))))
+ (build-system go-build-system)
+ (native-inputs (list go-github-com-cheekybits-is))
+ (arguments
+ (list #:import-path "github.com/matryer/try"
+ #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-tests
+ (lambda* (#:key import-path #:allow-other-keys)
+ (substitute* (string-append "src/" import-path
+ "/try_test.go")
+ (("var value string")
+ "")
+ (("value, err = SomeFunction\\(\\)")
+ "_, err = SomeFunction()")))))))
+ (home-page "https://github.com/matryer/try")
+ (synopsis "Simple idiomatic retry package for Go")
+ (description "Package try provides retry functionality.")
+ (license license:expat)))
+
(define-public go-github-com-hashicorp-go-syslog
(package
(name "go-github-com-hashicorp-go-syslog")
--
2.39.1
T
T
Thomas Ieong wrote on 4 Mar 2023 00:01
[PATCH 3/6] gnu: Add go-github-com-tdewolff-parse-v2.
(address . 61946@debbugs.gnu.org)(name . Thomas Ieong)(address . th.ieong@free.fr)
27da1dcb05ba4189960ec4d190c803c4e65b1277.1677883649.git.th.ieong@free.fr
* gnu/packages/golang.scm (go-github-com-tdewolff-parse-v2): New variable.
---
gnu/packages/golang.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 1bd2a51d8d..a331331546 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9668,6 +9668,30 @@ (define-public go-github-com-matryer-try
(description "Package try provides retry functionality.")
(license license:expat)))
+(define-public go-github-com-tdewolff-parse-v2
+ (package
+ (name "go-github-com-tdewolff-parse-v2")
+ (version "2.6.5")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tdewolff/parse")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0wmyylml2b1fy735qfpwavjnhfn2ihjgna2yab433mg1ikgl6wxl"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/tdewolff/parse/v2"))
+ (propagated-inputs `(("go-github-com-tdewolff-test" ,go-github-com-tdewolff-test)))
+ (home-page "https://github.com/tdewolff/parse")
+ (synopsis "Go parsers for web formats")
+ (description
+ "Package parse contains a collection of parsers for various formats in its
+subpackages.")
+ (license license:expat)))
+
(define-public go-github-com-hashicorp-go-syslog
(package
(name "go-github-com-hashicorp-go-syslog")
--
2.39.1
T
T
Thomas Ieong wrote on 4 Mar 2023 00:01
[PATCH 4/6] gnu: Add go-github-com-tdewolff-test.
(address . 61946@debbugs.gnu.org)(name . Thomas Ieong)(address . th.ieong@free.fr)
b49bde37e178fd889a3283e5d86302473c6098c9.1677883649.git.th.ieong@free.fr
* gnu/packages/golang.scm (go-github-com-tdewolff-test): New variable.
---
gnu/packages/golang.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index a331331546..c4426d2a4f 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9692,6 +9692,30 @@ (define-public go-github-com-tdewolff-parse-v2
subpackages.")
(license license:expat)))
+(define-public go-github-com-tdewolff-test
+ (package
+ (name "go-github-com-tdewolff-test")
+ (version "1.0.7")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tdewolff/test")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0k1yk2y2mryps0klsbcdxvn7acaxqxkl9mdi2cm6zgl29n3l5gi0"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/tdewolff/test"))
+ (home-page "https://github.com/tdewolff/test")
+ (synopsis "Go test helper functions")
+ (description
+ "Test is a helper package written in @@url{http://golang.org/,Go}. It implements
+a few functions that are useful for io testing, such as readers and writers that
+fail after N consecutive reads/writes.")
+ (license license:expat)))
+
(define-public go-github-com-hashicorp-go-syslog
(package
(name "go-github-com-hashicorp-go-syslog")
--
2.39.1
T
T
Thomas Ieong wrote on 4 Mar 2023 00:01
[PATCH 5/6] gnu: Add go-github-com-tdewolff-minify-v2.
(address . 61946@debbugs.gnu.org)(name . Thomas Ieong)(address . th.ieong@free.fr)
3b1c104b18eb5144de2ad545ddc28557e802198b.1677883649.git.th.ieong@free.fr
* gnu/packages/golang.scm (go-github-com-tdewolff-minify-v2): New variable.
---
gnu/packages/golang.scm | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index c4426d2a4f..de5c0847f6 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9716,6 +9716,37 @@ (define-public go-github-com-tdewolff-test
fail after N consecutive reads/writes.")
(license license:expat)))
+(define-public go-github-com-tdewolff-minify-v2
+ (package
+ (name "go-github-com-tdewolff-minify-v2")
+ (version "2.12.4")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tdewolff/minify")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1bbygm8x68xxgqgjzqfwak06212lalsz4aq4dg9z5yjq1c3hp3ji"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/tdewolff/minify/v2"))
+ (propagated-inputs (list go-github-com-tdewolff-test
+ go-github-com-tdewolff-parse-v2
+ go-github-com-spf13-pflag
+ go-github-com-matryer-try
+ go-github-com-fsnotify-fsnotify
+ go-github-com-dustin-go-humanize
+ go-github-com-djherbis-atime
+ go-github-com-cheekybits-is))
+ (home-page "https://github.com/tdewolff/minify")
+ (synopsis "Go minifiers for web formats")
+ (description
+ "Package minify relates MIME type to minifiers. Several minifiers are provided
+in the subpackages.")
+ (license license:expat)))
+
(define-public go-github-com-hashicorp-go-syslog
(package
(name "go-github-com-hashicorp-go-syslog")
--
2.39.1
T
T
Thomas Ieong wrote on 4 Mar 2023 00:01
[PATCH 6/6] gnu: Add minify.
(address . 61946@debbugs.gnu.org)(name . Thomas Ieong)(address . th.ieong@free.fr)
a1b048fab605e90e0302145c1010b6e3010867d4.1677883649.git.th.ieong@free.fr
* gnu/packages/golang.scm (minify): New variable.
---
gnu/packages/golang.scm | 10 ++++++++++
1 file changed, 10 insertions(+)

Toggle diff (23 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index de5c0847f6..85c3d4e893 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9747,6 +9747,16 @@ (define-public go-github-com-tdewolff-minify-v2
in the subpackages.")
(license license:expat)))
+(define-public minify
+ (package
+ (inherit go-github-com-tdewolff-minify-v2)
+ (name "minify")
+ (arguments
+ `(#:import-path "github.com/tdewolff/minify/cmd/minify"
+ #:unpack-path "github.com/tdewolff/minify"
+ #:install-source? #f))))
+
+
(define-public go-github-com-hashicorp-go-syslog
(package
(name "go-github-com-hashicorp-go-syslog")
--
2.39.1
T
T
Thomas Ieong wrote on 4 Mar 2023 22:30
Go generated files
(address . 61946@debbugs.gnu.org)
87mt4sjjbo.fsf@free.fr
Hi,

I forgot to check for generated files in the go packages.
I did just that and there is indeed one file hash.go that is generated
in the parse and minify package.

Taking care of this and resending later.
--
Thomas Ieong
H
H
Hilton Chain wrote on 10 Aug 2023 14:12
(name . Thomas Ieong)(address . th.ieong@free.fr)(address . 61946@debbugs.gnu.org)
87r0objdum.wl-hako@ultrarare.space
Hi Thomas,

Toggle quote (6 lines)
> I forgot to check for generated files in the go packages.
> I did just that and there is indeed one file hash.go that is generated
> in the parse and minify package.
>
> Taking care of this and resending later.

go-github-com-tdewolff-minify-v2 has been available in Guix for a
while (but not the minify command and its dependency). I have sent a
patchset [1] to generate hash.go at build time. Can you update the
series to base on it and current Guix?

And I think dependencies not added to go-github-com-tdewolff-minify-v2
are only required by minify command, so there's no need to touch
definition of the former, inherit and modify is sufficient. What do
you think?

Thanks

S
S
Sharlatan Hellseher wrote on 31 Jan 00:17 +0100
[PATCH 0/6] gnu: golang: Add minify
(address . 61946-done@debbugs.gnu.org)
87v87as96e.fsf@gmail.com
Hi Thomas and Hilton,

I've tried to resolved all highlights which Hilton pointed out and from
some investigation I've left with 3 pushed patches.

- present [3/3]
- [X] go-github-com-tdewolff-parse-v2
- [X] go-github-com-tdewolff-test
- [X] go-github-com-tdewolff-minify-v2

- added to golang-xyz.scm [2/2]
- [X] go-github-com-djherbis-atime
- [X] go-github-com-matryer-try

And the minify looks like this with inherit and modification:

Toggle snippet (18 lines)
(define-public minify
(package
(inherit go-github-com-tdewolff-minify-v2)
(name "minify")
(arguments
(substitute-keyword-arguments
(package-arguments go-github-com-tdewolff-minify-v2)
((#:install-source? _ #t) #f)
((#:import-path _ "github.com/tdewolff/minify/v2")
"github.com/tdewolff/minify/cmd/minify")))
(inputs
(list go-github-com-djherbis-atime
go-github-com-dustin-go-humanize
go-github-com-fsnotify-fsnotify
go-github-com-matryer-try
go-github-com-spf13-pflag))))

Maxim or Ricardo,

Pinging you here as following, I've built it few times locally and
everything passed just fine, for some reason CI feel bad.

Thanks,
Oleg
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEmEeB3micIcJkGAhndtcnv/Ys0rUFAmW5g4kACgkQdtcnv/Ys
0rXydg//WNpQNkb0dpzUN6mgcCY2YWYRaV2SPbWlKFkfZR3AnJPsfLYTZt25JUtd
ewwe0xVF8FLNwZazcUONmvUWUlHzk6p+Uk3T/p0P2FXYRnkh57CkPuTX+QHXz+8G
+StXuC1s5ZQJc9Oxov8PiYJG6920E9GyoDYQnBHtTRj2Ev4mZVw7hEZMQvb/czpY
kzfaXROVwYvF46DDZ7d4JxU9eLtemHhb6wf7oHR6BrQ9vOeGoHThzNzMivqK7tU1
3+a614m5BHrbYI8Z2f8dy0vRm6lOWUUDMwK543j1uNKeJSl8Wbo7knA9mXxIXk5l
WVjn6iVR8mUpB4mBW/cs5hnAw/AGsrirkaizFUiDkgFNJ/yTmZ+wXeGeUmnEy9Q6
Tf18P8AU4oj8pkzMVn9Pgiw77+M0L2KMTxwFIePpWTNFbYtqq+7+0DGdav9dVaMe
GgDShNGhTs16Diw2NCd3EMcC48/DDwRmBrq2aKM/8ngZbAvkVVr426yw+NeTJjaZ
64ABn4TfwD7cAY0MiJ6Bdskq/FwbUeQqpQ4kWs2zxMhaZtvWxFIleOP1+cZnnm/b
Q37wmLJ8AKYNpvwHgtQ890gqsF+SleBvTdzBFMDV/IPeCcosKqX/m2lGNZ8/w5Nm
x3b0ZROuv3ol8gZ+ZrJdtMhit7pPgmp/7J5lnmV58GLqwV9eYCU=
=zduw
-----END PGP SIGNATURE-----

Closed
H
H
Hilton Chain wrote on 1 Feb 04:10 +0100
(name . Sharlatan Hellseher)(address . sharlatanus@gmail.com)(address . 61946@debbugs.gnu.org)
87plxg5174.wl-hako@ultrarare.space
Hi Sharlatan,

On Wed, 31 Jan 2024 07:17:29 +0800,
Sharlatan Hellseher wrote:
Toggle quote (31 lines)
>
> [1 <text/plain (quoted-printable)>]
>
> Hi Thomas and Hilton,
>
> I've tried to resolved all highlights which Hilton pointed out and from
> some investigation I've left with 3 pushed patches.
>
> - present [3/3]
> - [X] go-github-com-tdewolff-parse-v2
> - [X] go-github-com-tdewolff-test
> - [X] go-github-com-tdewolff-minify-v2
>
> - added to golang-xyz.scm [2/2]
> - [X] go-github-com-djherbis-atime
> - [X] go-github-com-matryer-try
>
> And the minify looks like this with inherit and modification:
>
> --8<---------------cut here---------------start------------->8---
> (define-public minify
> (package
> (inherit go-github-com-tdewolff-minify-v2)
> (name "minify")
> (arguments
> (substitute-keyword-arguments
> (package-arguments go-github-com-tdewolff-minify-v2)
> ((#:install-source? _ #t) #f)
> ((#:import-path _ "github.com/tdewolff/minify/v2")
> "github.com/tdewolff/minify/cmd/minify")))

I think there's no need to supply a default value to #:import-path
since all Go packages should have it in their arguments list.

Toggle quote (8 lines)
> (inputs
> (list go-github-com-djherbis-atime
> go-github-com-dustin-go-humanize
> go-github-com-fsnotify-fsnotify
> go-github-com-matryer-try
> go-github-com-spf13-pflag))))
> --8<---------------cut here---------------end--------------->8---

And we can avoid the inherited propagated-inputs.

I have adjusted the definition to the following, does this look good
to you?

Toggle snippet (19 lines)
(define-public minify
(let ((base go-github-com-tdewolff-minify-v2))
(package
(inherit base)
(name "minify")
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:install-source? _ #t) #f)
((#:import-path _) "github.com/tdewolff/minify/cmd/minify")))
(inputs
(modify-inputs (package-propagated-inputs base)
(prepend go-github-com-djherbis-atime
go-github-com-dustin-go-humanize
go-github-com-fsnotify-fsnotify
go-github-com-matryer-try
go-github-com-spf13-pflag)))
(propagated-inputs '()))))

Thanks
S
S
Sharlatan Hellseher wrote on 1 Feb 21:54 +0100
[PATCH 0/6] gnu: golang: Add minify
(address . 61946-done@debbugs.gnu.org)(address . hako@ultrarare.space)
87h6irsy5f.fsf@gmail.com
Hi Hilton,

Base on suggestions from https://issues.guix.gnu.org/68835 I've moved
minifry into golang-web and renamed the package with manner proposed in

I image there would be a large verity of packages with name 'minify' in
the future :-).

There is alsoy Python binding we may pack as well

Pushed to go-minify as df65af45b5f2cc76ce813ca91fab9054fd807bba to master.

Thanks,
Oleg
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEmEeB3micIcJkGAhndtcnv/Ys0rUFAmW8BRwACgkQdtcnv/Ys
0rVl0A//SMvkjGWP4VtxSfTqZ6tmAN7BvroEd4UYRLft9oSk9PgVgbZjSWjva4QO
FmQga5zcqiYnfJlhv6+YdQeNeqDJh5IEtKPbTZhAWXS3zkVSpvhbm5jXwv5QCNDX
ndDSECMotsLlavurPLMWivGf2EsipInClyLpoLWmL9ZnEmnACQoRe/zKTb9GpPIf
9pjc6c8XkZgP2BQacotFKvN8ik+IbVEFEh4rQWiu1n3aIBgB07n5e1x8Jd55H8cH
ZfJXan5XE7t4XYkmkrxvVZ1R6V25b/DN+dy91lvE5E9+y621POkO9dS7xQQE3WE5
Q2O5HuN3AXK1F1XvPgxMU6WdVfpQ5hZXgSvooyq2upf07O7c49gbugRaEaPZApxt
rViu5x/0kGZ778tbGUN6yFNDZu8MACUNdhBbUUuVacZBPskV/8JqaEx2CKOKHkGs
qJrxhwkTajuAelVYTsGTPABlxwGyVaZXBE2UJXlIMOftqmXhirVGYyw9xrZlGwVg
8Qw7H1SxXYsmJQ8QpoKnvZMTtpujign6Zkk+Vai4B6hta+1Fm82VHon+BrP/Z/uI
peqJzEg0DfJ5mdalf4ofHiG4rceEdgmTM02DayfhX2RPzD8usQQ84j5bPdCA9pw6
PM/9DVRcn4xB09c1FTPPibc6fib+UpMVD11/79BqPM7H8NbawBw=
=vJIh
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 61946@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 61946
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch