unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#57118] [PATCH] gnu: Add linode-cli.
@ 2022-08-10 14:18 raingloom
  2022-08-15  8:32 ` Mathieu Othacehe
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: raingloom @ 2022-08-10 14:18 UTC (permalink / raw)
  To: 57118; +Cc: raingloom

* gnu/packages/python-xyz.scm (linode-cli): New variable.
---
 gnu/packages/python-xyz.scm | 69 +++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e5326274c0..1625df48c2 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30353,3 +30353,72 @@ (define-public i3-autotiling
      "Script for Sway and i3 to automatically switch the horizontal/vertical
  window split orientation.")
     (license license:gpl3)))
+
+;; linode-cli would normally fetch this at build time
+;; TODO: is there a way to refer to previous versions? is there even a point
+;; in trying to?
+(define linode-openapi-spec
+  (origin
+    (method url-fetch)
+    (uri "https://www.linode.com/docs/api/openapi.yaml")
+    (sha256
+     (base32
+      "1jcjfnagjihcy03fcmn5sghdf7a80798xjgj1x7z3ncqwd5aggwg"))))
+
+(define-public linode-cli
+  (package
+    (name "linode-cli")
+    (version "5.22.0")
+    (synopsis "Tool for managing Linode resources")
+    (home-page "https://www.linode.com/docs/products/tools/cli/")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/linode/linode-cli")
+             (commit version)))
+       (sha256
+        (base32
+         "1fv53wikx745kci86xrsq9kfsgv0a65srhywdw32cab1wywwpn2z"))))
+    (build-system python-build-system)
+    (arguments '(#:tests? #f ;; requires personal access token
+                 #:phases
+                 (modify-phases %standard-phases
+                   (add-after 'build 'bake-api
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       ;; The "build" make target tries to do some Python 2
+                       ;; stuff, so instead we just take the two lines we care
+                       ;; about:
+                       (invoke "python3" "-m" "linodecli" "bake"
+                               (assoc-ref inputs
+                                          "linode-openapi-spec")
+                               "--skip-config")
+                       (copy-file "data-3" "linodecli/data-3")))
+                   (add-before 'install 'fix-bash-completions-path
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       ;; rename it so setup.py thinks it's missing and
+                       ;; doesn't try to install it to /etc
+                       (rename-file "linode-cli.sh" "completions")
+                       ;; TODO for some reason these don't work?
+                       ;; I don't use bash, so I leave it for someone else to
+                       ;; figure out.
+                       (install-file "completions"
+                                  (string-append
+                                   (assoc-ref outputs "out")
+                                   "/share/bash-completion/"))))
+                   (replace 'sanity-check
+                     (lambda _
+                       ;; this way it doesn't ask for an access token
+                       (invoke "linode-cli" "--version" "--skip-config"))))))
+    (native-inputs
+     `(("linode-openapi-spec" ,linode-openapi-spec)))
+    (inputs
+     (list
+      python-terminaltables
+      python-requests
+      python-pyyaml))
+    (description
+     "A wrapper around the Linode API, which gives you the ability to manage
+your Linode account from the command line. Almost any task that can be done
+through the Cloud Manager can also be performed through the CLI.")
+    (license license:bsd-3)))
-- 
2.37.1





