From a8efa0fc79c9ad5a78fb6cc20c3b309d8393d05e Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 14 Apr 2012 12:57:04 +0200 Subject: [PATCH] Use the host key properly in build mode. --- python/pakfire/builder.py | 9 +++++++-- python/pakfire/keyring.py | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/python/pakfire/builder.py b/python/pakfire/builder.py index edc4dee68..5a0ea0a29 100644 --- a/python/pakfire/builder.py +++ b/python/pakfire/builder.py @@ -203,10 +203,15 @@ class BuildEnviron(object): "enable_loop_devices" : True, "enable_ccache" : True, "enable_icecream" : False, - "sign_packages" : True, + "sign_packages" : False, } #self.settings.update(settings) + # Try to get the configured host key. If it is available, + # we will automatically sign all packages with it. + if self.keyring.get_host_key(secret=True): + self.settings["sign_packages"] = True + # Lock the buildroot self._lock = None self.lock() @@ -739,7 +744,7 @@ class BuildEnviron(object): # Sign all built packages with the host key (if available). if self.settings.get("sign_packages"): - host_key = self.keyring.get_host_key() + host_key = self.keyring.get_host_key_id() assert host_key # Do the signing... diff --git a/python/pakfire/keyring.py b/python/pakfire/keyring.py index f7242e77d..8fe052e9b 100644 --- a/python/pakfire/keyring.py +++ b/python/pakfire/keyring.py @@ -212,6 +212,8 @@ class Keyring(object): def sign(self, keyid, cleartext): key = self.ctx.get_key(keyid, True) + assert key, "Key was not found or no secret key installed." + self.ctx.signers = [key,] cleartext = io.BytesIO(cleartext) -- 2.39.5