Skip to content

Commit

Permalink
Make metalinks work on CentOS Stream 9
Browse files Browse the repository at this point in the history
The metalinks in the default /etc/yum.repos.d/*.repo on C9S
contain $stream variable whose value (9-stream) I don't know
where to get programmatically,
hence the 'hack' with reading /etc/redhat-release.
  • Loading branch information
jpopelka committed Oct 2, 2023
1 parent acb41be commit f815446
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions rpmdeplint/repodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,14 @@ class Repo:
@staticmethod
def get_yumvars() -> dict[str, str]:
with suppress(ModuleNotFoundError):
import dnf.conf
import dnf.rpm

subst = dnf.conf.Conf().substitutions
subst["releasever"] = dnf.rpm.detect_releasever(installroot="")
return subst
import dnf

with dnf.Base() as base:
subst = base.conf.substitutions
with suppress(FileNotFoundError):
if "CentOS Stream" in Path("/etc/redhat-release").read_text():
subst["stream"] = f"{subst['releasever']}-stream"
return subst

# Probably not going to work but there's not much else we can do...
return {
Expand Down

0 comments on commit f815446

Please sign in to comment.