GNU bug report logs - #50793
[PATCH 0/2] cloudflare-cli and dependency JSON.sh

Previous Next

Package: guix-patches;

Reported by: Stephen Paul Weber <singpolyma <at> singpolyma.net>

Date: Sat, 25 Sep 2021 01:39:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50793 in the body.
You can then email your comments to 50793 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sat, 25 Sep 2021 01:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stephen Paul Weber <singpolyma <at> singpolyma.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 25 Sep 2021 01:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/2] cloudflare-cli and dependency JSON.sh
Date: Fri, 24 Sep 2021 20:38:48 -0500
[Message part 1 (text/plain, inline)]
This series submits two new packages: cloudflare-cli and its dependency JSON.sh
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sat, 25 Sep 2021 01:40:02 GMT) Full text and rfc822 format available.

Message #8 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: 50793 <at> debbugs.gnu.org
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Subject: [PATCH 2/2] gnu: Add cloudflare-cli
Date: Fri, 24 Sep 2021 20:39:34 -0500
* 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")
+    (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




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sat, 25 Sep 2021 01:40:03 GMT) Full text and rfc822 format available.

Message #11 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: 50793 <at> debbugs.gnu.org
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Subject: [PATCH 1/2] gnu: Add JSON.sh
Date: Fri, 24 Sep 2021 20:39:33 -0500
* 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")
+    (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




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sat, 25 Sep 2021 02:59:01 GMT) Full text and rfc822 format available.

Message #14 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Cc: 50793 <at> debbugs.gnu.org
Subject: Re: [bug#50793] [PATCH 1/2] gnu: Add JSON.sh
Date: Fri, 24 Sep 2021 19:58:44 -0700
Hi,

Thanks for the patches!  Just a couple quick comments:

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

> * 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).

> +    (version "0d5e5c7")

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

> +    (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. :)

> +         (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.

> +                    ":")))))))))
> +    (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).

> +    (home-page "https://github.com/dominictarr/JSON.sh")
> +    (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




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sat, 25 Sep 2021 02:59:01 GMT) Full text and rfc822 format available.

Message #17 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Cc: 50793 <at> debbugs.gnu.org
Subject: Re: [bug#50793] [PATCH 2/2] gnu: Add cloudflare-cli
Date: Fri, 24 Sep 2021 19:58:54 -0700
Hi,

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

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

> * 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.

> +    (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.

> +                    ":")))))))))
> +    (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.)

> +    (home-page "https://github.com/earlchew/cloudflare-cli")
> +    (license license:expat)))
> +
>  (define-public ldns
>    (package
>      (name "ldns")

Thank you!

--
Sarah




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sun, 26 Sep 2021 01:09:01 GMT) Full text and rfc822 format available.

Message #20 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: Sarah Morgensen <iskarian <at> mgsn.dev>
Cc: 50793 <at> debbugs.gnu.org
Subject: Re: [bug#50793] [PATCH 1/2] gnu: Add JSON.sh
Date: Sat, 25 Sep 2021 20:08:27 -0500
[Message part 1 (text/plain, inline)]
>> +(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?

>> +    (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.

>> +         (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

>> +                         '("grep" "coreutils"))
>
>Does this script actually use coreutils?

It uses printf

> On the other hand, it looks >like it does use gawk

gawk is only used if egrep is not present

> and sed.

Missed this, will add.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sun, 26 Sep 2021 01:22:02 GMT) Full text and rfc822 format available.

Message #23 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: Sarah Morgensen <iskarian <at> mgsn.dev>
Cc: 50793 <at> debbugs.gnu.org
Subject: Re: [bug#50793] [PATCH 2/2] gnu: Add cloudflare-cli
Date: Sat, 25 Sep 2021 20:21:49 -0500
[Message part 1 (text/plain, inline)]
>> +                         '("grep" "curl" "coreutils"))
>
>I don't think this uses anything from coreutils either, but I just took
>a quick look.

printf again
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sun, 26 Sep 2021 01:30:02 GMT) Full text and rfc822 format available.

Message #26 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: 50793 <at> debbugs.gnu.org
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Subject: [PATCH v2 1/2] gnu: Add JSON.sh
Date: Sat, 25 Sep 2021 20:29:45 -0500
* gnu/packages/serialization.scm (JSON.sh): New variable.
---
 gnu/packages/serialization.scm | 51 ++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

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




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sun, 26 Sep 2021 01:30:02 GMT) Full text and rfc822 format available.

Message #29 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: 50793 <at> debbugs.gnu.org
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Subject: [PATCH v2 2/2] gnu: Add cloudflare-cli
Date: Sat, 25 Sep 2021 20:29:46 -0500
* gnu/packages/dns.scm (cloudflare-cli): New variable.
---
 gnu/packages/dns.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

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




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sun, 26 Sep 2021 03:03:01 GMT) Full text and rfc822 format available.

Message #32 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Cc: 50793 <at> debbugs.gnu.org
Subject: Re: [bug#50793] [PATCH 1/2] gnu: Add JSON.sh
Date: Sat, 25 Sep 2021 20:02:18 -0700
Hi,

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

>>> +(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).

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

'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---

--
Sarah




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sun, 26 Sep 2021 23:33:02 GMT) Full text and rfc822 format available.

Message #35 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: Sarah Morgensen <iskarian <at> mgsn.dev>
Cc: 50793 <at> debbugs.gnu.org
Subject: Re: [bug#50793] [PATCH 1/2] gnu: Add JSON.sh
Date: Sun, 26 Sep 2021 18:32:24 -0500
[Message part 1 (text/plain, inline)]
>'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.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sun, 26 Sep 2021 23:36:01 GMT) Full text and rfc822 format available.

Message #38 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: 50793 <at> debbugs.gnu.org
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>, iskarian <at> mgsn.dev
Subject: [PATCH v3 2/2] gnu: Add cloudflare-cli
Date: Sun, 26 Sep 2021 18:35:13 -0500
* gnu/packages/dns.scm (cloudflare-cli): New variable.
---
 gnu/packages/dns.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

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




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Sun, 26 Sep 2021 23:36:02 GMT) Full text and rfc822 format available.

Message #41 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Paul Weber <singpolyma <at> singpolyma.net>
To: 50793 <at> debbugs.gnu.org
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>, iskarian <at> mgsn.dev
Subject: [PATCH v3 1/2] gnu: Add JSON.sh
Date: Sun, 26 Sep 2021 18:35:12 -0500
* gnu/packages/serialization.scm (JSON.sh): New variable.
---
 gnu/packages/serialization.scm | 50 ++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

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




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Wed, 13 Oct 2021 09:06:02 GMT) Full text and rfc822 format available.

Message #44 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Cc: 50793 <at> debbugs.gnu.org, iskarian <at> mgsn.dev
Subject: Re: bug#50793: [PATCH 0/2] cloudflare-cli and dependency JSON.sh
Date: Wed, 13 Oct 2021 11:05:03 +0200
[Message part 1 (text/plain, inline)]
Hi,

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

> * gnu/packages/serialization.scm (JSON.sh): New variable.

Applied with the cosmetic changes below.

Thanks,
Ludo’.

[Message part 2 (text/x-patch, inline)]
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

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 13 Oct 2021 09:09:01 GMT) Full text and rfc822 format available.