^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [bug#57118] [PATCH] gnu: Add linode-cli.
  2022-08-10 14:18 [bug#57118] [PATCH] gnu: Add linode-cli raingloom
@ 2022-08-15  8:32 ` Mathieu Othacehe
  2022-08-15 11:42 ` [bug#57118] [PATCH v2] " raingloom
  2024-04-01  7:53 ` [bug#57118] Linode-cli license Steve George
  2 siblings, 0 replies; 11+ messages in thread
From: Mathieu Othacehe @ 2022-08-15  8:32 UTC (permalink / raw)
  To: raingloom; +Cc: 57118


Hey,

> * gnu/packages/python-xyz.scm (linode-cli): New variable.

You also need to mention the linode-openapi-spec variable.

> +    (synopsis "Tool for managing Linode resources")
> +    (home-page "https://www.linode.com/docs/products/tools/cli/")

These are usually at the end of the package definition.

> +                               (assoc-ref inputs
> +                                          "linode-openapi-spec")

It would be preferable to use the gexp mechanism.

> +                                   (assoc-ref outputs "out")

Here too.

> +     "A wrapper around the Linode API, which gives you the ability to manage
> +your Linode account from the command line. Almost any task that can be done
> +through the Cloud Manager can also be performed through the CLI.")

This package provides a wrapper around Linode API which gives the
ability to manage Linode accounts from the command line.  Almost ...

Sentences must be separated by two spaces.

Could you please send a v2?

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#57118] [PATCH v2] gnu: Add linode-cli.
  2022-08-10 14:18 [bug#57118] [PATCH] gnu: Add linode-cli raingloom
  2022-08-15  8:32 ` Mathieu Othacehe
@ 2022-08-15 11:42 ` raingloom
  2022-08-31 21:33   ` [bug#57118] [PATCH] " Ludovic Courtès
  2024-04-01  7:53 ` [bug#57118] Linode-cli license Steve George
  2 siblings, 1 reply; 11+ messages in thread
From: raingloom @ 2022-08-15 11:42 UTC (permalink / raw)
  To: 57118; +Cc: Csepp

From: Csepp <raingloom@riseup.net>

* gnu/packages/python-xyz.scm (linode-cli) (linode-openapi-spec): New variables.
---
 gnu/packages/python-xyz.scm | 67 +++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e5326274c0..f299476f47 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30353,3 +30353,70 @@ (define-public i3-autotiling
      "Script for Sway and i3 to automatically switch the horizontal/vertical
  window split orientation.")
     (license license:gpl3)))
+
+;; linode-cli would normally fetch this at build time
+;; TODO: is there a way to refer to previous versions? is there even a point
+;; in trying to?
+(define linode-openapi-spec
+  (origin
+    (method url-fetch)
+    (uri "https://www.linode.com/docs/api/openapi.yaml")
+    (sha256
+     (base32
+      "1jcjfnagjihcy03fcmn5sghdf7a80798xjgj1x7z3ncqwd5aggwg"))))
+
+(define-public linode-cli
+  (package
+    (name "linode-cli")
+    (version "5.22.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/linode/linode-cli")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1fv53wikx745kci86xrsq9kfsgv0a65srhywdw32cab1wywwpn2z"))))
+    (build-system python-build-system)
+    (arguments (list
+                #:tests? #f ;; requires personal access token
+                #:phases
+                #~(modify-phases %standard-phases
+                    (add-after 'build 'bake-api
+                      (lambda _
+                        ;; The "build" make target tries to do some Python 2
+                        ;; stuff, so instead we just take the two lines we care
+                        ;; about:
+                        (invoke "python3" "-m" "linodecli" "bake"
+                                #+linode-openapi-spec
+                                "--skip-config")
+                        (copy-file "data-3" "linodecli/data-3")))
+                    (add-before 'install 'fix-bash-completions-path
+                      (lambda _
+                        ;; rename it so setup.py thinks it's missing and
+                        ;; doesn't try to install it to /etc
+                        (rename-file "linode-cli.sh" "completions")
+                        ;; TODO for some reason these don't work?
+                        ;; I don't use bash, so I leave it for someone else to
+                        ;; figure out.
+                        (install-file
+                         "completions"
+                         (string-append #$output "/share/bash-completion/"))))
+                    (replace 'sanity-check
+                      (lambda _
+                        ;; this way it doesn't ask for an access token
+                        (invoke "linode-cli" "--version" "--skip-config"))))))
+    (inputs
+     (list
+      python-terminaltables
+      python-requests
+      python-pyyaml))
+    (synopsis "Tool for managing Linode resources")
+    (home-page "https://www.linode.com/docs/products/tools/cli/")
+    (description
+     "A wrapper around the Linode API, which gives you the ability to manage
+your Linode account from the command line.  Almost any task that can be done
+through the Cloud Manager can also be performed through the CLI.")
+    (license license:bsd-3)))
-- 
2.37.1





^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [bug#57118] [PATCH] gnu: Add linode-cli.
  2022-08-15 11:42 ` [bug#57118] [PATCH v2] " raingloom
@ 2022-08-31 21:33   ` Ludovic Courtès
  2022-09-01  1:10     ` Csepp
  0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2022-08-31 21:33 UTC (permalink / raw)
  To: raingloom; +Cc: 57118

Hi,

raingloom <raingloom@riseup.net> skribis:

> From: Csepp <raingloom@riseup.net>
>
> * gnu/packages/python-xyz.scm (linode-cli) (linode-openapi-spec): New variables.

[...]

> +;; linode-cli would normally fetch this at build time
> +;; TODO: is there a way to refer to previous versions? is there even a point
> +;; in trying to?
> +(define linode-openapi-spec
> +  (origin
> +    (method url-fetch)
> +    (uri "https://www.linode.com/docs/api/openapi.yaml")
> +    (sha256
> +     (base32
> +      "1jcjfnagjihcy03fcmn5sghdf7a80798xjgj1x7z3ncqwd5aggwg"))))

Unfortunately, as you probably guess, this file was updated in place and
the hash is now different.

Is there a stable URL for the specific version we’d want to use here?
Otherwise it’s just too shaky: the thing will fail to build a week or
month later, when linode.com decides to update that file.

With this fixed, the patch is ready to go.

Thanks in advance,
Ludo’.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#57118] [PATCH] gnu: Add linode-cli.
  2022-08-31 21:33   ` [bug#57118] [PATCH] " Ludovic Courtès
@ 2022-09-01  1:10     ` Csepp
  2022-09-01  8:52       ` Ludovic Courtès
  0 siblings, 1 reply; 11+ messages in thread
From: Csepp @ 2022-09-01  1:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 57118, raingloom


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

> Hi,
>
> raingloom <raingloom@riseup.net> skribis:
>
>> From: Csepp <raingloom@riseup.net>
>>
>> * gnu/packages/python-xyz.scm (linode-cli) (linode-openapi-spec): New variables.
>
> [...]
>
>> +;; linode-cli would normally fetch this at build time
>> +;; TODO: is there a way to refer to previous versions? is there even a point
>> +;; in trying to?
>> +(define linode-openapi-spec
>> +  (origin
>> +    (method url-fetch)
>> +    (uri "https://www.linode.com/docs/api/openapi.yaml")
>> +    (sha256
>> +     (base32
>> +      "1jcjfnagjihcy03fcmn5sghdf7a80798xjgj1x7z3ncqwd5aggwg"))))
>
> Unfortunately, as you probably guess, this file was updated in place and
> the hash is now different.
>
> Is there a stable URL for the specific version we’d want to use here?
> Otherwise it’s just too shaky: the thing will fail to build a week or
> month later, when linode.com decides to update that file.
>
> With this fixed, the patch is ready to go.
>
> Thanks in advance,
> Ludo’.

I skimmed the OpenAPI spec and couldn't find any mention of how to
access previous versions.
IMHO if there is a build failure, guix refresh -u should take care of
updating the hash.  It's better than trying to use an outdated API
description without notifying the user.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#57118] [PATCH] gnu: Add linode-cli.
  2022-09-01  1:10     ` Csepp
@ 2022-09-01  8:52       ` Ludovic Courtès
  2022-09-01 20:06         ` Csepp
  0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2022-09-01  8:52 UTC (permalink / raw)
  To: Csepp; +Cc: 57118

Hi,

Csepp <raingloom@riseup.net> skribis:

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

[...]

>>> +(define linode-openapi-spec
>>> +  (origin
>>> +    (method url-fetch)
>>> +    (uri "https://www.linode.com/docs/api/openapi.yaml")
>>> +    (sha256
>>> +     (base32
>>> +      "1jcjfnagjihcy03fcmn5sghdf7a80798xjgj1x7z3ncqwd5aggwg"))))

[...]

> I skimmed the OpenAPI spec and couldn't find any mention of how to
> access previous versions.

OK.

> IMHO if there is a build failure, guix refresh -u should take care of
> updating the hash.  It's better than trying to use an outdated API
> description without notifying the user.

I should say I don’t know what this file is used for.  :-)

What I do know is that we should avoid having origins like that above
that are bound to fail.  Perhaps we can find another option?  If the CLI
tools really need the latest version of ‘openapi.yaml’, could they
download it (and possibly cache it) at run time?  Perhaps there are
already provisions for that?

If the tools don’t strictly need the latest version, then hopefully
Linode keeps a copy of this file in a Git repo somewhere?

TIA,
Ludo’.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#57118] [PATCH] gnu: Add linode-cli.
  2022-09-01  8:52       ` Ludovic Courtès
@ 2022-09-01 20:06         ` Csepp
  2022-09-02  9:13           ` Ludovic Courtès
  2022-09-17 20:24           ` Maxime Devos
  0 siblings, 2 replies; 11+ messages in thread
From: Csepp @ 2022-09-01 20:06 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 57118, Csepp


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

> Hi,
>
> Csepp <raingloom@riseup.net> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>
> [...]
>
>>>> +(define linode-openapi-spec
>>>> +  (origin
>>>> +    (method url-fetch)
>>>> +    (uri "https://www.linode.com/docs/api/openapi.yaml")
>>>> +    (sha256
>>>> +     (base32
>>>> +      "1jcjfnagjihcy03fcmn5sghdf7a80798xjgj1x7z3ncqwd5aggwg"))))
>
> [...]
>
>> I skimmed the OpenAPI spec and couldn't find any mention of how to
>> access previous versions.
>
> OK.
>
>> IMHO if there is a build failure, guix refresh -u should take care of
>> updating the hash.  It's better than trying to use an outdated API
>> description without notifying the user.
>
> I should say I don’t know what this file is used for.  :-)
>
> What I do know is that we should avoid having origins like that above
> that are bound to fail.  Perhaps we can find another option?  If the CLI
> tools really need the latest version of ‘openapi.yaml’, could they
> download it (and possibly cache it) at run time?  Perhaps there are
> already provisions for that?
>
> If the tools don’t strictly need the latest version, then hopefully
> Linode keeps a copy of this file in a Git repo somewhere?
>
> TIA,
> Ludo’.

Oh wow, the git repo suggestion was head on.  I didn't think they would
have something like that, but alas, they do:
https://github.com/linode/linode-api-docs/blob/development/openapi.yaml

It doesn't really have a license though, I'm not sure if that's a problem.
Would we get in trouble for redistributing it?




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#57118] [PATCH] gnu: Add linode-cli.
  2022-09-01 20:06         ` Csepp
@ 2022-09-02  9:13           ` Ludovic Courtès
  2022-09-17 20:13             ` Csepp
  2022-09-17 20:24           ` Maxime Devos
  1 sibling, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2022-09-02  9:13 UTC (permalink / raw)
  To: Csepp; +Cc: 57118

Hi,

Csepp <raingloom@riseup.net> skribis:

> Oh wow, the git repo suggestion was head on.  I didn't think they would
> have something like that, but alas, they do:
> https://github.com/linode/linode-api-docs/blob/development/openapi.yaml
>
> It doesn't really have a license though, I'm not sure if that's a problem.
> Would we get in trouble for redistributing it?

Could you open an issue upstream asking them to clarify that?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#57118] [PATCH] gnu: Add linode-cli.
  2022-09-02  9:13           ` Ludovic Courtès
@ 2022-09-17 20:13             ` Csepp
  0 siblings, 0 replies; 11+ messages in thread
From: Csepp @ 2022-09-17 20:13 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 57118, Csepp


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

> Hi,
>
> Csepp <raingloom@riseup.net> skribis:
>
>> Oh wow, the git repo suggestion was head on.  I didn't think they would
>> have something like that, but alas, they do:
>> https://github.com/linode/linode-api-docs/blob/development/openapi.yaml
>>
>> It doesn't really have a license though, I'm not sure if that's a problem.
>> Would we get in trouble for redistributing it?
>
> Could you open an issue upstream asking them to clarify that?
>
> Thanks,
> Ludo’.

Finally got around to this, let's see how they respond.

https://github.com/linode/linode-api-docs/issues/677




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#57118] [PATCH] gnu: Add linode-cli.
  2022-09-01 20:06         ` Csepp
  2022-09-02  9:13           ` Ludovic Courtès
@ 2022-09-17 20:24           ` Maxime Devos
  1 sibling, 0 replies; 11+ messages in thread
From: Maxime Devos @ 2022-09-17 20:24 UTC (permalink / raw)
  To: Csepp, Ludovic Courtès; +Cc: 57118


[-- Attachment #1.1.1: Type: text/plain, Size: 877 bytes --]



On 01-09-2022 22:06, Csepp wrote:
> 
> [...]
> Oh wow, the git repo suggestion was head on.  I didn't think they would
> have something like that, but alas, they do:
> https://github.com/linode/linode-api-docs/blob/development/openapi.yaml
> 
> It doesn't really have a license though, I'm not sure if that's a problem.
> Would we get in trouble for redistributing it?

Sources (not only code (*), also it's documentation) needs to not only 
be redistributable, but also modifiable.

(*) it seems mostly 'data' (+ documentation), but it's data that to a 
large degree controls how the program works, so seems rather important 
data to me (e.g. what if you make your own version of 'linode.com' and 
need to tweak the openapi.yaml to accomodate your own version that 
behaves differently in some aspects, or removes or adds parts?).

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#57118] Linode-cli license
  2022-08-10 14:18 [bug#57118] [PATCH] gnu: Add linode-cli raingloom
  2022-08-15  8:32 ` Mathieu Othacehe
  2022-08-15 11:42 ` [bug#57118] [PATCH v2] " raingloom
@ 2024-04-01  7:53 ` Steve George
  2 siblings, 0 replies; 11+ messages in thread
From: Steve George @ 2024-04-01  7:53 UTC (permalink / raw)
  To: 57118

Hi,

Bumping this linode-cli patch.

According to the repository there is now a license (Apache 2).

https://github.com/linode/linode-api-docs/blob/development/LICENSE.txt

Steve




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-04-01  7:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 14:18 [bug#57118] [PATCH] gnu: Add linode-cli raingloom
2022-08-15  8:32 ` Mathieu Othacehe
2022-08-15 11:42 ` [bug#57118] [PATCH v2] " raingloom
2022-08-31 21:33   ` [bug#57118] [PATCH] " Ludovic Courtès
2022-09-01  1:10     ` Csepp
2022-09-01  8:52       ` Ludovic Courtès
2022-09-01 20:06         ` Csepp
2022-09-02  9:13           ` Ludovic Courtès
2022-09-17 20:13             ` Csepp
2022-09-17 20:24           ` Maxime Devos
2024-04-01  7:53 ` [bug#57118] Linode-cli license Steve George

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).