guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#58408] [PATCH] gnu: Add doctl.


From: Matthew James Kraai
Subject: [bug#58408] [PATCH] gnu: Add doctl.
Date: Mon, 10 Oct 2022 06:20:00 -0700

Hi,

On Mon, Oct 10, 2022 at 12:01:58PM +0100, ( wrote:
> Hey Matthew,
> 
> On Mon Oct 10, 2022 at 10:54 AM BST, Matthew James Kraai wrote:
> > * gnu/packages/doctl.scm: New file.
> > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
> 
> You sure there's no better place to put it than a new file? Maybe
> ``gnu/packages/admin.scm''?
> 
> > +  #:use-module (guix download)
> 
> Since you're using git-fetch, you shouldn't need this module, right?
> 
> > +    (arguments
> > +     `(#:build-flags '(,(string-append "-ldflags=-X 
> > github.com/digitalocean/doctl.Label=release"
> > +                                       " -X 
> > github.com/digitalocean/doctl.Major="
> > +                                       (first (string-split version #\.))
> > +                                       " -X 
> > github.com/digitalocean/doctl.Minor="
> > +                                       (second (string-split version #\.))
> > +                                       " -X 
> > github.com/digitalocean/doctl.Patch="
> > +                                       (third (string-split version #\.))))
> 
> So, this whole thing would be better formatted with "new style" arguments
> (using ``list'' and gexps). Like this:
> 
>  (arguments
>   (list #:build-flags
>         #~(list (string-append ...))
>         #| et cetera |#))
> 
> This would also allow you to remove the unquote in ``,go-1.19''. Note that 
> only
> ``#:build-flags'' needs the gexp ``#~'' in this arguments list.
> 
> > +       #:go ,go-1.19
> 
> Might be best to put this above build-flags.
> 
> > +       #:import-path "github.com/digitalocean/doctl/cmd/doctl"
> 
> The import-path is usually at the top of the arguments list.
> 
> > +       #:unpack-path "github.com/digitalocean/doctl"))
> 
> And the unpack-path is usually directly after the import-path.
> 
> > +    (description
> > +     "doctl provides a unified command line interface to the DigitalOcean 
> > API.")
> 
> Change ``doctl'' to ``@code{doctl}''.
> 
>     -- (

Thank you for all of the suggestions.  How about the following patch instead?

-- 
Matt

>From f31936b941b1db1a4dfe8e07270ef4b004c33c54 Mon Sep 17 00:00:00 2001
From: Matthew James Kraai <kraai@ftbfs.org>
Date: Sun, 9 Oct 2022 05:07:23 -0700
Subject: [PATCH] gnu: Add doctl.

* gnu/packages/admin.scm (doctl): New variable.
---
 gnu/packages/admin.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 13d582403b..be80713f52 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -54,6 +54,7 @@
 ;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
 ;;; Copyright © 2022 Andreas Rammhold <andreas@rammhold.de>
 ;;; Copyright © 2022 ( <paren@disroot.org>
+;;; Copyright © 2022 Matthew James Kraai <kraai@ftbfs.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5596,3 +5597,36 @@ (define-public rex
 several hosts in succession or in parallel.  It can also be used to copy a
 file or files to several hosts.")
     (license license:gpl3+)))
+
+(define-public doctl
+  (package
+    (name "doctl")
+    (version "1.83.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/digitalocean/doctl";)
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1narjmj3npd39gxi42k3h4zjyiaq5lvjv31vaxw8slf9h9sjhjh9"))))
+    (build-system go-build-system)
+    (arguments
+     (list #:import-path "github.com/digitalocean/doctl/cmd/doctl"
+           #:unpack-path "github.com/digitalocean/doctl"
+           #:go go-1.19
+           #:build-flags
+           #~(list (string-append "-ldflags=-X 
github.com/digitalocean/doctl.Label=release"
+                                  " -X github.com/digitalocean/doctl.Major="
+                                  (car (string-split #$version #\.))
+                                  " -X github.com/digitalocean/doctl.Minor="
+                                  (cadr (string-split #$version #\.))
+                                  " -X github.com/digitalocean/doctl.Patch="
+                                  (caddr (string-split #$version #\.))))
+           #:install-source? #f))
+    (synopsis "Command line client for DigitalOcean")
+    (description
+     "@code{doctl} provides a unified command line interface to the 
DigitalOcean API.")
+    (home-page "https://github.com/digitalocean/doctl";)
+    (license license:asl2.0)))
-- 
2.38.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]