diff mbox series

[bug#50793,2/2] gnu: Add cloudflare-cli

Message ID 20210925013934.2763-2-singpolyma@singpolyma.net
State New
Headers show
Series cloudflare-cli and dependency JSON.sh | expand

Checks

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

Commit Message

Stephen Paul Weber Sept. 25, 2021, 1:39 a.m. UTC
* gnu/packages/dns.scm (cloudflare-cli): New variable.
---
 gnu/packages/dns.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

Comments

Sarah Morgensen Sept. 25, 2021, 2:58 a.m. UTC | #1
Hi,

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

Stephen Paul Weber <singpolyma@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
Stephen Paul Weber Sept. 26, 2021, 1:21 a.m. UTC | #2
>> +                         '("grep" "curl" "coreutils"))
>
>I don't think this uses anything from coreutils either, but I just took
>a quick look.

printf again
diff mbox series

Patch

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")