From b131d3cf5798f6c99b401436e940960471d8fb22 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 16 Feb 2024 10:04:14 -0800 Subject: [PATCH] osbuild-depsolve-dnf5: Fix url substitutions Substitutions should be set on Base, not per-repo. Discovered this in lorax's dnf5 code so I am updating it here as well. --- tools/osbuild-depsolve-dnf5 | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tools/osbuild-depsolve-dnf5 b/tools/osbuild-depsolve-dnf5 index ca1e5b79..0246aca5 100755 --- a/tools/osbuild-depsolve-dnf5 +++ b/tools/osbuild-depsolve-dnf5 @@ -88,13 +88,12 @@ class Solver(): if not exclude_pkgs: exclude_pkgs = [] - # substitutions to use with the repo urls - self.substitutions = { - "arch": arch, - "basearch": _BASEARCH_MAP[arch] - } self.base = dnf5.base.Base() + + # Base is the correct place to set substitutions, not per-repo. + # See https://github.com/rpm-software-management/dnf5/issues/1248 self.base.get_vars().set("arch", arch) + self.base.get_vars().set("basearch", _BASEARCH_MAP[arch]) # Enable fastestmirror to ensure we choose the fastest mirrors for # downloading metadata (when depsolving) and downloading packages. @@ -217,9 +216,6 @@ class Solver(): if "module_hotfixes" in desc: repo.module_hotfixes = desc["module_hotfixes"] - # This needs to be set on each repo - repo.set_substitutions(self.substitutions) - # Set the packages to exclude conf.excludepkgs = exclude_pkgs