[PATCH 0/2] cloudflare-cli and dependency JSON.sh

  • Done
  • quality assurance status badge
Details
5 participants
  • Sarah Morgensen
  • Ludovic Courtès
  • Maxim Cournoyer
  • Stephen Paul Weber
  • zimoun
Owner
unassigned
Submitted by
Stephen Paul Weber
Severity
normal
S
S
Stephen Paul Weber wrote on 25 Sep 2021 03:38
(address . guix-patches@gnu.org)
20210925013848.GA2384@singpolyma-beefy.lan
This series submits two new packages: cloudflare-cli and its dependency JSON.sh
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEWeaCw+rzmiEMpzU00RwpEc5RnN4FAmFOfagACgkQ0RwpEc5R
nN721A//YPSkpqyRkrKCZrcqLdwCQMSyqAsTcnidKrjuS1vux5ozpZZyVX5Fq87d
sit3BPBai0ihfgmUxppQuxIin1fB3UF1Xa8eSR6po3HjsP+igoaYOGVodt0U2N+R
lQyQEKLEg1O1TomT4qh9AChkEFAKsY9BAA6Wa38MpzcC4+DeT5o6karXtbajIEpe
JbV236CEo7LXYRbBZzuF+AA+tAyFhUb8IGfEl7np7yfAd8stXkWM7zJr/BIqdZ97
oBl2S7uuLgKe2K94WVtmTEvWENVJINSQOzYw3N8csKYmgz8cz0IXytEQkVghR7Ra
HmE9NqdwFPPcqrRy2Ouf28l733ksAqU8NIztfG5Qx07vRTJyQxtTa/wODJ4ipkmh
wjlTmqgmvvM8MGt2Uld5TsHSbaYSE7ert7NWDrkiveA8vj/toW8d71uagY8O66Yf
9jfxWJxI6BqhcAaAKrwfa1t0wGO9L4uBjuIbJQIG5NpxWMXZfZTJvyEK8muzvyqx
Qbi/a1G7UWMGDpSTk6SBhMrlYNu+tlSv3eYE2WnqWifkBCX7H1DZsAVEt1bD1xdO
bPuq/xR32OhOa00x/pxn2ndEwKnOm6S9q14rhNgIl65Xx8vxWWgqBT0iU11FwWCo
yOPMOQ3f5c3E7Vea9w9Pu2P6x21pz/dciGIR3kLN162VIYEPMeE=
=2EJF
-----END PGP SIGNATURE-----


S
S
Stephen Paul Weber wrote on 25 Sep 2021 03:39
[PATCH 2/2] gnu: Add cloudflare-cli
(address . 50793@debbugs.gnu.org)(name . Stephen Paul Weber)(address . singpolyma@singpolyma.net)
20210925013934.2763-2-singpolyma@singpolyma.net
* gnu/packages/dns.scm (cloudflare-cli): New variable.
---
gnu/packages/dns.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)

