Dist-repo with write-signed-rpm option
Fixes: https://pagure.io/koji/issue/2806
This commit is contained in:
parent
5abb84c01d
commit
d3ef00fff4
4 changed files with 36 additions and 0 deletions
|
|
@ -6150,6 +6150,33 @@ enabled=1
|
|||
selected[rpm_id] = rpminfo
|
||||
else:
|
||||
selected[rpm_id] = rpm_idx[rpm_id][best_key]
|
||||
selected[rpm_id]['best_key'] = best_key
|
||||
|
||||
# write signed rpms
|
||||
if opts.get('write_signed_rpms'):
|
||||
results = []
|
||||
rpm_with_key = []
|
||||
with session.multicall(batch=1000) as m:
|
||||
for rpm_id in selected:
|
||||
if selected[rpm_id].get('best_key'):
|
||||
results.append(m.host.writeSignedRPM(rpm_id, selected[rpm_id]['best_key']))
|
||||
rpm_with_key.append(rpm_id)
|
||||
|
||||
log_output = ''
|
||||
for rpm_id, r in zip(rpm_with_key, results):
|
||||
if isinstance(r._result, list):
|
||||
log_output += 'Signed RPM %s is writen with %s key.\n' \
|
||||
% (rpm_id, selected[rpm_id]['best_key'])
|
||||
else:
|
||||
log_output += 'FAILED: Signed RPM %s is not written with %s key, ' \
|
||||
'error: %s\n' % (rpm_id, selected[rpm_id]['best_key'],
|
||||
r._result['faultString'])
|
||||
|
||||
if log_output:
|
||||
writen_log = os.path.join(self.workdir, 'writen_signed_rpms.log')
|
||||
with koji._open_text_file(writen_log, 'at') as outfile:
|
||||
outfile.write(log_output)
|
||||
self.session.uploadWrapper(writen_log, self.uploadpath)
|
||||
|
||||
# generate kojipkgs data and note missing files
|
||||
fs_missing = []
|
||||
|
|
|
|||
|
|
@ -7603,6 +7603,8 @@ def handle_dist_repo(options, session, args):
|
|||
parser.add_option('--zck-dict-dir', action='store', default=None,
|
||||
help=_('Directory containing compression dictionaries for use by zchunk '
|
||||
'(on builder)'))
|
||||
parser.add_option("--write-signed-rpms", action='store_true', default=False,
|
||||
help=_('Write a signed rpms for given tag'))
|
||||
task_opts, args = parser.parse_args(args)
|
||||
if len(args) < 1:
|
||||
parser.error(_('You must provide a tag to generate the repo from'))
|
||||
|
|
@ -7678,6 +7680,7 @@ def handle_dist_repo(options, session, args):
|
|||
task_opts.arch.append('src')
|
||||
if not task_opts.arch:
|
||||
parser.error(_('No arches left.'))
|
||||
|
||||
opts = {
|
||||
'arch': task_opts.arch,
|
||||
'comps': task_opts.comps,
|
||||
|
|
@ -7692,6 +7695,7 @@ def handle_dist_repo(options, session, args):
|
|||
'allow_missing_signatures': task_opts.allow_missing_signatures,
|
||||
'zck': task_opts.zck,
|
||||
'zck_dict_dir': task_opts.zck_dict_dir,
|
||||
'write_signed_rpms': task_opts.write_signed_rpms,
|
||||
}
|
||||
task_id = session.distRepo(tag, keys, **opts)
|
||||
print("Creating dist repo for tag " + tag)
|
||||
|
|
|
|||
|
|
@ -15123,6 +15123,10 @@ class HostExports(object):
|
|||
host.verify()
|
||||
return host.isEnabled()
|
||||
|
||||
def writeSignedRPM(self, an_rpm, sigkey, force=False):
|
||||
"""Write a signed copy of the rpm"""
|
||||
return write_signed_rpm(an_rpm, sigkey, force)
|
||||
|
||||
|
||||
def get_upload_path(reldir, name, create=False, volume=None):
|
||||
orig_reldir = reldir
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ Options:
|
|||
--zck-dict-dir=ZCK_DICT_DIR
|
||||
Directory containing compression dictionaries for use
|
||||
by zchunk (on builder)
|
||||
--write-signed-rpms Write a signed rpms for given tag
|
||||
""" % self.progname)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue