From 25cb5bad5e2475a49e20a2da888652e0bd322530 Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Fri, 24 Sep 2021 13:05:05 +0200 Subject: gnu: python-trezor-agent: Fix key generation with trezor-gpg init * gnu/packages/finance.scm (trezor-agent): Add comment on why the undoing of the wrapping is done, and also delete the irrelevant sideffect of the now undone wrapping. (python-trezor-agent): Add a patch that changes the python code to handle the argv[0] changed by the wrapping. * gnu/packages/patches/trezor-agent-fix-argv0.patch: New file. * gnu/local.mk (dist_patch_DATA): Reference patch. Signed-off-by: Nicolas Goaziou --- gnu/packages/finance.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gnu/packages/finance.scm') diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm index 00e3b7a5af..f4978a444b 100644 --- a/gnu/packages/finance.scm +++ b/gnu/packages/finance.scm @@ -844,7 +844,8 @@ the Monero GUI client.") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "0q99vbfd3h85s8rnjipnmldixabqmmlk5w9karv6f0rhyi54f4zv")))) + (base32 "0q99vbfd3h85s8rnjipnmldixabqmmlk5w9karv6f0rhyi54f4zv")) + (patches (search-patches "python-trezor-agent-fix-argv0.patch")))) (build-system python-build-system) (arguments `(#:phases @@ -1091,7 +1092,15 @@ the KeepKey Hardware Wallet.") (add-after 'wrap 'fixup-agent-py (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out"))) - ;; overwrite the wrapper with the real thing. + ;; The wrap phase also wraps trezor_agent.py (besides the + ;; public facing executable called trezor-agent). We need to + ;; undo that wrapping. The reason this is needed is that the + ;; python easy install generates a toplevel script (?) that + ;; messes with argv[0] and then re-opens the python + ;; module. This fails when the wrapped file is actually a shell + ;; script, not a python file. + (delete-file (string-append out "/bin/.trezor_agent.py-real")) + ;; Overwrite the wrapped one with the real thing. (install-file "./trezor_agent.py" (string-append out "/bin")) #t)))))) -- cgit v1.2.3 From bf90403f42556bd1b80773723a3c04b404641d08 Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Sun, 28 Nov 2021 21:15:17 +0100 Subject: gnu: python-trezor-agent: Update to 0.14.2. * gnu/packages/finance.scm (python-trezor-agent): Update to 0.14.2. [propagated-inputs]: Add python-pynacl, python-hidapi. Remove python-ed25519. Signed-off-by: Nicolas Goaziou --- gnu/packages/finance.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gnu/packages/finance.scm') diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm index f4978a444b..334a3e7a90 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,7 @@ the Monero GUI client.") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "0q99vbfd3h85s8rnjipnmldixabqmmlk5w9karv6f0rhyi54f4zv")) + (base32 "0nl44ldfw9s2v3p7g5bldfw3ds2hz9r28j42bpnp8bj0v5na3ivk")) (patches (search-patches "python-trezor-agent-fix-argv0.patch")))) (build-system python-build-system) (arguments @@ -868,9 +870,10 @@ the Monero GUI client.") ("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-pynacl" ,python-pynacl) ("python-semver" ,python-semver) ("python-unidecode" ,python-unidecode) ("python-wheel" ,python-wheel))) -- cgit v1.2.3 From 857098830bcfcb864d0375d59fbf79c2dbfd6c5b Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Sun, 28 Nov 2021 21:19:30 +0100 Subject: gnu: python-trezor: Update to 0.12.3. * gnu/packages/finance.scm (python-trezor): Update to 0.12.3. [source]: Use GitHub repository. [propagated-inputs]: Add python-attrs. Signed-off-by: Nicolas Goaziou --- gnu/packages/finance.scm | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'gnu/packages/finance.scm') diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm index 334a3e7a90..08639e26d5 100644 --- a/gnu/packages/finance.scm +++ b/gnu/packages/finance.scm @@ -992,16 +992,38 @@ 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)) - (sha256 - (base32 "1w19m9lws55k9sjhras47hpfpqwq1jm5vy135nj65yhkblygqg19")))) + (origin + (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 "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"))))) (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) -- cgit v1.2.3 From d3448fafea40b6c53de34696d7e481811de36c09 Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Sun, 28 Nov 2021 21:23:24 +0100 Subject: gnu: trezor-agent: Update to 0.11.0. * gnu/packages/finance.scm (trezor-agent): Update to 0.11.0. [source]: Use GitHub repository. [native-inputs]: Remove python-hidapi. Add python-attrs. Signed-off-by: Nicolas Goaziou --- gnu/packages/finance.scm | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'gnu/packages/finance.scm') diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm index 08639e26d5..2492f04741 100644 --- a/gnu/packages/finance.scm +++ b/gnu/packages/finance.scm @@ -1102,16 +1102,40 @@ 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"))) (sha256 - (base32 - "144657c7bn0a667dq5fv5r6j7iilxf3h9agj29v1m2qpq40g0az8")))) + (base32 "0nl44ldfw9s2v3p7g5bldfw3ds2hz9r28j42bpnp8bj0v5na3ivk")) + (modules + '((guix build utils) + (ice-9 ftw) + (srfi srfi-1) + (srfi srfi-26))) + (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"))))) (arguments - ;; Tests fail with "AttributeError: module 'attr' has no attribute 's'". `(#:phases (modify-phases %standard-phases (add-after 'wrap 'fixup-agent-py @@ -1128,13 +1152,13 @@ the KeepKey Hardware Wallet.") ;; Overwrite the wrapped one with the real thing. (install-file "./trezor_agent.py" (string-append out "/bin")) - #t)))))) + #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))) (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 -- cgit v1.2.3 From b8abc6c88a3d2a52d4f6292c9f7769d35968a0dc Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Sun, 28 Nov 2021 21:24:45 +0100 Subject: gnu: trezord: Update to 2.0.31. * gnu/packages/finance.scm (trezord): Update to 2.0.31. Signed-off-by: Nicolas Goaziou --- gnu/packages/finance.scm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gnu/packages/finance.scm') diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm index 2492f04741..60ed9fc4e3 100644 --- a/gnu/packages/finance.scm +++ b/gnu/packages/finance.scm @@ -1361,7 +1361,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) @@ -1369,8 +1369,7 @@ trezord as a regular user instead of needing to it run as root.") (url "https://github.com/trezor/trezord-go") (commit (string-append "v" version)))) (sha256 - (base32 - "1hzvk0wfgg7b4wpqjk3738yqxlv3pj5i7zxwm0jady2h97hmrqrr")) + (base32 "130nhk1pnr3xx9qkcij81mm3jxrl5zvvdqhvrgvrikqg3zlb6v5b")) (file-name (git-file-name name version)))) (build-system go-build-system) (arguments -- cgit v1.2.3 From c7c4f8088195a8e6650904de4e16d71b98776a76 Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Wed, 1 Dec 2021 18:05:26 +0100 Subject: gnu: Update Trezor support. * gnu/packages/patches/python-trezor-agent-fix-argv0.patch: Remove file. * gnu/local.mk (dist_patch_DATA): Apply previous removal. * gnu/packages/finance.scm (python-trezor-agent): Update to 0.14.4. [source]: Remove now useless patch. (python-mnemonic): Update to 0.20. (python-trezor): Update to 0.12.4 (trezor-agent): Update to 0.11.0-1. [source]: Add file-name field. [arguments]: Remove trailing #T in phases. Signed-off-by: Nicolas Goaziou --- gnu/local.mk | 1 - gnu/packages/finance.scm | 29 +++++++++++----------- .../patches/python-trezor-agent-fix-argv0.patch | 27 -------------------- 3 files changed, 14 insertions(+), 43 deletions(-) delete mode 100644 gnu/packages/patches/python-trezor-agent-fix-argv0.patch (limited to 'gnu/packages/finance.scm') diff --git a/gnu/local.mk b/gnu/local.mk index d3949f36a4..7219f3ad72 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1682,7 +1682,6 @@ dist_patch_DATA = \ %D%/packages/patches/python-pytorch-system-libraries.patch \ %D%/packages/patches/python-robotframework-source-date-epoch.patch \ %D%/packages/patches/python-seaborn-kde-test.patch \ - %D%/packages/patches/python-trezor-agent-fix-argv0.patch \ %D%/packages/patches/python2-subprocess32-disable-input-test.patch \ %D%/packages/patches/python-unittest2-python3-compat.patch \ %D%/packages/patches/python-unittest2-remove-argparse.patch \ diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm index 60ed9fc4e3..268f7ab3a5 100644 --- a/gnu/packages/finance.scm +++ b/gnu/packages/finance.scm @@ -837,7 +837,7 @@ the Monero GUI client.") ;; the toplevel app called trezor-agent. (package (name "python-trezor-agent") - (version "0.14.2") + (version "0.14.4") (source (origin (method git-fetch) @@ -846,8 +846,7 @@ the Monero GUI client.") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "0nl44ldfw9s2v3p7g5bldfw3ds2hz9r28j42bpnp8bj0v5na3ivk")) - (patches (search-patches "python-trezor-agent-fix-argv0.patch")))) + (base32 "1ksv494xpga27ifrjyn1bkqaya5h769lqb9rx1ng0n4kvmnrqr3l")))) (build-system python-build-system) (arguments `(#:phases @@ -918,13 +917,13 @@ settings.") (define-public python-mnemonic (package (name "python-mnemonic") - (version "0.19") + (version "0.20") (source (origin (method url-fetch) (uri (pypi-uri "mnemonic" version)) (sha256 - (base32 "0cd9prmdj8wzdmc7lxbf9lz0xrlkvak5ignag406mmfbn81fndsf")))) + (base32 "1xi5qvj2rvi5almf9c89rl7hz1z4ms04d53pg818i4vpkmivavvw")))) (build-system python-build-system) (propagated-inputs `(("python-pbkdf2" ,python-pbkdf2))) @@ -992,7 +991,7 @@ Nano dongle.") (define-public python-trezor (package (name "python-trezor") - (version "0.12.3") + (version "0.12.4") (source (origin (method git-fetch) @@ -1001,7 +1000,7 @@ Nano dongle.") (commit (string-append "python/v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "0wdm1y5zli6w09zbpjqc6rbcs1b4hjq007mbh7xdr17prbnqprac")) + (base32 "1k0zk94jnkhr4iyngjfhfvff5mibx265q81v8jhvhd3m4clzgc45")) (modules '((guix build utils) (srfi srfi-26) @@ -1102,18 +1101,19 @@ the KeepKey Hardware Wallet.") (define-public trezor-agent (package (name "trezor-agent") - (version "0.11.0") + (version "0.11.0-1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/romanz/trezor-agent") - ;; The version mismatch is not a mistake. Multiple python + ;; 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"))) + ;; 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.4"))) + (file-name (git-file-name name version)) (sha256 (base32 "0nl44ldfw9s2v3p7g5bldfw3ds2hz9r28j42bpnp8bj0v5na3ivk")) (modules @@ -1151,8 +1151,7 @@ the KeepKey Hardware Wallet.") (delete-file (string-append out "/bin/.trezor_agent.py-real")) ;; Overwrite the wrapped one with the real thing. (install-file "./trezor_agent.py" - (string-append out "/bin")) - #t)))))) + (string-append out "/bin")))))))) (build-system python-build-system) (inputs `(("python-trezor" ,python-trezor) diff --git a/gnu/packages/patches/python-trezor-agent-fix-argv0.patch b/gnu/packages/patches/python-trezor-agent-fix-argv0.patch deleted file mode 100644 index 9462067cd5..0000000000 --- a/gnu/packages/patches/python-trezor-agent-fix-argv0.patch +++ /dev/null @@ -1,27 +0,0 @@ -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) -- cgit v1.2.3