From e0e1dc15ee3f54ed128374d49f7cda9d6065733b Mon Sep 17 00:00:00 2001 From: Jay Greguske Date: Sun, 10 Jan 2016 11:22:06 -0500 Subject: [PATCH] implement comps --- cli/koji | 10 +++++++++- hub/kojihub.py | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cli/koji b/cli/koji index 375a7e5a..5a34e021 100755 --- a/cli/koji +++ b/cli/koji @@ -7085,6 +7085,7 @@ def handle_signed_repo(options, session, args): 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('--comps', help='Include a comps file in the repodata') parser.add_option('--delta-rpms', metavar='PATH',default=[], action='append', help=_('Create delta-rpms. PATH points to (older) rpms to generate against. May be specified multiple times.')) @@ -7094,7 +7095,6 @@ def handle_signed_repo(options, session, args): help=_('Include multilib packages in the repository')) parser.add_option("--noinherit", action='store_true', default=False, help=_('Do not consider tag inheritance')) - # TODO: accept comps # TODO: latest? parser.add_option("--nowait", action='store_true', default=False, help=_('Do not wait for the task to complete')) @@ -7106,6 +7106,13 @@ def handle_signed_repo(options, session, args): if task_opts.allow_unsigned and task_opts.skip_unsigned: parser.error(_('allow_signed and skip_unsigned are mutually exclusive')) activate_session(session) + if task_opts.comps: + if not os.path.exists(task_opts.comps): + parser.error(_('could not find %s' % task_opts.comps)) + compsdir = _unique_path('cli-signed') + session.uploadWrapper(task_opts.comps, compsdir, + callback=_progress_callback) + task_opts.comps = os.path.join(compsdir, os.path.basename(task_opts.comps)) tag = args[0] keys = args[1:] taginfo = session.getTag(tag) @@ -7126,6 +7133,7 @@ def handle_signed_repo(options, session, args): pass opts = { 'arch': task_opts.arch, + 'comps': task_opts.comps, 'event': task_opts.event, 'delta': task_opts.delta_rpms, 'multilib': task_opts.multilib, diff --git a/hub/kojihub.py b/hub/kojihub.py index d3ae5cb3..30879f32 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -2537,6 +2537,13 @@ def signed_repo_init(tag, keys, task_opts): missing.sort() raise koji.GenericError('Unsigned packages found: ' + '\n'.join(missing)) + + # handle comps + if task_opts['comps']: + groupsdir = os.path.join(repodir, 'groups') + koji.ensuredir(groupsdir) + shutil.copyfile(os.path.join(koji.pathinfo.work(), task_opts['comps']), + groupsdir + '/comps.xml') koji.plugin.run_callbacks('postRepoInit', tag=tinfo, event=task_opts['event'], repo_id=repo_id) return repo_id, task_opts['event']