From 58afece033bea099f361d3f647a1ebb133c1dbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 17 Apr 2018 14:49:46 +0200 Subject: [PATCH] Only use comps repo if we really have comps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lubomír Sedlář --- pungi/phases/gather/methods/method_deps.py | 3 ++- pungi/phases/ostree.py | 8 ++++---- tests/helpers.py | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pungi/phases/gather/methods/method_deps.py b/pungi/phases/gather/methods/method_deps.py index b47f8891..7b1709b0 100644 --- a/pungi/phases/gather/methods/method_deps.py +++ b/pungi/phases/gather/methods/method_deps.py @@ -95,8 +95,9 @@ def write_pungi_config(compose, arch, variant, packages, groups, filter_packages repos = { "pungi-repo": compose.paths.work.arch_repo(arch=arch), - "comps-repo": compose.paths.work.comps_repo(arch=arch, variant=variant), } + if compose.has_comps: + repos["comps-repo"] = compose.paths.work.comps_repo(arch=arch, variant=variant) if variant.type == "optional": for var in variant.parent.get_variants( arch=arch, types=["self", "variant", "addon", "layered-product"]): diff --git a/pungi/phases/ostree.py b/pungi/phases/ostree.py index 1a93e112..2918fff8 100644 --- a/pungi/phases/ostree.py +++ b/pungi/phases/ostree.py @@ -60,10 +60,10 @@ class OSTreeThread(WorkerThread): repo_baseurl = compose.paths.work.arch_repo('$basearch', create_dir=False) comps_repo = compose.paths.work.comps_repo('$basearch', variant=variant, create_dir=False) - repos = get_repo_dicts(shortcuts.force_list(config['repo']) - + shortcuts.force_list(translate_path(compose, repo_baseurl)) - + shortcuts.force_list(translate_path(compose, comps_repo)), - logger=self.pool) + repos = shortcuts.force_list(config['repo']) + [translate_path(compose, repo_baseurl)] + if compose.has_comps: + repos.append(translate_path(compose, comps_repo)) + repos = get_repo_dicts(repos, logger=self.pool) # copy the original config and update before save to a json file new_config = copy.copy(config) diff --git a/tests/helpers.py b/tests/helpers.py index 34d34fdc..0a5f8c4e 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -121,6 +121,7 @@ class DummyCompose(object): checks.validate(self.conf) self.paths = paths.Paths(self) self._logger = mock.Mock() + self.has_comps = True self.variants = { 'Server': MockVariant(uid='Server', arches=['x86_64', 'amd64'], type='variant'),