From 3599db0a7bb047ac482eef45b0885ff8d8318d8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
 <marmarek@invisiblethingslab.com>
Date: Wed, 20 Apr 2016 03:06:02 +0200
Subject: [PATCH] Hacky way to pass gpgkey to lorax
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Invisible Things Lab
Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

Since lorax is running in separate process, it no longer use repo
objects initialized by pungi. Because of this, gpgkey+gpgcheck must be
passed down some other way. Appending it to the repository URL is awful,
but is effective:
 - if lorax version used doesn't support verification, it will fail
 (good)
 - it binds key to the repository

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 pungi/gather.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pungi/gather.py b/pungi/gather.py
index 66212d2..6be45e6 100644
--- a/pungi/gather.py
+++ b/pungi/gather.py
@@ -1413,15 +1413,16 @@ class Pungi(PungiBase):
             pass
 
         for repo in self.ksparser.handler.repo.repoList:
+            url_suffix = '({})'.format(repo.gpgkey) if repo.gpgkey else ''
             if repo.mirrorlist:
                 # The not bool() thing is because pykickstart is yes/no on
                 # whether to ignore groups, but yum is a yes/no on whether to
                 # include groups.  Awkward.
                 repo.mirrorlist = yum.parser.varReplace(repo.mirrorlist, self.ayum.conf.yumvar)
-                cmd.extend(["--mirrorlist", repo.mirrorlist])
+                cmd.extend(["--mirrorlist", repo.mirrorlist + url_suffix])
             else:
                 repo.baseurl = yum.parser.varReplace(repo.baseurl, self.ayum.conf.yumvar)
-                cmd.extend(["--source", repo.baseurl])
+                cmd.extend(["--source", repo.baseurl + url_suffix])
 
         # Add the repo in the destdir to our yum object
         cmd.extend(["--source", "file://%s" % self.topdir])
-- 
2.1.0

