Only pass one project_name to copr build command

This commit is contained in:
Dominic Cleal 2016-05-11 17:53:24 +01:00
parent 7e930274a9
commit de9ef27b3f
No known key found for this signature in database
GPG key ID: 7C7D326F2C2B72CC
2 changed files with 17 additions and 3 deletions

View file

@ -79,7 +79,7 @@ class CoprReleaser(KojiReleaser):
if self.remote_location:
path = self.remote_location + os.path.basename(srpm_location)
self._upload(srpm_location)
self._submit(path)
self._submit(path, tag)
def _upload(self, srpm_location):
if self.srpm_submitted:
@ -99,9 +99,9 @@ class CoprReleaser(KojiReleaser):
print(run_command(cmd_upload))
self.srpm_submitted = srpm_location
def _submit(self, srpm_location):
def _submit(self, srpm_location, project):
cmd_submit = "/usr/bin/%s build %s %s %s" % \
(self.cli_tool, self.copr_options, self.releaser_config.get(self.target, "project_name"), srpm_location)
(self.cli_tool, self.copr_options, project, srpm_location)
if self.dry_run:
self.print_dry_run_warning(cmd_submit)
return

View file

@ -84,3 +84,17 @@ class CoprReleaserTests(TitoGitTestFixture):
self.assertFalse(upload.called)
self.assertTrue(submit.called)
@mock.patch("tito.release.CoprReleaser._run_command")
def test_multiple_project_names(self, run_command):
self.releaser_config.remove_option("test", "remote_location")
self.releaser_config.set('test', 'project_name', "%s %s" % (PKG_NAME,
PKG_NAME))
releaser = CoprReleaser(PKG_NAME, None, '/tmp/tito/',
self.config, {}, 'test', self.releaser_config, False,
False, False, **{'offline': True})
releaser.release()
args = mock.call('/usr/bin/copr-cli build --nowait releaseme %s' %
releaser.builder.srpm_location)
self.assertEquals(args, run_command.mock_calls[0])
self.assertEquals(args, run_command.mock_calls[1])