GNU bug report logs - #57118
[PATCH] gnu: Add linode-cli.

Previous Next

Package: guix-patches;

Reported by: raingloom <raingloom <at> riseup.net>

Date: Wed, 10 Aug 2022 14:20:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 57118 AT debbugs.gnu.org.

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#57118; Package guix-patches. (Wed, 10 Aug 2022 14:20:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to raingloom <raingloom <at> riseup.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 10 Aug 2022 14:20:01 GMT) Full text and rfc822 format available.

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

From: raingloom <raingloom <at> riseup.net>
To: guix-patches <at> gnu.org
Cc: raingloom <raingloom <at> riseup.net>
Subject: [PATCH] gnu: Add linode-cli.
Date: Wed, 10 Aug 2022 16:18:43 +0200
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Mon, 15 Aug 2022 08:33:02 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: raingloom <raingloom <at> riseup.net>
Cc: 57118 <at> debbugs.gnu.org
Subject: Re: bug#57118: [PATCH] gnu: Add linode-cli.
Date: Mon, 15 Aug 2022 10:32:14 +0200
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




Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Mon, 15 Aug 2022 11:44:02 GMT) Full text and rfc822 format available.

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

From: raingloom <raingloom <at> riseup.net>
To: 57118 <at> debbugs.gnu.org
Cc: Csepp <raingloom <at> riseup.net>
Subject: [PATCH v2] gnu: Add linode-cli.
Date: Mon, 15 Aug 2022 13:42:28 +0200
From: Csepp <raingloom <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Wed, 31 Aug 2022 21:34:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: raingloom <raingloom <at> riseup.net>
Cc: 57118 <at> debbugs.gnu.org
Subject: Re: bug#57118: [PATCH] gnu: Add linode-cli.
Date: Wed, 31 Aug 2022 23:33:18 +0200
Hi,

raingloom <raingloom <at> riseup.net> skribis:

> From: Csepp <raingloom <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Thu, 01 Sep 2022 01:16:01 GMT) Full text and rfc822 format available.

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

From: Csepp <raingloom <at> riseup.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 57118 <at> debbugs.gnu.org, raingloom <raingloom <at> riseup.net>
Subject: Re: bug#57118: [PATCH] gnu: Add linode-cli.
Date: Thu, 01 Sep 2022 03:10:32 +0200
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi,
>
> raingloom <raingloom <at> riseup.net> skribis:
>
>> From: Csepp <raingloom <at> 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.




Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Thu, 01 Sep 2022 08:54:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Csepp <raingloom <at> riseup.net>
Cc: 57118 <at> debbugs.gnu.org
Subject: Re: bug#57118: [PATCH] gnu: Add linode-cli.
Date: Thu, 01 Sep 2022 10:52:58 +0200
Hi,

Csepp <raingloom <at> riseup.net> skribis:

> Ludovic Courtès <ludo <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Thu, 01 Sep 2022 20:23:01 GMT) Full text and rfc822 format available.

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

From: Csepp <raingloom <at> riseup.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 57118 <at> debbugs.gnu.org, Csepp <raingloom <at> riseup.net>
Subject: Re: bug#57118: [PATCH] gnu: Add linode-cli.
Date: Thu, 01 Sep 2022 22:06:32 +0200
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi,
>
> Csepp <raingloom <at> riseup.net> skribis:
>
>> Ludovic Courtès <ludo <at> 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?




Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Fri, 02 Sep 2022 09:14:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Csepp <raingloom <at> riseup.net>
Cc: 57118 <at> debbugs.gnu.org
Subject: Re: bug#57118: [PATCH] gnu: Add linode-cli.
Date: Fri, 02 Sep 2022 11:13:01 +0200
Hi,

Csepp <raingloom <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Sat, 17 Sep 2022 20:16:02 GMT) Full text and rfc822 format available.

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

From: Csepp <raingloom <at> riseup.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 57118 <at> debbugs.gnu.org, Csepp <raingloom <at> riseup.net>
Subject: Re: bug#57118: [PATCH] gnu: Add linode-cli.
Date: Sat, 17 Sep 2022 22:13:55 +0200
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi,
>
> Csepp <raingloom <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Sat, 17 Sep 2022 20:25:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Csepp <raingloom <at> riseup.net>, Ludovic Courtès
 <ludo <at> gnu.org>
Cc: 57118 <at> debbugs.gnu.org
Subject: Re: [bug#57118] [PATCH] gnu: Add linode-cli.
Date: Sat, 17 Sep 2022 22:24:33 +0200
[Message part 1 (text/plain, inline)]

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.
[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#57118; Package guix-patches. (Mon, 01 Apr 2024 07:54:02 GMT) Full text and rfc822 format available.

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

From: Steve George <steve <at> futurile.net>
To: 57118 <at> debbugs.gnu.org
Subject: RE: Linode-cli license
Date: Mon, 1 Apr 2024 08:53:43 +0100
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




This bug report was last modified 1 year and 130 days ago.

Previous Next


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