From b441ff01d38d0752b4b0c6415bae69944b677d8a Mon Sep 17 00:00:00 2001 From: Aleš Raszka Date: Sep 15 2015 13:00:32 +0000 Subject: Container-build: add --nowait option Resolves: bz#1257191 Signed-off-by: Aleš Raszka --- diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py index 1373265..b9f16be 100644 --- a/src/pyrpkg/__init__.py +++ b/src/pyrpkg/__init__.py @@ -2341,7 +2341,7 @@ class Commands(object): self._run_command(cmd, shell=True) def osbs_build(self, config_file, config_section, target_override=False, - yum_repourls=[]): + yum_repourls=[], nowait=False): os_conf = Configuration(conf_file=config_file, conf_section=config_section) build_conf = Configuration(conf_file=config_file, conf_section=config_section) osbs = OSBS(os_conf, build_conf) @@ -2368,6 +2368,11 @@ class Commands(object): yum_repourls=yum_repourls ) build_id = build.build_id + + if nowait: + self.log.info('Build submited: %s' % build_id) + return + print("Build submitted (%s), watching logs (feel free to interrupt)" % build_id) for line in osbs.get_build_logs(build_id, follow=True): print(line) @@ -2386,7 +2391,8 @@ class Commands(object): def container_build_koji(self, target_override=False, opts={}, kojiconfig=None, build_client=None, - koji_task_watcher=None): + koji_task_watcher=None, + nowait=False): docker_target = self.target if not target_override: @@ -2430,8 +2436,8 @@ class Commands(object): self.log.info('Created task: %s' % task_id) self.log.info('Task info: %s/taskinfo?taskID=%s' % (self.kojiweburl, task_id)) - - koji_task_watcher(self.kojisession, [task_id]) + if not nowait: + koji_task_watcher(self.kojisession, [task_id]) finally: (self.build_client, self.kojiconfig) = koji_session_backup self.load_kojisession() diff --git a/src/pyrpkg/cli.py b/src/pyrpkg/cli.py index daa6daf..b0325c1 100755 --- a/src/pyrpkg/cli.py +++ b/src/pyrpkg/cli.py @@ -832,6 +832,10 @@ defined, packages will be built sequentially.""" % {'name': self.name}) dest="build_with", choices=("koji", "osbs"), default="koji") + self.container_build_parser.add_argument('--nowait', + action='store_true', + default=False, + help="Don't wait on build") self.container_build_parser.set_defaults(command=self.container_build) @@ -1057,7 +1061,8 @@ defined, packages will be built sequentially.""" % {'name': self.name}) self.cmd.container_build_koji(target_override, opts=opts, kojiconfig=kojiconfig, build_client=build_client, - koji_task_watcher=self._watch_koji_tasks) + koji_task_watcher=self._watch_koji_tasks, + nowait=self.args.nowait) def container_build_osbs(self): target_override = False @@ -1070,7 +1075,8 @@ defined, packages will be built sequentially.""" % {'name': self.name}) config_file=self.args.osbs_config, config_section=self.args.instance, target_override=target_override, - yum_repourls=self.args.repo_url + yum_repourls=self.args.repo_url, + nowait=self.args.nowait ) def container_build_setup(self):