Toggle diff (84 lines)
diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index 45e250138e..9e68d76a93 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -42,6 +42,7 @@
#:use-module (gnu packages bash)
#:use-module (gnu packages certs)
#:use-module (gnu packages check)
+ #:use-module (gnu packages curl)
#:use-module (gnu packages databases)
#:use-module (gnu packages documentation)
#:use-module (gnu packages compression)
@@ -69,6 +70,7 @@
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages ragel)
+ #:use-module (gnu packages serialization)
#:use-module (gnu packages shells)
#:use-module (gnu packages sphinx)
#:use-module (gnu packages swig)
@@ -82,11 +84,61 @@
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix utils)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system glib-or-gtk)
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (guix build-system trivial))
+(define-public cloudflare-cli
+ (package
+ (name "cloudflare-cli")
+ (version "2d986d3")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/earlchew/cloudflare-cli")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0f86g6n86kwykl3jnhqjrdfy8ybkp03ghr3dlr70q2552qw4axw2"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan '(("cloudflare-cli" "bin/") ("cloudflare-cli.sh" "bin/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'find-jsonsh
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "cloudflare-cli.sh"
+ (("\\$\\{0%/\\*\\}/jsonsh")
+ (string-append (assoc-ref inputs "JSON.sh") "/bin/JSON.sh")))
+ #t))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (wrap-program (string-append (assoc-ref outputs "out") "/bin/cloudflare-cli")
+ `("PATH" ":" prefix
+ (,(string-join
+ (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
+ '("grep" "curl" "coreutils"))
+ ":")))))))))
+ (inputs
+ `(("bash-minimal" ,bash-minimal)
+ ("coreutils" ,coreutils)
+ ("curl" ,curl)
+ ("grep" ,grep)
+ ("JSON.sh" ,JSON.sh)))
+ (synopsis
+ "CLI to edit Cloudflare DNS records")
+ (description
+ "This command line tool to update Cloudfare DNS records is useful in the
+following scenarios:
+* Keeping dynamic DNS records up to date
+* Updating DNS records as part of the ACME DNS-01 protocol")
+ (home-page "https://github.com/earlchew/cloudflare-cli")
+ (license license:expat)))
+
(define-public ldns
(package
(name "ldns")
--
2.20.1
S
S
Stephen Paul Weber wrote on 25 Sep 2021 03:39
[PATCH 1/2] gnu: Add JSON.sh
(address . 50793@debbugs.gnu.org)(name . Stephen Paul Weber)(address . singpolyma@singpolyma.net)
20210925013934.2763-1-singpolyma@singpolyma.net
* gnu/packages/serialization.scm (JSON.sh): New variable.
---
gnu/packages/serialization.scm | 45 ++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 196141ace8..f5677d9e5f 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -34,10 +34,13 @@
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (guix build-system cmake)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
@@ -458,6 +461,48 @@ it a convenient format to store user input files.")
(base32
"1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
+(define-public JSON.sh
+ (package
+ (name "JSON.sh")
+ (version "0d5e5c7")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dominictarr/JSON.sh")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "14lxvp5xbdk0dcwkjbdp098z1108j8z48zaibndh4i731kkcz43i"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan '(("JSON.sh" "bin/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'install 'check
+ (lambda _
+ (invoke "./all-tests.sh")
+ #t))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (wrap-program (string-append (assoc-ref outputs "out") "/bin/JSON.sh")
+ `("PATH" ":" prefix
+ (,(string-join
+ (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
+ '("grep" "coreutils"))
+ ":")))))))))
+ (inputs
+ `(("bash-minimal" ,bash-minimal)
+ ("grep" ,grep)
+ ("coreutils" ,coreutils)))
+ (synopsis
+ "Pipeable JSON parser written in shell")
+ (description
+ "JSON parser written in shell, compatible with ash, bash, dash and zsh")
+ (home-page "https://github.com/dominictarr/JSON.sh")
+ (license license:asl2.0)))
+
(define-public capnproto
(package
(name "capnproto")
--
2.20.1
S
S
Sarah Morgensen wrote on 25 Sep 2021 04:58
(name . Stephen Paul Weber)(address . singpolyma@singpolyma.net)(address . 50793@debbugs.gnu.org)
86k0j5wecb.fsf@mgsn.dev
Hi,

Thanks for the patches! Just a couple quick comments:

Stephen Paul Weber <singpolyma@singpolyma.net> writes:

Toggle quote (31 lines)
> * gnu/packages/serialization.scm (JSON.sh): New variable.
> ---
> gnu/packages/serialization.scm | 45 ++++++++++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
>
> diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
> index 196141ace8..f5677d9e5f 100644
> --- a/gnu/packages/serialization.scm
> +++ b/gnu/packages/serialization.scm
> @@ -34,10 +34,13 @@
> #:use-module (guix git-download)
> #:use-module (guix utils)
> #:use-module (guix build-system cmake)
> + #:use-module (guix build-system copy)
> #:use-module (guix build-system gnu)
> #:use-module (guix build-system python)
> #:use-module (gnu packages)
> #:use-module (gnu packages autotools)
> + #:use-module (gnu packages base)
> + #:use-module (gnu packages bash)
> #:use-module (gnu packages boost)
> #:use-module (gnu packages check)
> #:use-module (gnu packages compression)
> @@ -458,6 +461,48 @@ it a convenient format to store user input files.")
> (base32
> "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
>
> +(define-public JSON.sh
> + (package
> + (name "JSON.sh")

I can't find a rule for this per se, but it's convention that package
names to be lowercase (and for the variable name to match).

Toggle quote (2 lines)
> + (version "0d5e5c7")

Since this isn't a tagged version, this should follow the 'git-version'
pattern (search for usages of 'git-version' for examples).

Toggle quote (20 lines)
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/dominictarr/JSON.sh")
> + (commit version)))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "14lxvp5xbdk0dcwkjbdp098z1108j8z48zaibndh4i731kkcz43i"))))
> + (build-system copy-build-system)
> + (arguments
> + `(#:install-plan '(("JSON.sh" "bin/"))
> + #:phases
> + (modify-phases %standard-phases
> + (add-before 'install 'check
> + (lambda _
> + (invoke "./all-tests.sh")
> + #t))

Check phases should respect #:tests?, like so:

(lambda* (#:key tests? #:allow-other-keys)
(when tests?
[...]))

Also, it doesn't hurt, but phases no longer have to end in #t. :)

Toggle quote (8 lines)
> + (add-after 'install 'wrap-program
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (wrap-program (string-append (assoc-ref outputs "out") "/bin/JSON.sh")
> + `("PATH" ":" prefix
> + (,(string-join
> + (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
> + '("grep" "coreutils"))

Does this script actually use coreutils? On the other hand, it looks
like it does use gawk and sed.

Toggle quote (10 lines)
> + ":")))))))))
> + (inputs
> + `(("bash-minimal" ,bash-minimal)
> + ("grep" ,grep)
> + ("coreutils" ,coreutils)))
> + (synopsis
> + "Pipeable JSON parser written in shell")
> + (description
> + "JSON parser written in shell, compatible with ash, bash, dash and zsh")

This is a bit nit-picky since it's just a dependency, but descriptions
should use full sentences, and be a bit more descriptive than this (see
"Synopses and Descriptions" in the Guix manual).

Toggle quote (3 lines)
> + (license license:asl2.0)))

This is actually dual-licensed with expat, so:

(license (list license:expat license:asl2.0))

Could you please send an updated patch?

--
Sarah
S
S
Sarah Morgensen wrote on 25 Sep 2021 04:58
Re: [bug#50793] [PATCH 2/2] gnu: Add cloudflare-cli
(name . Stephen Paul Weber)(address . singpolyma@singpolyma.net)(address . 50793@debbugs.gnu.org)
86ilypwec1.fsf@mgsn.dev
Hi,

I've (naturally) got a few suggestions for this one, too.

Stephen Paul Weber <singpolyma@singpolyma.net> writes:

Toggle quote (40 lines)
> * gnu/packages/dns.scm (cloudflare-cli): New variable.
> ---
> gnu/packages/dns.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 52 insertions(+)
>
> diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
> index 45e250138e..9e68d76a93 100644
> --- a/gnu/packages/dns.scm
> +++ b/gnu/packages/dns.scm
> @@ -42,6 +42,7 @@
> #:use-module (gnu packages bash)
> #:use-module (gnu packages certs)
> #:use-module (gnu packages check)
> + #:use-module (gnu packages curl)
> #:use-module (gnu packages databases)
> #:use-module (gnu packages documentation)
> #:use-module (gnu packages compression)
> @@ -69,6 +70,7 @@
> #:use-module (gnu packages python)
> #:use-module (gnu packages python-xyz)
> #:use-module (gnu packages ragel)
> + #:use-module (gnu packages serialization)
> #:use-module (gnu packages shells)
> #:use-module (gnu packages sphinx)
> #:use-module (gnu packages swig)
> @@ -82,11 +84,61 @@
> #:use-module (guix download)
> #:use-module (guix git-download)
> #:use-module (guix utils)
> + #:use-module (guix build-system copy)
> #:use-module (guix build-system glib-or-gtk)
> #:use-module (guix build-system gnu)
> #:use-module (guix build-system meson)
> #:use-module (guix build-system trivial))
>
> +(define-public cloudflare-cli
> + (package
> + (name "cloudflare-cli")
> + (version "2d986d3")

Please use the 'git-version' pattern as I mentioned in the other patch.

Toggle quote (29 lines)
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/earlchew/cloudflare-cli")
> + (commit version)))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "0f86g6n86kwykl3jnhqjrdfy8ybkp03ghr3dlr70q2552qw4axw2"))))
> + (build-system copy-build-system)
> + (arguments
> + `(#:install-plan '(("cloudflare-cli" "bin/") ("cloudflare-cli.sh" "bin/"))
> + #:phases
> + (modify-phases %standard-phases
> + (add-after 'unpack 'find-jsonsh
> + (lambda* (#:key inputs #:allow-other-keys)
> + (substitute* "cloudflare-cli.sh"
> + (("\\$\\{0%/\\*\\}/jsonsh")
> + (string-append (assoc-ref inputs "JSON.sh") "/bin/JSON.sh")))
> + #t))
> + (add-after 'install 'wrap-program
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (wrap-program (string-append (assoc-ref outputs "out") "/bin/cloudflare-cli")
> + `("PATH" ":" prefix
> + (,(string-join
> + (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
> + '("grep" "curl" "coreutils"))

I don't think this uses anything from coreutils either, but I just took
a quick look.

Toggle quote (15 lines)
> + ":")))))))))
> + (inputs
> + `(("bash-minimal" ,bash-minimal)
> + ("coreutils" ,coreutils)
> + ("curl" ,curl)
> + ("grep" ,grep)
> + ("JSON.sh" ,JSON.sh)))
> + (synopsis
> + "CLI to edit Cloudflare DNS records")
> + (description
> + "This command line tool to update Cloudfare DNS records is useful in the
> +following scenarios:
> +* Keeping dynamic DNS records up to date
> +* Updating DNS records as part of the ACME DNS-01 protocol")

Could you update this description to use sentences rather than bullets
(and, preferably, use active rather than passive verbiage)?

(If you do ever need to write a list in the description, you can use
@itemize (info "(texinfo) Lists and Tables"); see other packages for
examples.)

Toggle quote (7 lines)
> + (license license:expat)))
> +
> (define-public ldns
> (package
> (name "ldns")

Thank you!

--
Sarah
S
S
Stephen Paul Weber wrote on 26 Sep 2021 03:08
Re: [bug#50793] [PATCH 1/2] gnu: Add JSON.sh
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 50793@debbugs.gnu.org)
20210926010827.GA16766@singpolyma-beefy.lan
Toggle quote (7 lines)
>> +(define-public JSON.sh
>> + (package
>> + (name "JSON.sh")
>
>I can't find a rule for this per se, but it's convention that package
>names to be lowercase (and for the variable name to match).

Ok. Should I keep the . for "json.sh" or go with "jsonsh" ? Should I change the
script/command name to match?

Toggle quote (5 lines)
>> + (version "0d5e5c7")
>
>Since this isn't a tagged version, this should follow the 'git-version'
>pattern (search for usages of 'git-version' for examples).

Will do.

Toggle quote (11 lines)
>> + (add-before 'install 'check
>> + (lambda _
>> + (invoke "./all-tests.sh")
>> + #t))
>
>Check phases should respect #:tests?, like so:
>
> (lambda* (#:key tests? #:allow-other-keys)
> (when tests?
> [...]))

Ok

Toggle quote (4 lines)
>> + '("grep" "coreutils"))
>
>Does this script actually use coreutils?

It uses printf

Toggle quote (2 lines)
> On the other hand, it looks >like it does use gawk

gawk is only used if egrep is not present

Toggle quote (2 lines)
> and sed.

Missed this, will add.
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEWeaCw+rzmiEMpzU00RwpEc5RnN4FAmFPyAAACgkQ0RwpEc5R
nN7L6A//Qdjw8aYXNpCgfpIZSIvdeG0BFhTpIkfku19LVyokPJaRotXj0QA5DhLz
uXu4Y9BixmXyqkOQCKM/oRv5aeLQVx78AmTV3Us+hUVk6ZT2mOOn8mpA+reuPk59
xqvUWM7LZvnmqlQ+aSvJRwSQ/yWX0bMqEUA1+/eSEQYhopdUn+USYu6y2umk0FQQ
+49o2WK/conJ1UfFOMaL8KUqc5pOuwL9oCYZjhNCHDe+88dK62hWwZpVw9yOmM4a
BcT7yOK2sX//CW03k3/Q24g/tGMGoFHZZQgCuZiPRjRBidd3FqxDIN7eCdL+GNZg
R7sVWEZa/o3/yzB/e+EB2OokSBkqR1QlsSi5/9nOaucR0roaF8bFMPoVJ/zg5Fce
l/fy/yu9+uFZJrDMoYczL8U3swyGadoNxfw2FWKEwLuRIIqNfaLQxXP39/R8JBGn
f3nQAPhkzZU7AkGv2+my/XOBy9dV+gfolOIdzRLeYe3yGJXNpHCoUJon6euteIuk
qsZ0Rzp8UhhDc6pAvLwm5QK6heCxyJyTZx6ogBpSsXR1CdJA6I2I6FOjzM/sR6iJ
dvBOtt31JdUV26LLv5U/1NM2dyhMCsksFVQuEDtSlcW9wEkeh9/zkoD8baxKzZyn
v5lyTqBaWnMhCXsDZESafouVF8f0FRpfLq6qQDR1n+3uKZRJNL0=
=aXki
-----END PGP SIGNATURE-----


S
S
Stephen Paul Weber wrote on 26 Sep 2021 03:21
Re: [bug#50793] [PATCH 2/2] gnu: Add cloudflare-cli
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 50793@debbugs.gnu.org)
20210926012149.GB16766@singpolyma-beefy.lan
Toggle quote (5 lines)
>> + '("grep" "curl" "coreutils"))
>
>I don't think this uses anything from coreutils either, but I just took
>a quick look.

printf again
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEWeaCw+rzmiEMpzU00RwpEc5RnN4FAmFPyykACgkQ0RwpEc5R
nN5xHA//XZC7+zLTQSpvxtLuxjdkjeAnKLJ2QD9x5DRoDBKhP6qUe9ZWtNTbo78S
SHC1vxhHhGRPHpkRPwl4YdhYFghw0r7kfCOAKVqqMe4mRIeFI0xSC5u4nre33P8C
rj156UOHQlINZifIRUPoNMYmqjPxjccs89JX9s0UNusEmKgB6usAPsdZ9H2NihLE
CRPlOALLFFpeW148DLilqZF3gyUOT+9T8faVtjtpvZaMyEanXetJ+sLZv7N0HqSM
wkzQfEqXPaXpUK/+sqasDT/97AXtNtv0pub5HiMoSV7A3NdrKPDHLbxBoFJtL6om
N1r4L3GAzatSStDovSWDIbf2RuLWAjLFqUlEGJSy1K3HTyMhFBxK2qFupwe6JDOg
hEDHTuZ/QHlresB5n8l2e7LEG1jFP2e2zFLhRo5eAyNwofdvaajMGMPOMRGyTTqX
40IaSFStSNi6tsFMdfSfgDTuj6lRSwohJBhMpZPKqFzdwCBMPuObFcQf9F+wzlcS
WyBHAMBkSGy7dBAseJO02o3rBRIgPb9EQKZARqZ/pFtZHNWt6kX6ZIXRx0RUZIDl
yAOZUF1bTlEyiRPrg2KMhePW1NA5GLpWiEdu1hcpAUYXuG+XDIbtHVsO2nF5VF8O
u5NfSlYl3+vsT7t+NnbBu5kz8DP5YHyyi+6dMA9g6I2E2ei24mk=
=ma34
-----END PGP SIGNATURE-----


S
S
Stephen Paul Weber wrote on 26 Sep 2021 03:29
[PATCH v2 1/2] gnu: Add JSON.sh
(address . 50793@debbugs.gnu.org)(name . Stephen Paul Weber)(address . singpolyma@singpolyma.net)
20210926012946.621-1-singpolyma@singpolyma.net
* gnu/packages/serialization.scm (JSON.sh): New variable.
---
gnu/packages/serialization.scm | 51 ++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)

Toggle diff (75 lines)
diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 196141ace8..b8cdfdc048 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -34,10 +34,13 @@
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (guix build-system cmake)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
@@ -458,6 +461,54 @@ it a convenient format to store user input files.")
(base32
"1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
+(define-public json.sh
+ (let ((commit "0d5e5c77365f63809bf6e77ef44a1f34b0e05840")
+ (revision "1"))
+ (package
+ (name "json.sh")
+ (version (git-version "0.0.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dominictarr/JSON.sh")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "14lxvp5xbdk0dcwkjbdp098z1108j8z48zaibndh4i731kkcz43i"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan '(("JSON.sh" "bin/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'install 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests? (invoke "./all-tests.sh"))
+ #t))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (wrap-program (string-append (assoc-ref outputs "out") "/bin/JSON.sh")
+ `("PATH" ":" prefix
+ (,(string-join
+ (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
+ '("grep" "sed" "coreutils"))
+ ":"))))
+ #t)))))
+ (inputs
+ `(("bash-minimal" ,bash-minimal)
+ ("grep" ,grep)
+ ("sed" ,sed)
+ ("coreutils" ,coreutils)))
+ (synopsis
+ "Pipeable JSON parser written in shell")
+ (description
+ "A JSON parser written in shell, compatible with ash, bash, dash and zsh.
+Pipe json to it, and it traverses the json objects and prints out the path to
+the current object (as a JSON array) and then the object, without whitespace.")
+ (home-page "https://github.com/dominictarr/JSON.sh")
+ (license (list license:expat license:asl2.0)))))
+
(define-public capnproto
(package
(name "capnproto")
--
2.20.1
S
S
Stephen Paul Weber wrote on 26 Sep 2021 03:29
[PATCH v2 2/2] gnu: Add cloudflare-cli
(address . 50793@debbugs.gnu.org)(name . Stephen Paul Weber)(address . singpolyma@singpolyma.net)
20210926012946.621-2-singpolyma@singpolyma.net
* gnu/packages/dns.scm (cloudflare-cli): New variable.
---
gnu/packages/dns.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)

Toggle diff (86 lines)
diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index 45e250138e..d9ef88af99 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -42,6 +42,7 @@
#:use-module (gnu packages bash)
#:use-module (gnu packages certs)
#:use-module (gnu packages check)
+ #:use-module (gnu packages curl)
#:use-module (gnu packages databases)
#:use-module (gnu packages documentation)
#:use-module (gnu packages compression)
@@ -69,6 +70,7 @@
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages ragel)
+ #:use-module (gnu packages serialization)
#:use-module (gnu packages shells)
#:use-module (gnu packages sphinx)
#:use-module (gnu packages swig)
@@ -82,11 +84,63 @@
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix utils)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system glib-or-gtk)
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (guix build-system trivial))
+(define-public cloudflare-cli
+ (let ((commit "2d986d3ec1b0e3158c4bd40e8918947cb74aa392")
+ (revision "1"))
+ (package
+ (name "cloudflare-cli")
+ (version (git-version "0.0.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/earlchew/cloudflare-cli")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0f86g6n86kwykl3jnhqjrdfy8ybkp03ghr3dlr70q2552qw4axw2"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan '(("cloudflare-cli" "bin/") ("cloudflare-cli.sh" "bin/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'find-jsonsh
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "cloudflare-cli.sh"
+ (("\\$\\{0%/\\*\\}/jsonsh")
+ (string-append (assoc-ref inputs "json.sh") "/bin/JSON.sh")))
+ #t))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (wrap-program (string-append (assoc-ref outputs "out") "/bin/cloudflare-cli")
+ `("PATH" ":" prefix
+ (,(string-join
+ (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
+ '("grep" "curl" "coreutils"))
+ ":"))))
+ #t)))))
+ (inputs
+ `(("bash-minimal" ,bash-minimal)
+ ("coreutils" ,coreutils)
+ ("curl" ,curl)
+ ("grep" ,grep)
+ ("json.sh" ,json.sh)))
+ (synopsis
+ "CLI to edit Cloudflare DNS records")
+ (description
+ "This command line tool to update Cloudfare DNS records is useful for tasks
+such as updating dynamic DNS records or updating DNS records for the ACME DNS-01
+protocol.")
+ (home-page "https://github.com/earlchew/cloudflare-cli")
+ (license license:expat))))
+
(define-public ldns
(package
(name "ldns")
--
2.20.1
S
S
Sarah Morgensen wrote on 26 Sep 2021 05:02
Re: [bug#50793] [PATCH 1/2] gnu: Add JSON.sh
(name . Stephen Paul Weber)(address . singpolyma@singpolyma.net)(address . 50793@debbugs.gnu.org)
86o88gujid.fsf@mgsn.dev
Hi,

Stephen Paul Weber <singpolyma@singpolyma.net> writes:

Toggle quote (10 lines)
>>> +(define-public JSON.sh
>>> + (package
>>> + (name "JSON.sh")
>>
>>I can't find a rule for this per se, but it's convention that package
>>names to be lowercase (and for the variable name to match).
>
> Ok. Should I keep the . for "json.sh" or go with "jsonsh" ? Should I change the
> script/command name to match?

I'd keep the dot in the package name. We don't want to modify the
actual script name in the package, though (we try to leave the actual
contents of packages as unmodified as possible).

Toggle quote (7 lines)
>
>>> + '("grep" "coreutils"))
>>
>>Does this script actually use coreutils?
>
> It uses printf

'printf' should just be calling the shell builtin:

Toggle snippet (4 lines)
$ type printf
printf is a shell builtin

--
Sarah
S
S
Stephen Paul Weber wrote on 27 Sep 2021 01:32
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 50793@debbugs.gnu.org)
20210926233224.GB2089@singpolyma-beefy.lan
Toggle quote (7 lines)
>'printf' should just be calling the shell builtin:
>
>--8<---------------cut here---------------start------------->8---
>$ type printf
>printf is a shell builtin
>--8<---------------cut here---------------end--------------->8---

Oh of course, silly me, I'll submit a version without coreutils input.
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEWeaCw+rzmiEMpzU00RwpEc5RnN4FAmFRAwMACgkQ0RwpEc5R
nN5U5RAAqXhfIX6jIZRhQCOw66QV13FrsEPG0lMIHtMYqVfhxCa8qx1La8WgHWiU
epnp5FvNRjEAj+VNWquii1gjdMY+wX94Hubx5l/CNSjZNxwyf6oEoO9N6yapzUc4
tTaviS0yDuq1wU/kjH9FBRXOvD1P24jZDk5rxCw1uUOTfBe/tqtGrrrt1Nxb8SGs
Xh6/5ZQCiGrDOOaWvuhQO5IN7YDUo/p11PbRLWCafNnSK4E0dEzMWanv+zH59Ox7
9REE7S0R7w1HKonlqyK24iR4Oo0Yqn4VnD5oMs9n+QUibswS59gFnh7KrPW1RqvF
oPqVDZkelRyPolrj4NGl1ezOnGjk1pT7ctQjGGK+LSKk9uRCTM9Fu23JbXeQdg8K
BzasuPhF4VTfuYfl9xxTqIyaZUIYebBNyuwHhCYpEJ7/94Ct24omrmhrngDM25bp
klfR3ipu6+RvF7Gg0OWTTtiNLEIh9xDgtfaZXHHrO1yzN3dw7pr86TkCkmxJMNhY
iTMgGiCsOJ8267GZr4RkQ20TTQHtZmA/tTArPPI/aIAP21uDfQPoPpvCZDGNovqR
lKcw4pu8xV37SSwHbLYAimtiDxM6dTsMG8ZYzzR8Im0mYyjNrgmyCmB44E7RKILz
h16qMmVg+iBu8MYnlbScSax+Tvn6QIotaMhaoAwOqN68ILau+pY=
=iRLD
-----END PGP SIGNATURE-----


S
S
Stephen Paul Weber wrote on 27 Sep 2021 01:35
[PATCH v3 2/2] gnu: Add cloudflare-cli
(address . 50793@debbugs.gnu.org)
20210926233513.3710-2-singpolyma@singpolyma.net
* gnu/packages/dns.scm (cloudflare-cli): New variable.
---
gnu/packages/dns.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)

Toggle diff (85 lines)
diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index 45e250138e..3b0da466f5 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -42,6 +42,7 @@
#:use-module (gnu packages bash)
#:use-module (gnu packages certs)
#:use-module (gnu packages check)
+ #:use-module (gnu packages curl)
#:use-module (gnu packages databases)
#:use-module (gnu packages documentation)
#:use-module (gnu packages compression)
@@ -69,6 +70,7 @@
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages ragel)
+ #:use-module (gnu packages serialization)
#:use-module (gnu packages shells)
#:use-module (gnu packages sphinx)
#:use-module (gnu packages swig)
@@ -82,11 +84,62 @@
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix utils)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system glib-or-gtk)
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (guix build-system trivial))
+(define-public cloudflare-cli
+ (let ((commit "2d986d3ec1b0e3158c4bd40e8918947cb74aa392")
+ (revision "1"))
+ (package
+ (name "cloudflare-cli")
+ (version (git-version "0.0.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/earlchew/cloudflare-cli")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0f86g6n86kwykl3jnhqjrdfy8ybkp03ghr3dlr70q2552qw4axw2"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan '(("cloudflare-cli" "bin/") ("cloudflare-cli.sh" "bin/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'find-jsonsh
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "cloudflare-cli.sh"
+ (("\\$\\{0%/\\*\\}/jsonsh")
+ (string-append (assoc-ref inputs "json.sh") "/bin/JSON.sh")))
+ #t))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (wrap-program (string-append (assoc-ref outputs "out") "/bin/cloudflare-cli")
+ `("PATH" ":" prefix
+ (,(string-join
+ (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
+ '("grep" "curl"))
+ ":"))))
+ #t)))))
+ (inputs
+ `(("bash-minimal" ,bash-minimal)
+ ("curl" ,curl)
+ ("grep" ,grep)
+ ("json.sh" ,json.sh)))
+ (synopsis
+ "CLI to edit Cloudflare DNS records")
+ (description
+ "This command line tool to update Cloudfare DNS records is useful for tasks
+such as updating dynamic DNS records or updating DNS records for the ACME DNS-01
+protocol.")
+ (home-page "https://github.com/earlchew/cloudflare-cli")
+ (license license:expat))))
+
(define-public ldns
(package
(name "ldns")
--
2.20.1
S
S
Stephen Paul Weber wrote on 27 Sep 2021 01:35
[PATCH v3 1/2] gnu: Add JSON.sh
(address . 50793@debbugs.gnu.org)
20210926233513.3710-1-singpolyma@singpolyma.net
* gnu/packages/serialization.scm (JSON.sh): New variable.
---
gnu/packages/serialization.scm | 50 ++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)

Toggle diff (74 lines)
diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 196141ace8..07ce5f2537 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -34,10 +34,13 @@
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (guix build-system cmake)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
@@ -458,6 +461,53 @@ it a convenient format to store user input files.")
(base32
"1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
+(define-public json.sh
+ (let ((commit "0d5e5c77365f63809bf6e77ef44a1f34b0e05840")
+ (revision "1"))
+ (package
+ (name "json.sh")
+ (version (git-version "0.0.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dominictarr/JSON.sh")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "14lxvp5xbdk0dcwkjbdp098z1108j8z48zaibndh4i731kkcz43i"))))
+ (build-system copy-build-system)
+ (arguments
+ `(#:install-plan '(("JSON.sh" "bin/"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'install 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests? (invoke "./all-tests.sh"))
+ #t))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (wrap-program (string-append (assoc-ref outputs "out") "/bin/JSON.sh")
+ `("PATH" ":" prefix
+ (,(string-join
+ (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
+ '("grep" "sed"))
+ ":"))))
+ #t)))))
+ (inputs
+ `(("bash-minimal" ,bash-minimal)
+ ("grep" ,grep)
+ ("sed" ,sed)))
+ (synopsis
+ "Pipeable JSON parser written in shell")
+ (description
+ "A JSON parser written in shell, compatible with ash, bash, dash and zsh.
+Pipe json to it, and it traverses the json objects and prints out the path to
+the current object (as a JSON array) and then the object, without whitespace.")
+ (home-page "https://github.com/dominictarr/JSON.sh")
+ (license (list license:expat license:asl2.0)))))
+
(define-public capnproto
(package
(name "capnproto")
--
2.20.1
L
L
Ludovic Courtès wrote on 13 Oct 2021 11:05
Re: bug#50793: [PATCH 0/2] cloudflare-cli and dependency JSON.sh
(name . Stephen Paul Weber)(address . singpolyma@singpolyma.net)
87czo9s3b4.fsf_-_@gnu.org
Hi,

Stephen Paul Weber <singpolyma@singpolyma.net> skribis:

Toggle quote (2 lines)
> * gnu/packages/serialization.scm (JSON.sh): New variable.

Applied with the cosmetic changes below.

Thanks,
Ludo’.
Toggle diff (34 lines)
diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 07ce5f2537..e24ef973b5 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -462,7 +462,7 @@ (define-public jsoncpp-for-tensorflow
"1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
(define-public json.sh
- (let ((commit "0d5e5c77365f63809bf6e77ef44a1f34b0e05840")
+ (let ((commit "0d5e5c77365f63809bf6e77ef44a1f34b0e05840") ;no releases
(revision "1"))
(package
(name "json.sh")
@@ -499,14 +499,14 @@ (define-public json.sh
`(("bash-minimal" ,bash-minimal)
("grep" ,grep)
("sed" ,sed)))
- (synopsis
- "Pipeable JSON parser written in shell")
+ (synopsis "Pipeable JSON parser written in shell")
(description
- "A JSON parser written in shell, compatible with ash, bash, dash and zsh.
-Pipe json to it, and it traverses the json objects and prints out the path to
-the current object (as a JSON array) and then the object, without whitespace.")
+ "This package provides a JSON parser written in shell, compatible with
+ash, Bash, Dash and Zsh. Pipe JSON to it, and it traverses the JSON objects
+and prints out the path to the current object (as a JSON array) and then the
+object, without whitespace.")
(home-page "https://github.com/dominictarr/JSON.sh")
- (license (list license:expat license:asl2.0)))))
+ (license (list license:expat license:asl2.0))))) ;dual-licensed
(define-public capnproto
(package
L
L
Ludovic Courtès wrote on 13 Oct 2021 11:08
(name . Stephen Paul Weber)(address . singpolyma@singpolyma.net)
878ryxs35m.fsf_-_@gnu.org
Stephen Paul Weber <singpolyma@singpolyma.net> skribis:

Toggle quote (2 lines)
> * gnu/packages/dns.scm (cloudflare-cli): New variable.

Applied. Thank you, and thanks Sarah!

Ludo’.
Closed
M
M
Maxim Cournoyer wrote on 13 Oct 2021 21:03
Re: [bug#50793] [PATCH 0/2] cloudflare-cli and dependency JSON.sh
(name . Ludovic Courtès)(address . ludo@gnu.org)
87lf2wwxvg.fsf@gmail.com
Hello!

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (8 lines)
> Hi,
>
> Stephen Paul Weber <singpolyma@singpolyma.net> skribis:
>
>> * gnu/packages/serialization.scm (JSON.sh): New variable.
>
> Applied with the cosmetic changes below.

Didn't we have some coding style preferring hyphens over '.' ? I can't
find any of this in our manual, but ISTR that there were some commits
made to adjust package names that had '.' in them.

Thanks!
Z
Z
zimoun wrote on 14 Oct 2021 10:54
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
86v920q94p.fsf@gmail.com
Hi,

On Wed, 13 Oct 2021 at 15:03, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

Toggle quote (4 lines)
> Didn't we have some coding style preferring hyphens over '.' ? I can't
> find any of this in our manual, but ISTR that there were some commits
> made to adjust package names that had '.' in them.

Yes, the implicit rule of thumb is to prefer hyphens ’-’ over dot ’.’
for naming variable. Indeed, I do not find neither this in manual.

Is it better to add a lint checker? Or just add an item to


?

Cheers,
simon
M
M
Maxim Cournoyer wrote on 15 Oct 2021 05:26
(name . zimoun)(address . zimon.toutoune@gmail.com)
87h7djnf3o.fsf@gmail.com
Hello Simon,

zimoun <zimon.toutoune@gmail.com> writes:

Toggle quote (15 lines)
> Hi,
>
> On Wed, 13 Oct 2021 at 15:03, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>
>> Didn't we have some coding style preferring hyphens over '.' ? I can't
>> find any of this in our manual, but ISTR that there were some commits
>> made to adjust package names that had '.' in them.
>
> Yes, the implicit rule of thumb is to prefer hyphens ’-’ over dot ’.’
> for naming variable. Indeed, I do not find neither this in manual.
>
> Is it better to add a lint checker? Or just add an item to
>
> <https://guix.gnu.org/manual/devel/en/guix.html#Submitting-Patches>

I'd say both! Were you volunteering to add it? :-)

Thanks,

Maxim
L
L
Ludovic Courtès wrote on 15 Oct 2021 17:28
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87bl3qi9z0.fsf@gnu.org
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (14 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hi,
>>
>> Stephen Paul Weber <singpolyma@singpolyma.net> skribis:
>>
>>> * gnu/packages/serialization.scm (JSON.sh): New variable.
>>
>> Applied with the cosmetic changes below.
>
> Didn't we have some coding style preferring hyphens over '.' ? I can't
> find any of this in our manual, but ISTR that there were some commits
> made to adjust package names that had '.' in them.

Ah, I wasn’t sure, but I can change it to a hyphen.

Thanks!

Ludo’.
?
Your comment

This issue is archived.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 50793
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