Only use comps repo if we really have comps

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-04-17 14:49:46 +02:00
parent 267ff86f04
commit 58afece033
3 changed files with 7 additions and 5 deletions

View File

@ -95,8 +95,9 @@ def write_pungi_config(compose, arch, variant, packages, groups, filter_packages
repos = { repos = {
"pungi-repo": compose.paths.work.arch_repo(arch=arch), "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": if variant.type == "optional":
for var in variant.parent.get_variants( for var in variant.parent.get_variants(
arch=arch, types=["self", "variant", "addon", "layered-product"]): arch=arch, types=["self", "variant", "addon", "layered-product"]):

View File

@ -60,10 +60,10 @@ class OSTreeThread(WorkerThread):
repo_baseurl = compose.paths.work.arch_repo('$basearch', create_dir=False) repo_baseurl = compose.paths.work.arch_repo('$basearch', create_dir=False)
comps_repo = compose.paths.work.comps_repo('$basearch', variant=variant, 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']) repos = shortcuts.force_list(config['repo']) + [translate_path(compose, repo_baseurl)]
+ shortcuts.force_list(translate_path(compose, repo_baseurl)) if compose.has_comps:
+ shortcuts.force_list(translate_path(compose, comps_repo)), repos.append(translate_path(compose, comps_repo))
logger=self.pool) repos = get_repo_dicts(repos, logger=self.pool)
# copy the original config and update before save to a json file # copy the original config and update before save to a json file
new_config = copy.copy(config) new_config = copy.copy(config)

View File

@ -121,6 +121,7 @@ class DummyCompose(object):
checks.validate(self.conf) checks.validate(self.conf)
self.paths = paths.Paths(self) self.paths = paths.Paths(self)
self._logger = mock.Mock() self._logger = mock.Mock()
self.has_comps = True
self.variants = { self.variants = {
'Server': MockVariant(uid='Server', arches=['x86_64', 'amd64'], 'Server': MockVariant(uid='Server', arches=['x86_64', 'amd64'],
type='variant'), type='variant'),