From patchwork Thu Sep 23 08:30:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 33256 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 158FF27BBE3; Thu, 23 Sep 2021 09:33:46 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7018C27BBE1 for ; Thu, 23 Sep 2021 09:33:45 +0100 (BST) Received: from localhost ([::1]:55988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTKAq-00042c-Gt for patchwork@mira.cbaines.net; Thu, 23 Sep 2021 04:33:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTKAB-00042G-1N for guix-patches@gnu.org; Thu, 23 Sep 2021 04:33:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTKAA-0006Tr-Pd for guix-patches@gnu.org; Thu, 23 Sep 2021 04:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mTKAA-0002VN-Mf for guix-patches@gnu.org; Thu, 23 Sep 2021 04:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50751] [PATCH] gnu: update Trezor support Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Sep 2021 08:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50751 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50751@debbugs.gnu.org Cc: Attila Lendvai X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16323859349558 (code B ref -1); Thu, 23 Sep 2021 08:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Sep 2021 08:32:14 +0000 Received: from localhost ([127.0.0.1]:52660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTK9N-0002U6-Mt for submit@debbugs.gnu.org; Thu, 23 Sep 2021 04:32:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:59352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTK9L-0002Tw-A5 for submit@debbugs.gnu.org; Thu, 23 Sep 2021 04:32:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTK9L-0003zH-3Q for guix-patches@gnu.org; Thu, 23 Sep 2021 04:32:11 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:44917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTK95-0005Z4-R9 for guix-patches@gnu.org; Thu, 23 Sep 2021 04:32:10 -0400 Received: by mail-ed1-x52b.google.com with SMTP id v22so20159579edd.11 for ; Thu, 23 Sep 2021 01:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KvV/YGgTbBWlBYn5NkzqiDai+K72fi+J5CUxoOQTt8U=; b=gVnwyidAuhLOBZBYu8QnpSxeS5LzZyBg9fdrLt7k6ad+sY+RjOKW3bSW4YYbYCeP5j 8gRnP2CqUlSnLXjBz3FEa2Rj60RS0Uce98jrwBek56IiM3kgIS1JThMaz3z7xgN2U4WY 6tzYzUi+2FrqAmO3n42c7Zv8x+siFoPu4spuBqF9n8C3wAyRePEmYSfQw1+LJYTGKrE8 /rAA3tWTtSHNcCAF6RJQaRpu+GmDqtTWyXjXYOtE7WPQcWLbiMe5hC3A2X/AFPkpUdgV 7wCWYCXt+a/+ICMIwsdIFT609Yb/MFqn+EJNV79EMWpCs1dEqrDqmU+V9MB2SgN6MO8Y B3Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=KvV/YGgTbBWlBYn5NkzqiDai+K72fi+J5CUxoOQTt8U=; b=KyS3Z4a90AHcqjDVAA1TFOOspH6FuCf3tSkgIzqM7fpYXWa1Yg/GkaLTb77b/aebNN 01QGbbr8Z482C19nNaKjDu/FzjxIHlbXiA+1IsLCBoiIdJ+0TiLuevtedMKt9yqP73zh I1LV3cGkZPCBXEHfIx0z9xrvlLaw+Ll5NAZtmW8adtvCOdypKWK+6NQwxopSAs62K6NI UBMpucgEHQdQqhTSp8G7bWyAHTdRkznK1uASs/WJN+dSH95564lamoVqvhScy2vdpM3O jzVxybgxT+o2i7/VXWaL2lXtS2QXy2vhO72500YWSWjpX/HmAa2/vAAJyV765VH845HJ 7Inw== X-Gm-Message-State: AOAM5339TMTLxlpbrnkLGm32E8ldUXjPXpQXRXwgWFsQHqEQqZtVV0Zq Fkw6utc7MYXdWip4I8nzPFvo5chVjyE= X-Google-Smtp-Source: ABdhPJxjxD0JKP3V8b064xREbwRgb6O81r0uCW3MP17ufW71zSIlD2sLudjcEX5NgitUrOxZTO0emA== X-Received: by 2002:a17:906:f906:: with SMTP id lc6mr3532601ejb.487.1632385914084; Thu, 23 Sep 2021 01:31:54 -0700 (PDT) Received: from lelap.lan (catv-213-222-131-28.catv.broadband.hu. [213.222.131.28]) by smtp.gmail.com with ESMTPSA id r22sm2530603ejj.91.2021.09.23.01.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Sep 2021 01:31:53 -0700 (PDT) From: Attila Lendvai Date: Thu, 23 Sep 2021 10:30:46 +0200 Message-Id: <20210923083045.10372-1-attila@lendvai.name> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=attila.lendvai@gmail.com; helo=mail-ed1-x52b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 Fetch everything from their git repos, instead of pypi. * gnu/packages/finance.scm (python-trezor-agent): Update to 0.14.2. (python-trezor): Update to 0.12.3. (trezor-agent): Update to 0.11.0. (trezord): Update to 2.0.31. * gnu/packages/patches/trezor-agent-fix-argv0.patch: New file. --- gnu/packages/finance.scm | 84 ++++++++++++++----- .../patches/trezor-agent-fix-argv0.patch | 27 ++++++ 2 files changed, 92 insertions(+), 19 deletions(-) create mode 100644 gnu/packages/patches/trezor-agent-fix-argv0.patch diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm index 9b073541de..34bb73016c 100644 --- a/gnu/packages/finance.scm +++ b/gnu/packages/finance.scm @@ -833,9 +833,11 @@ the Monero GUI client.") (license license:bsd-3))) (define-public python-trezor-agent + ;; It is called 'libagent' in pypi; i.e. this is the library as opposed to + ;; the toplevel app called trezor-agent. (package (name "python-trezor-agent") - (version "0.13.1") + (version "0.14.2") (source (origin (method git-fetch) @@ -844,7 +846,8 @@ the Monero GUI client.") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "0q99vbfd3h85s8rnjipnmldixabqmmlk5w9karv6f0rhyi54f4zv")))) + (base32 "0nl44ldfw9s2v3p7g5bldfw3ds2hz9r28j42bpnp8bj0v5na3ivk")) + (patches (search-patches "trezor-agent-fix-argv0.patch")))) (build-system python-build-system) (arguments `(#:phases @@ -863,11 +866,12 @@ the Monero GUI client.") (add-installed-pythonpath inputs outputs) (invoke "py.test")))))) (propagated-inputs - `(("python-configargparse" ,python-configargparse) + `(("python-pynacl" ,python-pynacl) + ("python-configargparse" ,python-configargparse) ("python-daemon" ,python-daemon) ("python-docutils" ,python-docutils) ("python-ecdsa" ,python-ecdsa) - ("python-ed25519" ,python-ed25519) + ("python-hidapi" ,python-hidapi) ("python-mnemonic" ,python-mnemonic) ("python-pymsgbox" ,python-pymsgbox) ("python-semver" ,python-semver) @@ -986,16 +990,35 @@ Nano dongle.") (define-public python-trezor (package (name "python-trezor") - (version "0.12.1") + (version "0.12.3") (source (origin - (method url-fetch) - (uri (pypi-uri "trezor" version)) + (method git-fetch) + (uri (git-reference + (url "https://github.com/trezor/trezor-firmware/") + (commit (string-append "python/v" version)))) + (file-name (git-file-name name version)) (sha256 - (base32 "1w19m9lws55k9sjhras47hpfpqwq1jm5vy135nj65yhkblygqg19")))) + (base32 "0wdm1y5zli6w09zbpjqc6rbcs1b4hjq007mbh7xdr17prbnqprac")) + (modules '((guix build utils) (srfi srfi-26) (srfi srfi-1) (ice-9 ftw))) + (snippet + '(begin + ;; Delete everything except ./python/ + (for-each delete-file-recursively + (scandir "./" (negate (cut member <> '("python" "." "..") + string=)))) + ;; Move ./python/* to the toplevel + (for-each (lambda (file-name) + (rename-file (string-append "./python/" file-name) + (string-append "./" file-name))) + (scandir "./python/" + (negate (cut member <> '("." "..") string=)))) + (delete-file-recursively "./python") + #t)))) (build-system python-build-system) (propagated-inputs - `(("python-click" ,python-click) + `(("python-attrs" ,python-attrs) + ("python-click" ,python-click) ("python-construct" ,python-construct) ("python-ecdsa" ,python-ecdsa) ("python-libusb1" ,python-libusb1) @@ -1074,16 +1097,39 @@ the KeepKey Hardware Wallet.") (define-public trezor-agent (package (name "trezor-agent") - (version "0.10.0") + (version "0.11.0") (source (origin - (method url-fetch) - (uri (pypi-uri "trezor_agent" version)) + (method git-fetch) + (uri (git-reference + (url "https://github.com/romanz/trezor-agent") + ;; The version mismatch is not a mistake. Multiple python + ;; apps/packages are in the same git repo, and they have + ;; different versions. The git tag seems to track libagent, + ;; i.e. python-trezor-agent in the Guix namespace. + ;; See e.g. ./agents/trezor/setup.py + (commit "v0.14.2"))) + (file-name (git-file-name name version)) (sha256 (base32 - "144657c7bn0a667dq5fv5r6j7iilxf3h9agj29v1m2qpq40g0az8")))) + "0nl44ldfw9s2v3p7g5bldfw3ds2hz9r28j42bpnp8bj0v5na3ivk")) + (modules '((guix build utils) (srfi srfi-26) (srfi srfi-1) (ice-9 ftw))) + (snippet + '(begin + ;; Delete everything except ./agents/trezor/ + (for-each delete-file-recursively + (filter (lambda (full-name) + (not (string-prefix? "./agents/trezor/" full-name))) + (find-files "."))) + ;; Move ./agents/trezor/* to the toplevel + (for-each (lambda (file-name) + (rename-file (string-append "./agents/trezor/" file-name) + (string-append "./" file-name))) + (scandir "./agents/trezor/" + (negate (cut member <> '("." "..") string=)))) + (delete-file-recursively "./agents") + #t)))) (arguments - ;; Tests fail with "AttributeError: module 'attr' has no attribute 's'". `(#:phases (modify-phases %standard-phases (add-after 'wrap 'fixup-agent-py @@ -1091,14 +1137,14 @@ the KeepKey Hardware Wallet.") (let* ((out (assoc-ref outputs "out"))) ;; overwrite the wrapper with the real thing. (install-file "./trezor_agent.py" - (string-append out "/bin")) - #t)))))) + (string-append out "/bin"))) + #t))))) (build-system python-build-system) (inputs `(("python-trezor" ,python-trezor) ("python-trezor-agent" ,python-trezor-agent))) (native-inputs - `(("python-hidapi" ,python-hidapi))) + `(("python-attrs" ,python-attrs))) ; for the tests (home-page "https://github.com/romanz/trezor-agent") (synopsis "Using Trezor as hardware SSH/GPG agent") (description "This package allows using Trezor as a hardware SSH/GPG @@ -1301,7 +1347,7 @@ trezord as a regular user instead of needing to it run as root.") (define-public trezord (package (name "trezord") - (version "2.0.30") + (version "2.0.31") (source (origin (method git-fetch) @@ -1310,7 +1356,7 @@ trezord as a regular user instead of needing to it run as root.") (commit (string-append "v" version)))) (sha256 (base32 - "1hzvk0wfgg7b4wpqjk3738yqxlv3pj5i7zxwm0jady2h97hmrqrr")) + "130nhk1pnr3xx9qkcij81mm3jxrl5zvvdqhvrgvrikqg3zlb6v5b")) (file-name (git-file-name name version)))) (build-system go-build-system) (arguments diff --git a/gnu/packages/patches/trezor-agent-fix-argv0.patch b/gnu/packages/patches/trezor-agent-fix-argv0.patch new file mode 100644 index 0000000000..9462067cd5 --- /dev/null +++ b/gnu/packages/patches/trezor-agent-fix-argv0.patch @@ -0,0 +1,27 @@ +diff --git a/libagent/gpg/__init__.py b/libagent/gpg/__init__.py +index 3711bc8..67085de 100644 +--- a/libagent/gpg/__init__.py ++++ b/libagent/gpg/__init__.py +@@ -122,15 +122,19 @@ def run_init(device_type, args): + verify_gpg_version() + + # Prepare new GPG home directory for hardware-based identity +- device_name = os.path.basename(sys.argv[0]).rsplit('-', 1)[0] +- log.info('device name: %s', device_name) ++ exe_name = os.path.basename(sys.argv[0]) ++ # drop the Guix wrapper's dot prefix from the name ++ if exe_name[0] == '.' and exe_name.endswith('-real'): ++ exe_name = exe_name[1:-5:] ++ device_name = exe_name.rsplit('-', 1)[0] ++ log.info('exe name: %s, device name: %s', exe_name, device_name) + homedir = args.homedir + if not homedir: + homedir = os.path.expanduser('~/.gnupg/{}'.format(device_name)) + + log.info('GPG home directory: %s', homedir) + +- if os.path.exists(homedir): ++ if os.path.exists(homedir) and not args.subkey: + log.error('GPG home directory %s exists, ' + 'remove it manually if required', homedir) + sys.exit(1)