summary refs log tree commit diff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorAttila Lendvai <attila@lendvai.name>2021-09-24 13:05:05 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2021-11-28 21:31:08 +0100
commit25cb5bad5e2475a49e20a2da888652e0bd322530 (patch)
tree1bf2fc264b5e5bac5be97dd47f4fb5fee56b9eb3 /gnu/packages/patches
parent032d1c03b65b134c05fec2dec91da3c0ba05ae0b (diff)
downloadguix-25cb5bad5e2475a49e20a2da888652e0bd322530.tar.gz
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 <mail@nicolasgoaziou.fr>
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/python-trezor-agent-fix-argv0.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/gnu/packages/patches/python-trezor-agent-fix-argv0.patch b/gnu/packages/patches/python-trezor-agent-fix-argv0.patch
new file mode 100644
index 0000000000..9462067cd5
--- /dev/null
+++ b/gnu/packages/patches/python-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)