From 004ef319175233d8c0c20143ab06516de229096f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Fri, 8 Jun 2018 12:52:50 +0200 Subject: [PATCH] gather: Ignore comps in lookaside repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a case where extra packages are pulled in. The scenario is: * there's a lookaside repo which contains group G which has package P * we want to pull group G into the compose, but our definition of G does not contain P * lookaside repo does not contain package P * current package set has P DNF depsolver will then merge the two definitions and try to get all the packages. For most cases this is not a problem, since the package is in the lookaside repo and will not be pulled into the compose. But in the example above since P is not in lookaside, Pungi will put it into current compose. This is also ugly in the depsolving log says it includes package P because it was in input. But checking comps file does not show it. The result of this change is that some packages might disappear from current composes. This can only happen if there is a lookaside which defines groups with similar IDs, which should be very rare. In cases where this would be a problem the fix is to explicitly add wanted packages either to comps or to additional packages. Fixes: https://pagure.io/pungi/issue/978 Signed-off-by: Lubomír Sedlář --- bin/pungi-gather | 7 +++++-- pungi/dnf_wrapper.py | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/pungi-gather b/bin/pungi-gather index 2546799c..392f1389 100755 --- a/bin/pungi-gather +++ b/bin/pungi-gather @@ -107,10 +107,13 @@ def main(persistdir, cachedir): # read repos from ks for ks_repo in ksparser.handler.repo.repoList: - # HACK: lookaside repos first; this is workaround for no repo priority handling in hawkey + # HACK: lookaside repos first; this is workaround for no repo priority + # handling in hawkey if ks_repo.name not in gather_opts.lookaside_repos: continue - dnf_obj.add_repo(ks_repo.name, ks_repo.baseurl, ks_repo.mirrorlist) + dnf_obj.add_repo( + ks_repo.name, ks_repo.baseurl, ks_repo.mirrorlist, enablegroups=False + ) for ks_repo in ksparser.handler.repo.repoList: if ks_repo.name in gather_opts.lookaside_repos: diff --git a/pungi/dnf_wrapper.py b/pungi/dnf_wrapper.py index 20722769..48843535 100644 --- a/pungi/dnf_wrapper.py +++ b/pungi/dnf_wrapper.py @@ -55,7 +55,9 @@ class DnfWrapper(dnf.Base): self.arch_wrapper = ArchWrapper(self.conf.substitutions["arch"]) self.comps_wrapper = CompsWrapper(self) - def add_repo(self, repoid, baseurl=None, mirrorlist=None, ignoregroups=False, lookaside=False): + def add_repo( + self, repoid, baseurl=None, mirrorlist=None, enablegroups=True, lookaside=False + ): if "://" not in baseurl: baseurl = "file://%s" % os.path.abspath(baseurl) if LooseVersion(dnf.__version__) < LooseVersion("2.0.0"): @@ -64,7 +66,7 @@ class DnfWrapper(dnf.Base): repo = dnf.repo.Repo(repoid, self.conf) repo.baseurl = baseurl repo.mirrorlist = mirrorlist - repo.ignoregroups = ignoregroups + repo.enablegroups = enablegroups repo.enable() self.repos.add(repo) repo.priority = 10 if lookaside else 20