[util] Use koji profile for getting RPMs from buildroot
Instead of having a separate config option, just use the koji profile. According to release notes, this should have already been done. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
75d71ebbe1
commit
9eb85c481c
@ -30,6 +30,8 @@ import traceback
|
||||
from kobo.shortcuts import run, force_list
|
||||
from productmd.common import get_major_version
|
||||
|
||||
from .wrappers import kojiwrapper
|
||||
|
||||
|
||||
def _doRunCommand(command, logger, rundir='/tmp', output=subprocess.PIPE, error=subprocess.PIPE, env=None):
|
||||
"""Run a command and log the output. Error out if we get something on stderr"""
|
||||
@ -306,12 +308,10 @@ def get_buildroot_rpms(compose, task_id):
|
||||
result = []
|
||||
if task_id:
|
||||
# runroot
|
||||
import koji
|
||||
koji_url = compose.conf["pkgset_koji_url"]
|
||||
koji_proxy = koji.ClientSession(koji_url)
|
||||
buildroot_infos = koji_proxy.listBuildroots(taskID=task_id)
|
||||
koji = kojiwrapper.KojiWrapper(compose.conf['koji_profile'])
|
||||
buildroot_infos = koji.koji_proxy.listBuildroots(taskID=task_id)
|
||||
buildroot_info = buildroot_infos[-1]
|
||||
data = koji_proxy.listRPMs(componentBuildrootID=buildroot_info["id"])
|
||||
data = koji.koji_proxy.listRPMs(componentBuildrootID=buildroot_info["id"])
|
||||
for rpm_info in data:
|
||||
fmt = "%(nvr)s.%(arch)s"
|
||||
result.append(fmt % rpm_info)
|
||||
|
@ -320,22 +320,22 @@ RPM_LIST = [
|
||||
|
||||
class TestGetBuildrootRPMs(unittest.TestCase):
|
||||
|
||||
@mock.patch('koji.ClientSession')
|
||||
def test_get_from_koji(self, ClientSession):
|
||||
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
|
||||
def test_get_from_koji(self, KojiWrapper):
|
||||
compose = mock.Mock(conf={
|
||||
'pkgset_koji_url': 'http://example.com/koji'
|
||||
'koji_profile': 'koji',
|
||||
})
|
||||
|
||||
ClientSession.return_value.listBuildroots.return_value = BUILDROOT_LIST
|
||||
ClientSession.return_value.listRPMs.return_value = RPM_LIST
|
||||
KojiWrapper.return_value.koji_proxy.listBuildroots.return_value = BUILDROOT_LIST
|
||||
KojiWrapper.return_value.koji_proxy.listRPMs.return_value = RPM_LIST
|
||||
|
||||
rpms = util.get_buildroot_rpms(compose, 1234)
|
||||
|
||||
self.assertEqual(ClientSession.call_args_list,
|
||||
[mock.call('http://example.com/koji')])
|
||||
self.assertEqual(ClientSession.return_value.mock_calls,
|
||||
[mock.call.listBuildroots(taskID=1234),
|
||||
mock.call.listRPMs(componentBuildrootID=5458481)])
|
||||
self.assertEqual(KojiWrapper.call_args_list,
|
||||
[mock.call('koji')])
|
||||
self.assertEqual(KojiWrapper.return_value.mock_calls,
|
||||
[mock.call.koji_proxy.listBuildroots(taskID=1234),
|
||||
mock.call.koji_proxy.listRPMs(componentBuildrootID=5458481)])
|
||||
|
||||
self.assertItemsEqual(rpms, [
|
||||
'python3-kickstart-2.25-2.fc24.noarch',
|
||||
|
Loading…
Reference in New Issue
Block a user