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.
This commit is contained in:
Brian C. Lane 2024-02-16 10:04:14 -08:00 committed by Simon de Vlieger
parent 4f83cdc434
commit b131d3cf57

View file

@ -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