From f62ea2f82ec2598b1c392c2e57751a861f7dd777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kadl=C4=8D=C3=ADk?= Date: Fri, 11 Nov 2016 13:06:37 +0100 Subject: [PATCH] This repo_from_tag belongs to copr builder --- module_build_service/builder.py | 43 +++++++++++++++++---------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/module_build_service/builder.py b/module_build_service/builder.py index 56e8b58d..6e7e9f75 100644 --- a/module_build_service/builder.py +++ b/module_build_service/builder.py @@ -934,6 +934,28 @@ class CoprModuleBuilder(GenericBuilder): # @FIXME return KojiModuleBuilder.get_disttag_srpm(disttag) + @classmethod + def repo_from_tag(cls, config, tag_name, arch): + """ + :param backend: a string representing the backend e.g. 'koji'. + :param config: instance of rida.config.Config + :param tag_name: Tag for which the repository is returned + :param arch: Architecture for which the repository is returned + + Returns URL of repository containing the built artifacts for + the tag with particular name and architecture. + """ + # @TODO get the correct user + # Premise is that tag_name is in name-version-release format + owner, nvr = "@copr", tag_name + client = cls._get_client(config) + response = client.get_module_repo(owner, nvr).data + + if response["output"] == "notok": + raise ValueError(response["error"]) + return response["repo"] + + class MockModuleBuilder(GenericBuilder): """ See http://blog.samalik.com/copr-in-the-modularity-world/ @@ -1115,24 +1137,3 @@ class MockModuleBuilder(GenericBuilder): def get_disttag_srpm(disttag): # @FIXME return KojiModuleBuilder.get_disttag_srpm(disttag) - - @classmethod - def repo_from_tag(cls, config, tag_name, arch): - """ - :param backend: a string representing the backend e.g. 'koji'. - :param config: instance of rida.config.Config - :param tag_name: Tag for which the repository is returned - :param arch: Architecture for which the repository is returned - - Returns URL of repository containing the built artifacts for - the tag with particular name and architecture. - """ - # @TODO get the correct user - # Premise is that tag_name is in name-version-release format - owner, nvr = "@copr", tag_name - client = cls._get_client(config) - response = client.get_module_repo(owner, nvr).data - - if response["output"] == "notok": - raise ValueError(response["error"]) - return response["repo"]