Support API option "external_nodes" for starting build

This commit is contained in:
Konstantin Vlasov 2015-03-31 21:20:31 +03:00
parent 00f246b518
commit c7005fdbf2
3 changed files with 21 additions and 6 deletions

8
abf.py
View file

@ -234,6 +234,8 @@ def parse_command_line():
subparser.add_argument('--save-chroot', action='store_true', help=_('save build chroot in case of failure'))
subparser.add_argument('--update-type', action='store', choices=BuildList.update_types, help=_('Update type. Default is "%s".') %
(BuildList.update_types[0]) )
subparser.add_argument('--external-nodes', action='store', choices=BuildList.external_nodes_vals, help=_('Use any external ABF node or own external ABF node. Default is "%s".') %
(BuildList.external_nodes_vals[0]) )
subparser.add_argument('--skip-spec-check', action='store_true', help=_('Do not check spec file.'))
subparser.add_argument('--skip-proj-cfg-update', action='store_true', help=_('Do not update cache with information about project builds.'))
subparser.set_defaults(func=build)
@ -276,6 +278,8 @@ def parse_command_line():
subparser.add_argument('--save-chroot', action='store_true', help=_('save build chroot in case of failure'))
subparser.add_argument('--update-type', action='store', choices=BuildList.update_types, help=_('Update type. Default is "%s".') %
(BuildList.update_types[0]) )
subparser.add_argument('--external-nodes', action='store', choices=BuildList.external_nodes_vals, help=_('Use any external ABF node or own external ABF node. Default is "%s".') %
(BuildList.external_nodes_vals[0]) )
subparser.add_argument('--skip-proj-cfg-update', action='store_true', help=_('Do not update cache with information about project builds.'))
subparser.set_defaults(func=chain_build)
@ -1386,7 +1390,9 @@ def build(return_ids=False):
auto_create_container,
command_line.testing,
use_extra_tests,
extra_build_lists
extra_build_lists,
# TODO: Read external_nodes config value from user's profile
command_line.external_nodes or BuildList.external_nodes_vals[0]
)
ids = ','.join([str(i) for i in build_ids])
if 'projects_cfg' in globals():

View file

@ -558,6 +558,7 @@ class BuildList(Model):
self.arch.name, self.status_string)
update_types = ['security', 'bugfix', 'enhancement', 'recommended', 'newpackage']
external_nodes_vals = ['everything', 'owned']
auto_publish_statuses = ['default', 'none', 'testing']
@staticmethod
def new_build_task(models,
@ -574,7 +575,8 @@ class BuildList(Model):
auto_create_container,
include_testing_subrepo,
use_extra_tests,
extra_build_lists):
extra_build_lists,
external_nodes):
DATA = {
'project_id': project.id,
'commit_hash': commit_hash,
@ -584,14 +586,15 @@ class BuildList(Model):
'auto_publish_status': auto_publish_status,
'project_version': project_version,
'auto_create_container': auto_create_container,
'use_cached_chroot': cached_chroot,
'save_buildroot': save_chroot,
'use_cached_chroot': cached_chroot,
'save_buildroot': save_chroot,
'arch_id': None,
'include_repos': [],
'extra_repositories': [],
'extra_build_lists': extra_build_lists,
'include_testing_subrepository': include_testing_subrepo,
'use_extra_tests': use_extra_tests
'use_extra_tests': use_extra_tests,
'external_nodes': external_nodes
}
build_platforms = {}

View file

@ -69,8 +69,9 @@ __abf_rpmbuild()
__abf_build()
{
__abf_opts "--branch --build-list --tag --commit --target-platform --arch --repository --save-to-repository --auto-publish-status --auto-publish --update-type --skip-spec-check --auto-create-container --no-extra-tests --cached-chroot --save-chroot --testing"
__abf_opts "--branch --build-list --tag --commit --target-platform --arch --repository --save-to-repository --auto-publish-status --auto-publish --update-type --skip-spec-check --auto-create-container --no-extra-tests --cached-chroot --save-chroot --testing --external-nodes"
update_types="security bugfix enhancement recommended newpackage"
external_nodes_vals="owned everything"
auto_publish_status="none default testing"
if [ ${prev} == -r ] || [ ${prev} == --repository ] ; then
COMPREPLY=( $(compgen -W "`abf show build-repos`" -- "${cur}") )
@ -101,6 +102,11 @@ __abf_build()
return 0
fi
if [ ${prev} == --external-nodes ] ; then
COMPREPLY=( $(compgen -W "${external_nodes_vals}" -- "${cur}") )
return 0
fi
if [ ${prev} == --auto-publish-status ] ; then
COMPREPLY=( $(compgen -W "${auto_publish_status}" -- "${cur}") )
return 0