From 20f226dfb1b9e0aca7a347bd139d8be987cef2db Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Jun 09 2015 07:54:20 +0000 Subject: Allow koji directive to download debug info Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D381 --- diff --git a/libtaskotron/directives/koji_directive.py b/libtaskotron/directives/koji_directive.py index aaf8ed2..1f631e3 100644 --- a/libtaskotron/directives/koji_directive.py +++ b/libtaskotron/directives/koji_directive.py @@ -46,6 +46,11 @@ parameters: description: download also ``src`` RPM files type: bool default: False + debuginfo: + required: false + description: download also ``debuginfo`` RPM files + type: bool + default: False target_dir: required: false description: directory into which to download builds @@ -124,6 +129,8 @@ class KojiDirective(BaseDirective): if self.arches and ('noarch' not in self.arches): self.arches.append('noarch') + self.debuginfo = input_data.get('debuginfo', False) + self.src = input_data.get('src', False) # download files @@ -139,7 +146,7 @@ class KojiDirective(BaseDirective): nvr = rpm_utils.rpmformat(input_data['koji_build'], 'nvr') output_data['downloaded_rpms'] = self.koji.get_nvr_rpms(nvr, - self.target_dir, arches=self.arches, src=self.src) + self.target_dir, arches=self.arches, debuginfo=self.debuginfo, src=self.src) elif action == 'download_tag': if 'koji_tag' not in input_data: @@ -151,6 +158,6 @@ class KojiDirective(BaseDirective): koji_tag = input_data['koji_tag'] output_data['downloaded_rpms'] = self.koji.get_tagged_rpms(koji_tag, - self.target_dir, arches=self.arches, src=self.src) + self.target_dir, arches=self.arches, debuginfo=self.debuginfo, src=self.src) return output_data diff --git a/testing/test_koji_directive.py b/testing/test_koji_directive.py index a847be1..981a01e 100644 --- a/testing/test_koji_directive.py +++ b/testing/test_koji_directive.py @@ -136,7 +136,7 @@ class TestKojiDirective(): assert 'x86_64' in requested_arches assert 'noarch' in requested_arches - def test__download_command_src(self): + def test_download_command_src(self): ref_input = {'action': 'download', 'arch': [], 'src': True, 'koji_build': self.ref_nvr} ref_envdata = {'workdir': '/var/tmp/foo'} @@ -152,3 +152,20 @@ class TestKojiDirective(): assert len(getrpm_calls) == 1 assert [] == requested_arches assert requested_src + + def test_download_command_debuginfo(self): + ref_input = {'action': 'download', 'arch': [], 'debuginfo': True, + 'koji_build': self.ref_nvr} + ref_envdata = {'workdir': '/var/tmp/foo'} + + stub_koji = Dingus() + test_helper = koji_directive.KojiDirective(stub_koji) + test_helper.process(ref_input, ref_envdata) + + getrpm_calls = stub_koji.calls() + requested_arches = getrpm_calls[0][2]['arches'] + requested_debuginfo = getrpm_calls[0][2]['debuginfo'] + + assert len(getrpm_calls) == 1 + assert [] == requested_arches + assert requested_debuginfo