diff --git a/abf.py b/abf.py index d80a12e..18e5c8d 100755 --- a/abf.py +++ b/abf.py @@ -1054,8 +1054,19 @@ def build(): log.debug("Build repositories: " + str(build_repositories)) #exit() - build_ids = BuildList.new_build_task(models, proj, save_to_repository, build_repositories, commit_hash, - command_line.update_type or BuildList.update_types[0], command_line.auto_publish, arches, command_line.skip_personal, not command_line.auto_publish) + build_ids = BuildList.new_build_task( + models, + proj, + save_to_repository, + build_repositories, + commit_hash, + as_branch, + command_line.update_type or BuildList.update_types[0], + command_line.auto_publish_status or BuildList.auto_publish_statuses[0], + arches, + command_line.skip_personal, + command_line.auto_create_container or True + ) ids = ','.join([str(i) for i in build_ids]) projects_cfg['main']['last_build_ids'] = ids projects_cfg[str(proj)]['last_build_ids'] = ids diff --git a/abf/model.py b/abf/model.py index 7ce7e69..87b0ba5 100644 --- a/abf/model.py +++ b/abf/model.py @@ -391,9 +391,12 @@ class BuildList(Model): 9000: 'publishing rejected', 10000: 'build is canceling', 11000: 'tests failed', + 12000: '[testing] Build has been published', + 13000: '[testing] Build is being published', + 14000: '[testing] Publishing error' } status_by_name = dict([(status_by_id[x], x) for x in status_by_id]) - final_statuses = [1, 2, 3, 4, 666, 5000, 6000, 8000, 9000] + final_statuses = [1, 2, 3, 4, 666, 5000, 6000, 8000, 9000, 12000, 14000] def get_init_data(self, ID): ID = str(ID) @@ -450,20 +453,22 @@ class BuildList(Model): self.arch.name, self.status_string) update_types = ['security', 'bugfix', 'enhancement', 'recommended', 'newpackage'] + auto_publish_statuses = ['default', 'none', 'testing'] @staticmethod - def new_build_task(models, project, save_to_repository, repositories, commit_hash, update_type, auto_publish, arches, skip_personal, auto_create_container): + def new_build_task(models, project, save_to_repository, repositories, commit_hash, project_version, update_type, auto_publish_status, arches, skip_personal, auto_create_container): DATA = { - 'project_id': project.id, - 'commit_hash': commit_hash, - 'update_type': update_type, - 'save_to_repository_id': save_to_repository.id, - 'build_for_platform_id': None, - 'auto_publish': auto_publish, - 'auto_create_container': auto_create_container, - 'arch_id': None, - 'include_repos': [], - 'extra_repositories': [], - } + 'project_id': project.id, + 'commit_hash': commit_hash, + 'update_type': update_type, + 'save_to_repository_id': save_to_repository.id, + 'build_for_platform_id': None, + 'auto_publish_status': auto_publish_status, + 'project_version': project_version, + 'auto_create_container': auto_create_container, + 'arch_id': None, + 'include_repos': [], + 'extra_repositories': [] + } build_platforms = {} if not skip_personal and string.find(save_to_repository.platform.name,"_personal") > 0: diff --git a/bash_autocomplete b/bash_autocomplete index 425992d..7a6ed1d 100644 --- a/bash_autocomplete +++ b/bash_autocomplete @@ -64,8 +64,9 @@ __abf_rpmbuild() __abf_build() { - __abf_opts "--branch --tag --commit --target-platform --arch --repository --save-to-repository --auto-publish --update-type --skip-spec-check" + __abf_opts "--branch --tag --commit --target-platform --arch --repository --save-to-repository --auto-publish-status --update-type --skip-spec-check --auto-create-container" update_types="security bugfix enhancement recommended newpackage" + auto_publish_status="none default testing" if [ ${prev} == -r ] || [ ${prev} == --repository ] ; then COMPREPLY=( $(compgen -W "`abf show build-repos`" -- "${cur}") ) return 0 @@ -98,6 +99,12 @@ __abf_build() return 0 fi + if [ ${prev} == --auto-publish-status ] ; then + + COMPREPLY=( $(compgen -W "${auto_publish_status}" -- "${cur}") ) + return 0 + fi + } __abf_publish()