gather: handle mirrorlist in kickstart

Merges: https://pagure.io/pungi/pull-request/1406
Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
This commit is contained in:
Frédéric Pierret (fepitre) 2020-06-08 16:33:38 +02:00 committed by Lubomír Sedlář
parent 0196d7fd00
commit b973657197

View File

@ -125,23 +125,34 @@ def main(ns, persistdir, cachedir):
if ks_repo.name not in gather_opts.lookaside_repos: if ks_repo.name not in gather_opts.lookaside_repos:
continue continue
if not getattr(ks_repo, "metalink", False): if getattr(ks_repo, "metalink", False):
dnf_obj.add_repo(ks_repo.name, ks_repo.baseurl, enablegroups=False)
else:
dnf_obj.add_repo( dnf_obj.add_repo(
ks_repo.name, ks_repo.name,
ks_repo.baseurl, ks_repo.baseurl,
enablegroups=False, enablegroups=False,
metalink=ks_repo.metalink, metalink=ks_repo.metalink,
) )
elif getattr(ks_repo, "mirrorlist", False):
dnf_obj.add_repo(
ks_repo.name,
ks_repo.baseurl,
enablegroups=False,
mirrorlist=ks_repo.mirrorlist,
)
else:
dnf_obj.add_repo(ks_repo.name, ks_repo.baseurl, enablegroups=False)
for ks_repo in ksparser.handler.repo.repoList: for ks_repo in ksparser.handler.repo.repoList:
if ks_repo.name in gather_opts.lookaside_repos: if ks_repo.name in gather_opts.lookaside_repos:
continue continue
if not getattr(ks_repo, "metalink", False): if getattr(ks_repo, "metalink", False):
dnf_obj.add_repo(ks_repo.name, ks_repo.baseurl)
else:
dnf_obj.add_repo(ks_repo.name, ks_repo.baseurl, metalink=ks_repo.metalink) dnf_obj.add_repo(ks_repo.name, ks_repo.baseurl, metalink=ks_repo.metalink)
elif getattr(ks_repo, "mirrorlist", False):
dnf_obj.add_repo(
ks_repo.name, ks_repo.baseurl, mirrorlist=ks_repo.mirrorlist
)
else:
dnf_obj.add_repo(ks_repo.name, ks_repo.baseurl)
with Profiler("DnfWrapper.fill_sack()"): with Profiler("DnfWrapper.fill_sack()"):
dnf_obj.fill_sack(load_system_repo=False, load_available_repos=True) dnf_obj.fill_sack(load_system_repo=False, load_available_repos=True)