Skip to content

Commit 81baa83

Browse files
anupam-gitazubieta
authored andcommitted
Symlink gnupg homedir to /tmp for shorter path
1 parent cfb73bd commit 81baa83

File tree

1 file changed

+19
-11
lines changed
  • appimagebuilder/app_dir/deploy/pacman

1 file changed

+19
-11
lines changed

appimagebuilder/app_dir/deploy/pacman/venv.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import subprocess
1818
import sys
1919
from pathlib import Path
20+
from tempfile import TemporaryDirectory
2021

2122
from appimagebuilder.common import shell
2223

@@ -168,18 +169,25 @@ def _configure_keyring(self):
168169
)
169170
)
170171

171-
proc_gpgagent = self._run_command(
172-
"{fakeroot} {gpg-agent} --homedir {gpgdir} --daemon",
173-
assert_success=False,
174-
wait_for_completion=False
175-
)
176-
self._run_command("{fakeroot} {pacman-key} --config {config} --init")
177-
self._run_command(
178-
"{fakeroot} {pacman-key} --config {config} --populate "
179-
f"{' '.join(keyrings)}"
180-
)
172+
with TemporaryDirectory(prefix="appimage-builder.") as temp_dir:
173+
temp_gnupg_dir = str(Path(temp_dir) / 'gnupg')
174+
175+
os.symlink(self._gpg_dir.absolute(), temp_gnupg_dir, target_is_directory=True)
176+
177+
proc_gpgagent = self._run_command(
178+
"{fakeroot} {gpg-agent} --homedir"
179+
f" {temp_gnupg_dir}"
180+
" --daemon",
181+
assert_success=False,
182+
wait_for_completion=False
183+
)
184+
self._run_command("{fakeroot} {pacman-key} --config {config} --init")
185+
self._run_command(
186+
"{fakeroot} {pacman-key} --config {config} --populate "
187+
f"{' '.join(keyrings)}"
188+
)
181189

182-
proc_gpgagent.terminate()
190+
proc_gpgagent.terminate()
183191

184192
def _run_command(
185193
self,

0 commit comments

Comments
 (0)