From 669686777ced714f122d6a49b4840c7d88fa3fe1 Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Tue, 16 May 2023 14:03:56 -0400 Subject: [PATCH] Support extra repos passed into lorax --- .../empanadas/templates/isomock.tmpl.cfg | 1 + iso/empanadas/empanadas/util/shared.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/iso/empanadas/empanadas/templates/isomock.tmpl.cfg b/iso/empanadas/empanadas/templates/isomock.tmpl.cfg index 53cd821..907e658 100644 --- a/iso/empanadas/empanadas/templates/isomock.tmpl.cfg +++ b/iso/empanadas/empanadas/templates/isomock.tmpl.cfg @@ -42,6 +42,7 @@ name={{ repo.name }} baseurl={{ repo.url }} enabled=1 gpgcheck=0 +priority={{ repo.priority | default(100) }} {% endfor %} diff --git a/iso/empanadas/empanadas/util/shared.py b/iso/empanadas/empanadas/util/shared.py index c955d95..c803ff6 100644 --- a/iso/empanadas/empanadas/util/shared.py +++ b/iso/empanadas/empanadas/util/shared.py @@ -964,6 +964,7 @@ class Shared: compose_latest_sync, compose_dir_is_here: bool = False, hashed: bool = False, + extra_repos: list = None ): """ Builds the repo dictionary @@ -997,8 +998,26 @@ class Shared: repolist.append(repodata) + if extra_repos: + repolist.append(repo for repo in Shared.parse_extra_repos(extra_repos)) + return repolist + @staticmethod + def parse_extra_repos(extra_repos: list) -> list: + # must be in format URL[,PRIORITY] + result = [] + for idx, candidate in enumerate(extra_repos): + url, priority = candidate.split(',') + if not priority: + priority = 100 + result.append({ + 'name': f"extra_repo_{idx}", + 'url': url, + 'priority': priority + }) + return result + @staticmethod def composeinfo_write( compose_path,