diff --git a/.packit.yaml b/.packit.yaml index 620e2df..3f7a38e 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -11,7 +11,7 @@ actions: - "python3 -m build --sdist --outdir ." - "sh -c 'echo rpmdeplint-$(hatch version).tar.gz'" get-current-version: - - "hatch version" + - bash -c "hatch version | sed 's|^\([[:digit:]]\.[[:digit:]]\)rc|\1~rc|'" srpm_build_deps: - python3-build diff --git a/rpmdeplint/repodata.py b/rpmdeplint/repodata.py index 1df1a24..044b542 100644 --- a/rpmdeplint/repodata.py +++ b/rpmdeplint/repodata.py @@ -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 {