This reverts commit56cea9adc2, reversing changes made toe9b5ec215d. mock was changed meanwhile to automatically bind device mapper into the buildroot. Related: https://pagure.io/koji/issue/3567 https://pagure.io/koji/pull-request/3585 https://github.com/rpm-software-management/mock/pull/1005
63 lines
2.2 KiB
Python
63 lines
2.2 KiB
Python
import koji
|
|
import koji.tasks
|
|
import kojihub
|
|
|
|
from koji.context import context
|
|
from koji.plugin import export
|
|
|
|
koji.tasks.LEGACY_SIGNATURES['kiwiBuild'] = [
|
|
[['target', 'arches', 'desc_url', 'desc_path', 'opts'],
|
|
None, None, (None,)]]
|
|
koji.tasks.LEGACY_SIGNATURES['createKiwiImage'] = [
|
|
[['name', 'version', 'release', 'arch',
|
|
'target_info', 'build_tag', 'repo_info', 'desc_url', 'desc_path', 'opts'],
|
|
None, None, (None,)]]
|
|
|
|
|
|
@export
|
|
def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile=None,
|
|
scratch=False, priority=None, make_prep=False, repos=None, release=None,
|
|
type=None):
|
|
context.session.assertPerm('image')
|
|
for i in [desc_url, desc_path, profile, release]:
|
|
if i is not None:
|
|
kojihub.convert_value(i, cast=str, check_only=True)
|
|
if repos:
|
|
kojihub.convert_value(repos, cast=list, check_only=True)
|
|
kojihub.get_build_target(target, strict=True)
|
|
if isinstance(arches, list):
|
|
arches = " ".join(arches)
|
|
arches = koji.parse_arches(arches, to_list=True, strict=True, allow_none=False)
|
|
if isinstance(optional_arches, list):
|
|
optional_arches = " ".join(optional_arches)
|
|
optional_arches = koji.parse_arches(
|
|
optional_arches, to_list=True, strict=True, allow_none=True)
|
|
taskOpts = {
|
|
'channel': 'image',
|
|
}
|
|
if priority:
|
|
priority = kojihub.convert_value(priority, cast=int)
|
|
if priority < 0:
|
|
if not context.session.hasPerm('admin'):
|
|
raise koji.ActionNotAllowed(
|
|
'only admins may create high-priority tasks')
|
|
taskOpts['priority'] = koji.PRIO_DEFAULT + priority
|
|
|
|
opts = {}
|
|
if scratch:
|
|
opts['scratch'] = True
|
|
if profile:
|
|
opts['profile'] = profile
|
|
if release:
|
|
opts['release'] = release
|
|
if optional_arches:
|
|
opts['optional_arches'] = optional_arches
|
|
if repos:
|
|
opts['repos'] = repos
|
|
if make_prep:
|
|
opts['make_prep'] = True
|
|
if type:
|
|
opts['type'] = type
|
|
return kojihub.make_task('kiwiBuild',
|
|
[target, arches, desc_url, desc_path, opts],
|
|
**taskOpts)
|