From patchwork Mon Aug 15 11:42:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Csepp X-Patchwork-Id: 41689 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B8ACA27BBEA; Mon, 15 Aug 2022 12:50:33 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 56D5E27BBE9 for ; Mon, 15 Aug 2022 12:50:33 +0100 (BST) Received: from localhost ([::1]:48770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNYc0-0003ga-Cf for patchwork@mira.cbaines.net; Mon, 15 Aug 2022 07:50:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNYVn-0008MQ-Kt for guix-patches@gnu.org; Mon, 15 Aug 2022 07:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNYVm-0001Su-C7 for guix-patches@gnu.org; Mon, 15 Aug 2022 07:44:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNYVm-0006oG-8F for guix-patches@gnu.org; Mon, 15 Aug 2022 07:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57118] [PATCH v2] gnu: Add linode-cli. References: <20220810141843.21051-1-raingloom@riseup.net> In-Reply-To: <20220810141843.21051-1-raingloom@riseup.net> Resent-From: raingloom Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 Aug 2022 11:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57118 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57118@debbugs.gnu.org Cc: Csepp Received: via spool by 57118-submit@debbugs.gnu.org id=B57118.166056380226105 (code B ref 57118); Mon, 15 Aug 2022 11:44:02 +0000 Received: (at 57118) by debbugs.gnu.org; 15 Aug 2022 11:43:22 +0000 Received: from localhost ([127.0.0.1]:41055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNYV7-0006mz-Hg for submit@debbugs.gnu.org; Mon, 15 Aug 2022 07:43:21 -0400 Received: from mx0.riseup.net ([198.252.153.6]:39426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNYV4-0006mk-QB for 57118@debbugs.gnu.org; Mon, 15 Aug 2022 07:43:19 -0400 Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx0.riseup.net (Postfix) with ESMTPS id 4M5sq50Yk5z9sxL for <57118@debbugs.gnu.org>; Mon, 15 Aug 2022 11:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1660563793; bh=HRQcIWbwofe1+gtlyLgVqgh+8AjbltjeIHFyzgMf9Uo=; h=From:To:Cc:Subject:Date:From; b=PRWQxguMYYqoEVTBp+uWy9qNuY1lMpNc/d4OlO5xP0QduwUHwD83iacbUAELKMkFG +nEOjzetG60PeOZWayP+56w0FjQmgmsnO/E8w3kwBbI8hIF8dgZcu5r9+xeFK8uJ5g /fFMAHd4ik8vcxcEy7HG2+IE34Mdbn9zfaviopyI= X-Riseup-User-ID: 1A27FB2A1BFDF6AB96CBF1AAD8C2ED13446D3F4E47902FAFF6E234DEC9B4A798 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4M5sq41jTtz1ySb; Mon, 15 Aug 2022 11:43:11 +0000 (UTC) From: raingloom Date: Mon, 15 Aug 2022 13:42:28 +0200 Message-Id: <20220815114227.10424-1-raingloom@riseup.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From: Csepp * 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)))