From 49598dab042e2f9f0d5697786f3c6bf687709277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 21 Apr 2016 02:15:54 +0200 Subject: [PATCH 1/3] Allow specify gpg key for a repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Organization: Invisible Things Lab Cc: Marek Marczykowski-Górecki Quite hacky way, but current command line syntax doesn't support additional per-repository settings. Signed-off-by: Marek Marczykowski-Górecki --- src/pylorax/cmdline.py | 4 ++-- src/sbin/lorax | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/pylorax/cmdline.py b/src/pylorax/cmdline.py index 69b6ccb..855d9f3 100644 --- a/src/pylorax/cmdline.py +++ b/src/pylorax/cmdline.py @@ -41,7 +41,7 @@ def lorax_parser(): required.add_argument("-p", "--product", help="product name", required=True, metavar="PRODUCT") required.add_argument("-v", "--version", help="version identifier", required=True, metavar="VERSION") required.add_argument("-r", "--release", help="release information", required=True, metavar="RELEASE") - required.add_argument("-s", "--source", help="source repository (may be listed multiple times)", + required.add_argument("-s", "--source", help="source repository (may be listed multiple times), append gpgkey URL in brackets to enable package verification", metavar="REPOSITORY", action="append", default=[]) required.add_argument("--repo", help="source dnf repository file", type=os.path.abspath, dest="repos", metavar="REPOSITORY", action="append", default=[]) @@ -49,7 +49,7 @@ def lorax_parser(): # optional arguments optional = parser.add_argument_group("optional arguments") optional.add_argument("-m", "--mirrorlist", - help="mirrorlist repository (may be listed multiple times)", + help="mirrorlist repository (may be listed multiple times), append gpgkey URL in brackets to enable package verification", metavar="REPOSITORY", action="append", default=[]) optional.add_argument("-t", "--variant", help="variant name", metavar="VARIANT") diff --git a/src/sbin/lorax b/src/sbin/lorax index df4994d..12061b4 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -212,6 +212,11 @@ def get_dnf_base_object(installroot, sources, mirrorlists=None, repos=None, continue repo_name = "lorax-repo-%d" % i repo = dnf.repo.Repo(repo_name, cachedir) + if '(' in r and ')' in r: + assert r[-1] == ')' + r, gpgkey = r[:-1].split('(') + repo.gpgkey = [gpgkey] + repo.gpgcheck = True repo.baseurl = [r] if proxy: repo.proxy = proxy @@ -232,6 +237,11 @@ def get_dnf_base_object(installroot, sources, mirrorlists=None, repos=None, continue repo_name = "lorax-mirrorlist-%d" % i repo = dnf.repo.Repo(repo_name, cachedir) + if '(' in r and ')' in r: + assert r[-1] == ')' + r, gpgkey = r[:-1].split('(') + repo.gpgkey = [gpgkey] + repo.gpgcheck = True repo.mirrorlist = r if proxy: repo.proxy = proxy -- 2.7.4