From 0a06ec131888473e5a681450f8764dbc7604a64a Mon Sep 17 00:00:00 2001 From: Jay Greguske Date: Fri, 4 Dec 2015 11:23:58 -0500 Subject: [PATCH] implement CLI for signed-repos --- cli/koji | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/cli/koji b/cli/koji index 5a234fd5..4eb49bc5 100755 --- a/cli/koji +++ b/cli/koji @@ -7074,6 +7074,45 @@ def handle_regen_repo(options, session, args): session.logout() return watch_tasks(session, [task_id], quiet=options.quiet) +def handle_signed_repo(options, session, args): + """create a yum repo of GPG signed RPMs""" + usage = _("usage: %prog signed-repo [options] tag keyID [keyID...]") + usage += _("\n(Specify the --help option for a list of other options)") + parser = OptionParser(usage=usage) + parser.add_option("--arch", action='append', default=[], + help=_("Indicate an architecture to consider. The default is all architectures associated with the given tag. This option may be specified multiple times.")) + parser.add_option('--multilib', action='store_true', default=False, + help=_('Include multilib packages in the repository')) + parser.add_option("--noinherit", action='store_true', default=False, + help=_('Do not consider tag inheritance')) + parser.add_option("--nowait", action='store_true', default=False, + help=_('Do not wait for the task to complete')) + task_opts, args = parser.parse_args(args) + if len(args) < 2: + parser.error(_('You must provide a tag and 1 or more GPG key IDs')) + activate_session(session) + tag = args[0] + keys = args[1:] + taginfo = session.getTag(tag) + if not taginfo: + parser.error(_('unknown tag %s' % tag)) + if len(task_opts.arch) == 0: + task_opts.arch = taginfo['arches'] + if task_opts.arch == None: + parser.error(_('No arches given and no arches associated with tag')) + else: + for a in task_opts.arch: + if a not in taginfo['arches']: + print _('Warning: %s is not in the list of tag arches' % a) + task_id = session.signedRepo(tag, keys, **task_opts) + print "Creating signed repo for tag " + tag + if _running_in_bg() or task_opts.nowait: + return + else: + session.logout() + return watch_tasks(session, [task_id], quiet=options.quiet) + + def anon_handle_search(options, session, args): "[search] Search the system" usage = _("usage: %prog search [options] search_type pattern")