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

Manuel Traut manut at linutronix.de
Tue Apr 30 11:46:04 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. read_file returns a string an the loop iterates
over each character. But the code expects to iterate over lines.

While at it also improve the robustness of parsing the keyid. To allow
multiple whitespace between SignWith: and the keyid.

Signed-off-by: Manuel Traut <manut at linutronix.de>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
---

I picked this one into the master branch.

changes since v3:
  * use splitlines() instead of split('\n')
  * simplify keyid extraction

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

diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
index a1b4f500..6a450906 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]
                     unlock_key(self.keyid)
         else:
             self.keyid = generate_elbe_internal_key()
-- 
2.20.1




More information about the elbe-devel mailing list