[elbe-devel] [PATCH v3] repomanager: fix key unlock for existing repo

Manuel Traut manut at linutronix.de
Tue Apr 30 10:31:06 CEST 2019


the gnupg key should be unlocked by the repomanager constructor.
However "elbe prjrepo upload_pkg" fails with the following error:

--8<--
running cmd +reprepro --basedir
"/var/cache/elbe/e9c6c678-669b-4d6c-b822-d432e62a78ea/repo" export jessie+
------------------------------------------------------------------------------
gpgme gave error Pinentry:32870:  Inappropriate ioctl for device
ERROR: Could not finish exporting 'jessie'!
There have been errors!
------------------------------------------------------------------------------
Command failed with errorcode 251
--8<--

This is because the SignWith line in reprepos distribution configuration
was not parsed correctly.

While at it also improve the robustness of parsing the keyid.

Signed-off-by: Manuel Traut <manut at linutronix.de>
---

changes since v2:
  * use splitlines instead of split('\n')
  * improve robustness of keyid parsing

 elbepack/repomanager.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
index a1b4f500..1411baac 100644
--- a/elbepack/repomanager.py
+++ b/elbepack/repomanager.py
@@ -88,9 +88,9 @@ class RepoBase(object):
         # generate a new key and generate repository config
         if self.fs.isdir("/"):
             repo_conf = self.fs.read_file("conf/distributions")
-            for l in repo_conf:
+            for l in repo_conf.splitlines():
                 if l.startswith("SignWith"):
-                    self.keyid = l.split(" ")[1]
+                    self.keyid = l.split(":")[1].strip()
                     unlock_key(self.keyid)
         else:
             self.keyid = generate_elbe_internal_key()
-- 
2.20.1




More information about the elbe-devel mailing list