gather: handle metalink in kickstart repos

Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
This commit is contained in:
Frédéric Pierret (fepitre) 2019-12-15 11:48:53 +01:00
parent 0ed70fc8b6
commit 9b101d554f
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2
2 changed files with 18 additions and 5 deletions

View File

@ -52,7 +52,8 @@ class DnfWrapper(dnf.Base):
self.arch_wrapper = ArchWrapper(self.conf.substitutions["arch"]) self.arch_wrapper = ArchWrapper(self.conf.substitutions["arch"])
self.comps_wrapper = CompsWrapper(self) self.comps_wrapper = CompsWrapper(self)
def add_repo(self, repoid, baseurl=None, enablegroups=True, lookaside=False): def add_repo(self, repoid, baseurl=None, enablegroups=True, lookaside=False,
**kwargs):
self.repos.add_new_repo( self.repos.add_new_repo(
repoid, repoid,
self.conf, self.conf,
@ -60,6 +61,7 @@ class DnfWrapper(dnf.Base):
enabledgroups=enablegroups, enabledgroups=enablegroups,
priority=10 if lookaside else 20, priority=10 if lookaside else 20,
module_hotfixes=True, module_hotfixes=True,
**kwargs
) )

View File

@ -114,14 +114,25 @@ def main(ns, persistdir, cachedir):
# handling in hawkey # handling in hawkey
if ks_repo.name not in gather_opts.lookaside_repos: if ks_repo.name not in gather_opts.lookaside_repos:
continue continue
dnf_obj.add_repo(
ks_repo.name, ks_repo.baseurl, enablegroups=False if not ks_repo.metalink:
) dnf_obj.add_repo(
ks_repo.name, ks_repo.baseurl, enablegroups=False
)
else:
dnf_obj.add_repo(
ks_repo.name, ks_repo.baseurl, enablegroups=False,
metalink=ks_repo.metalink
)
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
dnf_obj.add_repo(ks_repo.name, ks_repo.baseurl) if not ks_repo.metalink:
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)
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)