From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oISyKJvA82IAUwEAbAwnHQ (envelope-from ) for ; Wed, 10 Aug 2022 16:28:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 2MqJKJvA82KDFwEA9RJhRA (envelope-from ) for ; Wed, 10 Aug 2022 16:28:43 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 718EF3D005 for ; Wed, 10 Aug 2022 16:28:43 +0200 (CEST) Received: from localhost ([::1]:49896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLmhO-0007e0-L6 for larch@yhetil.org; Wed, 10 Aug 2022 10:28:42 -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 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1660141723; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=tYNuP+eTm0bbMp6qiPMK4CkCWQ4H7AEz5DxSddUYtxw=; b=E/fFOXqLRfpPmo1TaBejmSVM0wDJNbaKMnLwFzhYH6M+ZKAroUqBOBQHLCqU15VNxXxShA gD9llV/R0pm3iUSzHeg5X8lfU7yjAyOyPVabV3h+a2P3LHEgL8GuWGaL5bvbDxIpt7H10d IdSg330OhAem0j7ufHAj9nNu2dTZX/zeyZQisVtdCdU22matrHGuvGahu6sHv3WwxkEHZn AmoCHCbB9VqDWgq8T+dxFIJyV2ScQkq3AaJGoswHNrJTHctG5ivWvcgil/9uGyWT+LSR9S LodTxse1E/PXLNfbidv8wzGz2ot92AYXdLxkMsCoB/0uc8rNQo1hmR4+SQnjqw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660141723; a=rsa-sha256; cv=none; b=n9hh2T0XtA/6DYFFsF4itywAx+5OSWiG/+ZterlXzOwvwb4+gWQ3P0aB8tYgHRwZunPb0v UDApI+uB+bq1U3LqBmRpRl818k7ejmJvVfh5Rl7EEj5oYfllSJFVdReYtDb5KGRg1jU9RA br9YZSxUIYYaLBs34qAI9as1MZdKRPotnhhcS/XyGDidblblEuYoX5cVY8X5F7c4Ddh9ki F5Q6bHeyGtT3K4t0BO6z2m0lm7jDQcJFMyUT9a0462rsB8va8Fa2YtZ3mUCvAiYSH6+Cfm cY0Xcvw93QdYIgXm8yYe2NhhoNmtf0LWG414uS2tu1HMLmksWW3G/IsvLlAGJw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=riseup.net header.s=squak header.b=tEYDVtZQ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=riseup.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 8.41 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=riseup.net header.s=squak header.b=tEYDVtZQ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=riseup.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 718EF3D005 X-Spam-Score: 8.41 X-Migadu-Spam: Yes X-Migadu-Scanner: scn0.migadu.com X-TUID: QPQEI9Q+6ABp * 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