Support extra repos passed into lorax

This commit is contained in:
Neil Hanlon 2023-05-16 14:03:56 -04:00
parent 48a4171ebd
commit 669686777c
Signed by: neil
GPG Key ID: 705BC21EC3C70F34
2 changed files with 20 additions and 0 deletions

View File

@ -42,6 +42,7 @@ name={{ repo.name }}
baseurl={{ repo.url }} baseurl={{ repo.url }}
enabled=1 enabled=1
gpgcheck=0 gpgcheck=0
priority={{ repo.priority | default(100) }}
{% endfor %} {% endfor %}

View File

@ -964,6 +964,7 @@ class Shared:
compose_latest_sync, compose_latest_sync,
compose_dir_is_here: bool = False, compose_dir_is_here: bool = False,
hashed: bool = False, hashed: bool = False,
extra_repos: list = None
): ):
""" """
Builds the repo dictionary Builds the repo dictionary
@ -997,8 +998,26 @@ class Shared:
repolist.append(repodata) repolist.append(repodata)
if extra_repos:
repolist.append(repo for repo in Shared.parse_extra_repos(extra_repos))
return repolist 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 @staticmethod
def composeinfo_write( def composeinfo_write(
compose_path, compose_path,