all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#50751] [PATCH] gnu: update Trezor support
@ 2021-09-23  8:30 Attila Lendvai
  2021-09-23 18:35 ` Sarah Morgensen
  2021-09-24 11:05 ` [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init Attila Lendvai
  0 siblings, 2 replies; 9+ messages in thread
From: Attila Lendvai @ 2021-09-23  8:30 UTC (permalink / raw)
  To: 50751; +Cc: Attila Lendvai

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)
-- 
2.33.0





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#50751] [PATCH] gnu: update Trezor support
  2021-09-23  8:30 [bug#50751] [PATCH] gnu: update Trezor support Attila Lendvai
@ 2021-09-23 18:35 ` Sarah Morgensen
  2021-09-24 11:05   ` Attila Lendvai
  2021-09-24 11:05 ` [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init Attila Lendvai
  1 sibling, 1 reply; 9+ messages in thread
From: Sarah Morgensen @ 2021-09-23 18:35 UTC (permalink / raw)
  To: Attila Lendvai; +Cc: 50751

Hi,

Thanks for the patch!  Reading over this, I have a few comments.

Attila Lendvai <attila@lendvai.name> writes:

> Fetch everything from their git repos, instead of pypi.
>

Given the resulting version mismatch, and having to pick apart the
sources, is there a compelling reason for this?  It looks like the same
files are included.

> * 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.

When at all possible, version updates should be separate commits from changes.

> @@ -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)))))

This wasn't added by your patch, but it's odd that the reason for
overriding the wrapper wasn't documented....

Because if we didn't overwrite the wrapper, your patch below would be
unnecessary, because the wrapper sets argv[0] to the original name of
the file.

> 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)

Hope that helps,
--
Sarah




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#50751] [PATCH] gnu: update Trezor support
  2021-09-23 18:35 ` Sarah Morgensen
@ 2021-09-24 11:05   ` Attila Lendvai
  0 siblings, 0 replies; 9+ messages in thread
From: Attila Lendvai @ 2021-09-24 11:05 UTC (permalink / raw)
  To: Sarah Morgensen; +Cc: 50751

> > Fetch everything from their git repos, instead of pypi.
>
> Given the resulting version mismatch, and having to pick apart the
> sources, is there a compelling reason for this? It looks like the same
> files are included.


an objective reason: one of these versions were not in pipy at the
time i was working on this.

a subjective reason: one less organization to rely on. if anything
would happen to pipy, e.g. some random API change, then that wouldn't
affect us anymore. if github went down or went hostile, then we could
just change the git URL and continue with a minor glitch.


> > -   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.
>
> When at all possible, version updates should be separate commits from changes.


ok, makes sense, because now that i think about it, it was broken with
the prior version, too. i'll resend it in two patches once i have tested them.


> > ;; overwrite the wrapper with the real thing.
> > (install-file "./trezor_agent.py"
> > -                               (string-append out "/bin"))
> > -               #t))))))
> > -                               (string-append out "/bin")))
> > -               #t)))))
>
> This wasn't added by your patch, but it's odd that the reason for
> overriding the wrapper wasn't documented....


i have added a comment explaining the situation.

thank you for the feedback! the updated patches will be coming a bit
later.

- attila
PGP: 5D5F 45C7 DFCD 0A39






^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init
  2021-09-23  8:30 [bug#50751] [PATCH] gnu: update Trezor support Attila Lendvai
  2021-09-23 18:35 ` Sarah Morgensen
@ 2021-09-24 11:05 ` Attila Lendvai
  2021-09-24 11:05   ` [bug#50751] [PATCH 2/2] gnu: update Trezor support Attila Lendvai
  2021-11-28 20:34   ` [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init Nicolas Goaziou
  1 sibling, 2 replies; 9+ messages in thread
From: Attila Lendvai @ 2021-09-24 11:05 UTC (permalink / raw)
  To: 50751; +Cc: Attila Lendvai

Someone with a better understanding of the python infrastructure may be able
to fix it nicer, but it works.

* 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/packages/finance.scm                      | 13 +++++++--
 .../patches/trezor-agent-fix-argv0.patch      | 27 +++++++++++++++++++
 2 files changed, 38 insertions(+), 2 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..a123efe207 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 "trezor-agent-fix-argv0.patch"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -1089,7 +1090,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))))))
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)
-- 
2.33.0





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#50751] [PATCH 2/2] gnu: update Trezor support
  2021-09-24 11:05 ` [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init Attila Lendvai
@ 2021-09-24 11:05   ` Attila Lendvai
  2021-11-28 20:35     ` bug#50751: " Nicolas Goaziou
  2021-11-28 20:34   ` [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init Nicolas Goaziou
  1 sibling, 1 reply; 9+ messages in thread
From: Attila Lendvai @ 2021-09-24 11:05 UTC (permalink / raw)
  To: 50751; +Cc: Attila Lendvai

Fetch everything from their git repos, instead of pypi. The rationale for that
is that at the time of this writing one of these are not updated to the latest
git tag in pipy, and this way there is one less organization/infrastructure to
rely on that is inbetween the author(s) and us.

* 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/finance.scm | 83 +++++++++++++++++++++++++++++++---------
 1 file changed, 64 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index a123efe207..a8b5604249 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 "trezor-agent-fix-argv0.patch"))))
     (build-system python-build-system)
     (arguments
@@ -864,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)
@@ -987,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)
@@ -1075,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
@@ -1100,14 +1145,14 @@ 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")))
+             #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
@@ -1310,7 +1355,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)
@@ -1319,7 +1364,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
-- 
2.33.0





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init
  2021-09-24 11:05 ` [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init Attila Lendvai
  2021-09-24 11:05   ` [bug#50751] [PATCH 2/2] gnu: update Trezor support Attila Lendvai
@ 2021-11-28 20:34   ` Nicolas Goaziou
  2021-11-30 20:51     ` Attila Lendvai
  1 sibling, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2021-11-28 20:34 UTC (permalink / raw)
  To: Attila Lendvai; +Cc: 50751

Hello,

Attila Lendvai <attila@lendvai.name> writes:

> Someone with a better understanding of the python infrastructure may be able
> to fix it nicer, but it works.
>
> * 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.

I prefixed the patch name with python-... and referenced it in local.mk.
Then I applied it.

Thank you.

Regards,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#50751: [PATCH 2/2] gnu: update Trezor support
  2021-09-24 11:05   ` [bug#50751] [PATCH 2/2] gnu: update Trezor support Attila Lendvai
@ 2021-11-28 20:35     ` Nicolas Goaziou
  0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2021-11-28 20:35 UTC (permalink / raw)
  To: Attila Lendvai; +Cc: 50751-done

Hello,

Attila Lendvai <attila@lendvai.name> writes:

> * 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.

I split the patch in four parts, and tweaked commit message. You may
want to have a look at them.

Thanks.

Regards,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init
  2021-11-28 20:34   ` [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init Nicolas Goaziou
@ 2021-11-30 20:51     ` Attila Lendvai
  2021-12-01 15:34       ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Attila Lendvai @ 2021-11-30 20:51 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: 50751

ouch, i already had a newer version of the patchset locally. i reported an issue upstream, and they got rid of the argv[0] usage, and also made a new release.

i was already testing it locally but then life happened before i could send it. i have sent the new patchset now: https://issues.guix.gnu.org/52207

re splitting the commit: i don't think it's a good idea, mostly due to git bisect: pushing commits that may not even compile can make someone's life much harder down the road. i think updating tightly interdependent packages should happen in one commit, so that each git commit leaves the repo in a functional state, and so that it can compile and run the test suite.

but in spite of the above, i have sent the new patchset as separate commits.

- attila
PGP: 5D5F 45C7 DFCD 0A39





^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init
  2021-11-30 20:51     ` Attila Lendvai
@ 2021-12-01 15:34       ` Nicolas Goaziou
  0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2021-12-01 15:34 UTC (permalink / raw)
  To: Attila Lendvai; +Cc: 50751

Hello,

Attila Lendvai <attila@lendvai.name> writes:

> ouch, i already had a newer version of the patchset locally.
> i reported an issue upstream, and they got rid of the argv[0] usage,
> and also made a new release.

It happens.
>
> i was already testing it locally but then life happened before i could
> send it. i have sent the new patchset now:
> https://issues.guix.gnu.org/52207

Great.

> re splitting the commit: i don't think it's a good idea, mostly due to
> git bisect: pushing commits that may not even compile can make
> someone's life much harder down the road. i think updating tightly
> interdependent packages should happen in one commit, so that each git
> commit leaves the repo in a functional state, and so that it can
> compile and run the test suite.
>
> but in spite of the above, i have sent the new patchset as separate
> commits.

I overlooked the fact that packages were interdependent, which is pretty
obvious now you mention it. In that case, I agree splitting the commit
was not a good idea.

So... could you send the new patchset again in a single commit?

Thanks,

Regards,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-12-01 15:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23  8:30 [bug#50751] [PATCH] gnu: update Trezor support Attila Lendvai
2021-09-23 18:35 ` Sarah Morgensen
2021-09-24 11:05   ` Attila Lendvai
2021-09-24 11:05 ` [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init Attila Lendvai
2021-09-24 11:05   ` [bug#50751] [PATCH 2/2] gnu: update Trezor support Attila Lendvai
2021-11-28 20:35     ` bug#50751: " Nicolas Goaziou
2021-11-28 20:34   ` [bug#50751] [PATCH 1/2] gnu: python-trezor-agent: Fix key generation with trezor-gpg init Nicolas Goaziou
2021-11-30 20:51     ` Attila Lendvai
2021-12-01 15:34       ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.