Notification sent to Stephen Paul Weber <singpolyma <at> singpolyma.net>:
bug acknowledged by developer. (Wed, 13 Oct 2021 09:09:01 GMT) Full text and rfc822 format available.

Message #49 received at 50793-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Stephen Paul Weber <singpolyma <at> singpolyma.net>
Cc: 50793-done <at> debbugs.gnu.org, iskarian <at> mgsn.dev
Subject: Re: bug#50793: [PATCH 0/2] cloudflare-cli and dependency JSON.sh
Date: Wed, 13 Oct 2021 11:08:21 +0200
Stephen Paul Weber <singpolyma <at> singpolyma.net> skribis:

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

Applied.  Thank you, and thanks Sarah!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Wed, 13 Oct 2021 19:04:01 GMT) Full text and rfc822 format available.

Message #52 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>, 50793 <at> debbugs.gnu.org,
 iskarian <at> mgsn.dev
Subject: Re: [bug#50793] [PATCH 0/2] cloudflare-cli and dependency JSON.sh
Date: Wed, 13 Oct 2021 15:03:31 -0400
Hello!

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

> Hi,
>
> Stephen Paul Weber <singpolyma <at> 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!




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Thu, 14 Oct 2021 08:57:02 GMT) Full text and rfc822 format available.

Message #55 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>, 50793 <at> debbugs.gnu.org,
 Ludovic Courtès <ludo <at> gnu.org>, iskarian <at> mgsn.dev
Subject: Re: [bug#50793] [PATCH 0/2] cloudflare-cli and dependency JSON.sh
Date: Thu, 14 Oct 2021 10:54:30 +0200
Hi,

On Wed, 13 Oct 2021 at 15:03, Maxim Cournoyer <maxim.cournoyer <at> 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>

?

Cheers,
simon




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Fri, 15 Oct 2021 03:27:02 GMT) Full text and rfc822 format available.

Message #58 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>, 50793 <at> debbugs.gnu.org,
 Ludovic Courtès <ludo <at> gnu.org>, iskarian <at> mgsn.dev
Subject: Re: [bug#50793] [PATCH 0/2] cloudflare-cli and dependency JSON.sh
Date: Thu, 14 Oct 2021 23:26:03 -0400
Hello Simon,

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

> Hi,
>
> On Wed, 13 Oct 2021 at 15:03, Maxim Cournoyer <maxim.cournoyer <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#50793; Package guix-patches. (Fri, 15 Oct 2021 15:29:01 GMT) Full text and rfc822 format available.

Message #61 received at 50793 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: Stephen Paul Weber <singpolyma <at> singpolyma.net>, 50793 <at> debbugs.gnu.org,
 iskarian <at> mgsn.dev
Subject: Re: [bug#50793] [PATCH 0/2] cloudflare-cli and dependency JSON.sh
Date: Fri, 15 Oct 2021 17:28:03 +0200
Hi,

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

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> Hi,
>>
>> Stephen Paul Weber <singpolyma <at> 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 13 Nov 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.