From patchwork Wed Aug 10 14:18:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Csepp X-Patchwork-Id: 41533 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 0D4FB27BBEA; Wed, 10 Aug 2022 15:28:43 +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 6B0B827BBE9 for ; Wed, 10 Aug 2022 15:28:42 +0100 (BST) Received: from localhost ([::1]:49896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLmhN-0007e0-Js for patchwork@mira.cbaines.net; Wed, 10 Aug 2022 10:28:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLmZ0-0001ab-LX for guix-patches@gnu.org; Wed, 10 Aug 2022 10:20:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oLmZ0-0006jL-Bc for guix-patches@gnu.org; Wed, 10 Aug 2022 10:20:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oLmYz-0001Me-RV for guix-patches@gnu.org; Wed, 10 Aug 2022 10:20:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57118] [PATCH] gnu: Add linode-cli. Resent-From: raingloom Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 10 Aug 2022 14:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57118 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57118@debbugs.gnu.org Cc: raingloom X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16601411475176 (code B ref -1); Wed, 10 Aug 2022 14:20:01 +0000 Received: (at submit) by debbugs.gnu.org; 10 Aug 2022 14:19:07 +0000 Received: from localhost ([127.0.0.1]:50403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLmY7-0001LQ-8N for submit@debbugs.gnu.org; Wed, 10 Aug 2022 10:19:07 -0400 Received: from lists.gnu.org ([209.51.188.17]:40852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLmY2-0001LG-P8 for submit@debbugs.gnu.org; Wed, 10 Aug 2022 10:19:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLmY2-000770-JL for guix-patches@gnu.org; Wed, 10 Aug 2022 10:19:02 -0400 Received: from mx0.riseup.net ([198.252.153.6]:54616) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLmXz-0006U5-21 for guix-patches@gnu.org; Wed, 10 Aug 2022 10:19:01 -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 4M2sW54l08z9sl6 for ; Wed, 10 Aug 2022 14:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1660141137; bh=QZYuQoj/BICIrf3oIk6/ibRTUvmS1RuANKMwy1mbIZw=; h=From:To:Cc:Subject:Date:From; b=tEYDVtZQZhxW87mJUEdjOmstBUN4nUjyffAaOdhGYSfY538ihDN40/zdhhWGIRWgQ 6AenaivCJde5bTZFqEmGZ/mR3m3PAVkuXNDLNR1yQiIwL6XI/BS4H3KNWIvF4d8SGg 4/RM13OQavX+NP/8rSpxl0uvG7/xwTAADZtCAhZI= X-Riseup-User-ID: 75A32E004762B468EAC2B91BA36A233193CC8588CD11B0C0D60A54FFBD4ABD88 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4M2sW45sWnz1ySb; Wed, 10 Aug 2022 14:18:56 +0000 (UTC) From: raingloom Date: Wed, 10 Aug 2022 16:18:43 +0200 Message-Id: <20220810141843.21051-1-raingloom@riseup.net> MIME-Version: 1.0 Received-SPF: pass client-ip=198.252.153.6; envelope-from=raingloom@riseup.net; helo=mx0.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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 * 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)))